-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69c9c03
commit 670aea3
Showing
32 changed files
with
317 additions
and
3 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/Duets.Cli/Components/Commands/Computer/OpenApp.Command.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace Duets.Cli.Components.Commands | ||
|
||
open Duets.Cli | ||
open Duets.Cli.Components | ||
open Duets.Cli.SceneIndex | ||
open Duets.Cli.Text | ||
open Duets.Entities | ||
open Duets.Simulation | ||
|
||
[<RequireQualifiedAccess>] | ||
module OpenAppCommand = | ||
let private appName = | ||
function | ||
| WordProcessor -> "Word" | ||
|
||
/// Command to open an app on the currently used computer. | ||
let create item computer apps = | ||
{ Name = "open app" | ||
Description = "Shows a picker to open an app on the computer" | ||
Handler = | ||
fun _ -> | ||
let selectedApp = | ||
showOptionalChoicePrompt | ||
"Select an app" | ||
Generic.cancel | ||
appName | ||
apps | ||
|
||
match selectedApp with | ||
| Some app -> | ||
$"Opening {app |> appName}..." |> showMessage | ||
|
||
wait 500<millisecond> | ||
|
||
Computer.openApp item computer app |> Effect.applyMultiple | ||
| None -> () | ||
|
||
Scene.World } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module rec Duets.Cli.Text.Focused | ||
|
||
open Duets.Entities | ||
open Duets.Entities.SituationTypes | ||
|
||
let actionPrompt date dayMoment attributes activity = | ||
$"""{Generic.infoBar date dayMoment attributes} | ||
{activityEmoji activity} {activityName activity}""" | ||
|> Styles.prompt | ||
|
||
let activityName activity = | ||
match activity with | ||
| FocusSituation.UsingComputer(item, computer) -> | ||
match computer.ComputerState with | ||
| Booting -> "" (* Won't be shown, it'll be switched right after. *) | ||
| AppSwitcher -> $"Using {item.Name}" | ||
| AppRunning(WordProcessor) -> "Using Word" | ||
|> Styles.faded | ||
|
||
let activityEmoji activity = | ||
match activity with | ||
| FocusSituation.UsingComputer(_, computer) -> | ||
match computer.ComputerState with | ||
| Booting -> "" | ||
| AppSwitcher -> $"{Emoji.computer} " | ||
| AppRunning(WordProcessor) -> Emoji.writing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Duets.Entities.Computer | ||
|
||
/// Default state of a computer's storage. | ||
let defaultStorage = { WordProcessor = { BookProjects = [] } } | ||
|
||
/// Creates a computer with the default state and storage and the given performance. | ||
let forPerformance perf = | ||
{ Performance = perf | ||
ComputerState = Booting | ||
Storage = defaultStorage } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace Duets.Entities | ||
|
||
[<AutoOpen>] | ||
module ComputerTypes = | ||
/// Represents the kind of applications that can be used in the computer. | ||
type App = | WordProcessor | ||
|
||
/// Represents the different states that the computer can be in. | ||
type ComputerState = | ||
| Booting | ||
| AppSwitcher | ||
| AppRunning of App | ||
|
||
/// Types related to the word processor application. | ||
module WordProcessor = | ||
/// Represents a book that the character is currently working on. | ||
type BookProject = | ||
{ Title: string | ||
Genre: BookGenre | ||
Progress: int<percent> } | ||
|
||
/// Represents a collection of books that the character is currently | ||
/// working on. | ||
type WordProcessorStorage = { BookProjects: BookProject list } | ||
|
||
/// Represents what's stored in a computer. | ||
type ComputerStorage = | ||
{ WordProcessor: WordProcessor.WordProcessorStorage } | ||
|
||
/// Resembles a computer that the character can use. | ||
type Computer = | ||
{ | ||
/// Represents the kind of performance that can be extracted from the | ||
/// computer. The performance depends on the computer's hardware | ||
/// and depletes over time. | ||
Performance: decimal<percent> | ||
|
||
/// Represents the current state of the computer. | ||
ComputerState: ComputerState | ||
|
||
/// Represents the storage available in the computer. | ||
Storage: ComputerStorage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.