diff --git a/readme.md b/readme.md index d86df76..d693a2a 100644 --- a/readme.md +++ b/readme.md @@ -9,8 +9,6 @@ An in-dev game that I plan to make a shooter game out of. Ui theming is based on Catppucin Mocha. You can find the colors [here](https://github.com/catppuccin/catppuccin) and the style guide [here](https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md) -I should put this in the game sometime, but the option to open the configuration menu is O and the debug menu is F4. You can hold alt in the debug menu to get information when hovering over objects. - # Hacks * I get a strange error about private identifiers in [`./src/ReplicatedStorage/ecs/state.ts`](./src/ReplicatedStorage/ecs/state.ts) * I decided to omit the "TS" folder from [`./default.project.json:40`](./default.project.json) due to the script override not working in Health.server.ts in StarterCharacterScripts. diff --git a/src/ReplicatedStorage/ui/components/acrylic/index.tsx b/src/ReplicatedStorage/ui/components/acrylic/index.tsx index 15116de..82cd98d 100644 --- a/src/ReplicatedStorage/ui/components/acrylic/index.tsx +++ b/src/ReplicatedStorage/ui/components/acrylic/index.tsx @@ -3,7 +3,6 @@ import { useEffect, useCallback, useMemo, useMutable } from "@rbxts/roact-hooked import { acrylicInstance } from "./acrylicInstance" import { Lighting, Workspace } from "@rbxts/services" import Make from "@rbxts/make" -import { useRootSelector } from "ReplicatedStorage/ui/store/hooks/useUiProducer" const cylinderAngleOffset = CFrame.Angles(0, math.rad(90), 0) @@ -35,7 +34,7 @@ Make("DepthOfFieldEffect", { Parent: Lighting }) -function AcrylicComponent(props: acrylicProps): Roact.Element { +function acrylic(props: acrylicProps): Roact.Element { const { radius, distance } = props const spreadableProps = { ...props } as Partial @@ -162,20 +161,4 @@ function AcrylicComponent(props: acrylicProps): Roact.Element { ) } -function acrylic(props: acrylicProps): Roact.Element { - const { radius, distance } = props - - const spreadableProps = { ...props } as Partial - delete spreadableProps.radius - delete spreadableProps.distance - - const enabled = useRootSelector((state) => state.configProducer.acrylicBlur) - - return <> - { - enabled && - } - -} - export default acrylic \ No newline at end of file diff --git a/src/ReplicatedStorage/ui/store/hooks/useUiProducer.ts b/src/ReplicatedStorage/ui/store/hooks/useUiProducer.ts index 95c0bec..979e43c 100644 --- a/src/ReplicatedStorage/ui/store/hooks/useUiProducer.ts +++ b/src/ReplicatedStorage/ui/store/hooks/useUiProducer.ts @@ -1,5 +1,4 @@ -import { UseProducerHook, UseSelectorHook, useProducer, useSelector } from "@rbxts/roact-reflex" +import { UseProducerHook, useProducer } from "@rbxts/roact-reflex" import { rootProducer } from "../producer" -export const useRootProducer: UseProducerHook = useProducer -export const useRootSelector: UseSelectorHook = useSelector \ No newline at end of file +export const useUiProducer: UseProducerHook = useProducer \ No newline at end of file diff --git a/src/ReplicatedStorage/ui/store/producer/config.ts b/src/ReplicatedStorage/ui/store/producer/config.ts deleted file mode 100644 index de831aa..0000000 --- a/src/ReplicatedStorage/ui/store/producer/config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createProducer } from "@rbxts/reflex" - -export interface ConfigState { - readonly acrylicBlur: boolean -} - -const initialState: ConfigState = { - acrylicBlur: false -} - -export const configProducer = createProducer(initialState, { - toggleAcrylic: (state) => ({ - ...state, - acrylicBlur: !state.acrylicBlur - }) -}) \ No newline at end of file diff --git a/src/ReplicatedStorage/ui/store/producer/index.ts b/src/ReplicatedStorage/ui/store/producer/index.ts index 4ac2bdf..2646565 100644 --- a/src/ReplicatedStorage/ui/store/producer/index.ts +++ b/src/ReplicatedStorage/ui/store/producer/index.ts @@ -1,10 +1,9 @@ import { InferDispatchers, InferState, combineProducers, loggerMiddleware } from "@rbxts/reflex" -import { configProducer } from "./config" export type rootProducer = typeof producer export type rootState = InferState export type rootDispatchers = InferDispatchers export const producer = combineProducers({ - configProducer + }).applyMiddleware(loggerMiddleware) \ No newline at end of file diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx deleted file mode 100644 index 92a05dc..0000000 --- a/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import Roact from "@rbxts/roact" -import Padding from "ReplicatedStorage/ui/components/padding" -import Acrylic from "ReplicatedStorage/ui/components/acrylic" -import { ContextActionService, HttpService } from "@rbxts/services" -import { Spring } from "@rbxts/flipper" -import { useGroupMotor } from "@rbxts/roact-hooked-plus" -import { useEffect } from "@rbxts/roact-hooked" -import { useRootProducer } from "ReplicatedStorage/ui/store/hooks/useUiProducer" - -interface ConfigProps extends Roact.JsxInstanceProperties { - shown: boolean - - Event?: Roact.JsxInstanceEvents - Change?: Roact.JsxInstanceChangeEvents -} - -const CONFIG_DEFAULT = [new Spring(1.5, { frequency: 6 })] -const CONFIG_ACTIVE = [new Spring(.5, { frequency: 6 })] - -function config(props: ConfigProps): Roact.Element { - const { toggleAcrylic } = useRootProducer() - - let { shown } = props - - const spreadableProps = { ...props } as Partial - delete spreadableProps.shown - - const [slotPosYMap, setPosYGoal] = useGroupMotor([1.5, 6]) - const slotPosY = slotPosYMap.map((t) => t[0]) - - useEffect(() => { - const guid = HttpService.GenerateGUID(false) - ContextActionService.BindAction( - guid, - (_, userInputState) => { - if (Enum.UserInputState.Begin === userInputState) { - shown = !shown - if (shown) { - setPosYGoal(CONFIG_ACTIVE) - } else { - setPosYGoal(CONFIG_DEFAULT) - } - } - }, - false, - Enum.KeyCode.P - ) - }) - - return ( - { - return new UDim2(.5, 0, posY, 0) - }) - } - BackgroundTransparency={1} - Size={new UDim2(.4, 0, .7, 0)} - Key={"Config"} - > - - - - - - {toggleAcrylic()} - }} - > - - - - - - ) -} - -export default config \ No newline at end of file diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx index 203d9c9..27f718b 100644 --- a/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx +++ b/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx @@ -62,19 +62,19 @@ function slot(props: SlotProps): Roact.Element { return ( { @@ -20,12 +19,6 @@ export default function main(props: MainProps): Roact.Element { AnchorPoint={new Vector2(0.5, 1)} Size={new UDim2(1, 0, 0.2, 0)} /> - ) } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 5a4e62b..05870df 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "downlevelIteration": true, "jsx": "react", "jsxFactory": "Roact.createElement", - "jsxFragmentFactory": "Roact.createFragment", + "jsxFragmentFactory": "Roact.Fragment", "module": "commonjs", "moduleResolution": "Node", "noLib": true,