Merge branch 'main' into PlayerController

This commit is contained in:
Glence 2023-02-27 15:58:37 +08:00
commit 75295b5d6e
88 changed files with 2473 additions and 76 deletions

View File

@ -1,4 +1,4 @@
Start Maximized: true
Working Scene ID: 97158628
Working Scene ID: 86098106
Window Size: {x: 1920, y: 1013}
Style: 0

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 51158984
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: GameIcon
ID: 126117259
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 62200943
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: Instruction_01
ID: 124926341
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 53303669
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: Instruction_02
ID: 128721520
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 61780097
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: Instruction_03
ID: 124482180
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 59178524
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: Instruction_04
ID: 129768803
Type: 7

View File

@ -0,0 +1,12 @@
- VertexShader: 46580970
FragmentShader: 48832081
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 64651793
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}
data.sliderThreshold: 1
data.sliderStartColor: {x: 0, y: 1, z: 0, w: 1}
data.sliderEndColor: {x: 1, y: 0, z: 0, w: 1}
data.sliderBarColor: {x: 1, y: 1, z: 1, w: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Slider
ID: 128676209
Type: 7

View File

@ -0,0 +1,9 @@
- VertexShader: 46580970
FragmentShader: 43211183
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 51995224
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}
data.sliderThreshold: 1

View File

@ -0,0 +1,3 @@
Name: UIMat_Slider_Textured
ID: 127128823
Type: 7

View File

@ -0,0 +1,147 @@
- EID: 0
PrefabID: 117058283
Name: ====Raccoon====
IsActive: true
NumberOfChildren: 2
Components: ~
Scripts: ~
- EID: 1
Name: Player
IsActive: true
NumberOfChildren: 3
Components:
Transform Component:
Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999999881, y: 1, z: 0.999999881}
IsActive: true
Renderable Component:
Mesh: 149697411
Material: 126974645
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: false
Interpolate: false
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: true
Freeze Position Z: false
Freeze Rotation X: true
Freeze Rotation Y: true
Freeze Rotation Z: true
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.400000006, y: 0.5, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.25, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts:
- Type: PlayerController
Enabled: true
respawnPoint: 239
currentState: 0
maxMoveVel: 3
moveForce: 50
sprintMultiplier: 1.5
rotationFactorPerFrame: 5
maxJumpHeight: 2
maxJumpTime: 0.75
fallMultipler: 3
lightMultiper: 0.899999976
mediumMultiper: 0.699999988
heavyMultiper: 0.5
- Type: PickAndThrow
Enabled: true
throwForce: [10, 8, 10]
cameraArmOffSet: [0.25, 0.600000024, 0.200000003]
delayTimer: 1
aimingLength: 1
throwItem: false
rayDistance: 0.75
rayHeight: 0.100000001
- EID: 2
Name: HoldingPoint
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0.899999976, z: 0.200000286}
Rotate: {x: 0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 3
Name: PlayerCamera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -5.96046448e-08, z: 0}
Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 2.12735963, y: 0.362327784, z: 7.98933029}
Pitch: 0
Yaw: 360
Roll: 1.28065994e-06
Width: 2560
Near: 0.00999999978
Far: 10000
Perspective: true
FOV: 45
IsActive: true
Camera Arm Component:
Arm Pitch: 0
Arm Yaw: 0
Arm Length: 3
Look At Camera Origin: true
Target Offset: {x: 0, y: 0.75, z: 0}
Camera Collision: true
IsActive: true
Scripts:
- Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true
armLength: 3
turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006
pitchClamp: 45
inverseXControls: false
inverseYControls: false
lowerClamp: 5
- EID: 4
Name: PlayerBag
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -2.98023224e-08, z: 4.76837158e-07}
Rotate: {x: 0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 144838771
Material: 123745521
IsActive: true
Scripts: ~
- EID: 5
Name: RespawnPoint
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 0.660660267, z: 7}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: ====Raccoon====
ID: 117058283
Type: 6

View File

@ -4508,6 +4508,9 @@
density: 1
dontReturn: false
soundDistance: 10
highlightSpeed: 200
highlightThickness: 600
highlightLowerClamp: 0.25
- EID: 227
Name: Mesh_Cheese
IsActive: true
@ -4556,6 +4559,9 @@
density: 1
dontReturn: false
soundDistance: 10
highlightSpeed: 200
highlightThickness: 600
highlightLowerClamp: 0.25
- EID: 65778
Name: Mesh_Apple
IsActive: true
@ -4604,6 +4610,9 @@
density: 1
dontReturn: false
soundDistance: 10
highlightSpeed: 200
highlightThickness: 600
highlightLowerClamp: 0.25
- EID: 216
Name: Mesh_Apple
IsActive: true
@ -4652,6 +4661,9 @@
density: 1
dontReturn: false
soundDistance: 10
highlightSpeed: 200
highlightThickness: 600
highlightLowerClamp: 0.25
- EID: 229
Name: ====ScoreZonePool====
IsActive: true
@ -5119,6 +5131,8 @@
delayTimer: 1
aimingLength: 0.899999976
throwItem: false
silhouettePlayer: 51000
silhouetteBag: 51000
rayDistance: 0.5
rayHeight: 0.100000001
aimingFOV: 50

View File

