Skip to content

Commit

Permalink
Moves to stack
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 30, 2023
1 parent 2eb5b5b commit f2c048f
Showing 1 changed file with 136 additions and 139 deletions.
275 changes: 136 additions & 139 deletions tgui/packages/tgui/interfaces/GameMaster.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
import { Flex, Dropdown, Button, Section, Slider, Collapsible, Stack, Divider } from '../components';
import { Dropdown, Button, Section, Slider, Collapsible, Stack, Divider } from '../components';
import { Window } from '../layouts';

export const GameMaster = (props, context) => {
Expand All @@ -8,144 +8,141 @@ export const GameMaster = (props, context) => {
return (
<Window width={400} height={400}>
<Window.Content scrollable>
<Flex grow direction="column">
<Flex.Item>
<Section title="Spawning">
<Flex grow direction="column">
<Flex.Item>
<Flex grow>
<Flex.Item>
<Button.Input
minWidth={4}
minHeight={2}
content={data.xeno_spawn_count}
currentValue={data.xeno_spawn_count}
onCommit={(e, value) => {
act('set_xeno_spawns', { value });
}}
/>
</Flex.Item>
<Flex.Item>
<Dropdown
options={data.spawnable_xenos}
selected={data.selected_xeno}
onSelected={(new_xeno) => {
act('set_selected_xeno', { new_xeno });
}}
/>
</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex grow>
<Flex.Item>
<Button.Checkbox
checked={data.spawn_ai}
content="AI"
onClick={() => {
act('xeno_spawn_ai_toggle');
}}
/>
</Flex.Item>
<Flex.Item>
<Button
selected={data.spawn_click_intercept}
content="Click Spawn"
onClick={() => {
act('toggle_click_spawn');
}}
/>
</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Button
content="Delete all xenos"
onClick={() => {
act('delete_all_xenos');
}}
/>
</Flex.Item>
</Flex>
</Section>
</Flex.Item>
<Flex.Item>
<Section title="Objective">
<Flex direction="column">
<Flex.Item>
<Button
selected={data.objective_click_intercept}
content="Click Objective"
onClick={() => {
act('toggle_click_objective');
}}
/>
</Flex.Item>
{data.game_master_objectives && (
<Flex.Item>
<Collapsible title="Objectives">
<Stack vertical>
{data.game_master_objectives.map((val) => {
if (val) {
return (
<Stack.Item>
<Divider />
<Flex>
<Flex.Item align="center">
<Button
content={val.object_name}
onClick={() => {
act('jump_to', { val });
}}
/>
</Flex.Item>
<Flex.Item
grow
pl={1}
py={0.25}
fontSize="12px">
{val.objective_info}
</Flex.Item>
</Flex>
</Stack.Item>
);
}
})}
<Divider />
</Stack>
</Collapsible>
</Flex.Item>
)}
</Flex>
</Section>
</Flex.Item>
<Flex.Item>
<Section title="Communication">
<Flex grow direction="column">
<Flex.Item>
<Button
content="Game Master Phone"
onClick={() => {
act('use_game_master_phone');
}}
/>
</Flex.Item>
<Flex.Item>Communication Clarity</Flex.Item>
<Flex.Item>
<Slider
maxValue={100}
minValue={0}
value={data.communication_clarity}
suppressFlicker={2500}
onChange={(e, clarity) => {
act('set_communication_clarity', { clarity });
}}
/>
</Flex.Item>
</Flex>
</Section>
</Flex.Item>
</Flex>
<Stack direction="column">
<Section title="Spawning">
<Stack direction="column">
<Stack.Item>
<Stack>
<Stack.Item>
<Button.Input
ml={1}
minWidth={3.5}
minHeight={1.5}
content={data.xeno_spawn_count}
currentValue={data.xeno_spawn_count}
onCommit={(e, value) => {
act('set_xeno_spawns', { value });
}}
/>
</Stack.Item>
<Stack.Item>
<Dropdown
options={data.spawnable_xenos}
selected={data.selected_xeno}
onSelected={(new_xeno) => {
act('set_selected_xeno', { new_xeno });
}}
/>
</Stack.Item>
</Stack>
</Stack.Item>
<Stack.Item>
<Stack>
<Stack.Item>
<Button.Checkbox
checked={data.spawn_ai}
content="AI"
onClick={() => {
act('xeno_spawn_ai_toggle');
}}
/>
</Stack.Item>
<Stack.Item>
<Button
selected={data.spawn_click_intercept}
content="Click Spawn"
onClick={() => {
act('toggle_click_spawn');
}}
/>
</Stack.Item>
</Stack>
</Stack.Item>
<Stack.Item>
<Button
content="Delete all xenos"
onClick={() => {
act('delete_all_xenos');
}}
/>
</Stack.Item>
</Stack>
</Section>
<Section title="Objective">
<Stack direction="column">
<Stack.Item>
<Button
ml={1}
selected={data.objective_click_intercept}
content="Click Objective"
onClick={() => {
act('toggle_click_objective');
}}
/>
</Stack.Item>
{data.game_master_objectives && (
<Stack.Item>
<Collapsible title="Objectives">
<Stack vertical>
{data.game_master_objectives.map((val) => {
if (val) {
return (
<Stack.Item>
<Divider />
<Stack>
<Stack.Item align="center">
<Button
content={val.object_name}
onClick={() => {
act('jump_to', { val });
}}
/>
</Stack.Item>
<Stack.Item
grow
pl={1}
py={0.25}
fontSize="12px">
{val.objective_info}
</Stack.Item>
</Stack>
</Stack.Item>
);
}
})}
<Divider />
</Stack>
</Collapsible>
</Stack.Item>
)}
</Stack>
</Section>
<Section title="Communication">
<Stack direction="column">
<Stack.Item>
<Button
ml={1}
content="Game Master Phone"
onClick={() => {
act('use_game_master_phone');
}}
/>
</Stack.Item>
<Stack.Item>Communication Clarity</Stack.Item>
<Stack.Item>
<Slider
maxValue={100}
minValue={0}
value={data.communication_clarity}
suppressFlicker={2500}
onChange={(e, clarity) => {
act('set_communication_clarity', { clarity });
}}
/>
</Stack.Item>
</Stack>
</Section>
</Stack>
</Window.Content>
</Window>
);
Expand Down

0 comments on commit f2c048f

Please sign in to comment.