添加常用的插件和代码

This commit is contained in:
yangjing 2022-01-26 15:46:33 +08:00
parent a79d0736e6
commit 175fcf9624
1041 changed files with 100710 additions and 156 deletions

View File

@ -0,0 +1,318 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5195663043837274135
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5195663043837274130}
- component: {fileID: 5195663043837274129}
- component: {fileID: 5195663043837274128}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5195663043837274130
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663043837274135}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10240}
m_LocalScale: {x: 113.77778, y: 113.77778, z: 113.77778}
m_Children: []
m_Father: {fileID: 5195663044295154642}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5195663043837274129
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663043837274135}
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!114 &5195663043837274128
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663043837274135}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!1 &5195663044226207331
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5195663044226207340}
m_Layer: 5
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5195663044226207340
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044226207331}
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_Children: []
m_Father: {fileID: 5195663044295154642}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &5195663044295154646
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5195663044295154642}
- component: {fileID: 5195663044295154641}
- component: {fileID: 5195663044295154640}
- component: {fileID: 5195663044295154647}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5195663044295154642
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044295154646}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 5195663043837274130}
- {fileID: 5195663044226207340}
m_Father: {fileID: 5195663044779228676}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &5195663044295154641
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044295154646}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 5195663044821397915}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &5195663044295154640
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044295154646}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 640, y: 1120}
m_ScreenMatchMode: 1
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &5195663044295154647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044295154646}
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!1 &5195663044779228731
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5195663044779228676}
m_Layer: 0
m_Name: SceneRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5195663044779228676
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044779228731}
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_Children:
- {fileID: 5195663044821397860}
- {fileID: 5195663044295154642}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5195663044821397912
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5195663044821397860}
- component: {fileID: 5195663044821397915}
- component: {fileID: 5195663044821397913}
m_Layer: 0
m_Name: UICam
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5195663044821397860
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044821397912}
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_Children: []
m_Father: {fileID: 5195663044779228676}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &5195663044821397915
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044821397912}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
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: 0
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 0
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &5195663044821397913
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5195663044821397912}
m_Enabled: 1

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0d493612b52c641639174d49a4b1d0b1
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -121,6 +121,38 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &493959135
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 493959136}
m_Layer: 0
m_Name: SceneRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &493959136
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 493959135}
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_Children:
- {fileID: 519420032}
- {fileID: 1041748534}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@ -133,7 +165,7 @@ GameObject:
- component: {fileID: 519420031}
- component: {fileID: 519420029}
m_Layer: 0
m_Name: Main Camera
m_Name: UICam
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -157,7 +189,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
@ -197,13 +229,48 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
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_Children: []
m_Father: {fileID: 0}
m_Father: {fileID: 493959136}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &981190535
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 981190536}
m_Layer: 5
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &981190536
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 981190535}
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_Children: []
m_Father: {fileID: 1041748534}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1041748530
GameObject:
m_ObjectHideFlags: 0
@ -294,8 +361,9 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1829594260}
m_Father: {fileID: 0}
- {fileID: 1162486262}
- {fileID: 981190536}
m_Father: {fileID: 493959136}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -362,154 +430,10 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1162486259}
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_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10240}
m_LocalScale: {x: 113.77778, y: 113.77778, z: 113.77778}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_Father: {fileID: 1041748534}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1409168459
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1041748534}
m_Modifications:
- target: {fileID: 1031543550377437056, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_Name
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c69c62a08854f8b4792878b1f3ce7463, type: 3}
--- !u!1 &1829594259 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1031543550377437056, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
m_PrefabInstance: {fileID: 1409168459}
m_PrefabAsset: {fileID: 0}
--- !u!224 &1829594260 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 1031543550377437057, guid: c69c62a08854f8b4792878b1f3ce7463,
type: 3}
m_PrefabInstance: {fileID: 1409168459}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1829594261
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1829594259}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 39668ad64220a4c15ade9d53c9fe33db, type: 3}
m_Name:
m_EditorClassIdentifier:
StateName:

206
Assets/Scenes/Init.unity Normal file
View File

@ -0,0 +1,206 @@
%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: 11
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_UseShadowmask: 1
--- !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
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!81 &9193662541828971636
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9193662541828971637}
m_Enabled: 1
--- !u!1 &9193662541828971637
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9193662541828971657}
- component: {fileID: 9193662541828971638}
- component: {fileID: 9193662541828971636}
m_Layer: 0
m_Name: MainCamera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!20 &9193662541828971638
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9193662541828971637}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
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: 0
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 0
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &9193662541828971657
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9193662541828971637}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3843edec69a01407ba47adf3b0facef3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

886
Assets/Scenes/Main.unity Normal file
View File