@ -1,7 +1,7 @@
- EID: 0
Name: Canvas
Name: Main Menu Canvas
IsActive: true
NumberOfChildren: 4
NumberOfChildren: 9
Components:
Canvas Component:
Canvas Width: 1920
@ -10,7 +10,7 @@
IsActive: true
Scripts: ~
- EID: 1
Name: Background
Name: BackGround
IsActive: true
NumberOfChildren: 0
Components:
@ -21,7 +21,7 @@
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
Material: 129138332
IsActive: true
UI Component:
Canvas ID: 0
@ -35,9 +35,9 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0.400000006}
Translate: {x: -700, y: 100, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
@ -63,9 +63,9 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0.400000006}
Translate: {x: -700, y: -400, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
@ -85,7 +85,127 @@
- Type: QuitButton
Enabled: true
- EID: 7
Name: Test
Name: Level Select Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -700, y: 0, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 52901020
Hovered Texture: 62235279
Clicked Texture: 64722619
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 9
Name: How To Play Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -700, y: -100, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 65084899
Hovered Texture: 58647112
Clicked Texture: 55758383
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 10
Name: Credits Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -700, y: -200, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 52901020
Hovered Texture: 62235279
Clicked Texture: 64722619
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 11
Name: Options Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -700, y: -300, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 450, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 52901020
Hovered Texture: 62235279
Clicked Texture: 64722619
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 12
Name: Game Icon
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -700, y: 350, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 355.756439, y: 355.756439, z: 1.18585491}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 126117259
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 54
Name: test
IsActive: true
NumberOfChildren: 0
Components:
@ -96,7 +216,7 @@
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
Material: 129138332
IsActive: true
UI Component:
Canvas ID: 0
@ -150,4 +270,815 @@
Enabled: true
sceneID: 96668835
obj: 1
test: 7
test: 54
- EID: 8
Name: TweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts: ~
- EID: 13
Name: How To Play Canvas
IsActive: false
NumberOfChildren: 5
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 14
Name: BackGround
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 15
Name: Instruction Image
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1344, y: 756, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 124926341
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 16
Name: NextButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 800, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 17
Name: PrevButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 18
Name: BackButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 450, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 19
Name: Options Canvas
IsActive: false
NumberOfChildren: 11
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 20
Name: BackGround
IsActive: false
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: false
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: false
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: false
Scripts: ~
- EID: 21
Name: BackButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 450, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 22
Name: Options Title Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Text Renderer Component:
Text: Options
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 23
Name: Audio Title Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -900, y: 300, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Text Renderer Component:
Text: Audio
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 25
Name: Audio Text Group
IsActive: true
NumberOfChildren: 3
Components:
Transform Component:
Translate: {x: -900, y: 200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 24
Name: Master Volume Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: Master
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 26
Name: SFX Volume Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: SFX
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 27
Name: BGM Volume Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: BGM
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 28
Name: Audio Slider Group
IsActive: true
NumberOfChildren: 3
Components:
Transform Component:
Translate: {x: 100, y: 225, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 29
Name: Master Volume Slider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1000, y: 75, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 128676209
IsActive: true
Slider Component:
Slider Value: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 30
Name: SFX Volume Slider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1000, y: 75, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 128676209
IsActive: true
Slider Component:
Slider Value: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 31
Name: BGM Volume Slider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1000, y: 75, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 128676209
IsActive: true
Slider Component:
Slider Value: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 32
Name: Camera Title Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -900, y: -120, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Text Renderer Component:
Text: Camera
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 33
Name: Camera Text Group
IsActive: true
NumberOfChildren: 2
Components:
Transform Component:
Translate: {x: -900, y: -220, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 34
Name: FOV Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: FOV
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 35
Name: Sensitivity Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: Sensitivity
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 36
Name: Camera Slider Group
IsActive: true
NumberOfChildren: 2
Components:
Transform Component:
Translate: {x: 100, y: -200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 37
Name: FOV Slider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1000, y: 75, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 128676209
IsActive: true
Slider Component:
Slider Value: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 38
Name: Sensitivity Slider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1000, y: 75, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 128676209
IsActive: true
Slider Component:
Slider Value: 0
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 39
Name: Audio Slider Text Group
IsActive: true
NumberOfChildren: 3
Components:
Transform Component:
Translate: {x: 700, y: 200, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 40
Name: Master Volume Slider Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: 100
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 41
Name: SFX Volume Slider Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: 100
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 42
Name: BGM Volume Slider Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: 100
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 43
Name: Camera Slider Text Group
IsActive: true
NumberOfChildren: 2
Components:
Transform Component:
Translate: {x: 700, y: -225, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 44
Name: FOV Slider Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: 100
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 45
Name: Sensitivity Slider Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
Text Renderer Component:
Text: 100
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 19
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 46
Name: Credits Canvas
IsActive: false
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 47
Name: BackGround
IsActive: false
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: false
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: false
UI Component:
Canvas ID: 46
Hovered: false
Clicked: false
IsActive: false
Scripts: ~
- EID: 48
Name: BackButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 450, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 46
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 49
Name: Credits Title Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Text Renderer Component:
Text: Credits
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 46
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 50
Name: Level Select Canvas
IsActive: false
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 51
Name: BackGround
IsActive: false
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: false
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: false
UI Component:
Canvas ID: 50
Hovered: false
Clicked: false
IsActive: false
Scripts: ~
- EID: 52
Name: BackButton
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 450, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
UI Component:
Canvas ID: 50
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 53
Name: Level Select Title Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
Text Renderer Component:
Text: Level Select
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 50
Hovered: false
Clicked: false
IsActive: true
Scripts: ~

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public enum EASING_METHOD
{
EASE_IN_SINE,
EASE_OUT_SINE,
EASE_OUT_BOUNCE,
EASE_IN_BOUNCE,
EASE_INOUT_BOUNCE
}
public static class EasingHelper
{
public static float EaseHelp(float value, EASING_METHOD method)
{
switch (method)
{
case EASING_METHOD.EASE_IN_SINE:
{
return EaseInSine(value);
}break;
case EASING_METHOD.EASE_OUT_SINE:
{
return EaseOutSine(value);
}break;
case EASING_METHOD.EASE_OUT_BOUNCE:
{
return EaseOutBounce(value);
}break;
case EASING_METHOD.EASE_IN_BOUNCE:
{
return EaseInBounce(value);
}
break;
case EASING_METHOD.EASE_INOUT_BOUNCE:
{
return EaseInOutBounce(value);
}
break;
default:
return 0.0f;
}
}
private static float EaseInSine(float value)
{
return (float)(1.0f - Math.Cos((value * Math.PI) / 2.0f));
}
private static float EaseOutSine(float value)
{
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f);
}
private static float EaseOutBounce(float value)
{
const float n1 = 7.5625f;
const float d1 = 2.75f;
if (value < 1.0f / d1)
{
return n1 * value * value;
} else if (value < 2.0f / d1)
{
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
}
else
{
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
}
}
private static float EaseInBounce(float value)
{
return 1 - EaseOutBounce(1 - value);
}
private static float EaseInOutBounce(float value)
{
return (value < 0.5f)
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
}
}
}

View File

@ -0,0 +1,3 @@
Name: EasingHelper
ID: 161000975
Type: 9

View File

@ -0,0 +1,123 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class ButtonFX:Script
{
public string onHoverEnterSound = "event:/Music/player_undetected";
public string onHoverExitSound = "event:/Music/player_undetected";
public string onClickSound = "event:/Music/player_undetected";
public string onReleaseSound = "event:/Music/player_undetected";
[NonSerialized]
private AudioClipHandler onHoverEnterACHandler;
[NonSerialized]
private AudioClipHandler onHoverExitACHandler;
[NonSerialized]
private AudioClipHandler onClickACHandler;
[NonSerialized]
private AudioClipHandler onReleaseACHandler;
[NonSerialized]
private Vector3 defaultScale;
public float hoverScale = 1.1f;
public float clickScale = 0.9f;
[NonSerialized]
private TweenThread thread;
[NonSerialized]
private bool tweening = false;
[NonSerialized]
private float currentScale = 1.0f;
protected override void awake()
{
onHoverEnterACHandler = SHADE.Audio.CreateAudioClip(onHoverEnterSound);
onHoverExitACHandler = SHADE.Audio.CreateAudioClip(onHoverExitSound);
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
}
protected override void start()
{
thread = TweenManager.CreateTweenThread(0.1f, 0.9f, 1.0f, EASING_METHOD.EASE_IN_SINE);
Transform transform = GetComponent<Transform>();
if (transform == null)
return;
defaultScale = transform.LocalScale;
UIElement ui = GetComponent<UIElement>();
if (ui == null)
return;
ui.OnClick.RegisterAction(() =>
{
if (onClickSound != "")
onClickACHandler.Play();
tweening = true;
if(thread != null)
thread.Reset(currentScale,clickScale);
});
ui.OnRelease.RegisterAction(() =>
{
if (onReleaseSound != "")
onReleaseACHandler.Play();
tweening = true;
if (thread != null)
thread.Reset(currentScale, 1.0f);
});
ui.OnHoverEnter.RegisterAction(() =>
{
if (onHoverEnterSound != "")
onHoverEnterACHandler.Play();
tweening = true;
if (thread != null)
thread.Reset(currentScale, hoverScale);
});
ui.OnHoverExit.RegisterAction(() =>
{
if (onHoverExitSound != "")
onHoverExitACHandler.Play();
tweening = true;
if (thread != null)
thread.Reset(currentScale, 1.0f);
});
}
protected override void update()
{
Transform transform = GetComponent<Transform>();
if (transform == null)
return;
if (tweening == true && thread != null)
{
Debug.Log("Tweening value " + thread.GetValue());
transform.LocalScale = defaultScale * thread.GetValue();
currentScale = thread.GetValue();
if (thread.IsCompleted())
tweening = false;
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ButtonFX
ID: 163796084
Type: 9

View File

@ -0,0 +1,42 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class ChangeCanvasButton:Script
{
public GameObject canvasToActivate;
protected override void awake()
{
//if (canvasToActivate.GetComponent<Canvas>() == null)
// return;
UIElement ui = GetComponent<UIElement>();
ui.OnRelease.RegisterAction(() =>
{
Canvas.DeactivateAllCanvas();
canvasToActivate.SetActive(true);
});
}
protected override void start()
{
}
protected override void update()
{
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ChangeCanvasButton
ID: 154633292
Type: 9

View File

@ -25,6 +25,7 @@ public class ChangeSceneButton : Script
else
{
Debug.LogError("Failed to register button action for ChangeSceneButton.");
}
}
protected override void update()

View File

@ -0,0 +1,51 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class MultiImageList:Script
{
public List<MaterialAsset> imageAssetList = new List<MaterialAsset>();
[NonSerialized]
private int index = 0;
protected override void awake()
{
}
protected override void start()
{
}
public void NextImage()
{
++index;
if(index >= imageAssetList.Count())
{
index = 0;
}
Renderable rend = GetComponent<Renderable>();
rend.SetMaterial(imageAssetList[index]);
}
public void PrevImage()
{
if (index == 0)
index = imageAssetList.Count();
--index;
Renderable rend = GetComponent<Renderable>();
rend.SetMaterial(imageAssetList[index]);
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_MultiImageList
ID: 166320642
Type: 9

View File

@ -0,0 +1,40 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class MultiImageListControlButton: Script
{
public bool isNext = true;
public GameObject multiImageList;
protected override void awake()
{
UIElement ui = GetComponent<UIElement>();
if (ui != null)
{
ui.OnRelease.RegisterAction(() =>
{
MultiImageList imageList = multiImageList.GetScript<MultiImageList>();
if(imageList != null)
{
if (isNext)
imageList.NextImage();
else
imageList.PrevImage();
}
});
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_MultiImageListControlButton
ID: 164209885
Type: 9

View File

@ -0,0 +1,47 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class ScaleBounce:Script
{
[NonSerialized]
private TweenThread thread;
public float minScale = 1.0f;
public float maxScale = 1.2f;
public float duration = 1.0f;
private Vector3 defaultScale;
protected override void start()
{
thread = TweenManager.CreateTweenThread(duration, minScale, maxScale, EASING_METHOD.EASE_IN_SINE);
Transform trans = GetComponent<Transform>();
if(trans != null)
{
defaultScale = trans.LocalScale;
}
}
protected override void update()
{
Transform trans = GetComponent<Transform>();
if(trans != null)
{
trans.LocalScale = defaultScale * thread.GetValue();
}
if(thread.IsCompleted())
{
thread.ResetInvert();
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ScaleBounce
ID: 152015842
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class SliderText:Script
{
public GameObject sliderObj;
public int minValue = 0;
public int maxValue = 0;
protected override void update()
{
Slider slider = sliderObj.GetComponent<Slider>();
TextRenderable text = GetComponent<TextRenderable>();
if(slider != null && text != null)
{
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString();
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SliderText
ID: 158412308
Type: 9

View File

@ -0,0 +1,120 @@
using SHADE;
using SHADE_Scripting.Audio;
using System;
using System.Collections.Generic;
using System.Threading;
namespace SHADE_Scripting.UI
{
public class TweenThread
{
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private float value = 0.0f;
public float startValue = 0.0f;
public float endValue = 1.0f;
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer > duration)
return;
timer += deltaTime;
if (timer > duration)
timer = duration;
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(float startValue, float endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
float temp = startValue;
startValue = endValue;
endValue = temp;
}
public float GetValue()
{
return value;
}
}
public class TweenManager : Script
{
public static TweenManager Instance { get; private set; }
[NonSerialized]
private List<TweenThread> threadList;
protected override void awake()
{
if (Instance != null && Instance != this)
RemoveScript<TweenManager>();
else
Instance = this;
threadList = new List<TweenThread>();
}
protected override void onDestroy()
{
if (Instance == this)
Instance = null;
}
protected override void update()
{
foreach (TweenThread thread in threadList)
{
thread.Update(Time.DeltaTimeF);
}
}
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
Instance.threadList.Add(thread);
thread.Reset();
return thread;
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_TweenManager
ID: 164072799
Type: 9

View File

@ -0,0 +1,60 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
struct MatPropData
{
int textureIndex;
float alpha;
float sliderThreshold;
vec4 sliderStartColor;
vec4 sliderEndColor;
vec4 sliderBarColor;
};
layout(location = 0) in struct
{
vec4 vertPos; // location 0
vec2 uv; // location = 1
vec4 normal; // location = 2
} In;
// material stuff
layout(location = 3) flat in struct
{
int materialIndex;
uint eid;
uint lightLayerIndex;
} In2;
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
{
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 fragColor;
layout(location = 1) out uint outEntityID;
void main()
{
//fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (In.uv.x > MatProp.data[In2.materialIndex].sliderThreshold)
fragColor = MatProp.data[In2.materialIndex].sliderBarColor;
else
fragColor = (1.0f - In.uv.x) * MatProp.data[In2.materialIndex].sliderStartColor + In.uv.x * MatProp.data[In2.materialIndex].sliderEndColor;
//fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (fragColor.a < 0.01f)
{
discard;
}
fragColor.a = MatProp.data[In2.materialIndex].alpha;
// fragColor.a = 1.0f;
outEntityID = In2.eid;
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: UI_Slider_FS
ID: 48832081
Type: 2

View File

@ -0,0 +1,62 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
struct MatPropData
{
int textureIndex;
float alpha;
float sliderThreshold;
vec4 sliderStartColor;
vec4 sliderEndColor;
vec4 sliderBarColor;
};
layout(location = 0) in struct
{
vec4 vertPos; // location 0
vec2 uv; // location = 1
vec4 normal; // location = 2
} In;
// material stuff
layout(location = 3) flat in struct
{
int materialIndex;
uint eid;
uint lightLayerIndex;
} In2;
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
{
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 fragColor;
layout(location = 1) out uint outEntityID;
void main()
{
//fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (In.uv.x > MatProp.data[In2.materialIndex].sliderThreshold)
fragColor = MatProp.data[In2.materialIndex].sliderBarColor;
else
//fragColor = (1.0f - In.uv.x) * MatProp.data[In2.materialIndex].sliderStartColor + In.uv.x * MatProp.data[In2.materialIndex].sliderEndColor;
fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (fragColor.a < 0.01f)
{
discard;
}
fragColor.a = MatProp.data[In2.materialIndex].alpha;
// fragColor.a = 1.0f;
outEntityID = In2.eid;
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: UI_Slider_Textured_FS
ID: 43211183
Type: 2

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: RaccoonTransparent
ID: 51158984
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_WK10_HowToPlay_01
ID: 62200943
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_WK10_HowToPlay_02
ID: 53303669
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_WK10_HowToPlay_03
ID: 61780097
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_WK10_HowToPlay_04
ID: 59178524
Type: 3

View File

@ -19,6 +19,10 @@
#include "Tools/Utilities/SHStringUtilities.h"
#include <filesystem>
#include <rttr/type>
#include "Assets/Asset Types/SHPrefabAsset.h"
#include "Serialization/SHSerialization.h"
#include <Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.h>
#include "Serialization/Prefab/SHPrefabManager.h"
namespace SHADE
{
@ -247,6 +251,7 @@ namespace SHADE
const ImRect childRect = DrawAsset(file.assetMeta, file.ext);
return childRect;
}
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
}
ImRect SHAssetBrowser::DrawAsset(SHAsset const* const asset, FileExt const& ext /*= ""*/) noexcept
@ -365,6 +370,35 @@ namespace SHADE
}
}
if(ImGui::BeginPopupContextItem())
{
switch (asset->type)
{
case AssetType::INVALID: break;
case AssetType::SHADER: break;
case AssetType::SHADER_BUILT_IN: break;
case AssetType::TEXTURE: break;
case AssetType::MESH: break;
case AssetType::SCENE:
break;
case AssetType::PREFAB:
{
if(ImGui::Selectable("Insert into scene"))
{
auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData<SHPrefabAsset>(asset->id)->data);
SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>()->SetScrollTo(createdEntitiesList.begin()->second);
SHPrefabManager::AddEntity(asset->id, createdEntitiesList.begin()->second);
}
}
break;
case AssetType::MATERIAL: break;
case AssetType::SCRIPT: break;
case AssetType::MAX_COUNT: break;
default:;
}
ImGui::EndPopup();
}
if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();

View File

@ -26,6 +26,9 @@
#include "Serialization/SHSerialization.h"
#include "Tools/Utilities/SHClipboardUtilities.h"
#include "Tools/Utilities/SHStringUtilities.h"
#include "Serialization/Prefab/SHPrefabManager.h"
#include "../SHEditorWindowManager.h"
#include "../AssetBrowser/SHAssetBrowser.h"
namespace SHADE
@ -96,6 +99,8 @@ namespace SHADE
}
ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal);
if (!ImGui::IsAnyItemFocused())
{
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_A))
{
SelectAllEntities();
@ -119,7 +124,7 @@ namespace SHADE
{
DeleteSelectedEntities();
}
}
}
if(ImGui::IsWindowHovered() && !ImGui::IsAnyItemHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left))
{
@ -315,7 +320,7 @@ namespace SHADE
const ImGuiTreeNodeFlags nodeFlags = ((isSelected) ? ImGuiTreeNodeFlags_Selected : 0) | ((children.empty()) ? ImGuiTreeNodeFlags_Leaf : ImGuiTreeNodeFlags_OpenOnArrow);
//Draw Node
bool isNodeOpen = ImGui::TreeNodeEx(reinterpret_cast<void*>(eid), nodeFlags, "%u: %s", SHEntityManager::GetEntityIndex(eid), entity->name.c_str());
bool isNodeOpen = ImGui::TreeNodeEx((void*)(eid), nodeFlags, "%u: %s", SHEntityManager::GetEntityIndex(eid), entity->name.c_str());
if(!filter.empty())
{
@ -388,6 +393,11 @@ namespace SHADE
//SHEntityManager::DestroyEntity(eid);
DeleteSelectedEntities();
}
if(ImGui::Selectable("Save entity as Prefab"))
{
SHPrefabManager::SaveEntityAsPrefab(eid);
SHEditorWindowManager::GetEditorWindow<SHAssetBrowser>()->QueueRefresh();
}
if ((currentNode->GetParent() != sceneGraph.GetRoot()) && ImGui::Selectable(std::format("{} Unparent Selected", ICON_MD_NORTH_WEST).data()))
{

View File

@ -22,6 +22,7 @@
#include "UI/SHCanvasComponent.h"
#include "UI/SHButtonComponent.h"
#include "UI/SHToggleButtonComponent.h"
#include "UI/SHSliderComponent.h"
#include "SHEditorComponentView.h"
#include "AudioSystem/SHAudioListenerComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
@ -170,6 +171,9 @@ namespace SHADE
if (auto toggleButton = SHComponentManager::GetComponent_s<SHToggleButtonComponent>(eid))
{
DrawComponent(toggleButton);
}if (auto slider = SHComponentManager::GetComponent_s<SHSliderComponent>(eid))
{
DrawComponent(slider);
}
ImGui::Separator();
// Render Scripts
@ -185,6 +189,7 @@ namespace SHADE
DrawAddComponentButton<SHCanvasComponent>(eid);
DrawAddComponentButton<SHButtonComponent>(eid);
DrawAddComponentButton<SHToggleButtonComponent>(eid);
DrawAddComponentButton<SHSliderComponent>(eid);
// Components that require Transforms

View File

@ -26,6 +26,8 @@
#include "Serialization/Configurations/SHConfigurationManager.h"
#include "Editor/EditorWindow/SHEditorWindowManager.h"
#include "Physics/System/SHPhysicsDebugDrawSystem.h"
#include "Camera/SHCameraSystem.h"
#include "Tools/Utilities/SHClipboardUtilities.h"
const std::string LAYOUT_FOLDER_PATH{ std::string(ASSET_ROOT) + "/Editor/Layouts" };
@ -154,7 +156,39 @@ namespace SHADE
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg]);
if (ImGui::BeginViewportSideBar("MainStatusBar", ImGui::GetMainViewport(), ImGuiDir_Down, menuBarHeight, editorMenuBarFlags))
{
ImGui::Text("Entity count: %zu", SHEntityManager::GetEntityCount());
auto camSystem = SHSystemManager::GetSystem<SHCameraSystem>();
std::string editorCamPosText{};
auto editorCam = camSystem->GetEditorCamera();
if(editorCam)
{
auto editorCamPos = editorCam->GetPosition();
editorCamPosText = std::format("Editor Cam [X: {:.3f}, Y: {:.3f}, Z: {:.3f}]", editorCamPos.x, editorCamPos.y, editorCamPos.z);
//ImGui::Text(editorCamPosText.data());
}
ImGui::Text("Entity count: %zu %s", SHEntityManager::GetEntityCount(), editorCamPosText.data());
if(ImGui::BeginPopupContextItem("EditorCamPosContext"))
{
if(editorCam)
{
if(ImGui::Selectable("Copy Editor Cam Pos X"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.x));
}
if (ImGui::Selectable("Copy Editor Cam Pos Y"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.y));
}
if (ImGui::Selectable("Copy Editor Cam Pos Z"))
{
auto editorCamPos = editorCam->GetPosition();
SHClipboardUtilities::WriteToClipboard(std::format("{:.3f}", editorCamPos.z));
}
}
ImGui::EndPopup();
}
}
ImGui::End();
ImGui::PopStyleColor();

View File

@ -70,7 +70,8 @@ namespace SHADE
beginCursorPos = ImGui::GetCursorScreenPos();
viewportMousePos = { mousePos.x - beginCursorPos.x, mousePos.y - beginCursorPos.y };
gfxSystem->GetMousePickSystem()->SetViewportMousePos(viewportMousePos);
ImGui::Image((ImTextureID)descriptorSet, { beginContentRegionAvailable.x, beginContentRegionAvailable.y });
SHVec2 viewportSize = CalculateWindowSize(beginContentRegionAvailable);
ImGui::Image((ImTextureID)descriptorSet, { viewportSize.x, viewportSize.y });
if (ImGui::IsWindowHovered() && ImGui::IsMouseDown(ImGuiMouseButton_Right))
{
@ -122,12 +123,22 @@ namespace SHADE
//auto pos = ImGui::GetCursorPos();
//windowCursorPos = {}
if (beginContentRegionAvailable.x == 0 || beginContentRegionAvailable.y == 0)
{
beginContentRegionAvailable = windowSize;
}
gfxSystem->PrepareResize(static_cast<uint32_t>(beginContentRegionAvailable.x), static_cast<uint32_t>(beginContentRegionAvailable.y));
//beginContentRegionAvailable = CalculateWindowSize(beginContentRegionAvailable);
SHVec2 viewportSize = CalculateWindowSize(beginContentRegionAvailable);
gfxSystem->PrepareResize(static_cast<uint32_t>(viewportSize.x), static_cast<uint32_t>(viewportSize.y));
shouldUpdateCamera = true;
//if (aspectRatio != AspectRatio::FREE && (ImGui::IsMouseDown(ImGuiMouseButton_Left) || ImGui::IsMouseReleased(ImGuiMouseButton_Left)))
//{
// windowSize = CalculateWindowSize(windowSize);
// beginContentRegionAvailable = CalculateWindowSize(beginContentRegionAvailable);
// ImGui::SetWindowSize(windowName.data(), CalculateWindowSize(windowSize));
//}
}
void SHEditorViewport::OnPosChange()
@ -195,13 +206,73 @@ namespace SHADE
ImGui::PopStyleColor();
ImGui::EndDisabled();
//TODO: Shift to constructor
auto arRTTRtype = rttr::type::get<SHEditorViewport::AspectRatio>();
auto enumAlign = arRTTRtype.get_enumeration();
auto names = enumAlign.get_names();
std::vector<const char*> arNames;
for (auto const& name : names)
{
arNames.push_back(name.data());
}
int currentAR = static_cast<int>(aspectRatio);
ImGui::SetNextItemWidth(80.0f);
if (ImGui::Combo("Aspect Ratio", &currentAR, arNames.data(), arNames.size()))
{
aspectRatio = static_cast<AspectRatio>(currentAR);
windowSize = CalculateWindowSize(windowSize);
ImGui::SetWindowSize(windowSize);
//beginContentRegionAvailable = CalculateWindowSize(beginContentRegionAvailable);
//OnResize();
}
auto camSystem = SHSystemManager::GetSystem<SHCameraSystem>();
auto editorCamera = camSystem->GetEditorCamera();
//ImGui::SetNextItemWidth(10.0f);
SHEditorWidgets::SliderFloat("CamSpeed", 0.0f, 5.0f, [editorCamera] {return editorCamera->movementSpeed; }, [editorCamera](float const& value) {editorCamera->movementSpeed = value; });
SHEditorWidgets::DragVec3("TurnSpeed", { "X", "Y", "Z" }, [editorCamera] {return editorCamera->turnSpeed; }, [editorCamera](SHVec3 const& value) {editorCamera->turnSpeed = value; });
//if(ImGui::BeginCombo("Aspect Ratio", arNames[(uint8_t)aspectRatio].data()))
//{
// auto nameIt = names.begin();
// auto valueIt = values.end();
// while(nameIt != names.end() && valueIt != values.end())
// {
// if ImGui::Beg
// }
//}
ImGui::EndMenuBar();
}
}
SHVec2 SHEditorViewport::CalculateWindowSize(SHVec2 const& rhs) noexcept
{
switch (aspectRatio)
{
case SHADE::SHEditorViewport::AspectRatio::FREE:
return rhs;
case SHADE::SHEditorViewport::AspectRatio::AR16_9:
return SHVec2(rhs.x, rhs.x * 0.5625f);
case SHADE::SHEditorViewport::AspectRatio::AR21_9:
return SHVec2(rhs.x, rhs.x * 0.42857f);
case SHADE::SHEditorViewport::AspectRatio::AR21_10:
return SHVec2(rhs.x, rhs.x * 0.47619f);
default:
return rhs;
}
}
}//namespace SHADE
RTTR_REGISTRATION
{
using namespace rttr;
using namespace SHADE;
registration::enumeration<SHEditorViewport::AspectRatio>("AspectRatio")(
value("FREE", SHEditorViewport::AspectRatio::FREE),
value("16:9", SHEditorViewport::AspectRatio::AR16_9),
value("21:9", SHEditorViewport::AspectRatio::AR21_9),
value("21:10", SHEditorViewport::AspectRatio::AR21_10)
);
}

View File

@ -16,7 +16,15 @@ namespace SHADE
{
class SHEditorViewport final : public SHEditorWindow
{
public:
enum class AspectRatio : uint8_t
{
FREE,
AR16_9,
AR21_9,
AR21_10
};
SHEditorViewport();
void Init() override;
void Update() override;
@ -27,9 +35,12 @@ namespace SHADE
void OnPosChange() override;
private:
void DrawMenuBar() noexcept;
SHVec2 beginCursorPos;
SHVec2 CalculateWindowSize(SHVec2 const& rhs) noexcept;
bool shouldUpdateCamera = false;
bool shouldUpdateCamArm = false;
AspectRatio aspectRatio {AspectRatio::FREE};
SHVec2 beginCursorPos;
SHVec3 targetPos;
};//class SHEditorViewport
}//namespace SHADE

View File

@ -1,13 +1,29 @@
#include "SHpch.h"
#include "SHPrefabManager.h"
#include "ECS_Base/Managers/SHEntityManager.h"
#include "Assets/SHAssetManager.h"
#include "Assets/Asset Types/SHPrefabAsset.h"
#include "Serialization/SHSerialization.h"
namespace SHADE
{
SHPrefabManager::PrefabMap SHPrefabManager::prefabMap{};
AssetID SHPrefabManager::GetPrefabAssetID(EntityID eid) noexcept
{
for(auto const& [assetId, entityList] : prefabMap)
{
if(std::ranges::find(entityList, eid) != entityList.end())
{
return assetId;
}
}
return 0;
}
void SHPrefabManager::AddPrefab(AssetID const& prefabAssetID) noexcept
{
prefabMap.insert({ prefabAssetID, {} });
prefabMap[prefabAssetID] = {};
}
void SHPrefabManager::RemovePrefab(AssetID const& prefabAssetID) noexcept
@ -30,20 +46,30 @@ namespace SHADE
void SHPrefabManager::AddEntity(AssetID const& prefabAssetID, EntityID const& eid) noexcept
{
if (prefabMap.contains(prefabAssetID))
{
prefabMap[prefabAssetID].insert(eid);
}
prefabMap[prefabAssetID].push_back(eid);
}
void SHPrefabManager::RemoveEntity(AssetID const& prefabAssetID, EntityID const& eid) noexcept
{
if (prefabMap.contains(prefabAssetID))
{
prefabMap[prefabAssetID].erase(eid);
(void)std::ranges::remove(prefabMap[prefabAssetID], eid);
}
}
void SHPrefabManager::SaveEntityAsPrefab(EntityID const& eid) noexcept
{
SHEntity* const entity = SHEntityManager::GetEntityByID(eid);
AssetID const assetID = SHAssetManager::CreateNewAsset(AssetType::PREFAB, entity->name);
AddEntity(assetID, eid);
auto assetData = SHAssetManager::GetData<SHPrefabAsset>(assetID);
assetData->data = SHSerialization::SerializeEntityToString(eid);
SHAssetManager::SaveAsset(assetID);
}
void SHPrefabManager::Clear() noexcept
{
prefabMap.clear();

View File

@ -2,7 +2,8 @@
#include "Assets/SHAssetMacros.h"
#include "ECS_Base/SHECSMacros.h"
#include <unordered_set>
#include "ECS_Base/General/SHFamily.h"
#include "ECS_Base/Components/SHComponent.h"
#include <unordered_map>
@ -11,18 +12,34 @@ namespace SHADE
class SHPrefabManager
{
public:
using PrefabMap = std::unordered_map<AssetID, std::unordered_set<EntityID>>;
enum class PrefabEntityComponentStatus : uint8_t
{
PES_UNCHANGED = 0,
PES_MODIFIED,
PES_ADDED,
PES_REMOVED
};
using PrefabMap = std::unordered_map<AssetID, std::vector<EntityID>>;
using PrefabEntitiesComponentStatusData = std::unordered_map<EntityID, std::unordered_map<SHFamilyID<SHComponent>,PrefabEntityComponentStatus>>;
static AssetID GetPrefabAssetID(EntityID eid) noexcept;
static void AddPrefab(AssetID const& prefabAssetID) noexcept;
static void RemovePrefab(AssetID const& prefabAssetID) noexcept;
static void ClearPrefab(AssetID const& prefabAssetID) noexcept;
static void UpdateAllPrefabEntities(AssetID const& prefabAssetID) noexcept;
static void AddEntity(AssetID const& prefabAssetID, EntityID const& eid) noexcept;
static void RemoveEntity(AssetID const& prefabAssetID, EntityID const& eid) noexcept;
static void SaveEntityAsPrefab(EntityID const& eid) noexcept;
static void Clear() noexcept;
static bool Empty() noexcept;
private:
static PrefabMap prefabMap;
static PrefabEntitiesComponentStatusData prefabEntitiesComponentStatusData;
friend class SHSerialization;
friend struct SHSerializationHelper;
};
}

View File

@ -15,6 +15,7 @@
#include "ECS_Base/Managers/SHSystemManager.h"
#include "Scripting/SHScriptEngine.h"
#include "Tools/FileIO/SHFileIO.h"
#include "Prefab/SHPrefabManager.h"
namespace SHADE
{
@ -23,7 +24,7 @@ namespace SHADE
auto assetData = SHAssetManager::GetData<SHSceneAsset>(sceneAssetID);
if(!assetData)
{
SHLOG_ERROR("Asset does not exist: {}", sceneAssetID);
SHLOG_ERROR("Serialization: Asset does not exist: {}", sceneAssetID);
return false;
}
YAML::Emitter out;
@ -45,7 +46,7 @@ namespace SHADE
auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
auto root = sceneGraph.GetRoot();
SHASSERT(root != nullptr, "Root is null. Failed to serialize scene to node.");
SHASSERT(root != nullptr, "Serialization: Root is null. Failed to serialize scene to node.");
auto const& children = root->GetChildren();
out << YAML::BeginSeq;
@ -62,6 +63,7 @@ namespace SHADE
EntityID eid{MAX_EID}, oldEID{MAX_EID};
if (!node)
return eid;
if (node[EIDNode])
oldEID = eid = node[EIDNode].as<EntityID>();
std::string name = "UnnamedEntitiy";
@ -105,7 +107,7 @@ namespace SHADE
auto assetData = SHAssetManager::GetData<SHSceneAsset>(sceneAssetID);
if(!assetData)
{
SHLOG_ERROR("Attempted to load scene that doesn't exist {}", sceneAssetID)
SHLOG_ERROR("Serialization: Attempted to load scene that doesn't exist {}", sceneAssetID)
SHSceneManager::SetCurrentSceneAssetID(0);
return NewSceneName.data();
}
@ -119,7 +121,7 @@ namespace SHADE
}
if (createdEntities.empty())
{
SHLOG_ERROR("Failed to create entities from deserializaiton")
SHLOG_ERROR("Serialization: Failed to create entities from deserialization")
return NewSceneName.data();
}
auto entityVecIt = createdEntities.begin();
@ -139,13 +141,16 @@ namespace SHADE
return assetData->name;
}
void SHSerialization::EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out)
void SHSerialization::EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out, bool isPrefab /*= false*/, EntityID* entityIndex /*= nullptr*/)
{
out << SerializeEntityToNode(entityNode);
out << SerializeEntityToNode(entityNode, isPrefab, entityIndex);
if(isPrefab)
++(*entityIndex);
auto const& children = entityNode->GetChildren();
for (auto const& child : children)
{
EmitEntity(child, out);
EmitEntity(child, out, isPrefab, entityIndex);
}
}
@ -155,6 +160,7 @@ namespace SHADE
YAML::Node node;
auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
out << YAML::BeginSeq;
EntityID entityIndex = 0;
for (auto const& eid : entities)
{
auto entityNode = sceneGraph.GetNode(eid);
@ -164,6 +170,21 @@ namespace SHADE
return std::string(out.c_str());
}
std::string SHSerialization::SerializeEntityToString(EntityID eid) noexcept
{
YAML::Emitter out;
YAML::Node node;
auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
out << YAML::BeginSeq;
EntityID entityIndex = 0;
auto entityNode = sceneGraph.GetNode(eid);
EmitEntity(entityNode, out, true, &entityIndex);
out << YAML::EndSeq;
return std::string(out.c_str());
}
//void SHSerialization::SerializeEntityToFile(std::filesystem::path const& path)
//{
//}
@ -179,8 +200,11 @@ namespace SHADE
}
}
YAML::Node SHSerialization::SerializeEntityToNode(SHSceneNode* sceneNode)
YAML::Node SHSerialization::SerializeEntityToNode(SHSceneNode* sceneNode, bool isPrefab /*= false*/, EntityID* entityIndex /*= nullptr*/)
{
if(!sceneNode)
return YAML::Node();
YAML::Node node;
auto eid = sceneNode->GetEntityID();
auto entity = SHEntityManager::GetEntityByID(eid);
@ -190,7 +214,15 @@ namespace SHADE
return node;
}
node.SetStyle(YAML::EmitterStyle::Block);
node[EIDNode] = eid;
node[EIDNode] = (entityIndex) ? *entityIndex : eid;
AssetID prefabAssetID = SHPrefabManager::GetPrefabAssetID(eid);
if(prefabAssetID != 0)
{
node[PrefabID] = prefabAssetID;
}
node[EntityNameNode] = entity->name;
node[IsActiveNode] = sceneNode->IsActive();
auto const& children = sceneNode->GetChildren();
@ -209,6 +241,7 @@ namespace SHADE
AddComponentToComponentNode<SHCanvasComponent>(components, eid);
AddComponentToComponentNode<SHButtonComponent>(components, eid);
AddComponentToComponentNode<SHToggleButtonComponent>(components, eid);
AddComponentToComponentNode<SHSliderComponent>(components, eid);
AddComponentToComponentNode<SHTextRenderableComponent>(components, eid);
AddComponentToComponentNode<SHAnimatorComponent>(components, eid);
@ -236,7 +269,7 @@ namespace SHADE
}
if (createdEntities.empty())
{
SHLOG_ERROR("Failed to create entities from deserializaiton")
SHLOG_ERROR("Failed to create entities from deserialization")
return createdEntities;
}
//auto entityVecIt = createdEntities.begin();
@ -269,6 +302,7 @@ namespace SHADE
AddComponentID<SHCanvasComponent>(componentIDList, componentsNode);
AddComponentID<SHButtonComponent>(componentIDList, componentsNode);
AddComponentID<SHToggleButtonComponent>(componentIDList, componentsNode);
AddComponentID<SHSliderComponent>(componentIDList, componentsNode);
AddComponentID<SHTextRenderableComponent>(componentIDList, componentsNode);
AddComponentID<SHAnimatorComponent>(componentIDList, componentsNode);
AddComponentID<SHUIComponent>(componentIDList, componentsNode);
@ -353,6 +387,7 @@ namespace SHADE
SHSerializationHelper::InitializeComponentFromNode<SHCanvasComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHButtonComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHToggleButtonComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHSliderComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHTextRenderableComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHAnimatorComponent>(componentsNode, eid);

View File

@ -24,6 +24,7 @@ namespace SHADE
constexpr const char* IsActiveNode = "IsActive";
constexpr const char* NumberOfChildrenNode = "NumberOfChildren";
constexpr const char* ScriptsNode = "Scripts";
constexpr const char* PrefabID = "PrefabID";
class SH_API SHSerialization
{
@ -37,12 +38,13 @@ namespace SHADE
static std::string DeserializeSceneFromFile(AssetID const& sceneAssetID) noexcept;
static void EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out);
static void EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out, bool isPrefab = false, EntityID* entityIndex = nullptr);
static std::string SerializeEntitiesToString(std::vector<EntityID> const& entities) noexcept;
static std::string SerializeEntityToString(EntityID eid) noexcept;
//static void SerializeEntityToFile(std::filesystem::path const& path);
static YAML::Node SerializeEntityToNode(SHSceneNode* sceneNode);
static YAML::Node SerializeEntityToNode(SHSceneNode* sceneNode, bool isPrefab = false, EntityID* entityIndex = nullptr);
static CreatedEntitiesList DeserializeEntitiesFromString(std::string const& data, EntityID const& parentEID = MAX_EID) noexcept;

View File

@ -135,6 +135,7 @@ namespace SHADE
}
}
return YAML::Node();
}
template <typename Type>

View File

@ -4,7 +4,7 @@
namespace SHADE
{
SHSliderComponent::SHSliderComponent()
:size(1.0f), isHovered(false), isClicked(false), value(0.0f)
:value(0.0f)
{
}

View File

@ -17,8 +17,6 @@ namespace SHADE
SHSliderComponent();
virtual ~SHSliderComponent() = default;
SHVec2 size;
float GetValue() const noexcept;
@ -29,8 +27,7 @@ namespace SHADE
friend class SHUISystem;
private:
bool isHovered;
bool isClicked;
float value;

View File

@ -377,6 +377,77 @@ namespace SHADE
}
void SHUISystem::UpdateSliderComponent(SHSliderComponent& comp) noexcept
{
if (!SHComponentManager::HasComponent<SHUIComponent>(comp.GetEID()))
{
return;
}
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
float tempValue = comp.GetValue();
CheckButtonHoveredOrClicked(*uiComp);
if (uiComp->GetIsClicked() == true)
{
SHVec4 topExtent4 = SHMatrix::Translate(-uiComp->size.x * 0.5f, uiComp->size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec4 btmExtent4 = SHMatrix::Translate(uiComp->size.x * 0.5f, -uiComp->size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec2 topExtent{ topExtent4.x,topExtent4.y };
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
SHVec2 mousePos;
SHVec2 windowSize;
#ifdef SHEDITOR
windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->beginContentRegionAvailable;
mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos;
mousePos /= windowSize;
#else
int x, y;
SHInputManager::GetMouseScreenPosition(&x, &y);
mousePos.x = x;
mousePos.y = y;
auto ws = SHSystemManager::GetSystem<SHGraphicsSystem>()->GetWindow()->GetWindowSize();
windowSize = { static_cast<float>(ws.first), static_cast<float>(ws.second) };
mousePos /= windowSize;
#endif
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0) };
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
topExtent = CanvasToScreenPoint(topExtent, true);
btmExtent = CanvasToScreenPoint(btmExtent, true);
comp.value = (mousePos.x - topExtent.x) / (btmExtent.x - topExtent.x);
if (comp.GetValue() > 1.0f)
comp.value = 1.0f;
if (comp.GetValue() < 0.0f)
comp.value = 0.0f;
}
if (comp.GetValue() != tempValue)
{
//Set shader value.
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
auto material = renderable->GetModifiableMaterial();
material->SetProperty("data.sliderThreshold", comp.GetValue());
}
}
void SHUISystem::UpdateButtonsRoutine::Execute(double dt) noexcept
{
SHUISystem* system = (SHUISystem*)GetSystem();
@ -395,6 +466,13 @@ namespace SHADE
if (SHSceneManager::CheckNodeAndComponentsActive<SHToggleButtonComponent>(comp.GetEID()))
system->UpdateToggleButtonComponent(comp);
}
auto& sliderDense = SHComponentManager::GetDense<SHSliderComponent>();
for (auto& comp : sliderDense)
{
if (SHSceneManager::CheckNodeAndComponentsActive<SHSliderComponent>(comp.GetEID()))
system->UpdateSliderComponent(comp);
}
}
SHVec2 SHUISystem::CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept
@ -415,6 +493,17 @@ namespace SHADE
return result;
}
void SHUISystem::HideActiveCanvas() noexcept
{
auto& dense = SHComponentManager::GetDense<SHCanvasComponent>();
for (auto& canvas : dense)
{
if (SHSceneManager::CheckNodeAndComponentsActive<SHCanvasComponent>(canvas.GetEID()))
{
SHSceneManager::GetCurrentSceneGraph().SetActive(canvas.GetEID(), false);
}
}
}

View File

@ -66,6 +66,8 @@ namespace SHADE
void Init();
void Exit();
void HideActiveCanvas() noexcept;
private:
bool loadTexture{false};
@ -74,7 +76,7 @@ namespace SHADE
void UpdateButtonComponent(SHButtonComponent& comp) noexcept;
void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept;
void UpdateCanvasComponent(SHCanvasComponent& comp) noexcept;
void UpdateSliderComponent(SHSliderComponent& comp) noexcept;
//returns true on button release.
bool CheckButtonHoveredOrClicked(SHUIComponent& comp) noexcept;

View File

@ -0,0 +1,27 @@
// Precompiled Headers
#include "SHpch.h"
// Primary Header
#include "Canvas.hxx"
#include "Assets/NativeAsset.hxx"
#include "Utility/Convert.hxx"
#include "Utility/Debug.hxx"
#include "ECS_Base/Managers/SHSystemManager.h"
#include "UI/SHUISystem.h"
namespace SHADE
{
Canvas::Canvas(Entity entity)
: Component(entity)
{}
void Canvas::DeactivateAllCanvas()
{
auto system = SHSystemManager::GetSystem<SHUISystem>();
system->HideActiveCanvas();
}
}

View File

@ -0,0 +1,49 @@
/************************************************************************************//*!
\file Canvas.hxx
\author Daniel Chua, 2001877
\par email: yeechendaniel/@digipen.edu
\date Feb 26, 2023
\brief Contains the definition of the managed Canvas class with the
declaration of functions for working with it.
Note: This file is written in C++17/CLI.
Copyright (C) 2023 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
// Project Includes
#include "Components/Component.hxx"
#include "Math/Vector3.hxx"
#include "Math/Quaternion.hxx"
// External Dependencies
#include "UI/SHCanvasComponent.h"
namespace SHADE
{
/// <summary>
/// CLR version of the SHADE Engine's SHCanvasComponent.
/// </summary>
public ref class Canvas : public Component<SHCanvasComponent>
{
internal:
/*-----------------------------------------------------------------------------*/
/* Constructors */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Constructs a Canvas Component that represents a native SHCanvasComponent
/// tied to the specified Entity.
/// </summary>
/// <param name="entity">Entity that this Component will be tied to.</param>
Canvas(Entity entity);
public:
static void DeactivateAllCanvas();
};
}

View File

@ -0,0 +1,26 @@
// Precompiled Headers
#include "SHpch.h"
// Primary Header
#include "Slider.hxx"
#include "Assets/NativeAsset.hxx"
#include "Utility/Convert.hxx"
#include "Utility/Debug.hxx"
#include "ECS_Base/Managers/SHSystemManager.h"
#include "UI/SHUISystem.h"
namespace SHADE
{
Slider::Slider(Entity entity)
: Component(entity)
{}
float Slider::GetValue()
{
return GetNativeComponent()->GetValue();
}
}

View File

@ -0,0 +1,49 @@
/************************************************************************************//*!
\file Slider.hxx
\author Daniel Chua, 2001877
\par email: yeechendaniel/@digipen.edu
\date Feb 26, 2023
\brief Contains the definition of the managed Slider class with the
declaration of functions for working with it.
Note: This file is written in C++17/CLI.
Copyright (C) 2023 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
// Project Includes
#include "Components/Component.hxx"
#include "Math/Vector3.hxx"
#include "Math/Quaternion.hxx"
// External Dependencies
#include "UI/SHSliderComponent.h"
namespace SHADE
{
/// <summary>
/// CLR version of the SHADE Engine's SHSliderComponent.
/// </summary>
public ref class Slider : public Component<SHSliderComponent>
{
internal:
/*-----------------------------------------------------------------------------*/
/* Constructors */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Constructs a Slider Component that represents a native SHSliderComponent
/// tied to the specified Entity.
/// </summary>
/// <param name="entity">Entity that this Component will be tied to.</param>
Slider(Entity entity);
public:
float GetValue();
};
}

