Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfofRome committed Apr 24, 2023
1 parent d8b37d3 commit 6e472f9
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 29 deletions.
20 changes: 17 additions & 3 deletions Assets/Resources/Prefabs/Pal3.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -804,6 +805,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -1360,6 +1362,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -1689,6 +1692,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -1790,6 +1794,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -1876,6 +1881,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -2006,6 +2012,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -2206,6 +2213,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -2701,7 +2709,7 @@ GameObject:
- component: {fileID: 5650567296555352649}
- component: {fileID: 416810473558055248}
m_Layer: 5
m_Name: BigMapButton
m_Name: MultiFunctionButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -3118,6 +3126,7 @@ Canvas:
m_OverrideSorting: 1
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -3180,6 +3189,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -3368,6 +3378,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -3470,6 +3481,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -3571,6 +3583,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -3942,7 +3955,7 @@ MonoBehaviour:
contentScrollRect: {fileID: 8374998735291348270}
touchControlUI: {fileID: 1398116650379626629}
interactionButton: {fileID: 2629186827427555584}
bigMapButton: {fileID: 416810473558055248}
multiFunctionButton: {fileID: 416810473558055248}
mainMenuButton: {fileID: 7186792160907318265}
eventSystem: {fileID: 20216138}
postProcessVolume: {fileID: 8346885185333560231}
Expand Down Expand Up @@ -4294,6 +4307,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 7
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
Expand Down Expand Up @@ -4357,7 +4371,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2755888773251150947, guid: 3ef1d32c83f86744286e2067bc5f73e4, type: 3}
propertyPath: m_Value
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2755888773251194751, guid: 3ef1d32c83f86744286e2067bc5f73e4, type: 3}
propertyPath: m_Enabled
Expand Down
137 changes: 135 additions & 2 deletions Assets/Scenes/PrefabEditor.unity
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
Expand All @@ -117,7 +117,7 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
Expand All @@ -128,6 +128,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 332266281639726118, guid: e86d7889291c041ba854821fd25047d6, type: 3}
Expand Down Expand Up @@ -230,6 +231,14 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3491202665095195611, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3596785283706710040, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 256925267}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
Expand Down Expand Up @@ -278,6 +287,14 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5077207798598084246, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 1661395006}
- target: {fileID: 6514349001384511054, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 91034975}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
Expand Down Expand Up @@ -446,6 +463,10 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834017742, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.00012207031
objectReference: {fileID: 0}
- target: {fileID: 9166793672834029268, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.x
value: 0
Expand All @@ -454,6 +475,10 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834029268, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
Expand Down Expand Up @@ -575,4 +600,112 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e86d7889291c041ba854821fd25047d6, type: 3}
--- !u!21 &91034975
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 4
m_Colors:
- _AdditiveColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
- _MultiplyColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
- _WidthHeightRadius: {r: 800, g: 600, b: 65, a: 0}
m_BuildTextureStacks: []
--- !u!21 &256925267
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 3
m_Colors:
- _AdditiveColor: {r: 0.039215688, g: 0.039215688, b: 0.039215688, a: 1}
- _MultiplyColor: {r: 0.54901963, g: 0.54901963, b: 0.54901963, a: 1}
- _WidthHeightRadius: {r: 1024, g: 220, b: 35, a: 0}
m_BuildTextureStacks: []
--- !u!21 &1661395006
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 4
m_Colors:
- _AdditiveColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
- _MultiplyColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
- _WidthHeightRadius: {r: 800, g: 600, b: 65, a: 0}
m_BuildTextureStacks: []
8 changes: 8 additions & 0 deletions Assets/Scripts/Pal3/Command/ConsoleCommands.PAL3.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,14 @@ public static void SceneSaveGlobalObjectYRotation(System.String cityName, System
new SceneSaveGlobalObjectYRotationCommand(cityName, sceneName, objectId, gameBoxYRotation));
}

// <auto-generated/>
[ConsoleMethodAttribute("SwitchPlayerActorRequest", "Execute SwitchPlayerActorRequest.")]
public static void SwitchPlayerActorRequest()
{
CommandDispatcher<ICommand>.Instance.Dispatch(
new SwitchPlayerActorRequest());
}

// <auto-generated/>
[ConsoleMethodAttribute("ToggleBigMapRequest", "Execute ToggleBigMapRequest.")]
public static void ToggleBigMapRequest()
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Pal3/Command/ConsoleCommands.PAL3A.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,14 @@ public static void SceneSaveGlobalThreePhaseSwitchState(System.String cityName,
new SceneSaveGlobalThreePhaseSwitchStateCommand(cityName, sceneName, objectId, previousState, currentState));
}

// <auto-generated/>
[ConsoleMethodAttribute("SwitchPlayerActorRequest", "Execute SwitchPlayerActorRequest.")]
public static void SwitchPlayerActorRequest()
{
CommandDispatcher<ICommand>.Instance.Dispatch(
new SwitchPlayerActorRequest());
}

// <auto-generated/>
[ConsoleMethodAttribute("ToggleBigMapRequest", "Execute ToggleBigMapRequest.")]
public static void ToggleBigMapRequest()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Pal3.Command.InternalCommands
{
[AvailableInConsole]
public class SwitchPlayerActorRequest : ICommand
{
public SwitchPlayerActorRequest() {}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Assets/Scripts/Pal3/GamePlay/PlayerGamePlayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public sealed class PlayerGamePlayController : MonoBehaviour,
ICommandExecutor<ScenePostLoadingNotification>,
ICommandExecutor<PlayerActorLookAtSceneObjectCommand>,
ICommandExecutor<PlayerInteractWithObjectCommand>,
ICommandExecutor<ToggleBigMapRequest>,
ICommandExecutor<SwitchPlayerActorRequest>,
ICommandExecutor<ResetGameStateCommand>
{
private const float MIN_JUMP_DISTANCE = 1.2f;
Expand Down Expand Up @@ -1272,8 +1272,7 @@ public void Execute(ResetGameStateCommand command)
_playerActorMovementController = null;
}

// TODO: Remove this
public void Execute(ToggleBigMapRequest command)
public void Execute(SwitchPlayerActorRequest command)
{
if (_sceneManager.GetCurrentScene().GetSceneInfo().SceneType == ScnSceneType.Maze)
{
Expand Down
Loading

0 comments on commit 6e472f9

Please sign in to comment.