@ -0,0 +1,886 @@
%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: 11
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_UseShadowmask: 1
--- !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
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &95334916
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 95334917}
- component: {fileID: 95334919}
- component: {fileID: 95334918}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &95334917
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95334916}
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_Children: []
m_Father: {fileID: 1721972075}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 50}
m_SizeDelta: {x: 551, y: 452}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &95334918
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95334916}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: f22b88cc81e0d43d39b89f6acd039e50, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &95334919
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95334916}
m_CullTransparentMesh: 0
--- !u!1 &454570507
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 454570508}
- component: {fileID: 454570510}
- component: {fileID: 454570509}
m_Layer: 5
m_Name: BG
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &454570508
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 454570507}
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_Children: []
m_Father: {fileID: 1721972075}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 880, y: 1420}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &454570509
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 454570507}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 4df75588a5cc94744b3fb37ca235eba6, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &454570510
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 454570507}
m_CullTransparentMesh: 0
--- !u!1 &889647017
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 889647018}
- component: {fileID: 889647020}
- component: {fileID: 889647019}
m_Layer: 5
m_Name: 0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &889647018
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 889647017}
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_Children: []
m_Father: {fileID: 1859672522}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -25, y: 0}
m_SizeDelta: {x: 123, y: 43}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &889647019
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 889647017}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 4332d22ed17ff4b3ba2af51470bd50e3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &889647020
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 889647017}
m_CullTransparentMesh: 0
--- !u!1 &1516804356
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1516804357}
- component: {fileID: 1516804359}
- component: {fileID: 1516804358}
m_Layer: 5
m_Name: 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1516804357
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1516804356}
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_Children: []
m_Father: {fileID: 1859672522}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 50, y: 0}
m_SizeDelta: {x: 39, y: 43}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1516804358
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1516804356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: e16cd3c57d4c549f3adaca77741cd492, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1516804359
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1516804356}
m_CullTransparentMesh: 0
--- !u!1 &1721972074
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1721972075}
m_Layer: 5
m_Name: FirstOpen
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1721972075
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1721972074}
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_Children:
- {fileID: 454570508}
- {fileID: 95334917}
- {fileID: 1859672522}
m_Father: {fileID: 3333527423099584207}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1859672521
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1859672522}
m_Layer: 5
m_Name: Word
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1859672522
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1859672521}
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_Children:
- {fileID: 889647018}
- {fileID: 1984246097}
- {fileID: 1516804357}
m_Father: {fileID: 1721972075}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -238.84}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1984246096
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1984246097}
- component: {fileID: 1984246099}
- component: {fileID: 1984246098}
m_Layer: 5
m_Name: 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1984246097
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1984246096}
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_Children: []
m_Father: {fileID: 1859672522}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 13, y: -1}
m_SizeDelta: {x: 39, y: 43}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1984246098
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1984246096}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: b20e71bd016bf44c4bd47aa67d6d1ebd, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1984246099
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1984246096}
m_CullTransparentMesh: 0
--- !u!224 &3333527423029586801
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423029586805}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 3333527424761485489}
- {fileID: 3333527423099584207}
m_Father: {fileID: 3333527423551884967}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &3333527423029586802
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423029586805}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 3333527423560040760}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &3333527423029586803
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423029586805}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 640, y: 1120}
m_ScreenMatchMode: 1
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &3333527423029586804
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423029586805}
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!1 &3333527423029586805
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3333527423029586801}
- component: {fileID: 3333527423029586802}
- component: {fileID: 3333527423029586803}
- component: {fileID: 3333527423029586804}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &3333527423099584192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3333527423099584207}
m_Layer: 5
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3333527423099584207
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423099584192}
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_Children:
- {fileID: 1721972075}
m_Father: {fileID: 3333527423029586801}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3333527423551884952
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3333527423551884967}
m_Layer: 0
m_Name: SceneRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3333527423551884967
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423551884952}
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_Children:
- {fileID: 3333527423560040903}
- {fileID: 3333527423029586801}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &3333527423560040760
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423560040763}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
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: 0
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 0
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &3333527423560040762
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423560040763}
m_Enabled: 1
--- !u!1 &3333527423560040763
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3333527423560040903}
- component: {fileID: 3333527423560040760}
- component: {fileID: 3333527423560040762}
m_Layer: 0
m_Name: UICam
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3333527423560040903
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527423560040763}
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_Children: []
m_Father: {fileID: 3333527423551884967}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &3333527424761485489
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527424761485492}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10240}
m_LocalScale: {x: 113.77778, y: 113.77778, z: 113.77778}
m_Children: []
m_Father: {fileID: 3333527423029586801}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3333527424761485490
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527424761485492}
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!114 &3333527424761485491
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3333527424761485492}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!1 &3333527424761485492
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3333527424761485489}
- component: {fileID: 3333527424761485490}
- component: {fileID: 3333527424761485491}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9aed4bd121efa4a9b941cacbf79df6dd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Core.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d3c8a5e9ddd4f42daa3590c789f0ac30
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : S_MonoSingleton<AudioManager>
{
[SerializeField] AudioListener mAudioListener;
[SerializeField] AudioSource mMusicPlayer;
[SerializeField] AudioSource mSoundPlayer;
public SoundPack[] soundPacks;
private Dictionary<SoundType, List<AudioClip>> mSoundDic = new Dictionary<SoundType, List<AudioClip>>();
private bool mIsSoundOn = true;
protected override void Initialize()
{
for (int i = 0; i < soundPacks.Length; i++)
{
SoundPack tPack = soundPacks[i];
if (!mSoundDic.ContainsKey(tPack.myType))
{
mSoundDic[tPack.myType] = new List<AudioClip>();
}
mSoundDic[tPack.myType] = tPack.myClips;
}
CheckAudioListner();
CheckMusicPlayer();
CheckSoundPlayer();
}
//private void Update()
//{
// if (AudioListener.pause && mIsSoundOn)
// {
// AudioListener.pause = false;
// }
// else if (!AudioListener.pause && !mIsSoundOn)
// {
// AudioListener.pause = true;
// }
//}
public void SetSoundOn(bool pIsOn)
{
mIsSoundOn = pIsOn;
AudioListener.pause = !pIsOn;
}
public void PlayBGMusic(SoundType pType, float pVolumeScale = 1)
{
if (!mIsSoundOn)
return;
CheckMusicPlayer();
AudioClip tClip = GetClip(pType);
if (tClip == null)
return;
mMusicPlayer.clip = tClip;
mMusicPlayer.loop = true;
mMusicPlayer.volume *= pVolumeScale;
mMusicPlayer.Play();
}
public void StopBGMusic()
{
CheckMusicPlayer();
mMusicPlayer.Stop();
mMusicPlayer.clip = null;
}
public void PlaySound(SoundType pType, float pVolumeScale = 1)
{
if (!mIsSoundOn)
return;
CheckSoundPlayer();
AudioClip tClip = GetClip(pType);
if (tClip == null)
return;
mSoundPlayer.PlayOneShot(tClip, pVolumeScale);
}
public AudioSource PlaySoundLoop(SoundType pType, float pVolumeScale = 1)
{
if (!mIsSoundOn)
return null;
AudioClip tClip = GetClip(pType);
if (tClip == null)
return null;
AudioSource tLoopAudio = gameObject.AddComponent<AudioSource>();
tLoopAudio.clip = tClip;
tLoopAudio.loop = true;
tLoopAudio.volume *= pVolumeScale;
tLoopAudio.Play();
return tLoopAudio;
}
public void StopSoundLoop(AudioSource pAudioSrc)
{
if (pAudioSrc == null)
return;
pAudioSrc.Stop();
Destroy(pAudioSrc);
}
public void PlaySound3D(AudioSource pAudioSrc, SoundType pType)
{
if (!mIsSoundOn)
return;
AudioClip tClip = GetClip(pType);
if (tClip == null)
return;
pAudioSrc.PlayOneShot(tClip);
}
private AudioClip GetClip(SoundType pType)
{
if (!mSoundDic.ContainsKey(pType) || mSoundDic[pType].Count == 0)
return null;
List<AudioClip> tClips = mSoundDic[pType];
int tRandomPlayIndex = UnityEngine.Random.Range(0, tClips.Count);
return tClips[tRandomPlayIndex];
}
private void CheckAudioListner()
{
if (mAudioListener == null)
mAudioListener = gameObject.AddComponent<AudioListener>();
}
private void CheckMusicPlayer()
{
if (mMusicPlayer == null)
mMusicPlayer = gameObject.AddComponent<AudioSource>();
}
private void CheckSoundPlayer()
{
if (mSoundPlayer == null)
mSoundPlayer = gameObject.AddComponent<AudioSource>();
}
}
[Serializable]
public class SoundPack
{
public SoundType myType;
public List<AudioClip> myClips;
}
public enum SoundType
{
None = -1,
Kick_Normal,
Kick_Door,
Enemy_Die,
Crumble_Wood,
Crumble_Pot,
Crumble_Wall,
Fall_Water,
Bomb_Explode
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1bdd22e611e6942489e40ead15305a34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using UnityEngine;
public class ConfigBase<T> : ScriptableObject where T :ScriptableObject
{
private static T mInstance;
public static T Instance
{
get
{
if (mInstance == null)
{
mInstance = Resources.Load<T>(typeof(T).ToString());
}
return mInstance;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 370d3746318754708915f9f5701c3f55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

120
Assets/Scripts/Core/FSM.cs Normal file
View File

@ -0,0 +1,120 @@
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FSM<T>
{
public string CurrentState => mCurrentState != null ? mCurrentState.GetType().ToString() : "";
private Dictionary<Type, BaseState<T>> mStateDic;
private T mMaster;
private BaseState<T> mCurrentState;
private bool mActive;
public FSM(T pMaster)
{
mMaster = pMaster;
mStateDic = new Dictionary<Type, BaseState<T>>();
mActive = true;
}
public void ChangeState(Type pStateType = null)
{
if (pStateType == null)//change to empty
{
if (mCurrentState != null)
mCurrentState.ExitState(null);
mCurrentState = null;
return;
}
BaseState<T> tNextState = null;
if (pStateType != null)
{
if (!mStateDic.ContainsKey(pStateType))
{
object tInstance = pStateType.Assembly.CreateInstance(pStateType.Name);
if (tInstance is BaseState<T>)
{
tNextState = tInstance as BaseState<T>;
tNextState.SetFSM(this);
tNextState.SetMaster(mMaster);
mStateDic.Add(pStateType, tNextState);
}
else
{
Debug.LogError("State Class : " + pStateType.Name + " is not a " + typeof(BaseState<T>).Name + "!");
}
}
else
{
tNextState = mStateDic[pStateType];
}
}
else
{
Debug.LogError("State Class : " + pStateType.Name + " is not found!");
}
if (tNextState != null && tNextState != mCurrentState)
{
if (mCurrentState != null)
mCurrentState.ExitState(tNextState.GetType());
tNextState.EnterState(mCurrentState?.GetType());
mCurrentState = tNextState;
}
}
public void Execute(float pDeltaTime)
{
if (!mActive)
return;
if (mCurrentState != null)
mCurrentState.ExecuteState(pDeltaTime);
}
public void SetActive(bool pActive)
{
mActive = pActive;
}
}
public class BaseState<T>
{
protected T mMaster;
protected FSM<T> mFSM;
public void SetFSM(FSM<T> pFSM)
{
mFSM = pFSM;
}
public void SetMaster(T pMaster)
{
mMaster = pMaster;
}
public virtual void EnterState(Type pLastState)
{
}
public virtual void ExitState(Type pNextState)
{
}
public virtual void ExecuteState(float pDeltaTime)
{
}
protected void ChangeState(Type pType)
{
mFSM.ChangeState(pType);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d858d9a53d0f346a7a673bb5ac4ba34f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b568d348fbfb46de8b3383cc727ffab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using LangSprite = LanguageConfig.LangSprite;
public class LangImage : MonoBehaviour
{
public bool FitSize = false;
[SerializeField] LangSprite[] mLangSprites;
private void Start()
{
Image tMyImage = GetComponent<Image>();
for (int i = 0; i < mLangSprites.Length; i++)
{
if (mLangSprites[i].LangType == LanguageConfig.Instance.LangType)
{
tMyImage.sprite = mLangSprites[i].LSprite;
}
}
if (FitSize)
{
tMyImage.SetNativeSize();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28761ee1a4f9445fba25f3fc4617b6c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Text))]
public class LangText : MonoBehaviour
{
public string Key;
private void Start()
{
Text tMyTxt = GetComponent<Text>();
tMyTxt.text = LanguageConfig.Instance.GetText(Key);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b0dfd162879d480b9a75ca842285e78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "LanguageConfig")]
public class LanguageConfig : ConfigBase<LanguageConfig>
{
public bool IsDebug = false;
[SerializeField] LanguageType DebugLang = LanguageType.Chinese;
[SerializeField] LanguageType DefaultLang = LanguageType.English;
[SerializeField] List<LanguageItem> Items;
public LanguageType LangType
{
get
{
if (IsDebug)
{
return DebugLang;
}
LanguageType tLangType = DefaultLang;
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{
tLangType = LanguageType.Chinese;
}
else if (Application.systemLanguage == SystemLanguage.Japanese)
{
tLangType = LanguageType.Japanese;
}
return tLangType;
}
}
public string GetText(string pKey)
{
LanguageItem tItem = Items.Find((pItem) => pItem.Key.Equals(pKey));
if (tItem != null)
{
return tItem.GetString(LangType);
}
return pKey;
}
[Serializable]
class LanguageItem
{
public string Key;
public LangString[] LangStrs;
public string GetString(LanguageType pLangType)
{
for (int i = 0; i < LangStrs.Length; i++)
{
if (LangStrs[i].LangType == pLangType)
return LangStrs[i].LString;
}
return Key;
}
}
[Serializable]
public class LangString
{
public LanguageType LangType;
public string LString;
}
[Serializable]
public class LangSprite
{
public LanguageType LangType;
public Sprite LSprite;
}
public enum LanguageType
{
Chinese = 0,
English,
Japanese
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa83530e0295a44b6adac1a7d3528d0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
using UnityEngine;
/// <summary>
/// 动态(Dynamic)
/// </summary>
public abstract class D_MonoSingleton<T> : MonoBehaviour where T : D_MonoSingleton<T>
{
private static T _instance = null;
public static T Instance
{
get {
if (_instance == null)
{
GameObject go = new GameObject();
DontDestroyOnLoad(go);
go.name = "MonoSingleton:" + typeof(T).ToString();
go.transform.localPosition = Vector3.zero;
go.transform.localEulerAngles = Vector3.zero;
go.transform.localScale = Vector3.one;
_instance = go.AddComponent<T>();
}
return _instance;
}
}
private void Awake()
{
Initialize();
}
protected virtual void Initialize()
{
}
private void OnDestroy()
{
_instance = null;
}
}
/// <summary>
/// 静态(static)
/// </summary>
public abstract class S_MonoSingleton<T> : MonoBehaviour where T : S_MonoSingleton<T>
{
private static T _instance = null;
public static T Instance
{
get
{
return _instance;
}
}
private void Awake()
{
if (_instance != null && _instance != (T)this)
{
Destroy (gameObject);
return;
}
_instance = (T)this;
Initialize ();
}
protected virtual void Initialize()
{
}
private void OnDestroy()
{
_instance = null;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b55be31c955f0418e8bfd76f3cd05048
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
using System.Runtime.CompilerServices;
using UnityEngine;
using System;
using System.Runtime.InteropServices;
using AOT;
public static class NativeTool
{
private static Action<bool> mShareResultDel;
public static void Shake(int pType, float pIntensity)//0 light,1 medium,2 heavy
{
#if UNITY_EDITOR
//Debug.Log($"Shake {pType} with intensity {pIntensity}");
#elif UNITY_IOS
mShake(pType, pIntensity);
#elif UNITY_ANDROID
mShake(pType * pType * 20 + (int)(pIntensity * (pType + 1) * 10));
#endif
}
public static void Share(string pTitle, string pUrl, Action<bool> pResultDel)
{
mShareResultDel = pResultDel;
#if UNITY_EDITOR
mShareResultDel?.Invoke(true);
#elif UNITY_IOS
mShare(pTitle, pUrl, onShareCallback);
#elif UNITY_ANDROID
mShare(pTitle, pUrl);
#endif
}
#if UNITY_IOS
[DllImport("__Internal")]
private static extern void mShake(int pType, float pIntensity);
[DllImport("__Internal")]
private static extern void mShare(string pTitle, string pUrl, BoolResultDelegate pResultCallback);
internal delegate void BoolResultDelegate(bool pResult);
[MonoPInvokeCallback(typeof(BoolResultDelegate))]
private static void onShareCallback(bool pResult)
{
mShareResultDel?.Invoke(pResult);
}
#endif
#if UNITY_ANDROID
private static AndroidJavaClass javaObj = new AndroidJavaClass("com.toukagames.NativeTool");
private static AndroidJavaObject mInstance = null;
private static void mShake(long mMilliSeconds)
{
if (mInstance == null)
mInstance = javaObj.CallStatic<AndroidJavaObject>("GetInstance");
mInstance.Call("Shake", mMilliSeconds);
}
private static void mShare(string pTitle, string pUrl)
{
if (mInstance == null)
mInstance = javaObj.CallStatic<AndroidJavaObject>("GetInstance");
mInstance.Call("Share", pUrl);
mShareResultDel?.Invoke(true);
}
#endif
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d99a7aebbcc31432bb339002134c4d40
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UObject = UnityEngine.Object;
public class ResourceManager : D_MonoSingleton<ResourceManager>
{
private Dictionary<string, UObject> mResDic = new Dictionary<string, UObject>();
public T LoadRes<T>(string pPath) where T : UObject
{
if (!mResDic.ContainsKey(pPath))
{
mResDic[pPath] = Resources.Load<T>(pPath);
}
return mResDic[pPath] as T;
}
internal GameObject LoadResource(string v)
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 98385bb2db6d5439fbecd7fabd2c51fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,65 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StorageBase<T> where T : StorageBase<T>,new ()
{
private static T mInstance;
public static T Instance
{
get
{
if (mInstance == null)
{
Load();
}
return mInstance;
}
}
protected virtual void InitFirstDefault()
{
}
protected virtual void InitBuildDefault()
{
}
public static void Load()
{
if (ES3.FileExists() && ES3.KeyExists(typeof(T).Name))
{
mInstance = ES3.Load<T>(typeof(T).Name);
}
else
{
mInstance = new T();
string tFirstDefaultKey = "FirstDefault_" + typeof(T).Name;
if (PlayerPrefs.GetInt(tFirstDefaultKey, 0) != 1)
{
PlayerPrefs.SetInt(tFirstDefaultKey, 1);
mInstance.InitFirstDefault();
}
}
string tBuildDefaultKey = "BuildDefault_" + typeof(T).Name + Application.buildGUID;
if (PlayerPrefs.GetInt(tBuildDefaultKey, 0) != 1)
{
PlayerPrefs.SetInt(tBuildDefaultKey, 1);
mInstance.InitBuildDefault();
}
Save();
}
public static void Save()
{
ES3.Save<T>(typeof(T).Name, mInstance);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c90fab9da08a8424fb2de4f64c1bbdd2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 61de45916d3b748258a9ea610c9d584c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimerManager : D_MonoSingleton<TimerManager>
{
[SerializeField] int _TimerCount;
private List<TimerUnit> mTimerList;
private List<TimerUnit> mDestroyList;
protected override void Initialize()
{
base.Initialize();
mTimerList = new List<TimerUnit>();
mDestroyList = new List<TimerUnit>();
}
private void Update()
{
_TimerCount = mTimerList.Count;
if (mTimerList.Count > 0)
{
for (int i = 0; i < mTimerList.Count; i++)
{
if (mTimerList[i].IsAvailable)
{
mTimerList[i].Update(Time.deltaTime, Time.unscaledDeltaTime);
}
else
{
mDestroyList.Add(mTimerList[i]);
}
}
if (mDestroyList.Count > 0)
{
for (int i = 0; i < mDestroyList.Count; i++)
{
mTimerList.Remove(mDestroyList[i]);
}
mDestroyList.Clear();
}
}
}
public TimerUnit CreateTimerUnit()
{
TimerUnit tUnit = new TimerUnit();
mTimerList.Add(tUnit);
return tUnit;
}
public void Schedule(Action pDelDone, float pSeconds, int pCount = 1, bool pIgnoreTimeScale = false)
{
TimerUnit tUnit = CreateTimerUnit();
tUnit.StartTimer(pDelDone, pSeconds, pCount, pIgnoreTimeScale, true);
}
public void DestroyTimerUnit(TimerUnit pUnit)
{
pUnit.Destroy();
}
public void ClearAll()
{
foreach (TimerUnit tUnit in mTimerList)
{
tUnit.Destroy();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 78a04fd9ba3054c08b112b9aeaec2414
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,103 @@
using System;
public class TimerUnit
{
public bool IsRunning => mStarted;
public bool IsAvailable => !mDestroyed;
private Action mDelDone;
private bool mStarted = false;
private bool mDestroyed = false;
private float mTotalTime;
private float mTimeCounter = -1;
private int mCount = 0;
private bool mIgnoreTimeScale = false;
private bool mAutoDestroy = false;
public void Update(float pDeltaTime, float pUnscaledDeltaTime)
{
if (mStarted)
{
if (mTimeCounter > 0)
{
mTimeCounter -= mIgnoreTimeScale ? pUnscaledDeltaTime : pDeltaTime;
if (mTimeCounter <= 0)
{
Done();
}
}
}
}
public void StartTimer(Action pDelDone, float pSeconds, int pCount = 1, bool pIgnoreTimeScale = false, bool pAutoDestroy = false)
{
mDelDone = pDelDone;
mTotalTime = pSeconds;
mCount = pCount;
mIgnoreTimeScale = pIgnoreTimeScale;
mAutoDestroy = pAutoDestroy;
if (pSeconds <= 0)
{
Done();
}
else
{
ExecuteOnce();
}
}
public void CancelTimer()
{
mStarted = false;
mTotalTime = 0;
mTimeCounter = -1;
mDelDone = null;
}
public void ResetTimeDelta(float pSeconds)
{
mTotalTime = pSeconds;
}
public void ReUse()
{
mDestroyed = false;
}
public void Destroy()
{
mStarted = false;
mDestroyed = true;
}
private void ExecuteOnce()
{
mStarted = true;
mTimeCounter = mTotalTime;
}
private void Done()
{
mStarted = false;
mDelDone?.Invoke();
mCount--;
if (mCount > 0)
{
ExecuteOnce();
}
else
{
if (mAutoDestroy)
{
Destroy();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f71fb0bbf4a494f45bb8db12772c9f11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c3226d76f0fe9475bb55baffa06ae6b0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BasePanel : MonoBehaviour
{
public bool IsOpened => gameObject.activeSelf;
public void Open()
{
gameObject.SetActive(true);
OnOpen();
}
protected virtual void OnOpen()
{
}
public void Close()
{
gameObject.SetActive(false);
OnClose();
}
protected virtual void OnClose()
{
}
public void Focus(bool pFocus)
{
OnFocus(pFocus);
}
protected virtual void OnFocus(bool pFocus)
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95da4430b60104f58bd8c0801f23b547
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,146 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class UIManager : S_MonoSingleton<UIManager>
{
public bool IsUICovered
{
get
{
return mUIList.Count > 0;
}
}
public Canvas UICanvas
{
get
{
if (mUICanvas == null)
{
mUICanvas = GetComponent<Canvas>();
}
return mUICanvas;
}
}
public Camera UICamera
{
get
{
if (mUICamera == null)
{
mUICamera = UICanvas.worldCamera;
}
return mUICamera;
}
}
private Canvas mUICanvas;
private Camera mUICamera;
private Dictionary<Type, BasePanel> mUIDic = new Dictionary<Type, BasePanel>();
private List<BasePanel> mUIList = new List<BasePanel>();
public T OpenUI<T>() where T : BasePanel
{
T tUI = GetUI<T>();
tUI.Open();
if (mUIList.Contains(tUI))
{
mUIList.Remove(tUI);
}
if (mUIList.Count > 0)
{
mUIList[mUIList.Count - 1].Focus(false);
}
mUIList.Add(tUI);
return tUI;
}
public T CloseUI<T>() where T : BasePanel
{
T tUI = GetUI<T>();
tUI.Close();
int tIndex = mUIList.IndexOf(tUI);
if (tIndex == mUIList.Count - 1)
{
mUIList.Remove(tUI);
if (mUIList.Count > 0)
{
mUIList[mUIList.Count - 1].Focus(true);
}
}
else
{
mUIList.Remove(tUI);
}
return tUI;
}
public T GetUI<T>() where T : BasePanel
{
T tUI = null;
if (!mUIDic.ContainsKey(typeof(T)))
{
mUIDic[typeof(T)] = GetComponentInChildren<T>(true);
}
tUI = mUIDic[typeof(T)] as T;
return tUI;
}
public void ShowTip(string pTip)
{
}
public static bool IsTouchUI()
{
if (EventSystem.current != null)
{
PointerEventData eventData = new PointerEventData(EventSystem.current);
eventData.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(eventData, results);
if (results == null || results.Count == 0)
{
return false;
}
return results.Count > 0 && results[0].gameObject.layer == 5;
}
return false;
}
public static List<GameObject> GetChildGobList(Transform pParent)
{
List<GameObject> tList = new List<GameObject>();
for (int i = 0; i < pParent.childCount; i++)
{
tList.Add(pParent.GetChild(i).gameObject);
}
return tList;
}
public static List<T> GetChildList<T>(Transform pParent)
{
List<T> tList = new List<T>();
for (int i = 0; i < pParent.childCount; i++)
{
tList.Add(pParent.GetChild(i).GetComponent<T>());
}
return tList;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5a7353a4fbe34fde8272bf21e0b8bc2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VibrateManager
{
private static VibrateManager mInstance;
public static VibrateManager Instance
{
get
{
if (mInstance == null)
{
mInstance = new VibrateManager();
}
return mInstance;
}
}
private VibrateManager()
{
}
private bool mIsVibrateOn = true;
public void SetVibrateOn(bool pIsOn)
{
mIsVibrateOn = pIsOn;
}
public void Vibrate(VibrateType pType, float pIntensity = 1)
{
if (mIsVibrateOn)
{
//Debug.Log("Vibrate : " + pType);
NativeTool.Shake((int)pType, pIntensity);
}
}
public void Shake()
{
if (mIsVibrateOn)
{
//Debug.Log("Shake!!!");
Handheld.Vibrate();
}
}
}
public enum VibrateType
{
Light = 0,
Medium,
Heavy
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 967f13cedb4cd44d8aa94ceb66a43815
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 296953bd0fc5c4a1ab308f54575a553c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using SRDebugger;
using SRDebugger.Services;
using SRF;
using SRF.Service;
using Debug = UnityEngine.Debug;
using Random = UnityEngine.Random;
public partial class SROptions
{
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f33afc791d8884a638deab3a99e290f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Game.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d66e751a0a4cc4c6290084f5c8aa6b8c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameLogic : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 329774faa237846ba88dab9cf6991f42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Init.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d00655b06d0c74750b89649f0bc7d692
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InitLogic : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ab09b3987d4e43f48ea32e9f76b8f3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Main.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ed3d9e25cbdfc49bb86179dab471c899
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainLogic : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eea13a3abf319425394d0eebefd89201
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ThirdPlugins.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8c8d03158493d4a54af02b2b682a4176
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c62843c57c147904b9ebffefca974d04
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3115cc2dd2d49d742b3cfe0b237788ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,98 @@
3.3.2f5
- Resolved issue where scripts were not overwritten by Asset Store importer, causing Easy Save to be unstable.
3.3.2f4
- Resolved issue where Save action for PlayMaker could return NullReferenceException due to using the wrong ES3.Save override.
- Worked around IL2CPP bug where reflection would not find particular ES3Types on iOS
- Resolved issue where trying to store an empty/unassigned PlayMaker object would throw a NulReferenceException.
- Keys of a type which no longer exists in the project are now automatically removed
- Abstract types used in an ES3Type will now work as intended
3.3.2f3
- Added GameObject variables to Auto Save
- Resolved issue where Sprites would be loaded with the incorrect pivot.
- Resolved issue where Stacks were loaded in reverse.
- Added a 'quality' field to the ES3.SaveImage method to allow the quality to be specified when saving JPEGs.
3.3.2f2
- Added method which allows raw bytes to be uploaded via ES3Cloud.
- Worked around issue where File IO was called on platforms which don't support it
- Accounted for situations where Component should evaluate to null but doesn't
- Updated PlayMaker actions to work around issue where global variables sometimes go missing
- Objects with the NotEditable hideFlags can now be stored by reference
- Worked around Unity bug where it fails to deserialize data when Prefab mode is open
- Resolved issue where global 'Save GameObject Children' settings can take precedence over Auto Save settings
- 'Enable Easy Save for Prefab' context menu item now works when multiple objects are selected.
3.3.2f1
- Resolved issue where Components on prefabs would sometimes not be added to the reference manager.
- Resolved issue where reference ID was read unnecesserily, causing format exception.
- Resolved issue where child prefabs would not be recognised by manager.
3.3.1p12
- Resolved case where certain references would not be added to manager.
3.3.1f11
- Fixed issue where using ES3.CacheFile with an encrypted file could fail.
- Fixed issue where Directory.GetFiles cannot process a full path on certain configurations.
- Accounted for case where HideFlags are changed during build process.
- Added a timeout parameter to the ES3Cloud constructor.
- ES3.Serialize and ES3.Deserialize now work with encryption and compression
3.3.1f10
- Full support for projects which use multiple scenes at once.
- Added ES3.Encrypt and ES3.Decrypt methods.
- Supported saving the active state and FsmVariables of PlayMaker FSMs.
- Added edge case for SkinnedMeshRenderers which use LODs to ensure that all meshes and Materials are added to the reference manager.
- Ensured that Auto Update References setting is ackowledged when first adding manager to scene.
- Moved menu items into Tools/Easy Save 3 menu.
- Using LoadInto will now assign the loaded reference ID to the object you're loading into.
3.3.1f9
- It's not possible to add an ES3ReferenceMgr to your scene directly, ensuring that initialisation code is performed.
- Compressed files can now be cached.
- Ability to only add prefabs directly referenced by your scene to the manager.
3.3.1f8
- Caching is now enabled by default for Auto Save, significantly improving performance.
- Added ES3.LoadString method so you do not need to provide all parameters to use the defaultValue overload.
- Resolved case where SaveAll would not correctly save some types of array.
- Resolved case where global references would not be acknowledged.
3.3.1f7
- Serialization depth limit has been raised to account for projects with deep hierearchies
- Fixed issue where Easy Save 3 Manager could not be found for scenes which had not been saved.
- Resolved issue where Add Reference(s) to Manager would not dirty scene when Auto Update References was disabled.
- Improved Editor performance by accounting for situations where post-processing events would be called multiple times.
3.3.1f6
- Internal fields of the UnityEngine.Object class are hidden in the Types pane as they are not serialisable.
- Accounted for edge case where unassigned script is returned by GameObject.GetComponents().
- ES3Settings constructor now accepts any settings enum (e.g. ES3.Location).
- No longer throws warning when multiple scenes are open.
3.3.1f5
- Updated PlayMaker actions.
- Provided workaround for issue where IL2CPP stripper removes methods which are marked to not be stripped.
- Performance updates.
3.3.1f4
- Improved performance when gathering references for reference manager.
3.3.1f3
- Added Cache as a storage location, providing a much simpler way of caching data.
- References can now be added by right-clicking the object and going to Easy Save 3 > Add Reference to Manager.
- Floats and doubles are now stored with full precision.
- Assorted bug fixes.
3.3.1f2
- Added compression, reducing file size by 85% on average when enabled
- JSON is now pretty printed (formatted) by default
- Added attributes to control serialisation
- Private fields in inherited classes are now stored
- Added search capabilities to the Auto Save window
- The way in which GameObjects is saved is now more flexible
- The reference manager is now updated whenever playmode is entered
- Null values in the global manager are now automatically removed
- Fixed issue where default settings were not applied properly
- Fixed issue where ES3Types would be stored in Easy Save root rather than in Assets/Easy Save 3/

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 48fdb523e0bb47f479a18f9b236df644
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 600dbc665993148f7b59ae7356fe862e
folderAsset: yes
timeCreated: 1474041532
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using ES3Internal;
using System.Linq;
namespace ES3Editor
{
public class AddES3Prefab : Editor
{
[MenuItem("GameObject/Easy Save 3/Enable Easy Save for Prefab(s)", false, 1001)]
[MenuItem("Assets/Easy Save 3/Enable Easy Save for Prefab(s)", false, 1001)]
public static void Enable()
{
if (Selection.gameObjects == null || Selection.gameObjects.Length == 0)
return;
foreach (var obj in Selection.gameObjects)
{
// Don't add the Component to a GameObject which already has it.
if (obj == null || (obj.GetComponent<ES3Prefab>() != null))
continue;
var go = obj;
#if UNITY_2018_3_OR_NEWER
if (PrefabUtility.GetPrefabInstanceStatus(go) != PrefabInstanceStatus.NotAPrefab)
{
go = (GameObject)PrefabUtility.GetCorrespondingObjectFromSource(go);
if (go == null)
continue;
}
#else
if(PrefabUtility.GetPrefabType(go) != PrefabType.Prefab)
{
go = (GameObject)PrefabUtility.GetPrefabParent(go);
if(go == null)
continue;
}
#endif
var es3Prefab = Undo.AddComponent<ES3Prefab>(go);
es3Prefab.GeneratePrefabReferences();
if (ES3ReferenceMgr.Current != null)
{
ES3ReferenceMgr.Current.AddPrefab(es3Prefab);
EditorUtility.SetDirty(ES3ReferenceMgr.Current);
}
}
}
[MenuItem("GameObject/Easy Save 3/Enable Easy Save for Prefab", true, 1001)]
[MenuItem("Assets/Easy Save 3/Enable Easy Save for Prefab", true, 1001)]
public static bool Validate()
{
return Selection.gameObjects != null && Selection.gameObjects.Length > 0;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 337c3be705d1942b3bf318b5b29aa7cb
timeCreated: 1519132282
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,308 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using ES3Internal;
namespace ES3Editor
{
[System.Serializable]
public class AutoSaveWindow : SubWindow
{
public bool showAdvancedSettings = false;
public ES3AutoSaveMgr mgr = null;
private HierarchyItem[] hierarchy = null;
public HierarchyItem selected = null;
private Vector2 hierarchyScrollPosition = Vector2.zero;
private bool sceneOpen = true;
private string searchTerm = "";
public AutoSaveWindow(EditorWindow window) : base("Auto Save", window){}
public override void OnGUI()
{
Init();
if(mgr == null)
{
EditorGUILayout.Space();
if (GUILayout.Button("Enable Auto Save for this scene"))
mgr = ES3Postprocessor.AddManagerToScene().GetComponent<ES3AutoSaveMgr>();
else
return;
}
var style = EditorStyle.Get;
using (var changeCheck = new EditorGUI.ChangeCheckScope())
{
using (var vertical = new EditorGUILayout.VerticalScope(style.areaPadded))
{
//GUILayout.Label("Settings for current scene", style.heading);
mgr.saveEvent = (ES3AutoSaveMgr.SaveEvent)EditorGUILayout.EnumPopup("Save Event", mgr.saveEvent);
mgr.loadEvent = (ES3AutoSaveMgr.LoadEvent)EditorGUILayout.EnumPopup("Load Event", mgr.loadEvent);
EditorGUILayout.Space();
showAdvancedSettings = EditorGUILayout.Foldout(showAdvancedSettings, "Show Advanced Settings");
if (showAdvancedSettings)
{
EditorGUI.indentLevel++;
mgr.key = EditorGUILayout.TextField("Key", mgr.key);
ES3SettingsEditor.Draw(mgr.settings);
EditorGUI.indentLevel--;
}
}
// Display the menu.
using (var horizontal = new EditorGUILayout.HorizontalScope())
{
if (GUILayout.Button("Scene", sceneOpen ? style.menuButtonSelected : style.menuButton))
{
sceneOpen = true;
OnFocus();
}
if (GUILayout.Button("Prefabs", sceneOpen ? style.menuButton : style.menuButtonSelected))
{
sceneOpen = false;
OnFocus();
}
}
//EditorGUILayout.HelpBox("Select the Components you want to be saved.\nTo maximise performance, only select the Components with variables which need persisting.", MessageType.None, true);
if (hierarchy == null || hierarchy.Length == 0)
{
EditorGUILayout.LabelField("Right-click a prefab and select 'Easy Save 3 > Enable Easy Save for Scene' to enable Auto Save for it.\n\nYour scene will also need to reference this prefab for it to be recognised.", style.area);
return;
}
using (var scrollView = new EditorGUILayout.ScrollViewScope(hierarchyScrollPosition, style.areaPadded))
{
hierarchyScrollPosition = scrollView.scrollPosition;
using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200)))
{
searchTerm = GUILayout.TextField(searchTerm, GUI.skin.FindStyle("ToolbarSeachTextField"));
if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton")))
{
// Remove focus if cleared
searchTerm = "";
GUI.FocusControl(null);
}
}
EditorGUILayout.Space();
EditorGUILayout.Space();
foreach (var go in hierarchy)
if (go != null)
go.DrawHierarchy(searchTerm.ToLowerInvariant());
}
if (changeCheck.changed)
EditorUtility.SetDirty(mgr);
}
}
public void Init()
{
if (mgr == null)
{
var mgrs = Resources.FindObjectsOfTypeAll<ES3AutoSaveMgr>();
if (mgrs.Length > 0)
mgr = mgrs[0];
}
if (hierarchy == null)
OnFocus();
}
public override void OnFocus()
{
GameObject[] parentObjects;
if (sceneOpen)
parentObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
else // Prefabs
{
var prefabs = ES3ReferenceMgr.Current.prefabs;
parentObjects = new GameObject[prefabs.Count];
for (int i = 0; i < prefabs.Count; i++)
if(prefabs[i] != null)
parentObjects[i] = prefabs[i].gameObject;
}
hierarchy = new HierarchyItem[parentObjects.Length];
for (int i = 0; i < parentObjects.Length; i++)
if(parentObjects[i] != null)
hierarchy[i] = new HierarchyItem(parentObjects[i].transform, null, this);
}
public class HierarchyItem
{
private ES3AutoSave autoSave;
private Transform t;
private Component[] components = null;
// Immediate children of this GameObject
private HierarchyItem[] children = new HierarchyItem[0];
private bool showComponents = false;
//private AutoSaveWindow window;
public HierarchyItem(Transform t, HierarchyItem parent, AutoSaveWindow window)
{
this.autoSave = t.GetComponent<ES3AutoSave>();
this.t = t;
this.components = t.GetComponents<Component>();
children = new HierarchyItem[t.childCount];
for (int i = 0; i < t.childCount; i++)
children[i] = new HierarchyItem(t.GetChild(i), this, window);
//this.window = window;
}
public void MergeDown(ES3AutoSave autoSave)
{
if (this.autoSave != autoSave)
{
if (this.autoSave != null)
{
autoSave.componentsToSave.AddRange(autoSave.componentsToSave);
Object.DestroyImmediate(this.autoSave);
}
this.autoSave = autoSave;
}
foreach (var child in children)
MergeDown(autoSave);
}
public void DrawHierarchy(string searchTerm)
{
bool containsSearchTerm = false;
if (t != null)
{
if (containsSearchTerm = t.name.ToLowerInvariant().Contains(searchTerm))
{
GUIContent saveIcon;
EditorGUIUtility.SetIconSize(new Vector2(16, 16));
if (HasSelectedComponents())
saveIcon = new GUIContent(t.name, EditorStyle.Get.saveIconSelected, "There are Components on this GameObject which will be saved.");
else
saveIcon = new GUIContent(t.name, EditorStyle.Get.saveIconUnselected, "No Components on this GameObject will be saved");
GUIStyle style = GUI.skin.GetStyle("Foldout");
if (Selection.activeTransform == t)
{
style = new GUIStyle(style);
style.fontStyle = FontStyle.Bold;
}
var open = EditorGUILayout.Foldout(showComponents, saveIcon, style);
if (open)
{
// Ping the GameObject if this was previously closed
if (showComponents != open)
EditorGUIUtility.PingObject(t.gameObject);
DrawComponents();
}
showComponents = open;
EditorGUI.indentLevel += 1;
}
}
// Draw children
if(children != null)
foreach (var child in children)
if(child != null)
child.DrawHierarchy(searchTerm);
if(containsSearchTerm)
EditorGUI.indentLevel-=1;
}
public void DrawComponents()
{
EditorGUI.indentLevel+=3;
using (var scope = new EditorGUILayout.VerticalScope())
{
bool toggle;
toggle = EditorGUILayout.ToggleLeft("active", autoSave != null ? autoSave.saveActive : false);
if((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent<ES3AutoSave>() : autoSave) != null)
autoSave.saveActive = toggle;
toggle = EditorGUILayout.ToggleLeft("hideFlags", autoSave != null ? autoSave.saveHideFlags : false);
if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent<ES3AutoSave>() : autoSave) != null)
autoSave.saveHideFlags = toggle;
toggle = EditorGUILayout.ToggleLeft("layer", autoSave != null ? autoSave.saveLayer : false);
if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent<ES3AutoSave>() : autoSave) != null)
autoSave.saveLayer = toggle;
toggle = EditorGUILayout.ToggleLeft("name", autoSave != null ? autoSave.saveName : false);
if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent<ES3AutoSave>() : autoSave) != null)
autoSave.saveName = toggle;
toggle = EditorGUILayout.ToggleLeft("tag", autoSave != null ? autoSave.saveTag : false);
if ((autoSave = (toggle && autoSave == null) ? t.gameObject.AddComponent<ES3AutoSave>() : autoSave) != null)
autoSave.saveTag = toggle;
foreach (var component in components)
{
if (component == null)
continue;
using (var horizontalScope = new EditorGUILayout.HorizontalScope())
{
bool saveComponent = false;
if (autoSave != null)
saveComponent = autoSave.componentsToSave.Contains(component);
var newValue = EditorGUILayout.ToggleLeft(EditorGUIUtility.ObjectContent(component, component.GetType()), saveComponent);
// If the checkbox has changed, we want to save or not save a Component
if (newValue != saveComponent)
{
if (autoSave == null)
{
autoSave = t.gameObject.AddComponent<ES3AutoSave>();
autoSave.saveChildren = false;
}
// If we've unchecked the box, remove the Component from the array.
if (newValue == false)
autoSave.componentsToSave.Remove(component);
// Else, add it to the array.
else
autoSave.componentsToSave.Add(component);
}
if(GUILayout.Button(EditorGUIUtility.IconContent("_Popup"), new GUIStyle("Label")))
ES3Window.InitAndShowTypes(component.GetType());
}
}
}
if(autoSave != null && (autoSave.componentsToSave == null || autoSave.componentsToSave.Count == 0) && !autoSave.saveActive && !autoSave.saveChildren && !autoSave.saveHideFlags && !autoSave.saveLayer && !autoSave.saveName && !autoSave.saveTag)
{
Undo.DestroyObjectImmediate(autoSave);
autoSave = null;
}
EditorGUI.indentLevel-=3;
}
public bool HasSelectedComponents()
{
if (autoSave != null)
foreach (var component in components)
if (component != null && autoSave.componentsToSave.Contains(component))
return true;
return false;
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6065cc5492e9f49728674de9a0c1fe84
timeCreated: 1519132286
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace ES3Internal
{
[CustomEditor(typeof(ES3AutoSave))]
public class ES3AutoSaveEditor : Editor
{
public override void OnInspectorGUI()
{
if (target == null)
return;
DrawDefaultInspector();
if (GUILayout.Button("Manage Auto Save Settings"))
ES3Editor.ES3Window.InitAndShowAutoSave();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 54ded3aeb20a94008a877da330bfc45f
timeCreated: 1519132285
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
using UnityEditor;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace ES3Internal
{
[CustomEditor(typeof(ES3AutoSaveMgr))]
public class ES3AutoSaveMgrEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This manages the saving and loading of GameObjects which have the Auto Save component attached to them.\n\nIf there are no Auto Save components in your scene, this component will do nothing.", MessageType.Info);
if(GUILayout.Button("Settings..."))
ES3Editor.ES3Window.InitAndShowAutoSave();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f440317f3fd444daf83c27a3381af17c
timeCreated: 1519132300
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,54 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
[ES3PropertiesAttribute([propertyNames])]
public class ES3UserType_[es3TypeSuffix] : ES3ObjectType
{
public static ES3Type Instance = null;
public ES3UserType_[es3TypeSuffix]() : base(typeof([fullType])){ Instance = this; priority = 1; }
protected override void WriteObject(object obj, ES3Writer writer)
{
var instance = ([fullType])obj;
[writes]
}
protected override void ReadObject<T>(ES3Reader reader, object obj)
{
var instance = ([fullType])obj;
foreach(string propertyName in reader.Properties)
{
switch(propertyName)
{
[reads]
default:
reader.Skip();
break;
}
}
}
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new [fullType]();
ReadObject<T>(reader, instance);
return instance;
}
}
public class ES3UserType_[es3TypeSuffix]Array : ES3ArrayType
{
public static ES3Type Instance;
public ES3UserType_[es3TypeSuffix]Array() : base(typeof([fullType][]), ES3UserType_[es3TypeSuffix].Instance)
{
Instance = this;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc3cada215f0d417a8fa879651f22f84
timeCreated: 1483698819
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
[ES3PropertiesAttribute([propertyNames])]
public class ES3UserType_[es3TypeSuffix] : ES3ComponentType
{
public static ES3Type Instance = null;
public ES3UserType_[es3TypeSuffix]() : base(typeof([fullType])){ Instance = this; priority = 1;}
protected override void WriteComponent(object obj, ES3Writer writer)
{
var instance = ([fullType])obj;
[writes]
}
protected override void ReadComponent<T>(ES3Reader reader, object obj)
{
var instance = ([fullType])obj;
foreach(string propertyName in reader.Properties)
{
switch(propertyName)
{
[reads]
default:
reader.Skip();
break;
}
}
}
}
public class ES3UserType_[es3TypeSuffix]Array : ES3ArrayType
{
public static ES3Type Instance;
public ES3UserType_[es3TypeSuffix]Array() : base(typeof([fullType][]), ES3UserType_[es3TypeSuffix].Instance)
{
Instance = this;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b74f7ff5e731846249f9e22ab7afedfb
timeCreated: 1483698819
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,84 @@
using System.Collections;
using UnityEngine;
using UnityEditor;
namespace ES3Editor
{
public class EditorStyle
{
private static EditorStyle style = null;
public GUIStyle area;
public GUIStyle areaPadded;
public GUIStyle menuButton;
public GUIStyle menuButtonSelected;
public GUIStyle smallSquareButton;
public GUIStyle heading;
public GUIStyle subheading;
public GUIStyle subheading2;
public GUIStyle boldLabelNoStretch;
public GUIStyle link;
public GUIStyle toggle;
public Texture2D saveIconSelected;
public Texture2D saveIconUnselected;
public static EditorStyle Get { get{ if(style == null) style = new EditorStyle(); return style; } }
public EditorStyle()
{
// An area with padding.
area = new GUIStyle();
area.padding = new RectOffset(10, 10, 10, 10);
area.wordWrap = true;
// An area with more padding.
areaPadded = new GUIStyle();
areaPadded.padding = new RectOffset(20, 20, 20, 20);
areaPadded.wordWrap = true;
// Unselected menu button.
menuButton = new GUIStyle(EditorStyles.toolbarButton);
menuButton.fontStyle = FontStyle.Normal;
menuButton.fontSize = 14;
menuButton.fixedHeight = 24;
// Selected menu button.
menuButtonSelected = new GUIStyle(menuButton);
menuButtonSelected.fontStyle = FontStyle.Bold;
// Main Headings
heading = new GUIStyle(EditorStyles.label);
heading.fontStyle = FontStyle.Bold;
heading.fontSize = 24;
subheading = new GUIStyle(heading);
subheading.fontSize = 18;
subheading2 = new GUIStyle(heading);
subheading2.fontSize = 14;
boldLabelNoStretch = new GUIStyle(EditorStyles.label);
boldLabelNoStretch.stretchWidth = false;
boldLabelNoStretch.fontStyle = FontStyle.Bold;
link = new GUIStyle();
link.fontSize = 16;
if(EditorGUIUtility.isProSkin)
link.normal.textColor = new Color (0.262f, 0.670f, 0.788f);
else
link.normal.textColor = new Color (0.129f, 0.129f, 0.8f);
toggle = new GUIStyle(EditorStyles.toggle);
toggle.stretchWidth = false;
saveIconSelected = AssetDatabase.LoadAssetAtPath<Texture2D>(ES3Settings.PathToEasySaveFolder() + "Editor/es3Logo16x16.png");
saveIconUnselected = AssetDatabase.LoadAssetAtPath<Texture2D>(ES3Settings.PathToEasySaveFolder() + "Editor/es3Logo16x16-bw.png");
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f556addc6753344019137cbc45d2c4ff
timeCreated: 1519132301
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
using ES3Internal;
public class ES3EditorUtility : Editor
{
public static void DisplayLink(string label, string url)
{
var style = ES3Editor.EditorStyle.Get;
if(GUILayout.Button(label, style.link))
Application.OpenURL(url);
var buttonRect = GUILayoutUtility.GetLastRect();
buttonRect.width = style.link.CalcSize(new GUIContent(label)).x;
EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
}
public static bool IsPrefabInAssets(UnityEngine.Object obj)
{
#if UNITY_2018_3_OR_NEWER
return PrefabUtility.IsPartOfPrefabAsset(obj);
#else
return (PrefabUtility.GetPrefabType(obj) == PrefabType.Prefab);
#endif
}
/*
* Gets all children and components from a GameObject or GameObjects.
* We create our own method for this because EditorUtility.CollectDeepHierarchy isn't thread safe in the Editor.
*/
public static IEnumerable<UnityEngine.Object> CollectDeepHierarchy(IEnumerable<GameObject> gos)
{
var deepHierarchy = new HashSet<UnityEngine.Object>();
foreach (var go in gos)
{
deepHierarchy.Add(go);
deepHierarchy.UnionWith(go.GetComponents<Component>());
foreach (Transform t in go.transform)
deepHierarchy.UnionWith( CollectDeepHierarchy( new GameObject[] { t.gameObject } ) );
}
return deepHierarchy;
}
[MenuItem("Tools/Easy Save 3/Getting Started...", false, 0)]
public static void DisplayGettingStarted()
{
Application.OpenURL("https://docs.moodkie.com/easy-save-3/getting-started/");
}
[MenuItem("Tools/Easy Save 3/Manual...", false, 0)]
public static void DisplayManual()
{
Application.OpenURL("https://docs.moodkie.com/product/easy-save-3/");
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 501719249e8124990973182985feaeb8
timeCreated: 1519132285
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,91 @@
#if !ES3GLOBAL_DISABLED
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Collections;
using System.Collections.Generic;
namespace ES3Internal
{
[CustomEditor(typeof(ES3Internal.ES3GlobalReferences))]
[System.Serializable]
public class ES3GlobalReferencesEditor : Editor
{
private bool isDraggingOver = false;
private bool openReferences = false;
private ES3Internal.ES3GlobalReferences _globalRefs = null;
private ES3Internal.ES3GlobalReferences globalRefs
{
get
{
if (_globalRefs == null)
_globalRefs = (ES3Internal.ES3GlobalReferences)serializedObject.targetObject;
return _globalRefs;
}
}
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This stores references to objects in Assets, allowing them to be referenced with the same ID between scenes.", MessageType.Info);
if (EditorGUILayout.Foldout(openReferences, "References") != openReferences)
{
openReferences = !openReferences;
if (openReferences == true)
openReferences = EditorUtility.DisplayDialog("Are you sure?", "Opening this list will display every reference in the manager, which for larger projects can cause the Editor to freeze\n\nIt is strongly recommended that you save your project before continuing.", "Open References", "Cancel");
}
// Make foldout drag-and-drop enabled for objects.
if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
{
Event evt = Event.current;
switch (evt.type)
{
case EventType.DragUpdated:
case EventType.DragPerform:
isDraggingOver = true;
break;
case EventType.DragExited:
isDraggingOver = false;
break;
}
if (isDraggingOver)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if (evt.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
Undo.RecordObject(globalRefs, "Add References to Easy Save 3 Reference List");
foreach (UnityEngine.Object obj in DragAndDrop.objectReferences)
globalRefs.GetOrAdd(obj);
// Return now because otherwise we'll change the GUI during an event which doesn't allow it.
return;
}
}
}
if (openReferences)
{
EditorGUI.indentLevel++;
foreach (var kvp in globalRefs.refId)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.ObjectField(kvp.Key, typeof(UnityEngine.Object), true);
EditorGUILayout.LongField(kvp.Value);
EditorGUILayout.EndHorizontal();
}
EditorGUI.indentLevel--;
}
}
}
}
#endif

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 286fb0c3863779e4d96bc682edb324ce
timeCreated: 1519132283
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Collections;
[CustomEditor(typeof(ES3InspectorInfo))]
public class ES3InspectorInfoEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox(((ES3InspectorInfo)target).message, MessageType.Info);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b344d685b614044aebf5285c5f59f52d
timeCreated: 1519132294
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,781 @@
#if PLAYMAKER_1_8_OR_NEWER
using UnityEngine;
using UnityEditor;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using HutongGames.PlayMakerEditor;
using System.Text.RegularExpressions;
namespace ES3PlayMaker
{
#region Base Actions
public abstract class BaseEditor : CustomActionEditor
{
bool showErrorHandling = false;
public abstract void DrawGUI();
public override bool OnGUI()
{
DrawGUI();
EditorGUILayout.Separator();
showErrorHandling = EditorGUILayout.Foldout(showErrorHandling, "Error Handling");
if (showErrorHandling)
{
EditorGUI.indentLevel++;
EditField("errorEvent");
EditField("errorMessage");
EditorGUI.indentLevel--;
}
return GUI.changed;
}
// Displays the FsmVar field without the unnecessary Type field.
protected void FsmVarField(string fieldName)
{
if (target == null || target.State == null)
return;
var fsmVar = (FsmVar)ES3Internal.ES3Reflection.GetField(target.GetType(), fieldName).GetValue(target);
if (fsmVar == null)
{
fsmVar = new FsmVar();
ES3Internal.ES3Reflection.GetField(target.GetType(), fieldName).SetValue(target, fsmVar);
}
EditorGUILayout.BeginHorizontal();
var label = Regex.Replace(fieldName, @"\p{Lu}", m => " " + m.Value.ToLowerInvariant());
EditorGUILayout.PrefixLabel(char.ToUpperInvariant(label[0]) + label.Substring(1));
var localVariables = target.Fsm.Variables.GetAllNamedVariablesSorted();
var globalVariables = FsmVariables.GlobalVariables.GetAllNamedVariablesSorted();
var variableNames = new string[localVariables.Length + globalVariables.Length];
int selected = -1;
for(int i=0; i<variableNames.Length; i++)
{
var variable = i >= localVariables.Length ? globalVariables[i - localVariables.Length] : localVariables[i];
variableNames[i] = i >= localVariables.Length ? "Globals/"+variable.Name : variable.Name;
if (fsmVar.NamedVar == variable)
selected = i;
}
var newSelected = EditorGUILayout.Popup(selected, variableNames);
EditorGUILayout.EndHorizontal();
if (newSelected == -1)
return;
if (selected != newSelected)
{
if (newSelected >= localVariables.Length)
fsmVar.NamedVar = globalVariables[newSelected - localVariables.Length];
else
fsmVar.NamedVar = localVariables[newSelected];
}
}
}
public abstract class SettingsEditor : BaseEditor
{
public override bool OnGUI()
{
base.OnGUI();
var action = target as ES3PlayMaker.SettingsAction;
if(action == null)
return false;
action.overrideDefaultSettings.Value = EditorGUILayout.ToggleLeft("Override Default Settings", action.overrideDefaultSettings.Value);
if(action.overrideDefaultSettings.Value)
{
EditorGUI.indentLevel++;
EditField("path");
EditField("location");
EditField("encryptionType");
EditField("encryptionPassword");
EditField("compressionType");
EditField("directory");
EditField("format");
EditField("bufferSize");
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
return GUI.changed;
}
}
public abstract class KeyValueSettingsEditor : SettingsEditor
{
public override bool OnGUI()
{
EditField("key");
EditField("value");
base.OnGUI();
return GUI.changed;
}
public override void DrawGUI(){}
}
public abstract class ES3FileActionEditor : BaseEditor
{
public override bool OnGUI()
{
EditField("fsmES3File");
base.OnGUI();
var action = target as ES3PlayMaker.ES3FileAction;
if (action == null)
return false;
return GUI.changed;
}
}
#endregion
#region Save Actions
[CustomActionEditor(typeof(ES3PlayMaker.Save))]
public class SaveEditor : KeyValueSettingsEditor{}
[CustomActionEditor(typeof(ES3PlayMaker.SaveAll))]
public class SaveAllEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("key");
EditField("saveFsmVariables");
EditField("saveGlobalVariables");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.SaveRaw))]
public class SaveRawEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("str");
EditField("useBase64Encoding");
EditField("appendNewline");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.AppendRaw))]
public class AppendRawEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("str");
EditField("useBase64Encoding");
EditField("appendNewline");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.SaveImage))]
public class SaveImageEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("imagePath");
EditField("texture2D");
}
}
#endregion
#region Load Actions
[CustomActionEditor(typeof(ES3PlayMaker.Load))]
public class LoadEditor : KeyValueSettingsEditor
{
public override void DrawGUI()
{
EditorGUILayout.Space();
EditField("defaultValue");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.LoadInto))]
public class LoadIntoEditor : KeyValueSettingsEditor{}
[CustomActionEditor(typeof(ES3PlayMaker.LoadAll))]
public class LoadAllEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("key");
EditField("loadFsmVariables");
EditField("loadGlobalVariables");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.LoadAudio))]
public class LoadAudioEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("audioFilePath");
EditField("audioClip");
#if UNITY_2018_3_OR_NEWER
EditField("audioType");
#endif
}
}
[CustomActionEditor(typeof(ES3PlayMaker.LoadImage))]
public class LoadImageEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("imagePath");
EditField("texture2D");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.LoadRawString))]
public class LoadRawStringEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("str");
EditField("useBase64Encoding");
}
}
#endregion
#region Exists Actions
[CustomActionEditor(typeof(ES3PlayMaker.KeyExists))]
public class KeyExistsEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("key");
EditField("exists");
EditorGUILayout.Separator();
EditField("existsEvent");
EditField("doesNotExistEvent");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.FileExists))]
public class FileExistsEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
EditField("exists");
EditorGUILayout.Separator();
EditField("existsEvent");
EditField("doesNotExistEvent");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.DirectoryExists))]
public class DirectoryExistsEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("directoryPath");
EditField("exists");
EditorGUILayout.Separator();
EditField("existsEvent");
EditField("doesNotExistEvent");
}
}
#endregion
#region Delete Actions
[CustomActionEditor(typeof(ES3PlayMaker.DeleteKey))]
public class DeleteKeyEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("key");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.DeleteFile))]
public class DeleteFileEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.DeleteDirectory))]
public class DeleteDirectoryEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("directoryPath");
}
}
#endregion
#region Backup Actions
[CustomActionEditor(typeof(ES3PlayMaker.CreateBackup))]
public class CreateBackupEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.RestoreBackup))]
public class RestoreBackupEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
EditField("backupWasRestored");
}
}
#endregion
#region Key, File and Directory methods
[CustomActionEditor(typeof(ES3PlayMaker.RenameFile))]
public class RenameFileEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("oldFilePath");
EditField("newFilePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.CopyFile))]
public class CopyFileEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("oldFilePath");
EditField("newFilePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.CopyDirectory))]
public class CopyDirectoryEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("oldDirectoryPath");
EditField("newDirectoryPath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.GetKeys))]
public class GetKeysEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
EditField("keys");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.GetKeyCount))]
public class GetKeyCountEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
EditField("keyCount");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.GetFiles))]
public class GetFilesEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("directoryPath");
EditField("files");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.GetDirectories))]
public class GetDirectoriesEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("directoryPath");
EditField("directories");
}
}
#endregion
#region ES3File Actions
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileCreate))]
public class ES3FileCreateEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
EditField("filePath");
EditField("syncWithFile");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileSync))]
public class ES3FileSyncEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileSave))]
public class ES3FileSaveEditor : SaveEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
base.DrawGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileLoad))]
public class ES3FileLoadEditor : LoadEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
base.DrawGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileLoadInto))]
public class ES3FileLoadIntoEditor : LoadIntoEditor
{
public override void DrawGUI()
{
base.DrawGUI();
EditField("fsmES3File");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileDeleteKey))]
public class ES3FileDeleteKeyEditor : DeleteKeyEditor
{
public override void DrawGUI()
{
base.DrawGUI();
EditField("fsmES3File");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileKeyExists))]
public class ES3FileKeyExistsEditor : KeyExistsEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
base.DrawGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileGetKeys))]
public class ES3FileGetKeysEditor : ES3FileActionEditor
{
public override void DrawGUI()
{
EditField("keys");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileClear))]
public class ES3FileClearEditor : BaseEditor
{
public override void DrawGUI()
{
EditField("fsmES3File");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3FileSize))]
public class ES3FileSizeEditor : BaseEditor
{
public override void DrawGUI()
{
EditField("size");
EditField("fsmES3File");
}
}
#endregion
#region ES3Cloud Actions
#if !DISABLE_WEB
public abstract class ES3CloudEditor : SettingsEditor
{
protected abstract void DrawChildGUI();
public override void DrawGUI()
{
EditField("url");
EditField("apiKey");
EditorGUILayout.Space();
DrawChildGUI();
EditorGUILayout.Space();
EditField("errorCode");
}
}
public abstract class ES3CloudUserEditor : ES3CloudEditor
{
public bool showUser = false;
protected override void DrawChildGUI()
{
if((showUser = EditorGUILayout.Foldout(showUser, "User (optional)")))
{
EditorGUI.indentLevel++;
EditField("user");
EditField("password");
EditorGUI.indentLevel--;
}
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudSync))]
public class ES3CloudSyncEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("path");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudDownloadFile))]
public class ES3CloudDownloadFileEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("path");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudDownloadES3File))]
public class ES3CloudDownloadES3FileEditor : BaseEditor
{
public bool showUser = false;
public override void DrawGUI()
{
EditField("fsmES3File");
EditField("url");
EditField("apiKey");
EditField("errorCode");
if ((showUser = EditorGUILayout.Foldout(showUser, "User (optional)")))
{
EditorGUI.indentLevel++;
EditField("user");
EditField("password");
EditorGUI.indentLevel--;
}
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudUploadFile))]
public class ES3CloudUploadFileEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("path");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudUploadES3File))]
public class ES3CloudUploadES3FileEditor : BaseEditor
{
public bool showUser = false;
public override void DrawGUI()
{
EditField("fsmES3File");
EditField("url");
EditField("apiKey");
EditField("errorCode");
if((showUser = EditorGUILayout.Foldout(showUser, "User (optional)")))
{
EditorGUI.indentLevel++;
EditField("user");
EditField("password");
EditorGUI.indentLevel--;
}
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudDeleteFile))]
public class ES3CloudDeleteFileEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("path");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudRenameFile))]
public class ES3CloudRenameFileEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("path");
EditField("newFilename");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudDownloadFilenames))]
public class ES3CloudDownloadFilenamesEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("filenames");
EditField("searchPattern");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudSearchFilenames))]
public class ES3CloudSearchFilenamesEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("filenames");
EditField("searchPattern");
base.DrawChildGUI();
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3CloudDownloadTimestamp))]
public class ES3CloudDownloadTimestampEditor : ES3CloudUserEditor
{
protected override void DrawChildGUI()
{
EditField("timestamp");
base.DrawChildGUI();
}
}
#endif
#endregion
#region ES3SpreadsheetActions
[CustomActionEditor(typeof(ES3PlayMaker.ES3SpreadsheetCreate))]
public class ES3SpreadsheetCreateEditor : BaseEditor
{
public override void DrawGUI()
{
EditField("fsmES3Spreadsheet");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3SpreadsheetSetCell))]
public class ES3SpreadsheetSetCellEditor : BaseEditor
{
public override void DrawGUI()
{
EditField("fsmES3Spreadsheet");
EditField("col");
EditField("row");
EditField("value");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3SpreadsheetGetCell))]
public class ES3SpreadsheetGetCellEditor : BaseEditor
{
public override void DrawGUI()
{
EditField("fsmES3Spreadsheet");
EditField("col");
EditField("row");
EditField("value");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3SpreadsheetLoad))]
public class ES3SpreadsheetLoadEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("fsmES3Spreadsheet");
EditField("filePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.ES3SpreadsheetSave))]
public class ES3SpreadsheetSaveEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("fsmES3Spreadsheet");
EditField("filePath");
EditField("append");
}
}
#endregion
#region Caching
[CustomActionEditor(typeof(ES3PlayMaker.CacheFile))]
public class CacheFileEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
}
}
[CustomActionEditor(typeof(ES3PlayMaker.StoreCachedFile))]
public class StoreCachedFileEditor : SettingsEditor
{
public override void DrawGUI()
{
EditField("filePath");
}
}
#endregion
}
#endif

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 61838eb75b8164d699b0f54416e0f0bc
timeCreated: 1497347459
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,149 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using ES3Internal;
/*
* ---- How Postprocessing works for the reference manager ----
* - When the manager is first added to the scene, all top-level dependencies are added to the manager (AddManagerToScene).
* - When the manager is first added to the scene, all prefabs with ES3Prefab components are added to the manager (AddManagerToScene).
* - All GameObjects and Components in the scene are added to the reference manager when we enter Playmode or the scene is saved (PlayModeStateChanged, OnWillSaveAssets -> AddGameObjectsAndComponentstoManager).
* - When a UnityEngine.Object field of a Component is modified, the new UnityEngine.Object reference is added to the reference manager (PostProcessModifications)
* - All prefabs with ES3Prefab Components are added to the reference manager when we enter Playmode or the scene is saved (PlayModeStateChanged, OnWillSaveAssets -> AddGameObjectsAndComponentstoManager).
* - Local references for prefabs are processed whenever a prefab with an ES3Prefab Component is deselected (SelectionChanged -> ProcessGameObject)
*/
[InitializeOnLoad]
public class ES3Postprocessor : UnityEditor.AssetModificationProcessor
{
private static bool refreshed = false;
public static ES3ReferenceMgr RefMgr
{
get { return (ES3ReferenceMgr)ES3ReferenceMgr.Current; }
}
public static GameObject lastSelected = null;
// This constructor is also called once when playmode is activated and whenever recompilation happens
// because we have the [InitializeOnLoad] attribute assigned to the class.
static ES3Postprocessor()
{
// Open the Easy Save 3 window the first time ES3 is installed.
//ES3Editor.ES3Window.OpenEditorWindowOnStart();
#if UNITY_2017_2_OR_NEWER
EditorApplication.playModeStateChanged += PlayModeStateChanged;
#else
EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
#endif
}
#region Reference Updating
private static void RefreshReferences(bool isEnteringPlayMode = false)
{
if (refreshed) // If we've already refreshed, do nothing.
return;
if (RefMgr != null && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
{
RefMgr.RefreshDependencies(isEnteringPlayMode);
}
UpdateAssembliesContainingES3Types();
refreshed = true;
}
#if UNITY_2017_2_OR_NEWER
public static void PlayModeStateChanged(PlayModeStateChange state)
{
// Add all GameObjects and Components to the reference manager before we enter play mode.
if (state == PlayModeStateChange.ExitingEditMode && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
RefreshReferences(true);
}
#else
public static void PlaymodeStateChanged()
{
// Add all GameObjects and Components to the reference manager before we enter play mode.
if (!EditorApplication.isPlaying && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
RefreshReferences(true);
}
#endif
public static string[] OnWillSaveAssets(string[] paths)
{
// Don't refresh references when the application is playing.
if (!EditorApplication.isUpdating && !Application.isPlaying && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
RefreshReferences();
return paths;
}
#endregion
private static void UpdateAssembliesContainingES3Types()
{
#if UNITY_2017_3_OR_NEWER
var assemblies = UnityEditor.Compilation.CompilationPipeline.GetAssemblies();
var defaults = ES3Settings.defaultSettingsScriptableObject;
var currentAssemblyNames = defaults.settings.assemblyNames;
var assemblyNames = new List<string>();
foreach (var assembly in assemblies)
{
try
{
var name = assembly.name;
var substr = name.Length >= 5 ? name.Substring(0, 5) : "";
if (substr != "Unity" && substr != "com.u" && !name.Contains("-Editor"))
assemblyNames.Add(name);
}
catch { }
}
// Only update if the list has changed.
for (int i = 0; i < currentAssemblyNames.Length; i++)
{
if (currentAssemblyNames[i] != assemblyNames[i])
{
defaults.settings.assemblyNames = assemblyNames.ToArray();
EditorUtility.SetDirty(defaults);
}
}
#endif
}
public static GameObject AddManagerToScene()
{
GameObject mgr = null;
if (RefMgr != null)
mgr = RefMgr.gameObject;
if (mgr == null)
mgr = new GameObject("Easy Save 3 Manager");
if (mgr.GetComponent<ES3ReferenceMgr>() == null)
{
mgr.AddComponent<ES3ReferenceMgr>();
if (!Application.isPlaying && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
RefMgr.RefreshDependencies();
}
if (mgr.GetComponent<ES3AutoSaveMgr>() == null)
mgr.AddComponent<ES3AutoSaveMgr>();
Undo.RegisterCreatedObjectUndo(mgr, "Enabled Easy Save for Scene");
return mgr;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4256380692bcb4e57bdc0a5e13956389
timeCreated: 1474041535
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,50 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Collections;
using ES3Internal;
[CustomEditor(typeof(ES3Prefab))]
[System.Serializable]
public class ES3PrefabEditor : Editor
{
bool showAdvanced = false;
bool openLocalRefs = false;
public override void OnInspectorGUI()
{
var es3Prefab = (ES3Prefab)serializedObject.targetObject;
EditorGUILayout.HelpBox("Easy Save is enabled for this prefab, and can be saved and loaded with the ES3 methods.", MessageType.None);
showAdvanced = EditorGUILayout.Foldout(showAdvanced, "Advanced Settings");
if(showAdvanced)
{
EditorGUI.indentLevel++;
es3Prefab.prefabId = EditorGUILayout.LongField("Prefab ID", es3Prefab.prefabId);
EditorGUILayout.LabelField("Reference count", es3Prefab.localRefs.Count.ToString());
EditorGUI.indentLevel--;
openLocalRefs = EditorGUILayout.Foldout(openLocalRefs, "localRefs");
if (openLocalRefs)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("It is not recommended to manually modify these.");
foreach (var kvp in es3Prefab.localRefs)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.ObjectField(kvp.Key, typeof(UnityEngine.Object), false);
EditorGUILayout.LongField(kvp.Value);
EditorGUILayout.EndHorizontal();
}
EditorGUI.indentLevel--;
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9d25610c9233c4cdfa5a0744c9956f5c
timeCreated: 1519132292
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,186 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Collections;
using System.Collections.Generic;
[CustomEditor(typeof(ES3ReferenceMgr))]
[System.Serializable]
public class ES3ReferenceMgrEditor : Editor
{
private bool isDraggingOver = false;
private bool openReferences = false;
private ES3ReferenceMgr _mgr = null;
private ES3ReferenceMgr mgr
{
get
{
if (_mgr == null)
_mgr = (ES3ReferenceMgr)serializedObject.targetObject;
return _mgr;
}
}
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This allows Easy Save to maintain references to objects in your scene.\n\nIt is automatically updated when you enter Playmode or build your project.", MessageType.Info);
if (EditorGUILayout.Foldout(openReferences, "References") != openReferences)
{
openReferences = !openReferences;
if (openReferences == true)
openReferences = EditorUtility.DisplayDialog("Are you sure?", "Opening this list will display every reference in the manager, which for larger projects can cause the Editor to freeze\n\nIt is strongly recommended that you save your project before continuing.", "Open References", "Cancel");
}
// Make foldout drag-and-drop enabled for objects.
if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
{
Event evt = Event.current;
switch (evt.type)
{
case EventType.DragUpdated:
case EventType.DragPerform:
isDraggingOver = true;
break;
case EventType.DragExited:
isDraggingOver = false;
break;
}
if (isDraggingOver)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if (evt.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
Undo.RecordObject(mgr, "Add References to Easy Save 3 Reference List");
foreach (UnityEngine.Object obj in DragAndDrop.objectReferences)
mgr.Add(obj);
// Return now because otherwise we'll change the GUI during an event which doesn't allow it.
return;
}
}
}
if (openReferences)
{
EditorGUI.indentLevel++;
foreach (var kvp in mgr.idRef)
{
EditorGUILayout.BeginHorizontal();
var value = EditorGUILayout.ObjectField(kvp.Value, typeof(UnityEngine.Object), true);
var key = EditorGUILayout.LongField(kvp.Key);
EditorGUILayout.EndHorizontal();
if (value != kvp.Value || key != kvp.Key)
{
Undo.RecordObject(mgr, "Change Easy Save 3 References");
// If we're deleting a value, delete it.
if (value == null)
mgr.Remove(key);
// Else, update the ID.
else
mgr.ChangeId(kvp.Key, key);
// Break, as removing or changing Dictionary items will make the foreach out of sync.
break;
}
}
EditorGUI.indentLevel--;
}
mgr.openPrefabs = EditorGUILayout.Foldout(mgr.openPrefabs, "ES3Prefabs");
if (mgr.openPrefabs)
{
EditorGUI.indentLevel++;
foreach (var prefab in mgr.prefabs)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.ObjectField(prefab, typeof(UnityEngine.Object), true);
EditorGUILayout.EndHorizontal();
}
EditorGUI.indentLevel--;
}
EditorGUILayout.LabelField("Reference count", mgr.refId.Count.ToString());
EditorGUILayout.LabelField("Prefab count", mgr.prefabs.Count.ToString());
if (GUILayout.Button("Refresh"))
{
mgr.RefreshDependencies();
}
if (GUILayout.Button("Optimize"))
{
mgr.Optimize();
}
}
[MenuItem("GameObject/Easy Save 3/Add Reference(s) to Manager", false, 33)]
[MenuItem("Assets/Easy Save 3/Add Reference(s) to Manager", false, 33)]
public static void AddReferenceToManager()
{
var mgr = ES3ReferenceMgr.Current;
if (mgr == null)
{
EditorUtility.DisplayDialog("Could not add reference to manager", "This object could not be added to the reference manager because no reference manager exists in this scene. To create one, go to Assets > Easy Save 3 > Add Manager to Scene", "Ok");
return;
}
if (Selection.objects == null || Selection.objects.Length == 0)
return;
Undo.RecordObject(mgr, "Update Easy Save 3 Reference Manager");
foreach (var obj in Selection.objects)
{
if (obj == null)
continue;
if (obj.GetType() == typeof(GameObject))
{
var go = (GameObject)obj;
if (ES3EditorUtility.IsPrefabInAssets(go) && go.GetComponent<ES3Internal.ES3Prefab>() != null)
mgr.AddPrefab(go.GetComponent<ES3Internal.ES3Prefab>());
}
((ES3ReferenceMgr)mgr).AddDependencies(obj);
}
}
[MenuItem("GameObject/Easy Save 3/Add Reference(s) to Manager", true, 33)]
[MenuItem("Assets/Easy Save 3/Add Reference(s) to Manager", true, 33)]
private static bool CanAddReferenceToManager()
{
return Selection.objects != null && Selection.objects.Length > 0 && ES3ReferenceMgr.Current != null;
}
[MenuItem("GameObject/Easy Save 3/Add Manager to Scene", false, 33)]
[MenuItem("Assets/Easy Save 3/Add Manager to Scene", false, 33)]
[MenuItem("Tools/Easy Save 3/Add Manager to Scene", false, 150)]
public static void EnableForScene()
{
if(!SceneManager.GetActiveScene().isLoaded)
EditorUtility.DisplayDialog("Could not add manager to scene", "Could not add Easy Save 3 Manager to scene because there is not currently a scene open.", "Ok");
Selection.activeObject = ES3Postprocessor.AddManagerToScene();
}
[MenuItem("GameObject/Easy Save 3/Add Manager to Scene", true, 33)]
[MenuItem("Assets/Easy Save 3/Add Manager to Scene", true, 33)]
[MenuItem("Tools/Easy Save 3/Add Manager to Scene", true, 150)]
private static bool CanEnableForScene()
{
return ES3ReferenceMgr.Current == null;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3b43d266ed3464dedaa77757645ad61c
timeCreated: 1519132283
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
[ES3PropertiesAttribute([propertyNames])]
public class ES3UserType_[es3TypeSuffix] : ES3ScriptableObjectType
{
public static ES3Type Instance = null;
public ES3UserType_[es3TypeSuffix]() : base(typeof([fullType])){ Instance = this; priority = 1; }
protected override void WriteScriptableObject(object obj, ES3Writer writer)
{
var instance = ([fullType])obj;
[writes]
}
protected override void ReadScriptableObject<T>(ES3Reader reader, object obj)
{
var instance = ([fullType])obj;
foreach(string propertyName in reader.Properties)
{
switch(propertyName)
{
[reads]
default:
reader.Skip();
break;
}
}
}
}
public class ES3UserType_[es3TypeSuffix]Array : ES3ArrayType
{
public static ES3Type Instance;
public ES3UserType_[es3TypeSuffix]Array() : base(typeof([fullType][]), ES3UserType_[es3TypeSuffix].Instance)
{
Instance = this;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b4ae594e55834c35b197df04c2e81cb
timeCreated: 1483698819
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Collections;
using ES3Internal;
namespace ES3Editor
{
public static class ES3SettingsEditor
{
public static void Draw(ES3SerializableSettings settings)
{
var style = EditorStyle.Get;
settings.location = (ES3.Location)EditorGUILayout.EnumPopup("Location", settings.location);
// If the location is File, show the Directory.
if(settings.location == ES3.Location.File)
settings.directory = (ES3.Directory)EditorGUILayout.EnumPopup("Directory", settings.directory);
settings.path = EditorGUILayout.TextField("Default File Path", settings.path);
EditorGUILayout.Space();
settings.encryptionType = (ES3.EncryptionType)EditorGUILayout.EnumPopup("Encryption", settings.encryptionType);
settings.encryptionPassword = EditorGUILayout.TextField("Encryption Password", settings.encryptionPassword);
EditorGUILayout.Space();
settings.compressionType = (ES3.CompressionType)EditorGUILayout.EnumPopup("Compression", settings.compressionType);
EditorGUILayout.Space();
settings.saveChildren = EditorGUILayout.Toggle("Save GameObject Children", settings.saveChildren);
EditorGUILayout.Space();
if(settings.showAdvancedSettings = EditorGUILayout.Foldout(settings.showAdvancedSettings, "Advanced Settings"))
{
EditorGUILayout.BeginVertical(style.area);
settings.format = (ES3.Format)EditorGUILayout.EnumPopup("Format", settings.format);
if (settings.format == ES3.Format.JSON)
settings.prettyPrint = EditorGUILayout.Toggle(new GUIContent("Pretty print JSON"), settings.prettyPrint);
settings.bufferSize = EditorGUILayout.IntField("Buffer Size", settings.bufferSize);
settings.memberReferenceMode = (ES3.ReferenceMode)EditorGUILayout.EnumPopup("Serialise Unity Object fields", settings.memberReferenceMode);
settings.serializationDepthLimit = EditorGUILayout.IntField("Serialisation Depth", settings.serializationDepthLimit);
EditorGUILayout.Space();
EditorGUILayout.EndVertical();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 35659b9a083a341d7bee216c4b71f4bc
timeCreated: 1519132282
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
[ES3PropertiesAttribute([propertyNames])]
public class ES3UserType_[es3TypeSuffix] : ES3Type
{
public static ES3Type Instance = null;
public ES3UserType_[es3TypeSuffix]() : base(typeof([fullType])){ Instance = this; priority = 1;}
public override void Write(object obj, ES3Writer writer)
{
var instance = ([fullType])obj;
[writes]
}
public override object Read<T>(ES3Reader reader)
{
var instance = new [fullType]();
ReadInto<T>(reader, instance);
return instance;
}
public override void ReadInto<T>(ES3Reader reader, object obj)
{
var instance = ([fullType])obj;
string propertyName;
while((propertyName = reader.ReadPropertyName()) != null)
{
switch(propertyName)
{
[reads]
default:
reader.Skip();
break;
}
}
}
}
public class ES3UserType_[es3TypeSuffix]Array : ES3ArrayType
{
public static ES3Type Instance;
public ES3UserType_[es3TypeSuffix]Array() : base(typeof([fullType][]), ES3UserType_[es3TypeSuffix].Instance)
{
Instance = this;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e84ec2bd739f543b0a5cd3c13741f744
timeCreated: 1483718243
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,62 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
public class ES3UserType_Material : ES3UnityObjectType
{
public static ES3Type Instance = null;
public ES3UserType_Material() : base(typeof(UnityEngine.Material)){ Instance = this; priority = 1; }
protected override void WriteUnityObject(object obj, ES3Writer writer)
{
var instance = (UnityEngine.Material)obj;
writer.WriteProperty("shader", instance.shader);
writer.WriteProperty("renderQueue", instance.renderQueue, ES3Type_int.Instance);
writer.WriteProperty("shaderKeywords", instance.shaderKeywords);
writer.WriteProperty("globalIlluminationFlags", instance.globalIlluminationFlags);
[writes]
}
protected override object ReadUnityObject<T>(ES3Reader reader)
{
var obj = new Material(Shader.Find("Diffuse"));
ReadUnityObject<T>(reader, obj);
return obj;
}
protected override void ReadUnityObject<T>(ES3Reader reader, object obj)
{
var instance = (UnityEngine.Material)obj;
foreach(string propertyName in reader.Properties)
{
switch(propertyName)
{
case "name":
instance.name = reader.Read<string>(ES3Type_string.Instance);
break;
case "shader":
instance.shader = reader.Read<UnityEngine.Shader>(ES3Type_Shader.Instance);
break;
case "renderQueue":
instance.renderQueue = reader.Read<System.Int32>(ES3Type_int.Instance);
break;
case "shaderKeywords":
instance.shaderKeywords = reader.Read<System.String[]>();
break;
case "globalIlluminationFlags":
instance.globalIlluminationFlags = reader.Read<UnityEngine.MaterialGlobalIlluminationFlags>();
break;
[reads]
default:
reader.Skip();
break;
}
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f90b0399488ef42e5bc804122fd99c58
timeCreated: 1483698819
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
using System;
using UnityEngine;
namespace ES3Types
{
[UnityEngine.Scripting.Preserve]
[ES3PropertiesAttribute([propertyNames])]
public class ES3UserType_[es3TypeSuffix] : ES3Type
{
public static ES3Type Instance = null;
public ES3UserType_[es3TypeSuffix]() : base(typeof([fullType])){ Instance = this; priority = 1;}
public override void Write(object obj, ES3Writer writer)
{
var instance = ([fullType])obj;
[writes]
}
public override object Read<T>(ES3Reader reader)
{
var instance = new [fullType]();
string propertyName;
while((propertyName = reader.ReadPropertyName()) != null)
{
switch(propertyName)
{
[reads]
default:
reader.Skip();
break;
}
}
return instance;
}
}
public class ES3UserType_[es3TypeSuffix]Array : ES3ArrayType
{
public static ES3Type Instance;
public ES3UserType_[es3TypeSuffix]Array() : base(typeof([fullType][]), ES3UserType_[es3TypeSuffix].Instance)
{
Instance = this;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f67742ea0c50242f8af16c3f807b723b
timeCreated: 1483718243
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,238 @@
using UnityEngine;
using UnityEditor;
using System.Linq;
namespace ES3Editor
{
public class ES3Window : EditorWindow
{
private SubWindow[] windows = null;
public SubWindow currentWindow;
[MenuItem("Window/Easy Save 3", false, 1000)]
[MenuItem("Assets/Easy Save 3/Open Easy Save 3 Window", false, 1000)]
public static void Init()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if(window != null)
window.Show();
}
public static void InitAndShowHome()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(HomeWindow));
}
}
[MenuItem("Tools/Easy Save 3/Auto Save", false, 100)]
public static void InitAndShowAutoSave()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(AutoSaveWindow));
}
}
public static void InitAndShowReferences()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(ReferencesWindow));
}
}
[MenuItem("Tools/Easy Save 3/Types", false, 100)]
public static void InitAndShowTypes()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(TypesWindow));
}
}
public static void InitAndShowTypes(System.Type type)
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
var typesWindow = (TypesWindow)window.SetCurrentWindow(typeof(TypesWindow));
typesWindow.SelectType(type);
}
}
[MenuItem("Tools/Easy Save 3/Settings", false, 100)]
public static void InitAndShowSettings()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(SettingsWindow));
}
}
[MenuItem("Tools/Easy Save 3/Tools", false, 100)]
public static void InitAndShowTools()
{
// Get existing open window or if none, make a new one:
ES3Window window = (ES3Window)EditorWindow.GetWindow(typeof(ES3Window));
if (window != null)
{
window.Show();
window.SetCurrentWindow(typeof(ToolsWindow));
}
}
public void InitSubWindows()
{
windows = new SubWindow[]{
new HomeWindow(this),
new SettingsWindow(this),
new ToolsWindow(this),
new TypesWindow(this),
new AutoSaveWindow(this)
//, new ReferencesWindow(this)
};
}
void OnLostFocus()
{
if(currentWindow != null)
currentWindow.OnLostFocus();
}
private void OnFocus()
{
if (currentWindow != null)
currentWindow.OnFocus();
}
void OnDestroy()
{
if(currentWindow != null)
currentWindow.OnDestroy();
}
void OnEnable()
{
if(windows == null)
InitSubWindows();
// Set the window name and icon.
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(ES3Settings.PathToEasySaveFolder()+"Editor/es3Logo16x16.png");
titleContent = new GUIContent("Easy Save", icon);
// Get the last opened window and open it.
if(currentWindow == null)
{
var currentWindowName = EditorPrefs.GetString("ES3Editor.Window.currentWindow", windows[0].name);
for(int i=0; i<windows.Length; i++)
{
if(windows[i].name == currentWindowName)
{
currentWindow = windows[i];
break;
}
}
}
}
private void OnHierarchyChange()
{
if (currentWindow != null)
currentWindow.OnHierarchyChange();
}
void OnGUI()
{
var style = EditorStyle.Get;
// Display the menu.
EditorGUILayout.BeginHorizontal();
for(int i=0; i<windows.Length; i++)
{
if(GUILayout.Button(windows[i].name, currentWindow == windows[i] ? style.menuButtonSelected : style.menuButton))
SetCurrentWindow(windows[i]);
}
EditorGUILayout.EndHorizontal();
if(currentWindow != null)
currentWindow.OnGUI();
}
void SetCurrentWindow(SubWindow window)
{
if (currentWindow != null)
currentWindow.OnLostFocus();
currentWindow = window;
currentWindow.OnFocus();
EditorPrefs.SetString("ES3Editor.Window.currentWindow", window.name);
}
SubWindow SetCurrentWindow(System.Type type)
{
currentWindow.OnLostFocus();
currentWindow = windows.First(w => w.GetType() == type);
EditorPrefs.SetString("ES3Editor.Window.currentWindow", currentWindow.name);
return currentWindow;
}
// Shows the Easy Save Home window if it's not been disabled.
// This method is called from the Postprocessor.
public static void OpenEditorWindowOnStart()
{
if(EditorPrefs.GetBool("Show ES3 Window on Start", true))
ES3Window.InitAndShowHome();
EditorPrefs.SetBool("Show ES3 Window on Start", false);
}
}
public abstract class SubWindow
{
public string name;
public EditorWindow parent;
public abstract void OnGUI();
public SubWindow(string name, EditorWindow parent)
{
this.name = name;
this.parent = parent;
}
public virtual void OnLostFocus()
{
}
public virtual void OnFocus()
{
}
public virtual void OnDestroy()
{
}
public virtual void OnHierarchyChange()
{
}
}
}

Some files were not shown because too many files have changed in this diff Show More