View File

@ -73,6 +73,8 @@ namespace SHADE
CallbackEvent^ get();
}
internal:
/*-----------------------------------------------------------------------------*/
/* Static Clear Functions */

View File

@ -30,18 +30,24 @@ of DigiPen Institute of Technology is prohibited.
#include "Graphics\MiddleEnd\Interface\SHRenderable.h"
#include "Graphics\MiddleEnd\TextRendering\SHTextRenderableComponent.h"
#include "UI\SHUIComponent.h"
#include "UI\SHSliderComponent.h"
#include "UI\SHCanvasComponent.h"
// Project Headers
#include "Utility/Convert.hxx"
#include "Utility/Debug.hxx"
#include "Components/Transform.hxx"
#include "Components/RigidBody.hxx"
#include "Components/Collider.hxx"
#include "Components/Camera.hxx"
#include "Components/CameraArm.hxx"
#include "Components/Light.hxx"
#include "Components\Transform.hxx"
#include "Components\RigidBody.hxx"
#include "Components\Collider.hxx"
#include "Components\Camera.hxx"
#include "Components\CameraArm.hxx"
#include "Components\Light.hxx"
#include "Components\Renderable.hxx"
#include "Components\TextRenderable.hxx"
#include "Components\UIElement.hxx"
#include "Components\Canvas.hxx"
#include "Components\Slider.hxx"
namespace SHADE
{
@ -327,6 +333,8 @@ namespace SHADE
componentMap.Add(createComponentSet<SHLightComponent, Light>());
componentMap.Add(createComponentSet<SHTextRenderableComponent, TextRenderable>());
componentMap.Add(createComponentSet<SHUIComponent, UIElement>());
componentMap.Add(createComponentSet<SHCanvasComponent, Canvas>());
componentMap.Add(createComponentSet<SHSliderComponent, Slider>());
}
/*---------------------------------------------------------------------------------*/

View File

@ -483,10 +483,19 @@ namespace SHADE
SAFE_NATIVE_CALL_BEGIN
// Clear the awake queue
for each (Script ^ script in awakeList)
{
if (script->Owner.IsActiveInHierarchy)
{
script->Awake();
}
else
{
inactiveAwakeList.Add(script);
}
}
awakeList.Clear();
awakeList.UnionWith(%inactiveAwakeList);
inactiveAwakeList.Clear();
// Clear the start queue
for each (Script^ script in startList)
@ -501,10 +510,7 @@ namespace SHADE
}
}
startList.Clear();
for each (Script ^ script in startList)
{
startList.Add(script);
}
startList.UnionWith(%inactiveStartList);
inactiveStartList.Clear();
SAFE_NATIVE_CALL_END_N("SHADE_Managed.ScriptStore")

View File

@ -353,6 +353,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/
static ScriptDictionary scripts;
static ScriptSet awakeList;
static ScriptSet inactiveAwakeList;
static ScriptSet startList;
static ScriptSet inactiveStartList;
static ScriptSet disposalQueue;