mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 14:44:15 +00:00
feat: use data from demo
This commit is contained in:
parent
22911804c0
commit
74139dd54e
28 changed files with 364 additions and 377 deletions
|
|
@ -8,21 +8,21 @@ interface Props {
|
|||
instructions: React.RefObject<SwitchMiiInstructions>;
|
||||
}
|
||||
|
||||
const TABS: { name: keyof SwitchMiiInstructions["eyes"]; length: number; colorsDisabled?: number[] }[] = [
|
||||
{ name: "eyesType", length: 50 },
|
||||
{ name: "eyelashesTop", length: 40 },
|
||||
{ name: "eyelashesBottom", length: 20 },
|
||||
{ name: "eyelidTop", length: 10 },
|
||||
{ name: "eyelidBottom", length: 5 },
|
||||
{ name: "eyeliner", length: 15 },
|
||||
{ name: "pupil", length: 3 },
|
||||
const TABS: { name: keyof SwitchMiiInstructions["eyes"]; length: number; colorsDisabled?: boolean }[] = [
|
||||
{ name: "main", length: 121 },
|
||||
{ name: "eyelashesTop", length: 6, colorsDisabled: true },
|
||||
{ name: "eyelashesBottom", length: 2, colorsDisabled: true },
|
||||
{ name: "eyelidTop", length: 3, colorsDisabled: true },
|
||||
{ name: "eyelidBottom", length: 3, colorsDisabled: true },
|
||||
{ name: "eyeliner", length: 2 },
|
||||
{ name: "pupil", length: 10, colorsDisabled: true },
|
||||
];
|
||||
|
||||
export default function OtherTab({ instructions }: Props) {
|
||||
const [tab, setTab] = useState(0);
|
||||
|
||||
// One type/color state per tab
|
||||
const [types, setTypes] = useState<number[]>(Array(TABS.length).fill(0));
|
||||
const [types, setTypes] = useState<number[]>([5, 0, 0, 0, 0, 0, 0]);
|
||||
const [colors, setColors] = useState<number[]>(Array(TABS.length).fill(0));
|
||||
|
||||
const currentTab = TABS[tab];
|
||||
|
|
@ -34,7 +34,7 @@ export default function OtherTab({ instructions }: Props) {
|
|||
return copy;
|
||||
});
|
||||
|
||||
instructions.current.eyes[currentTab.name] = value;
|
||||
instructions.current.eyes[currentTab.name].type = value;
|
||||
};
|
||||
|
||||
const setColor = (value: number) => {
|
||||
|
|
@ -44,8 +44,7 @@ export default function OtherTab({ instructions }: Props) {
|
|||
return copy;
|
||||
});
|
||||
|
||||
// TODO: check in actual game, temp
|
||||
instructions.current.eyes.color = value;
|
||||
if (!currentTab.colorsDisabled) (instructions.current.eyes[currentTab.name] as { color: number }).color = value;
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -53,7 +52,7 @@ export default function OtherTab({ instructions }: Props) {
|
|||
<div className="flex h-full">
|
||||
<div className="grow flex flex-col">
|
||||
<div className="flex items-center h-8">
|
||||
<h1 className="absolute font-bold text-xl">Other</h1>
|
||||
<h1 className="absolute font-bold text-xl">Eyes</h1>
|
||||
|
||||
<div className="flex justify-center grow">
|
||||
<div className="rounded-2xl bg-orange-200">
|
||||
|
|
@ -72,15 +71,15 @@ export default function OtherTab({ instructions }: Props) {
|
|||
</div>
|
||||
|
||||
<div className="flex justify-center h-74 mt-auto">
|
||||
<TypeSelector hasNoneOption length={currentTab.length} type={types[tab]} setType={setType} />
|
||||
<TypeSelector hasNoneOption={tab === 0} length={currentTab.length} type={types[tab]} setType={setType} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="shrink-0 w-21 pb-3 flex flex-col items-center">
|
||||
<div className={`${tab !== 0 ? "hidden" : "w-full"}`}>
|
||||
<div className={`${currentTab.colorsDisabled ? "hidden" : "w-full"}`}>
|
||||
<ColorPicker color={colors[tab]} setColor={setColor} />
|
||||
</div>
|
||||
<NumberInputs target={instructions.current.eyes} />
|
||||
<NumberInputs target={instructions.current.eyes[currentTab.name]} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue