存储功能更新
This commit is contained in:
@@ -1,438 +0,0 @@
|
||||
%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: 3
|
||||
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
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &516881017
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 516881021}
|
||||
- component: {fileID: 516881020}
|
||||
- component: {fileID: 516881019}
|
||||
- component: {fileID: 516881018}
|
||||
m_Layer: 5
|
||||
m_Name: Screen Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &516881018
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 516881017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &516881019
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 516881017}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!223 &516881020
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 516881017}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 2
|
||||
m_Camera: {fileID: 1118544095}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 1
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &516881021
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 516881017}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 960, y: 540}
|
||||
m_SizeDelta: {x: 1920, y: 1080}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &520191458
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 520191461}
|
||||
- component: {fileID: 520191460}
|
||||
- component: {fileID: 520191459}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &520191459
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 520191458}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &520191460
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 520191458}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!4 &520191461
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 520191458}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1118544093
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1118544096}
|
||||
- component: {fileID: 1118544095}
|
||||
- component: {fileID: 1118544094}
|
||||
- component: {fileID: 1118544097}
|
||||
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 &1118544094
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1118544093}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1118544095
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1118544093}
|
||||
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_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
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 &1118544096
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1118544093}
|
||||
serializedVersion: 2
|
||||
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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1118544097
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1118544093}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_RenderShadows: 1
|
||||
m_RequiresDepthTextureOption: 2
|
||||
m_RequiresOpaqueTextureOption: 2
|
||||
m_CameraType: 0
|
||||
m_Cameras: []
|
||||
m_RendererIndex: -1
|
||||
m_VolumeLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
m_VolumeTrigger: {fileID: 0}
|
||||
m_VolumeFrameworkUpdateModeOption: 2
|
||||
m_RenderPostProcessing: 0
|
||||
m_Antialiasing: 0
|
||||
m_AntialiasingQuality: 2
|
||||
m_StopNaN: 0
|
||||
m_Dithering: 0
|
||||
m_ClearDepth: 1
|
||||
m_AllowXRRendering: 1
|
||||
m_AllowHDROutput: 1
|
||||
m_UseScreenCoordOverride: 0
|
||||
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_RequiresDepthTexture: 0
|
||||
m_RequiresColorTexture: 0
|
||||
m_Version: 2
|
||||
m_TaaSettings:
|
||||
quality: 3
|
||||
frameInfluence: 0.1
|
||||
jitterScale: 1
|
||||
mipBias: 0
|
||||
varianceClampScale: 0.9
|
||||
contrastAdaptiveSharpening: 0
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 1118544096}
|
||||
- {fileID: 516881021}
|
||||
- {fileID: 520191461}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21b363830c54467459415a8f001d30a4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,6 +5,7 @@ using DG.Tweening;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
public class FavoritesManager : MonoBehaviour
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public class FavoritesManager : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
GameLoopManager.FixDataContainer.Register(_clueData);
|
||||
StorageSystem.Instance.RegisterData(_clueData);
|
||||
// 添加加载逻辑
|
||||
_clueData.LoadEvent += LoadData;
|
||||
}
|
||||
@@ -174,8 +175,9 @@ public class ClueData : IData
|
||||
public List<PunchTape> punchTapeFavorites = new List<PunchTape>();
|
||||
public event Action<ClueData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class ChipModule : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
// 将数据注册到数据容器内
|
||||
GameLoopManager.FixDataContainer.Register(_chipData);
|
||||
StorageSystem.Instance.RegisterData(_chipData);
|
||||
// 添加加载逻辑
|
||||
_chipData.LoadEvent += LoadData;
|
||||
_chipModule = transform.Find("Chip").gameObject;
|
||||
@@ -66,8 +66,9 @@ public class ChipData : IData
|
||||
|
||||
public event Action<ChipData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using AibisDream.FixSystem;
|
||||
|
||||
public class UFModule : MonoBehaviour
|
||||
@@ -17,7 +18,7 @@ public class UFModule : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
// 将数据注册到数据容器内
|
||||
GameLoopManager.FixDataContainer.Register(_ufData);
|
||||
StorageSystem.Instance.RegisterData(_ufData);
|
||||
// 添加加载逻辑
|
||||
_ufData.LoadEvent += LoadData;
|
||||
_ufModule = transform.Find("Module Pic").gameObject;
|
||||
@@ -118,8 +119,9 @@ public class UFData : IData
|
||||
|
||||
public event Action<UFData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace AibisDream
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
GameLoopManager.FixDataContainer.Register(_clinicData);
|
||||
StorageSystem.Instance.RegisterData(_clinicData);
|
||||
|
||||
character = transform.GetComponentInChildren<CharacterViewer>();
|
||||
character.CharacterChangeEvent += OnCharacterChange;
|
||||
@@ -75,7 +75,7 @@ namespace AibisDream
|
||||
character.CharacterChangeEvent -= OnCharacterChange;
|
||||
_clinicData.LoadEvent -= LoadData;
|
||||
characterGroup.ChangeEvent -= OnSpriteGroupChange;
|
||||
GameLoopManager.FixDataContainer.Unregister<ClinicData>();
|
||||
StorageSystem.Instance.UnregisterData<ClinicData>();
|
||||
FixSystemCenter.SystemDic.Unregister<ClinicSystem>();
|
||||
CameraKit.Instance.UnRegisterCamera(CameraEnum.Clinic);
|
||||
}
|
||||
@@ -93,21 +93,16 @@ namespace AibisDream
|
||||
|
||||
public class ClinicData : IData
|
||||
{
|
||||
public string characterName;
|
||||
public string faceName;
|
||||
public string poseName;
|
||||
public bool hasDevice;
|
||||
public bool isShow;
|
||||
|
||||
public string configKey;
|
||||
public string curState;
|
||||
public bool shown;
|
||||
|
||||
public event Action<ClinicData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,14 +30,13 @@ namespace AibisDream.FixSystem
|
||||
public IEnumerator SwitchState(FixState nextState, string args = "")
|
||||
{
|
||||
if (CurState == nextState) yield break;
|
||||
|
||||
|
||||
_curArgs = args;
|
||||
|
||||
yield return _curState?.Exit();
|
||||
|
||||
GameLoopManager.Instance?.UpdateFixState(nextState, _curArgs);
|
||||
_curState = CreateState(nextState, _curArgs);
|
||||
|
||||
|
||||
EnumEventSystem.Global.Send(EventEnum.FixStateSwitch, nextState);
|
||||
yield return _curState.Enter();
|
||||
}
|
||||
@@ -46,7 +45,6 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
_curArgs = null;
|
||||
yield return _curState?.Exit();
|
||||
GameLoopManager.Instance?.UpdateFixState(FixState.Default, _curArgs);
|
||||
_curState = null;
|
||||
}
|
||||
|
||||
@@ -196,7 +194,6 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public IEnumerator Enter()
|
||||
{
|
||||
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
||||
// 先切BodyModule
|
||||
if (!CameraKit.Instance.EqualToCameraState(CameraEnum.BodyModule))
|
||||
{
|
||||
@@ -284,7 +281,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public IEnumerator Exit()
|
||||
{
|
||||
float duration = 0.5f;
|
||||
float duration = 0.5f;
|
||||
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
||||
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
||||
yield return MainUIController.Instance?.FadeInSync(duration);
|
||||
@@ -304,7 +301,6 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public IEnumerator Enter()
|
||||
{
|
||||
//float duration = 0.5f;
|
||||
@@ -317,10 +313,11 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
|
||||
//打开盖子
|
||||
SpriteRenderer sp= bodyModuleSystem.FindBodyModuleByName("Eye").transform.Find("Cover").GetComponent<SpriteRenderer>();
|
||||
sp.sprite=Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开A");
|
||||
SpriteRenderer sp = bodyModuleSystem.FindBodyModuleByName("Eye").transform.Find("Cover")
|
||||
.GetComponent<SpriteRenderer>();
|
||||
sp.sprite = Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开A");
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
sp.sprite=Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开B");
|
||||
sp.sprite = Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开B");
|
||||
// 插头回到初始插孔
|
||||
bodyModuleSystem.ResetPlug();
|
||||
// 切换相机
|
||||
@@ -340,12 +337,13 @@ namespace AibisDream.FixSystem
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.Eye);
|
||||
eyeSystem.OnExit();
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
yield return MainUIController.Instance.FadeOutSync(duration);
|
||||
yield return MainUIController.Instance?.FadeOutSync(duration);
|
||||
//关上
|
||||
SpriteRenderer sp= bodyModuleSystem.FindBodyModuleByName("Eye").transform.Find("Cover").GetComponent<SpriteRenderer>();
|
||||
sp.sprite=Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开A");
|
||||
SpriteRenderer sp = bodyModuleSystem.FindBodyModuleByName("Eye").transform.Find("Cover")
|
||||
.GetComponent<SpriteRenderer>();
|
||||
sp.sprite = Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子打开A");
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
sp.sprite=Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子关闭");
|
||||
sp.sprite = Resources.Load<Sprite>("Art/Fix/Peipei/Eye/视觉模块盖子关闭");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
public class FixSystemCenter : Singleton<FixSystemCenter>
|
||||
public class FixSystemCenter : Kit.Singleton<FixSystemCenter>
|
||||
{
|
||||
public FixState CurState => StateMachine.CurState;
|
||||
|
||||
private readonly FixSystemData _data = new();
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
@@ -14,6 +17,9 @@ namespace AibisDream.FixSystem
|
||||
// 初始化状态机
|
||||
StateMachine = new FixStateMachine();
|
||||
StartCoroutine(StateMachine.SwitchState(FixState.Clinic));
|
||||
|
||||
// 注册
|
||||
StorageSystem.Instance.RegisterData(_data);
|
||||
}
|
||||
|
||||
public override void OnSingletonDestroy()
|
||||
@@ -21,6 +27,9 @@ namespace AibisDream.FixSystem
|
||||
CameraKit.Instance.RemoveAllCam();
|
||||
GameLoopManager.Instance.StartCoroutine(StateMachine.QuitState());
|
||||
SystemDic.Clear();
|
||||
|
||||
// 注销
|
||||
StorageSystem.Instance.UnregisterData<FixSystemData>();
|
||||
}
|
||||
|
||||
#region 系统索引
|
||||
@@ -36,4 +45,22 @@ namespace AibisDream.FixSystem
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[LoadIndex(1)]
|
||||
public class FixSystemData : IData
|
||||
{
|
||||
private FixState _curState;
|
||||
|
||||
public FixState CurState
|
||||
{
|
||||
get => FixSystemCenter.Instance.CurState;
|
||||
set => _curState = value;
|
||||
}
|
||||
|
||||
public IEnumerator Load()
|
||||
{
|
||||
yield return FixSystemCenter.StateMachine.SwitchState(_curState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
@@ -55,7 +56,7 @@ namespace AibisDream.Kit
|
||||
private void RegisterData()
|
||||
{
|
||||
// 注册数据
|
||||
GameLoopManager.FixDataContainer.Register(_audioData);
|
||||
StorageSystem.Instance.RegisterData(_audioData);
|
||||
_audioData.LoadEvent += LoadData;
|
||||
}
|
||||
|
||||
@@ -337,9 +338,10 @@ namespace AibisDream.Kit
|
||||
|
||||
public event Action<AudioData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.Utility;
|
||||
@@ -25,7 +26,7 @@ namespace AibisDream.Framework
|
||||
|
||||
public interface IData
|
||||
{
|
||||
void Load();
|
||||
IEnumerator Load();
|
||||
}
|
||||
|
||||
#region IOC容器
|
||||
@@ -125,8 +126,9 @@ namespace AibisDream.Framework
|
||||
return JObject.FromObject(_instances);
|
||||
}
|
||||
|
||||
public void LoadByJson(JObject dataJson)
|
||||
public IEnumerator LoadByJson(JObject dataJson)
|
||||
{
|
||||
// 数据回填
|
||||
foreach (var fixDataItemPair in _instances)
|
||||
{
|
||||
if (!dataJson.TryGetValue(fixDataItemPair.Key, out var fixData))
|
||||
@@ -147,9 +149,14 @@ namespace AibisDream.Framework
|
||||
CommonUtil.CopyFields(tempObj, fixDataItemPair.Value);
|
||||
}
|
||||
|
||||
foreach (var data in _instances.Values)
|
||||
// 执行加载过程
|
||||
// 1. 先按照LoadIdx排序
|
||||
var orderedInsArray = _instances.Values.OrderBy(LoadIndex.GetLoadIdx);
|
||||
|
||||
// 2. 顺序加载,使用协程
|
||||
foreach (var data in orderedInsArray)
|
||||
{
|
||||
data.Load();
|
||||
yield return data.Load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace AibisDream
|
||||
public class GameLoopManager : Singleton<GameLoopManager>
|
||||
{
|
||||
private const int MaxSaveNum = 200;
|
||||
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
private static readonly string TestSaveFilePath = Application.streamingAssetsPath + "/TestSaveFiles";
|
||||
|
||||
#region 运行模式相关
|
||||
|
||||
[Header("可用so合集")] public TalkSceneSO[] totalSceneSos;
|
||||
@@ -30,10 +32,15 @@ namespace AibisDream
|
||||
|
||||
#endregion
|
||||
|
||||
private TalkSceneSO _currentTalkSceneSo;
|
||||
private BindProperty<TalkSceneSO> _currentTalkSceneSo;
|
||||
|
||||
private GameLoopData _data = new();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// 先注册
|
||||
Register();
|
||||
// 加载其他部分
|
||||
#if UNITY_EDITOR
|
||||
if (runMode == RunMode.SingleScene)
|
||||
{
|
||||
@@ -44,7 +51,7 @@ namespace AibisDream
|
||||
{
|
||||
// MainUIController.Instance.TVFadeOut(1);
|
||||
StartMenu.Instance.HideStartMenu();
|
||||
StartCoroutine(LoadSaveFile($"{TestSaveFilePath}/{saveFileName}"));
|
||||
LoadSaveFile($"{TestSaveFilePath}/{saveFileName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -56,6 +63,14 @@ namespace AibisDream
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Register()
|
||||
{
|
||||
// 数据类注册
|
||||
StorageSystem.Instance.RegisterData(_data);
|
||||
// 场景So事件注册
|
||||
_currentTalkSceneSo.Register(item => _data.curSceneSoName = item.name);
|
||||
}
|
||||
|
||||
private IEnumerator LoadClinicOut()
|
||||
{
|
||||
yield return SceneLoader.Instance.LoadSceneAsync("ClinicOut");
|
||||
@@ -64,47 +79,52 @@ namespace AibisDream
|
||||
|
||||
public void StartWithTalkSceneSO(TalkSceneSO sceneSO)
|
||||
{
|
||||
_currentTalkSceneSo = sceneSO;
|
||||
_currentTalkSceneSo.Value = sceneSO;
|
||||
StartCoroutine(LoadScene());
|
||||
}
|
||||
|
||||
public void StartWithSaveFile(string saveFileName)
|
||||
{
|
||||
StartMenu.Instance.HideStartMenu();
|
||||
StartCoroutine(LoadSaveFile(saveFileName));
|
||||
LoadSaveFile(saveFileName);
|
||||
}
|
||||
|
||||
private void LoadSaveFile(string savePath)
|
||||
{
|
||||
StorageSystem.Instance.Load(savePath);
|
||||
}
|
||||
|
||||
public void StartNewGame()
|
||||
{
|
||||
_currentTalkSceneSo = firstTalkSo;
|
||||
_currentTalkSceneSo.Value = firstTalkSo;
|
||||
StartCoroutine(LoadClinicScene());
|
||||
}
|
||||
|
||||
private void StartSingleSceneTest()
|
||||
{
|
||||
_currentTalkSceneSo = testTalkSo;
|
||||
_currentTalkSceneSo.Value = testTalkSo;
|
||||
StartCoroutine(LoadClinicScene());
|
||||
}
|
||||
|
||||
private IEnumerator LoadClinicScene()
|
||||
{
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(_currentTalkSceneSo.firstSceneName);
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(_currentTalkSceneSo.Value.firstSceneName);
|
||||
StartMenu.Instance.HideStartMenu();
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.yarnProject);
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.Value.yarnProject);
|
||||
}
|
||||
|
||||
private IEnumerator LoadScene()
|
||||
{
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(_currentTalkSceneSo.firstSceneName);
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(_currentTalkSceneSo.Value.firstSceneName);
|
||||
StartMenu.Instance.HideStartMenu();
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.yarnProject);
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.Value.yarnProject);
|
||||
}
|
||||
|
||||
public IEnumerator NextSceneSo()
|
||||
{
|
||||
if (_currentTalkSceneSo && _currentTalkSceneSo.nextScene)
|
||||
if (_currentTalkSceneSo.Value && _currentTalkSceneSo.Value.nextScene)
|
||||
{
|
||||
_currentTalkSceneSo = _currentTalkSceneSo.nextScene;
|
||||
_currentTalkSceneSo.Value = _currentTalkSceneSo.Value.nextScene;
|
||||
yield return MainUIController.Instance.FadeInSync(1);
|
||||
yield return LoadClinicScene();
|
||||
// yield return MainUIController.Instance.FadeOutSync(1);
|
||||
@@ -115,7 +135,17 @@ namespace AibisDream
|
||||
Debug.Log("没有下个场景了");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetSceneSoByName(string soName)
|
||||
{
|
||||
_currentTalkSceneSo.Value = Array.Find(totalSceneSos, so => so.name == soName);
|
||||
}
|
||||
|
||||
public void StartDialog()
|
||||
{
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.Value.yarnProject);
|
||||
}
|
||||
|
||||
#region 重新开始游戏功能
|
||||
|
||||
/// <summary>
|
||||
@@ -139,141 +169,6 @@ namespace AibisDream
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 存档相关
|
||||
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
private static readonly string TestSaveFilePath = Application.streamingAssetsPath + "/TestSaveFiles";
|
||||
|
||||
// 维修系统相关数据
|
||||
public static readonly DataContainer FixDataContainer = new();
|
||||
|
||||
// 对话变量存储
|
||||
private VariableStorageBehaviour _dialogStorage;
|
||||
|
||||
// 当前场景
|
||||
private string _curSceneKey;
|
||||
|
||||
// 状态机
|
||||
private string _fixStateArgs;
|
||||
private FixState _fixState;
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
_dialogStorage = FindObjectOfType<VariableStorageBehaviour>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前场景自行更新
|
||||
/// </summary>
|
||||
/// <param name="sceneName">当前scene</param>
|
||||
public void UpdateCurScene(string sceneName)
|
||||
{
|
||||
_curSceneKey = sceneName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态机状态更新
|
||||
/// </summary>
|
||||
/// <param name="curState"></param>
|
||||
/// <param name="curArgs"></param>
|
||||
public void UpdateFixState(FixState curState, string curArgs)
|
||||
{
|
||||
_fixState = curState;
|
||||
_fixStateArgs = curArgs;
|
||||
}
|
||||
|
||||
private IEnumerator LoadSaveFile(string savePath)
|
||||
{
|
||||
var saveFile = JsonUtil.ReadJObject(savePath);
|
||||
// 先加载对话数据
|
||||
var floatDict = saveFile["floatDict"]?.ToObject<Dictionary<string, float>>();
|
||||
var stringDict = saveFile["stringDict"]?.ToObject<Dictionary<string, string>>();
|
||||
var boolDict = saveFile["boolDict"]?.ToObject<Dictionary<string, bool>>();
|
||||
_dialogStorage.SetAllVariables(floatDict, stringDict, boolDict);
|
||||
|
||||
// 再加载场景
|
||||
_currentTalkSceneSo = Array.Find(totalSceneSos, so => so.name == saveFile["curTalkSceneSo"]?.ToString());
|
||||
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(saveFile["curSceneKey"]?.ToString());
|
||||
|
||||
if (saveFile["fixDataContainer"] is not JObject fixDataJson)
|
||||
{
|
||||
Debug.Log("维修数据读取问题");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// 场景加载完成之后把数据填回去
|
||||
FixDataContainer.LoadByJson(fixDataJson);
|
||||
// 初始化维修状态机
|
||||
_fixState = saveFile["fixState"]!.ToObject<FixState>();
|
||||
_fixStateArgs = saveFile["fixStateArgs"]!.ToString();
|
||||
yield return FixSystemCenter.StateMachine.SwitchState(_fixState, _fixStateArgs);
|
||||
|
||||
// 开启对话
|
||||
DialogController.Instance.LoadDialog(_currentTalkSceneSo.yarnProject);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
JObject saveFile = new JObject();
|
||||
|
||||
// 场景维修相关数据保存
|
||||
var fixData = FixDataContainer.SaveAsJson();
|
||||
saveFile["fixDataContainer"] = fixData;
|
||||
|
||||
// 保存对话变量
|
||||
var (floatDict, stringDict, boolDict) = _dialogStorage.GetAllVariables();
|
||||
saveFile["floatDict"] = JObject.FromObject(floatDict);
|
||||
saveFile["stringDict"] = JObject.FromObject(stringDict);
|
||||
saveFile["boolDict"] = JObject.FromObject(boolDict);
|
||||
|
||||
// 保存场景数据
|
||||
saveFile["curSceneKey"] = _curSceneKey;
|
||||
saveFile["curTalkSceneSo"] = _currentTalkSceneSo.name;
|
||||
|
||||
// 保存状态机数据
|
||||
saveFile["fixState"] = (int)_fixState;
|
||||
saveFile["fixStateArgs"] = _fixStateArgs;
|
||||
|
||||
// 存为Json
|
||||
JsonUtil.SaveJObject(saveFile, GetSavePath());
|
||||
#if !UNITY_EDITOR
|
||||
DeleteOldSave();
|
||||
#endif
|
||||
}
|
||||
|
||||
private string GetSavePath()
|
||||
{
|
||||
string gameStageStr;
|
||||
try
|
||||
{
|
||||
_dialogStorage.TryGetValue("$gameStage", out float gameStage);
|
||||
gameStageStr = gameStage.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_dialogStorage.TryGetValue("$gameStage", out string gameStage);
|
||||
gameStageStr = gameStage;
|
||||
}
|
||||
|
||||
return $"{SaveFilePath}/{DateTime.Now:yyyyMMdd_HHmmss}_{_currentTalkSceneSo.name}_{gameStageStr}";
|
||||
}
|
||||
|
||||
private void DeleteOldSave()
|
||||
{
|
||||
var fileList = Directory.GetFiles(SaveFilePath);
|
||||
if (fileList.Length > MaxSaveNum)
|
||||
{
|
||||
var sorted = fileList.OrderByDescending(f => f).ToArray();
|
||||
for (var i = MaxSaveNum; i < fileList.Length; i++)
|
||||
{
|
||||
File.Delete(sorted[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum RunMode
|
||||
@@ -288,7 +183,21 @@ namespace AibisDream
|
||||
[YarnCommand("auto_save")]
|
||||
public static void AutoSave()
|
||||
{
|
||||
GameLoopManager.Instance.Save();
|
||||
StorageSystem.Instance.Save();
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[LoadIndex(10)]
|
||||
public class GameLoopData : IData
|
||||
{
|
||||
public string curSceneSoName;
|
||||
|
||||
public IEnumerator Load()
|
||||
{
|
||||
GameLoopManager.Instance.SetSceneSoByName(curSceneSoName);
|
||||
GameLoopManager.Instance.StartDialog();
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class LoadIndex : Attribute
|
||||
{
|
||||
private int Idx { get; }
|
||||
|
||||
public LoadIndex(int idx)
|
||||
{
|
||||
Idx = idx;
|
||||
}
|
||||
|
||||
public static int GetLoadIdx<T>(T instance)
|
||||
{
|
||||
// 先通过反射拿到属性
|
||||
var attribute = instance.GetType().GetCustomAttribute<LoadIndex>();
|
||||
return attribute?.Idx ?? 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb1d63c733941879217082bda086ade
|
||||
timeCreated: 1742905792
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
@@ -10,25 +11,16 @@ namespace AibisDream
|
||||
public class SceneLoader : Singleton<SceneLoader>
|
||||
{
|
||||
#region 场景转换参数
|
||||
|
||||
private BindProperty<string> _currentScene;
|
||||
|
||||
private AsyncOperationHandle _loadHandle;
|
||||
private string _sceneToLoad;
|
||||
private bool _isLoading;
|
||||
|
||||
private readonly SceneData _data = new();
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
_currentScene = new BindProperty<string>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_currentScene.Register(GameLoopManager.Instance.UpdateCurScene);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_currentScene.RemoveAll();
|
||||
StorageSystem.Instance.RegisterData(_data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +50,7 @@ namespace AibisDream
|
||||
// 场景转换参数
|
||||
_isLoading = true;
|
||||
_sceneToLoad = targetScene;
|
||||
if (!string.IsNullOrEmpty(_currentScene.Value))
|
||||
if (!string.IsNullOrEmpty(_data.sceneName))
|
||||
{
|
||||
yield return Addressables.UnloadSceneAsync(_loadHandle);
|
||||
}
|
||||
@@ -67,7 +59,7 @@ namespace AibisDream
|
||||
yield return _loadHandle;
|
||||
|
||||
EnumEventSystem.Global.Send(EventEnum.SceneLoad, _sceneToLoad);
|
||||
_currentScene.Value = _sceneToLoad;
|
||||
_data.sceneName = _sceneToLoad;
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +77,7 @@ namespace AibisDream
|
||||
if (_loadHandle.IsValid())
|
||||
{
|
||||
yield return Addressables.UnloadSceneAsync(_loadHandle);
|
||||
_currentScene.Value = null;
|
||||
_data.sceneName = null;
|
||||
EnumEventSystem.Global.Send(EventEnum.SceneUnload);
|
||||
}
|
||||
|
||||
@@ -93,4 +85,16 @@ namespace AibisDream
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[LoadIndex(0)]
|
||||
public class SceneData : IData
|
||||
{
|
||||
public string sceneName;
|
||||
|
||||
public IEnumerator Load()
|
||||
{
|
||||
yield return SceneLoader.Instance.LoadSceneAsync(sceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,9 +232,23 @@ namespace AibisDream
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Load()
|
||||
public void Load(string savePath)
|
||||
{
|
||||
// 先将存档文件转为JObject
|
||||
var saveData = JsonUtil.ReadJObject(savePath);
|
||||
// 加载Yarn数据
|
||||
var floatDict = saveData["floatDict"]?.ToObject<Dictionary<string, float>>();
|
||||
var stringDict = saveData["stringDict"]?.ToObject<Dictionary<string, string>>();
|
||||
var boolDict = saveData["boolDict"]?.ToObject<Dictionary<string, bool>>();
|
||||
SetAllVariables(floatDict, stringDict, boolDict);
|
||||
|
||||
// 加载系统数据
|
||||
if (saveData["systemData"] is not JObject systemDataJson)
|
||||
{
|
||||
Debug.Log("维修数据读取问题");
|
||||
return;
|
||||
}
|
||||
StartCoroutine(_dataContainer.LoadByJson(systemDataJson));
|
||||
}
|
||||
|
||||
private string GetSavePath()
|
||||
@@ -276,6 +290,22 @@ namespace AibisDream
|
||||
|
||||
return VariableType.Local;
|
||||
}
|
||||
|
||||
#region 单例部分
|
||||
|
||||
public static StorageSystem Instance { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum VariableType
|
||||
|
||||
@@ -39,7 +39,7 @@ public class EyeSystem : MonoBehaviour
|
||||
var virtualCamDeep = transform.Find("Eye DeepCamera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Eye, virtualCam);
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.EyeDeep, virtualCamDeep);
|
||||
GameLoopManager.FixDataContainer.Register(_eyeData);
|
||||
StorageSystem.Instance.RegisterData(_eyeData);
|
||||
// 添加加载逻辑
|
||||
_eyeData.LoadEvent += LoadData;
|
||||
}
|
||||
@@ -446,8 +446,9 @@ public class EyeData : IData
|
||||
public EyeColorState currentState = EyeColorState.CannotImagineColor;
|
||||
public event Action<EyeData> LoadEvent;
|
||||
|
||||
public void Load()
|
||||
public IEnumerator Load()
|
||||
{
|
||||
LoadEvent?.Invoke(this);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user