This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from latitudegames/TTH-220/unified-io
Tth 220/unified io
- Loading branch information
Showing
67 changed files
with
955 additions
and
268 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
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 |
---|---|---|
@@ -1,36 +1,16 @@ | ||
const chain = { | ||
id: '[email protected]', | ||
nodes: { | ||
'123': { | ||
id: 123, | ||
data: { | ||
socketKey: 'a2baf53a-d604-40cb-a102-609448c3f67c', | ||
dataControls: { | ||
name: { | ||
expanded: true, | ||
}, | ||
}, | ||
name: 'text', | ||
}, | ||
inputs: {}, | ||
outputs: { | ||
output: { | ||
connections: [], | ||
}, | ||
}, | ||
position: [-1555.0656080696986, -286.76976427120616], | ||
name: 'Module Input', | ||
}, | ||
'124': { | ||
id: 124, | ||
data: { | ||
name: 'default', | ||
socketKey: '20c0d2db-1916-433f-88c6-69d3ae123217', | ||
dataControls: { | ||
name: { | ||
expanded: true, | ||
}, | ||
}, | ||
name: 'default', | ||
}, | ||
inputs: {}, | ||
outputs: { | ||
|
@@ -41,28 +21,53 @@ const chain = { | |
position: [-1555.4724883179474, -132.7648214211178], | ||
name: 'Module Trigger In', | ||
}, | ||
'125': { | ||
id: 125, | ||
'232': { | ||
id: 232, | ||
data: { | ||
socketKey: '048b7f6e-c155-4958-975a-c7698fc7e84d', | ||
playtestToggle: { | ||
receivePlaytest: false, | ||
outputs: [], | ||
}, | ||
socketKey: '9d61118c-3c5a-4379-9dae-41965e56207f', | ||
text: 'Input text here', | ||
dataControls: { | ||
name: { | ||
expanded: true, | ||
}, | ||
playtestToggle: { | ||
expanded: true, | ||
}, | ||
}, | ||
name: 'result', | ||
name: 'Input', | ||
outputs: [], | ||
}, | ||
inputs: {}, | ||
outputs: { | ||
output: { | ||
connections: [], | ||
}, | ||
}, | ||
position: [-1554.8394720686588, -362.87500885530955], | ||
name: 'Universal Input', | ||
}, | ||
'233': { | ||
id: 233, | ||
data: {}, | ||
inputs: { | ||
input: { | ||
text: { | ||
connections: [], | ||
}, | ||
trigger: { | ||
connections: [], | ||
}, | ||
}, | ||
outputs: {}, | ||
position: [-601.1864065822252, -230.90176968690835], | ||
name: 'Module Output', | ||
outputs: { | ||
trigger: { | ||
connections: [], | ||
}, | ||
}, | ||
position: [-828.9994593860473, -299.2588216155752], | ||
name: 'Output', | ||
}, | ||
}, | ||
} | ||
|
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
51 changes: 51 additions & 0 deletions
51
client/src/features/Thoth/windows/InspectorWindow/DataControls/PlaytestControl.tsx
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,51 @@ | ||
import { useState } from 'react' | ||
|
||
import Switch from '../../../../common/Switch/Switch' | ||
|
||
type SocketType = { | ||
name: string | ||
socketKey: string | ||
socketType: string | ||
taskType: string | ||
} | ||
|
||
const SwitchControl = ({ control, updateData, initialValue }) => { | ||
const { dataKey, data } = control | ||
const { receivePlaytest } = initialValue | ||
const initial = | ||
typeof receivePlaytest === 'boolean' | ||
? receivePlaytest | ||
: receivePlaytest === 'true' | ||
const [checked, setChecked] = useState(initial) | ||
|
||
const onChange = e => { | ||
const playtest = e.target.checked | ||
setChecked(playtest) | ||
|
||
const outputs = [] as SocketType[] | ||
|
||
if (playtest) { | ||
outputs.push({ | ||
name: 'Playtest trigger', | ||
socketKey: 'trigger', | ||
socketType: 'triggerSocket', | ||
taskType: 'option', | ||
}) | ||
} | ||
|
||
updateData({ | ||
[dataKey]: { | ||
receivePlaytest: playtest, | ||
outputs, | ||
}, | ||
}) | ||
} | ||
|
||
return ( | ||
<div style={{ flex: 1, display: 'flex' }}> | ||
<Switch checked={checked} onChange={onChange} label={data.label} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default SwitchControl |
23 changes: 23 additions & 0 deletions
23
client/src/features/Thoth/windows/InspectorWindow/DataControls/SwitchControl.tsx
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,23 @@ | ||
import { useState } from 'react' | ||
|
||
import Switch from '../../../../common/Switch/Switch' | ||
|
||
const SwitchControl = ({ control, updateData, initialValue }) => { | ||
const { dataKey, data } = control | ||
const [checked, setChecked] = useState(initialValue) | ||
|
||
const onChange = e => { | ||
setChecked(e.target.checked) | ||
updateData({ | ||
[dataKey]: e.target.checked, | ||
}) | ||
} | ||
|
||
return ( | ||
<div style={{ flex: 1, display: 'flex' }}> | ||
<Switch checked={checked} onChange={onChange} label={data.label} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default SwitchControl |
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
Oops, something went wrong.