diff options
41 files changed, 1211 insertions, 11 deletions
diff --git a/WorldlineKeepers/Assets/Scenes/Test.unity b/WorldlineKeepers/Assets/Scenes/0_Test.unity index 0c1e493..0c1e493 100644 --- a/WorldlineKeepers/Assets/Scenes/Test.unity +++ b/WorldlineKeepers/Assets/Scenes/0_Test.unity diff --git a/WorldlineKeepers/Assets/Scenes/Test.unity.meta b/WorldlineKeepers/Assets/Scenes/0_Test.unity.meta index 6d2d5b2..6d2d5b2 100644 --- a/WorldlineKeepers/Assets/Scenes/Test.unity.meta +++ b/WorldlineKeepers/Assets/Scenes/0_Test.unity.meta diff --git a/WorldlineKeepers/Assets/Scenes/1_Entry.unity b/WorldlineKeepers/Assets/Scenes/1_Entry.unity new file mode 100644 index 0000000..63c8977 --- /dev/null +++ b/WorldlineKeepers/Assets/Scenes/1_Entry.unity @@ -0,0 +1,209 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &305075650 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 305075653} + - component: {fileID: 305075652} + - component: {fileID: 305075651} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &305075651 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305075650} + m_Enabled: 1 +--- !u!20 &305075652 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305075650} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &305075653 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305075650} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/WorldlineKeepers/Assets/Scenes/1_Entry.unity.meta b/WorldlineKeepers/Assets/Scenes/1_Entry.unity.meta new file mode 100644 index 0000000..f451799 --- /dev/null +++ b/WorldlineKeepers/Assets/Scenes/1_Entry.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 112e175ba5ba1114ebabf31b55e3bdd5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scenes/Lobby.unity b/WorldlineKeepers/Assets/Scenes/2_Lobby.unity index af98701..af98701 100644 --- a/WorldlineKeepers/Assets/Scenes/Lobby.unity +++ b/WorldlineKeepers/Assets/Scenes/2_Lobby.unity diff --git a/WorldlineKeepers/Assets/Scenes/Lobby.unity.meta b/WorldlineKeepers/Assets/Scenes/2_Lobby.unity.meta index 6337a0d..6337a0d 100644 --- a/WorldlineKeepers/Assets/Scenes/Lobby.unity.meta +++ b/WorldlineKeepers/Assets/Scenes/2_Lobby.unity.meta diff --git a/WorldlineKeepers/Assets/Scenes/TraningDojo.unity b/WorldlineKeepers/Assets/Scenes/3_Dojo.unity index 1056cd7..1056cd7 100644 --- a/WorldlineKeepers/Assets/Scenes/TraningDojo.unity +++ b/WorldlineKeepers/Assets/Scenes/3_Dojo.unity diff --git a/WorldlineKeepers/Assets/Scenes/TraningDojo.unity.meta b/WorldlineKeepers/Assets/Scenes/3_Dojo.unity.meta index 3249e26..3249e26 100644 --- a/WorldlineKeepers/Assets/Scenes/TraningDojo.unity.meta +++ b/WorldlineKeepers/Assets/Scenes/3_Dojo.unity.meta diff --git a/WorldlineKeepers/Assets/Scenes/4_Stage.unity b/WorldlineKeepers/Assets/Scenes/4_Stage.unity new file mode 100644 index 0000000..24aa7e3 --- /dev/null +++ b/WorldlineKeepers/Assets/Scenes/4_Stage.unity @@ -0,0 +1,209 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1573545328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1573545331} + - component: {fileID: 1573545330} + - component: {fileID: 1573545329} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1573545329 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1573545328} + m_Enabled: 1 +--- !u!20 &1573545330 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1573545328} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1573545331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1573545328} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/WorldlineKeepers/Assets/Scenes/4_Stage.unity.meta b/WorldlineKeepers/Assets/Scenes/4_Stage.unity.meta new file mode 100644 index 0000000..b6e11f0 --- /dev/null +++ b/WorldlineKeepers/Assets/Scenes/4_Stage.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ccc90f7a55ca31e4a820bc889ba35fec +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Application.meta b/WorldlineKeepers/Assets/Scripts/Application.meta new file mode 100644 index 0000000..3d93c15 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Application.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 880675e8c90730d4c94482d83cfd6df0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs new file mode 100644 index 0000000..a4698f4 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs @@ -0,0 +1,62 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + /// <summary> + /// 主循环,所有子系统的更新理论上都走这里的循环 + /// </summary> + public class ApplicationMain : Singleton<ApplicationMain> + { + public delegate void ApplicationCallback(); + + #region 事件 + public event ApplicationCallback onAwakeHandler; + public event ApplicationCallback onStartHandler; + public event ApplicationCallback onUpdateHandler; + public event ApplicationCallback onFixedUpdateHandler; + public event ApplicationCallback onApplicationQuitHandler; + public event ApplicationCallback onDestroyHandler; + public event ApplicationCallback onApplicationPauseHandler; + #endregion + + public void OnAwake() + { + onAwakeHandler?.Invoke(); + } + + public void OnStart() + { + onStartHandler?.Invoke(); + } + + public void OnUpdate() + { + onUpdateHandler?.Invoke(); + } + + public void OnFixedUpdate() + { + onFixedUpdateHandler?.Invoke(); + } + + public void OnDestroy() + { + onDestroyHandler?.Invoke(); + } + + public void OnApplicationQuit() + { + onApplicationQuitHandler?.Invoke(); + } + + public void OnApplicationPause() + { + onApplicationPauseHandler?.Invoke(); + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs.meta b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs.meta new file mode 100644 index 0000000..f201dbf --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95fdd2b99bd27a94eb3783f14ea43c22 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs b/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs new file mode 100644 index 0000000..5bbc60d --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs @@ -0,0 +1,23 @@ +using Mono.CompilerServices.SymbolWriter; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace WK +{ + + public interface ISubsystem + { + + void OnAwake(); + void OnStart(); + void OnUpdate(); + void OnFixedUpdate(); + void OnDestroy(); + void OnApplicationQuit(); + void OnApplicationPause(); + + } + +}
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs.meta b/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs.meta new file mode 100644 index 0000000..acad5f8 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Application/ISubsystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 471d0112ba2db594686ad821387d11e6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs b/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs index 9ed2fc9..ff7ac65 100644 --- a/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs @@ -2,10 +2,29 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class SceneManager : Singleton<SceneManager> +namespace WK { - // 鍦烘櫙鍐呮墍鏈夊璞$敤杩欎釜缁撴瀯缁存姢 - private GridMap m_GridMap; + /// <summary> + /// 鍛藉悕鍜孶nityEngine.SceneManagement.SceneManager鍖哄垎 + /// </summary> + public class GameSceneManager : Singleton<GameSceneManager> + { + private AsyncOperation m_AsyncOpt = null; + public AsyncOperation AsyncOpt + { + get + { + return m_AsyncOpt; + } + } -}
\ No newline at end of file + public void LoadScene(string sceneName, UnityEngine.SceneManagement.LoadSceneMode loadMode) + { + m_AsyncOpt = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, loadMode); + } + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Managers/Main.cs b/WorldlineKeepers/Assets/Scripts/Managers/Main.cs index 976779d..2d50dda 100644 --- a/WorldlineKeepers/Assets/Scripts/Managers/Main.cs +++ b/WorldlineKeepers/Assets/Scripts/Managers/Main.cs @@ -1,34 +1,46 @@ using System.Collections; using System.Collections.Generic; +using Unity.VisualScripting; using UnityEngine; using WK.Data; namespace WK { + /// <summary> + /// 托管ApplicationMain的Monobehaviour对象 + /// 这么作的目的是为了减少monobehaviour的调用,子系统同一走application main + /// </summary> public class Main : SingletonMB<Main> { protected override void Awake() { base.Awake(); - DontDestroyOnLoad(this.gameObject); + DontDestroyOnLoad(this.gameObject);// + + ApplicationMain.Instance.OnAwake(); } private void Start() { DataManager.Instance.Load(); - Debug.Log(DataManager.Instance.GetCharacterStats("health")); + ApplicationMain.Instance.OnStart(); } private void Update() { - + ApplicationMain.Instance.OnUpdate(); } private void FixedUpdate() { - + ApplicationMain.Instance.OnFixedUpdate(); + } + + private void OnDestroy() + { + ApplicationMain.Instance.OnDestroy(); } } diff --git a/WorldlineKeepers/Assets/Scripts/Stages.meta b/WorldlineKeepers/Assets/Scripts/Stages.meta new file mode 100644 index 0000000..c9ff25f --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dc0534a6527c55d4cb2b2e876775be80 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs new file mode 100644 index 0000000..73ded6e --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs @@ -0,0 +1,28 @@ +using Microsoft.Unity.VisualStudio.Editor; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace WK +{ + + public class GameStageBase : AsyncStatemachine.State + { + + public override IEnumerator<float> OnStart() + { + yield break; + } + + public override IEnumerator<float> OnEnd() + { + yield break; + } + + public override void OnUpdate(float deltaTime) + { + } + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs.meta new file mode 100644 index 0000000..15a5c56 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStageBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 432eadb305e58da4897534478987c4da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs new file mode 100644 index 0000000..a92a3d8 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs @@ -0,0 +1,59 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.VisualScripting; +using UnityEngine; +using WK.Tools; + +namespace WK +{ + + public sealed class GameStageManager : Singleton<GameStageManager>, ISubsystem + { + /// <summary> + /// GameStage的状态机 + /// </summary> + private AsyncStatemachine m_Statemachine; + private int[] stages = new int[(int)EGameStage.Num]; + private EGameStage prevStage = EGameStage.Launch; + private EGameStage curStage = EGameStage.Launch; + + public void OnAwake() + { + SetupGameStages(); + + } + + private void SetupGameStages() + { + m_Statemachine = new AsyncStatemachine(); + + + } + + public void OnStart() + { + } + + public void OnUpdate() + { + } + + public void OnFixedUpdate() + { + } + + public void OnDestroy() + { + } + + public void OnApplicationPause() + { + } + + public void OnApplicationQuit() + { + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs.meta new file mode 100644 index 0000000..0ce1cb9 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStageManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b7f17be1928ff849ba0d7d28ca8e87d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs new file mode 100644 index 0000000..3701299 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class GameStage_Battle : GameStageBase + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs.meta new file mode 100644 index 0000000..9104992 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Battle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad0f7465a835f2942ab4a37df3a827b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs new file mode 100644 index 0000000..fbb92a4 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class GameStage_Dojo : GameStageBase + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs.meta new file mode 100644 index 0000000..d4e25cf --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30c90d11e59fd3f42b4568e275bb3fbe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs new file mode 100644 index 0000000..e283008 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class GameStage_Launch : GameStageBase + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs.meta new file mode 100644 index 0000000..aa30aaa --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Launch.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 140927b1845ec1846814b71c4e114ad8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs new file mode 100644 index 0000000..01488d9 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public class GameStage_Lobby + { + + + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs.meta new file mode 100644 index 0000000..5add0f2 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Main.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 102ce3dadc4654b44838f17cf9415384 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs new file mode 100644 index 0000000..28ba28f --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + public enum EGameStage + { + Launch = 0, // splash screen + //Login = 1, // + Main = 2, // 主界面 + Battle = 3, // 战斗场景 + Dojo = 4, // 训练道场 + + Num + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs.meta b/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs.meta new file mode 100644 index 0000000..ea2c442 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStages.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4b80a072bd95b643a7c2295281f3174 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Statemachine.meta b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine.meta new file mode 100644 index 0000000..77a2746 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0a7c937b01d531843b68e7ecf1ac0ca9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Common/Statemachine.cs b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/AsyncStatemachine.cs index ffa33a2..605f737 100644 --- a/WorldlineKeepers/Assets/Scripts/Common/Statemachine.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/AsyncStatemachine.cs @@ -9,15 +9,15 @@ namespace WK /// <summary> /// 公共状态机 /// </summary> - public class StateMachine + public class AsyncStatemachine { public delegate void LoadStateComplete(); public abstract class State { - public StateMachine owner; - public int stateID; + public AsyncStatemachine owner; + public int stateID; // stateID可以是string.GetHashCode() 以提供扩展性 public abstract IEnumerator<float> OnStart(); public abstract IEnumerator<float> OnEnd(); public abstract void OnUpdate(float deltaTime); diff --git a/WorldlineKeepers/Assets/Scripts/Common/Statemachine.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/AsyncStatemachine.cs.meta index e2b8d49..e2b8d49 100644 --- a/WorldlineKeepers/Assets/Scripts/Common/Statemachine.cs.meta +++ b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/AsyncStatemachine.cs.meta diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs new file mode 100644 index 0000000..56dd28b --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs @@ -0,0 +1,249 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using Newtonsoft.Json.Utilities; + +namespace WK +{ + + public class BaseStateMachine + { + public delegate void StateEvent(); + public delegate bool StateFinishChecker(); + public class State + { + public BaseStateMachine owner; + public int stateId; + + public virtual void BeginState() + { + //reserve function + } + public virtual void EndState() + { + //reserve function + } + //时间单位是毫秒 + public virtual bool UpdateState(int deltaTimeMS) + { + return true; + } + } + + private Dictionary<int/*state id*/, State> stateDic = new Dictionary<int/*state id*/, State>(); + private int currentStateId = -1; + private int stateIdDistributor = 0; + + private int recordLastStateId = -1; + + public int RegisterState(State newState) + { + if (newState != null) + { + if (stateIdDistributor + 1 > int.MaxValue) + { + Debug.LogError("状态机添加状态失败:一个状态机中添加了过多的状态!"); + return -1; + } + + stateIdDistributor++; + if (!stateDic.ContainsKey(stateIdDistributor)) + { + stateDic.Add(stateIdDistributor, newState); + newState.owner = this; + newState.stateId = stateIdDistributor; + return stateIdDistributor; + } + } + Debug.LogError("状态机添加状态失败:无效的新状态或新状态已存在!"); + return -1; + } + + public bool RemoveState(State toBeRemoveState) + { + if (toBeRemoveState != null) + return RemoveState(toBeRemoveState.stateId); + Debug.LogError("状态机删除状态失败:无效的状态!"); + return false; + } + + public bool RemoveState(int stateId) + { + if (stateDic.ContainsKey(stateId)) + { + stateDic.Remove(stateId); + return true; + } + Debug.LogError("状态机删除状态失败:该状态不存在!"); + return false; + } + + public bool Begin(int beginStateId) + { + if (!HasBegin()) + { + ForceGoToState(beginStateId, false); + return true; + } + + return false; + } + + public bool Stop() + { + if (HasBegin()) + { + ForceGoToState(-1); + return true; + } + + return false; + } + + public bool GoToState(int newStateId, bool skipBeginFunc = false, bool forceLoad = false) + { + if (HasBegin()) + { + return ForceGoToState(newStateId, skipBeginFunc, forceLoad); + } + return false; + } + + private bool ForceGoToState(int newStateId) + { + return ForceGoToState(newStateId, false); + } + private bool ForceGoToState(int newStateId, bool skipBeginFunc, bool bForce = false) + { + if (currentStateId != newStateId || bForce) + { + OnStateEnd(currentStateId); + currentStateId = newStateId; + if (!skipBeginFunc) OnStateBegin(currentStateId); + return true; + } + else + { + return false; + } + } + + /// <summary> + /// + /// </summary> + /// <param name="filterState">剔除的state</param> + public void RecordCurrentState(int filterState) + { + if (currentStateId != filterState) + { + recordLastStateId = currentStateId; + } + } + + public void ClearRecordState() + { + recordLastStateId = -1; + } + + public void RevertToRecordState(int fallbackState, bool skipBeginFunc, bool bForce = false) + { + if (recordLastStateId >= 0 && stateDic.ContainsKey(recordLastStateId)) + { + GoToState(recordLastStateId, skipBeginFunc, bForce); + } + else if (fallbackState >= 0 && stateDic.ContainsKey(fallbackState)) + { + GoToState(fallbackState, skipBeginFunc, bForce); + } + } + + + //时间单位是毫秒 + public void OnUpdate(int mSecDeltaTime) + { + if (HasBegin()) + { + UpdateState(currentStateId, mSecDeltaTime); + } + } + + public bool HasBegin() + { + if (currentStateId != -1 && stateDic.ContainsKey(currentStateId)) + return true; + else + return false; + } + + public bool IsInState(int stateId) + { + if (HasBegin()) + { + return currentStateId == stateId; + } + return false; + } + + + public int GetCurrentStateId() + { + return currentStateId; + } + + public State GetState(int stateId) + { + if (stateDic.ContainsKey(stateId)) + { + return stateDic[stateId]; + } + return null; + } + + public void Clean() + { + stateDic.Clear(); + currentStateId = -1; + stateIdDistributor = 0; + recordLastStateId = -1; + } + + /// <summary> + /// 重置当前状态(置为-1) + /// </summary> + public void ResetCurrentState() + { + currentStateId = -1; + } + + private void OnStateBegin(int stateId) + { + if (HasBegin()) + { + State state = GetState(stateId); + if (state != null) + state.BeginState(); + } + } + + private void OnStateEnd(int stateId) + { + if (HasBegin()) + { + State state = GetState(stateId); + if (state != null) + state.EndState(); + } + } + //时间单位是毫秒 + private void UpdateState(int stateId, int mSecDeltaTime) + { + if (HasBegin()) + { + State state = GetState(stateId); + if (state != null) + state.UpdateState(mSecDeltaTime); + } + } + } + +}
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs.meta new file mode 100644 index 0000000..1f9dc33 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/Statemachine/Statemachine.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 740b9ccdbc7196546acfadecbcbd71f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs b/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs new file mode 100644 index 0000000..7e54840 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs @@ -0,0 +1,51 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK.Tools +{ + + public class UniqueStringMap + { + private int m_Index = 1; + + private Dictionary<string, int/*ID*/> m_StringMap = new Dictionary<string, int>(); + + public int RegisterString(string str) + { + if(m_StringMap.ContainsKey(str)) + return m_StringMap[str]; + + int index = m_Index++; + m_StringMap.Add(str, index); + + return index; + } + + public int GetStringCode(string str) + { + if (!m_StringMap.ContainsKey(str)) + return 0; + return m_StringMap[str]; + } + + //public int GetOrAddStringCode(string str) + //{ + // if (!m_StringMap.ContainsKey(str)) + // { + // RegisterString(str); + // } + // return m_StringMap[str]; + //} + + public int this[string str] + { + get + { + return GetStringCode(str); + } + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs.meta new file mode 100644 index 0000000..0e1c43d --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/UniqueStringMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f24ea275bd009864e8b1e4c0d64f2316 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs new file mode 100644 index 0000000..b9ec52e --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using System.Security.Cryptography; +using System.Text; +using UnityEngine; + +namespace WK.Utils +{ + + public class StringUtils + { + + public static byte[] GetHash(string inputString) + { + using (HashAlgorithm algorithm = SHA256.Create()) + return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); + } + + public static string GetHashString(string inputString) + { + StringBuilder sb = new StringBuilder(); + foreach (byte b in GetHash(inputString)) + sb.Append(b.ToString("X2")); + + return sb.ToString(); + } + + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta new file mode 100644 index 0000000..555da6c --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 917c8c50054333a45b8925c7b33ffdf5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |