-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow selecting the AI in the SetupPanel in the editor.
GitOrigin-RevId: dcde32caeb6fdf1bcfc52ec7ec26b7b6ad6db658
- Loading branch information
Showing
15 changed files
with
148 additions
and
23 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -70,6 +70,7 @@ const nullPlayer = new HumanPlayer( | |
'-1', | ||
0, | ||
0, | ||
undefined, | ||
new Set(), | ||
new Set(), | ||
0, | ||
|
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,34 @@ | ||
import { AIRegistryT } from '@deities/apollo/actions/executeGameAction.tsx'; | ||
import InlineLink from '@deities/ui/InlineLink.tsx'; | ||
import Select from '@deities/ui/Select.tsx'; | ||
import Stack from '@deities/ui/Stack.tsx'; | ||
|
||
export default function AISelector({ | ||
currentAI, | ||
registry, | ||
setAI, | ||
}: { | ||
currentAI: number | undefined; | ||
registry: AIRegistryT; | ||
setAI: (id: number) => void; | ||
}) { | ||
const currentEntry = ( | ||
currentAI != null ? registry.get(currentAI) : registry.get(0) | ||
)!; | ||
return ( | ||
<Stack alignCenter gap={16}> | ||
<fbt desc="Label to pick an AI">AI:</fbt> | ||
<Select selectedItem={currentEntry.name}> | ||
{[...registry].map(([id, { name }]) => ( | ||
<InlineLink | ||
key={id} | ||
onClick={() => setAI(id)} | ||
selectedText={id === currentAI} | ||
> | ||
{name} | ||
</InlineLink> | ||
))} | ||
</Select> | ||
</Stack> | ||
); | ||
} |
Oops, something went wrong.