mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c92716f3e5 | ||
|
|
7538ebe506 | ||
|
|
1c5623ad7d | ||
|
|
eda6c9a1bf | ||
|
|
fc4aec4e4d | ||
|
|
84355c168f | ||
|
|
809e55de82 | ||
|
|
7d606ab1f6 | ||
|
|
14b006dc87 | ||
|
|
840de611dd | ||
|
|
67209cb26e | ||
|
|
caf8c9cf3c | ||
|
|
7746523600 | ||
|
|
44c1424072 | ||
|
|
ba4d258939 | ||
|
|
5e89df5e60 | ||
|
|
8b0a6caa14 | ||
|
|
0fd5217fb8 | ||
|
|
33afb8c794 | ||
|
|
3b62ced28c | ||
|
|
a7edeeb319 | ||
|
|
57e102524a | ||
|
|
cad2ab4d59 | ||
|
|
4e7f0c2e93 | ||
|
|
a8b73c2060 | ||
|
|
db88fcdb9c | ||
|
|
7f81ed8c44 | ||
|
|
52fbf4e704 | ||
|
|
b5403823c8 | ||
|
|
2731f81c09 | ||
|
|
7f651a8b44 | ||
|
|
206dcf9e1d | ||
|
|
5bfba92940 | ||
|
|
f173fb665b | ||
|
|
ffbadeec5e | ||
|
|
7c34cd743a | ||
|
|
64c1fef3bb | ||
|
|
f45927fd9a | ||
|
|
5fa165914c | ||
|
|
9ef0365414 | ||
|
|
c50ae9fbe8 | ||
|
|
4de7b57852 | ||
|
|
f1f1b37716 | ||
|
|
b88c7d5d10 | ||
|
|
4b78cd4726 |
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -100,9 +100,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 0.78431374}
|
||||
m_HighlightedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.78431374}
|
||||
m_PressedColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.78431374}
|
||||
m_SelectedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.9019608}
|
||||
m_HighlightedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.78431374}
|
||||
m_PressedColor: {r: 0.078431375, g: 0.19607843, b: 0.39215687, a: 0.78431374}
|
||||
m_SelectedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.78431374}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
|
||||
@@ -11,6 +11,18 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: IngameDebugConsole
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11414302, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11420596, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11437802, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11452418, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: toggleBinding.m_Id
|
||||
value: 06175ea3-1b47-4b6e-bcd7-4d191ce555d1
|
||||
@@ -19,6 +31,18 @@ PrefabInstance:
|
||||
propertyPath: toggleBinding.m_SingletonActionBindings.Array.data[0].m_Id
|
||||
value: badbacc7-7d97-42d1-ac38-980883100f6e
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11466918, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11472314, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11477250, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
@@ -235,6 +259,22 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114000010993257018, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114466839828933532, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114664465529608634, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114786672304321734, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Navigation.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
@@ -286,36 +326,3 @@ PrefabInstance:
|
||||
m_RemovedComponents:
|
||||
- {fileID: 11492840, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
--- !u!1 &2755888773260686779 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 109254, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
m_PrefabInstance: {fileID: 2755888773260713853}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &2755888771526933940
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755888773260686779}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_MoveRepeatDelay: 0.5
|
||||
m_MoveRepeatRate: 0.1
|
||||
m_XRTrackingOrigin: {fileID: 0}
|
||||
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||
m_DeselectOnBackgroundClick: 0
|
||||
m_PointerBehavior: 0
|
||||
@@ -166,7 +166,6 @@ GameObject:
|
||||
- component: {fileID: 311849592}
|
||||
- component: {fileID: 311849591}
|
||||
- component: {fileID: 311849595}
|
||||
- component: {fileID: 311849594}
|
||||
- component: {fileID: 7927220425085558669}
|
||||
m_Layer: 0
|
||||
m_Name: GameCamera
|
||||
@@ -242,102 +241,6 @@ AudioListener:
|
||||
m_GameObject: {fileID: 311849590}
|
||||
m_Enabled: 1
|
||||
--- !u!82 &311849595
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 311849590}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!82 &311849594
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -990,9 +893,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0, g: 0, b: 0, a: 0.7058824}
|
||||
m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 0.6666667}
|
||||
m_HighlightedColor: {r: 0.509434, g: 0.509434, b: 0.509434, a: 0.6666667}
|
||||
m_PressedColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.6666667}
|
||||
m_SelectedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.9019608}
|
||||
m_SelectedColor: {r: 0.38679248, g: 0.38679248, b: 0.38679248, a: 0.9019608}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -1203,9 +1106,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0, g: 0, b: 0, a: 0.7058824}
|
||||
m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 0.6666667}
|
||||
m_HighlightedColor: {r: 0.509434, g: 0.509434, b: 0.509434, a: 0.6666667}
|
||||
m_PressedColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.6666667}
|
||||
m_SelectedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.9019608}
|
||||
m_SelectedColor: {r: 0.38679248, g: 0.38679248, b: 0.38679248, a: 0.9019608}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -2571,7 +2474,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -200, y: -50}
|
||||
m_SizeDelta: {x: -160, y: -50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &280950566019251211
|
||||
CanvasRenderer:
|
||||
@@ -2628,12 +2531,12 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 22
|
||||
m_fontSize: 23
|
||||
m_fontSizeBase: 22
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 16
|
||||
m_fontSizeMax: 23
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
@@ -2705,8 +2608,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 105, y: 0}
|
||||
m_SizeDelta: {x: -410, y: -50}
|
||||
m_AnchoredPosition: {x: 117.5, y: 0}
|
||||
m_SizeDelta: {x: -395, y: -50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8762462625390650021
|
||||
CanvasRenderer:
|
||||
@@ -2763,12 +2666,12 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 22
|
||||
m_fontSize: 23
|
||||
m_fontSizeBase: 22
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 16
|
||||
m_fontSizeMax: 23
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
@@ -4132,7 +4035,6 @@ MonoBehaviour:
|
||||
mainCamera: {fileID: 311849592}
|
||||
curtainImage: {fileID: 147356289}
|
||||
musicSource: {fileID: 311849595}
|
||||
sfxSource: {fileID: 311849594}
|
||||
videoPlayerCanvas: {fileID: 5102776189801015787}
|
||||
videoPlayer: {fileID: 4844794614659113022}
|
||||
noteCanvasGroup: {fileID: 6941303344842138483}
|
||||
@@ -4246,8 +4148,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -105, y: 0}
|
||||
m_SizeDelta: {x: -410, y: -50}
|
||||
m_AnchoredPosition: {x: -117.5, y: 0}
|
||||
m_SizeDelta: {x: -395, y: -50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6439756746665821290
|
||||
CanvasRenderer:
|
||||
@@ -4304,12 +4206,12 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 22
|
||||
m_fontSize: 23
|
||||
m_fontSizeBase: 22
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 16
|
||||
m_fontSizeMax: 23
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
|
||||
@@ -100,9 +100,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0, g: 0, b: 0, a: 0.7058824}
|
||||
m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 0.6666667}
|
||||
m_PressedColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.6666667}
|
||||
m_SelectedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.9019608}
|
||||
m_HighlightedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.6666667}
|
||||
m_PressedColor: {r: 0.07450981, g: 0.19607843, b: 0.39215687, a: 0.6666667}
|
||||
m_SelectedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.9019608}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -317,11 +317,11 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 18
|
||||
m_fontSizeBase: 18
|
||||
m_fontSizeBase: 21
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontSizeMax: 21
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
|
||||
@@ -100,9 +100,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 0.78431374}
|
||||
m_HighlightedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.78431374}
|
||||
m_PressedColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.78431374}
|
||||
m_SelectedColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.9019608}
|
||||
m_HighlightedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.78431374}
|
||||
m_PressedColor: {r: 0.07450981, g: 0.19607843, b: 0.39215687, a: 0.78431374}
|
||||
m_SelectedColor: {r: 0.11764706, g: 0.29411766, b: 0.54901963, a: 0.9019608}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
#if UNITY_EDITOR_OSX
|
||||
|
||||
namespace Build.Editor
|
||||
{
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Set NSPrefersDisplaySafeAreaCompatibilityMode in XCode project settings (Info.plist)
|
||||
/// </summary>
|
||||
public static class SetDisplaySafeAreaCompatibilityModeProcessor
|
||||
{
|
||||
[PostProcessBuild]
|
||||
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
|
||||
{
|
||||
if (buildTarget != BuildTarget.StandaloneOSX) return;
|
||||
|
||||
// Get plist
|
||||
#if PAL3
|
||||
string plistPath = pathToBuiltProject + "/PAL3/Info.plist";
|
||||
#elif PAL3A
|
||||
string plistPath = pathToBuiltProject + "/PAL3A/Info.plist";
|
||||
#endif
|
||||
|
||||
PlistDocument plist = new PlistDocument();
|
||||
plist.ReadFromString(File.ReadAllText(plistPath));
|
||||
|
||||
// Get root
|
||||
PlistElementDict rootDict = plist.root;
|
||||
|
||||
rootDict.SetBoolean("NSPrefersDisplaySafeAreaCompatibilityMode", false);
|
||||
|
||||
// Write to file
|
||||
File.WriteAllText(plistPath, plist.WriteToString());
|
||||
|
||||
Debug.Log("NSPrefersDisplaySafeAreaCompatibilityMode set to NO.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acf008c658174728b71ceb4a88b76bc6
|
||||
timeCreated: 1664790861
|
||||
@@ -68,17 +68,17 @@ namespace Core.Algorithm.PathFinding
|
||||
}
|
||||
|
||||
// Init start node
|
||||
var startNode = nodeArray[GetIndex(from.x, from.y, gridSize.x)];
|
||||
Node startNode = nodeArray[GetIndex(from.x, from.y, gridSize.x)];
|
||||
startNode.GCost = 0;
|
||||
startNode.CalculateFCost();
|
||||
nodeArray[startNode.Index] = startNode;
|
||||
|
||||
var endNodeIndex = GetIndex(to.x, to.y, gridSize.x);
|
||||
|
||||
List<int> openList = new List<int>();
|
||||
List<int> closedList = new List<int>();
|
||||
var openList = new List<int>();
|
||||
var closedList = new List<int>();
|
||||
|
||||
Vector2Int[] neighbourOffset = new Vector2Int[8];
|
||||
var neighbourOffset = new Vector2Int[8];
|
||||
neighbourOffset[0] = new Vector2Int(+0, -1);
|
||||
neighbourOffset[1] = new Vector2Int(+0, +1);
|
||||
neighbourOffset[2] = new Vector2Int(-1, +0);
|
||||
@@ -93,7 +93,7 @@ namespace Core.Algorithm.PathFinding
|
||||
while (openList.Count > 0)
|
||||
{
|
||||
var currentNodeIndex = GetLowestCostFNodeIndex(openList, nodeArray);
|
||||
var currentNode = nodeArray[currentNodeIndex];
|
||||
Node currentNode = nodeArray[currentNodeIndex];
|
||||
if (currentNodeIndex == endNodeIndex)
|
||||
{
|
||||
break;
|
||||
@@ -113,7 +113,7 @@ namespace Core.Algorithm.PathFinding
|
||||
|
||||
for (var i = 0; i < neighbourOffset.Length; i++)
|
||||
{
|
||||
var offset = neighbourOffset[i];
|
||||
Vector2Int offset = neighbourOffset[i];
|
||||
var neighbourPosition = new Vector2Int(currentNode.X + offset.x, currentNode.Y + offset.y);
|
||||
|
||||
if (!IsPositionInsideGrid(neighbourPosition, gridSize))
|
||||
@@ -128,7 +128,7 @@ namespace Core.Algorithm.PathFinding
|
||||
continue;
|
||||
}
|
||||
|
||||
var neighbourNode = nodeArray[neighbourNodeIndex];
|
||||
Node neighbourNode = nodeArray[neighbourNodeIndex];
|
||||
if (neighbourNode.IsObstacle)
|
||||
{
|
||||
continue;
|
||||
@@ -152,7 +152,7 @@ namespace Core.Algorithm.PathFinding
|
||||
}
|
||||
}
|
||||
|
||||
var endNode = nodeArray[endNodeIndex];
|
||||
Node endNode = nodeArray[endNodeIndex];
|
||||
if (endNode.PreviousNodeIndex != -1)
|
||||
{
|
||||
var pathList = GetPath(nodeArray, endNode);
|
||||
@@ -172,10 +172,10 @@ namespace Core.Algorithm.PathFinding
|
||||
|
||||
private static int GetLowestCostFNodeIndex(IList<int> openList, ReadOnlySpan<Node> nodeArray)
|
||||
{
|
||||
var lowestCostNode = nodeArray[openList[0]];
|
||||
Node lowestCostNode = nodeArray[openList[0]];
|
||||
for (var i = 0; i < openList.Count; i++)
|
||||
{
|
||||
var currentNode = nodeArray[openList[i]];
|
||||
Node currentNode = nodeArray[openList[i]];
|
||||
if (currentNode.FCost < lowestCostNode.FCost)
|
||||
{
|
||||
lowestCostNode = currentNode;
|
||||
@@ -202,10 +202,10 @@ namespace Core.Algorithm.PathFinding
|
||||
else
|
||||
{
|
||||
List<Vector2Int> path = new () { new Vector2Int(endNode.X, endNode.Y) };
|
||||
var currentNode = endNode;
|
||||
Node currentNode = endNode;
|
||||
while (currentNode.PreviousNodeIndex != -1)
|
||||
{
|
||||
var previousNode = nodeArray[currentNode.PreviousNodeIndex];
|
||||
Node previousNode = nodeArray[currentNode.PreviousNodeIndex];
|
||||
path.Add(new Vector2Int(previousNode.X, previousNode.Y));
|
||||
currentNode = previousNode;
|
||||
}
|
||||
|
||||
@@ -111,12 +111,12 @@ namespace Core.Algorithm.PathFinding
|
||||
}
|
||||
}
|
||||
|
||||
var startNode = nodes[from.x, from.y];
|
||||
SearchNode startNode = nodes[from.x, from.y];
|
||||
startNode.IsObstacle = false;
|
||||
startNode.SearchType = SearchType.Start;
|
||||
startNode.GCost = 0;
|
||||
|
||||
var endNode = nodes[to.x, to.y];
|
||||
SearchNode endNode = nodes[to.x, to.y];
|
||||
endNode.IsObstacle = false;
|
||||
startNode.SearchType = SearchType.Goal;
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Core.Algorithm.PathFinding
|
||||
for (var i = 0; i < currentNeighbors.Count; i++)
|
||||
{
|
||||
SearchNode neighbor = currentNeighbors[i];
|
||||
if(neighbor.Closed)
|
||||
if (neighbor.Closed)
|
||||
{
|
||||
var newGCost = neighbor.GCost +
|
||||
heuristicFunc(new Vector2Int(neighbor.X, neighbor.Y), new Vector2Int(node.X, node.Y));
|
||||
@@ -165,7 +165,7 @@ namespace Core.Algorithm.PathFinding
|
||||
var neighbors = GetNeighbors(node, nodes);
|
||||
for (var i = 0; i < neighbors.Count; i++)
|
||||
{
|
||||
var neighbor = neighbors[i];
|
||||
SearchNode neighbor = neighbors[i];
|
||||
if (IsNeighborValid(neighbor))
|
||||
{
|
||||
if (neighbor.Opened == false)
|
||||
@@ -185,7 +185,7 @@ namespace Core.Algorithm.PathFinding
|
||||
}
|
||||
|
||||
var path = new List<Vector2Int>();
|
||||
var lastNode = GetNode(endNode.Position, nodes);
|
||||
SearchNode lastNode = GetNode(endNode.Position, nodes);
|
||||
while (lastNode != null)
|
||||
{
|
||||
path.Add(new Vector2Int(lastNode.X, lastNode.Y));
|
||||
@@ -229,7 +229,7 @@ namespace Core.Algorithm.PathFinding
|
||||
SearchNode startNode,
|
||||
Func<Vector2Int, Vector2Int, int> heuristicFunc)
|
||||
{
|
||||
var parent = (currentNode.X == startNode.X && currentNode.Y == startNode.Y) ?
|
||||
SearchNode parent = (currentNode.X == startNode.X && currentNode.Y == startNode.Y) ?
|
||||
startNode : currentNode.Parent;
|
||||
|
||||
float gCost = parent.GCost +
|
||||
@@ -264,7 +264,7 @@ namespace Core.Algorithm.PathFinding
|
||||
List<SearchNode> result,
|
||||
SearchNode[,] nodes)
|
||||
{
|
||||
var node = GetNode(curtPos.x + dx, curtPos.y + dy, nodes);
|
||||
SearchNode node = GetNode(curtPos.x + dx, curtPos.y + dy, nodes);
|
||||
|
||||
if (node is {IsObstacle: false})
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace Core.Algorithm.PathFinding
|
||||
return true;
|
||||
}
|
||||
|
||||
var node = GetNode(x0, y0, nodes);
|
||||
SearchNode node = GetNode(x0, y0, nodes);
|
||||
if (node is {IsObstacle: true})
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -531,7 +531,7 @@
|
||||
lock (_queue)
|
||||
{
|
||||
//Copy to a separate list because we don't want to 'yield return' inside a lock
|
||||
foreach(var node in _queue)
|
||||
foreach(SimpleNode node in _queue)
|
||||
{
|
||||
queueData.Add(node.Data);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace Core.Animation
|
||||
float to,
|
||||
float duration,
|
||||
AnimationCurveType curveType,
|
||||
Action<float> onValueChanged)
|
||||
Action<float> onValueChanged,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (Mathf.Abs(duration) < Mathf.Epsilon)
|
||||
{
|
||||
@@ -45,7 +46,7 @@ namespace Core.Animation
|
||||
}
|
||||
|
||||
var timePast = 0f;
|
||||
while (timePast < duration)
|
||||
while (timePast < duration && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var newValue = Mathf.Lerp(from, to,
|
||||
GetInterpolationRatio(timePast / duration, curveType));
|
||||
@@ -54,7 +55,10 @@ namespace Core.Animation
|
||||
yield return null;
|
||||
}
|
||||
|
||||
onValueChanged?.Invoke(to);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
onValueChanged?.Invoke(to);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
@@ -64,7 +68,7 @@ namespace Core.Animation
|
||||
AnimationCurveType curveType = AnimationCurveType.Linear,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var oldPosition = target.position;
|
||||
Vector3 oldPosition = target.position;
|
||||
|
||||
var timePast = 0f;
|
||||
while (timePast < duration && target != null && !cancellationToken.IsCancellationRequested)
|
||||
@@ -79,14 +83,18 @@ namespace Core.Animation
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public static IEnumerator ShakeTransform(Transform target, float duration, float amplitude,
|
||||
bool shakeOnXAxis, bool shakeOnYAxis, bool shakeOnZAxis)
|
||||
public static IEnumerator ShakeTransform(Transform target,
|
||||
float duration,
|
||||
float amplitude,
|
||||
bool shakeOnXAxis,
|
||||
bool shakeOnYAxis,
|
||||
bool shakeOnZAxis)
|
||||
{
|
||||
var originalPosition = target.localPosition;
|
||||
Vector3 originalPosition = target.localPosition;
|
||||
|
||||
while (duration > 0 && target != null)
|
||||
{
|
||||
var delta = UnityEngine.Random.insideUnitSphere * amplitude;
|
||||
Vector3 delta = UnityEngine.Random.insideUnitSphere * amplitude;
|
||||
target.localPosition = originalPosition + new Vector3(
|
||||
shakeOnXAxis ? delta.x : 0f,
|
||||
shakeOnYAxis ? delta.y : 0f,
|
||||
@@ -108,16 +116,16 @@ namespace Core.Animation
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var distance = Vector3.Distance(target.position, centerPoint);
|
||||
var startRotation = target.rotation;
|
||||
Quaternion startRotation = target.rotation;
|
||||
|
||||
var timePast = 0f;
|
||||
while (timePast < duration && target != null && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var rotation = Quaternion.Lerp(startRotation, toRotation,
|
||||
Quaternion rotation = Quaternion.Lerp(startRotation, toRotation,
|
||||
GetInterpolationRatio(timePast / duration, curveType));
|
||||
|
||||
var direction = (rotation * Vector3.forward).normalized;
|
||||
var newPosition = centerPoint + direction * -(distance + (timePast / duration) * distanceDelta);
|
||||
Vector3 direction = (rotation * Vector3.forward).normalized;
|
||||
Vector3 newPosition = centerPoint + direction * -(distance + (timePast / duration) * distanceDelta);
|
||||
|
||||
target.rotation = rotation;
|
||||
target.position = newPosition;
|
||||
@@ -141,12 +149,12 @@ namespace Core.Animation
|
||||
AnimationCurveType curveType,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var startRotation = target.rotation;
|
||||
Quaternion startRotation = target.rotation;
|
||||
|
||||
var timePast = 0f;
|
||||
while (timePast < duration && target != null && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var rotation = Quaternion.Lerp(startRotation, toRotation,
|
||||
Quaternion rotation = Quaternion.Lerp(startRotation, toRotation,
|
||||
GetInterpolationRatio(timePast / duration, curveType));
|
||||
|
||||
target.rotation = rotation;
|
||||
|
||||
@@ -34,7 +34,15 @@ namespace Core.DataLoader
|
||||
}
|
||||
else
|
||||
{
|
||||
callback?.Invoke(DownloadHandlerAudioClip.GetContent(request));
|
||||
try
|
||||
{
|
||||
AudioClip audioClip = DownloadHandlerAudioClip.GetContent(request);
|
||||
callback?.Invoke(audioClip);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Failed to get audio clip: {filePath} with exception: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Core.DataLoader
|
||||
throw new ArgumentException($"Not a valid DXT file.");
|
||||
}
|
||||
|
||||
var header = DxtHeader.ReadHeader(reader);
|
||||
DxtHeader header = DxtHeader.ReadHeader(reader);
|
||||
var format = header.DxtPixelFormat.Format;
|
||||
hasAlphaChannel = format == "DXT1";
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Core.DataLoader
|
||||
public Texture2D ToTexture2D()
|
||||
{
|
||||
if (_rawData == null) return null;
|
||||
Texture2D texture = new Texture2D(_width, _height, _format, false);
|
||||
Texture2D texture = new Texture2D(_width, _height, _format, mipChain: false);
|
||||
texture.LoadRawTextureData(_rawData);
|
||||
texture.Apply();
|
||||
return texture;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Core.DataLoader
|
||||
public Texture2D ToTexture2D()
|
||||
{
|
||||
if (_pixels == null) return null;
|
||||
var texture = new Texture2D(_width, _height);
|
||||
var texture = new Texture2D(_width, _height, TextureFormat.RGBA32, mipChain: false);
|
||||
texture.SetPixels32(_pixels);
|
||||
texture.Apply();
|
||||
return texture;
|
||||
|
||||
@@ -111,14 +111,17 @@ namespace Core.DataReader.Bmp
|
||||
|
||||
public Texture2D ToTexture2D()
|
||||
{
|
||||
var tex = new Texture2D(info.absWidth, info.absHeight);
|
||||
var texture = new Texture2D(info.absWidth,
|
||||
info.absHeight,
|
||||
TextureFormat.RGBA32,
|
||||
mipChain: false);
|
||||
|
||||
if (info.height < 0)
|
||||
FlipImage();
|
||||
|
||||
tex.SetPixels32(imageData);
|
||||
tex.Apply();
|
||||
return tex;
|
||||
texture.SetPixels32(imageData);
|
||||
texture.Apply();
|
||||
return texture;
|
||||
}
|
||||
|
||||
// flip image if height is negative
|
||||
@@ -141,10 +144,10 @@ namespace Core.DataReader.Bmp
|
||||
|
||||
public void ReplaceColor(Color32 aColorToSearch, Color32 aReplacementColor)
|
||||
{
|
||||
var s = aColorToSearch;
|
||||
Color32 s = aColorToSearch;
|
||||
for (int i = 0; i < imageData.Length; i++)
|
||||
{
|
||||
var c = imageData[i];
|
||||
Color32 c = imageData[i];
|
||||
if (c.r == s.r && c.g == s.g && c.b == s.b && c.a == s.a)
|
||||
imageData[i] = aReplacementColor;
|
||||
}
|
||||
@@ -167,7 +170,7 @@ namespace Core.DataReader.Bmp
|
||||
|
||||
public BMPImage LoadBmp(string aFileName)
|
||||
{
|
||||
using var file = File.OpenRead(aFileName);
|
||||
using FileStream file = File.OpenRead(aFileName);
|
||||
return LoadBmp(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,21 +23,20 @@ namespace Core.DataReader.Cpk
|
||||
private const uint SUPPORTED_CPK_VERSION = 1;
|
||||
private const uint CPK_HEADER_MAGIC = 0x_1A_54_53_52; // CPK header magic label
|
||||
private const int CPK_DEFAULT_MAX_NUM_OF_FILE = 32768; // Max number of files per archive
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
|
||||
private readonly string _filePath;
|
||||
private readonly CrcHash _crcHash;
|
||||
private readonly int _codepage;
|
||||
private Dictionary<uint, CpkTableEntity> _tableEntities;
|
||||
|
||||
private readonly Dictionary<uint, byte[]> _fileNameMap = new ();
|
||||
private readonly Dictionary<uint, uint> _crcToTableIndexMap = new ();
|
||||
private readonly Dictionary<uint, HashSet<uint>> _fatherCrcToChildCrcTableIndexMap = new ();
|
||||
|
||||
private readonly CrcHash _crcHash;
|
||||
|
||||
|
||||
private bool _archiveInMemory;
|
||||
private byte[] _archiveData;
|
||||
|
||||
public CpkArchive(string cpkFilePath, CrcHash crcHash)
|
||||
public CpkArchive(string cpkFilePath, CrcHash crcHash, int codepage)
|
||||
{
|
||||
if (!File.Exists(cpkFilePath))
|
||||
{
|
||||
@@ -46,6 +45,7 @@ namespace Core.DataReader.Cpk
|
||||
|
||||
_filePath = cpkFilePath;
|
||||
_crcHash = crcHash;
|
||||
_codepage = codepage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +101,7 @@ namespace Core.DataReader.Cpk
|
||||
/// <returns>True if file exists</returns>
|
||||
public bool FileExists(string fileVirtualPath)
|
||||
{
|
||||
var crc = _crcHash.ComputeCrc32Hash(fileVirtualPath.ToLower());
|
||||
var crc = _crcHash.ComputeCrc32Hash(fileVirtualPath.ToLower(), _codepage);
|
||||
return _crcToTableIndexMap.ContainsKey(crc);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Core.DataReader.Cpk
|
||||
|
||||
private byte[] ReadAllBytesUsingInMemoryCache(string fileVirtualPath)
|
||||
{
|
||||
var entity = ValidateAndGetTableEntity(fileVirtualPath);
|
||||
CpkTableEntity entity = ValidateAndGetTableEntity(fileVirtualPath);
|
||||
|
||||
byte[] data;
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Core.DataReader.Cpk
|
||||
|
||||
private byte[] GetFileContent(string fileVirtualPath)
|
||||
{
|
||||
var entity = ValidateAndGetTableEntity(fileVirtualPath);
|
||||
CpkTableEntity entity = ValidateAndGetTableEntity(fileVirtualPath);
|
||||
return GetFileContentInternal(entity);
|
||||
}
|
||||
|
||||
@@ -173,13 +173,13 @@ namespace Core.DataReader.Cpk
|
||||
|
||||
private CpkTableEntity ValidateAndGetTableEntity(string fileVirtualPath)
|
||||
{
|
||||
var crc = _crcHash.ComputeCrc32Hash(fileVirtualPath.ToLower());
|
||||
var crc = _crcHash.ComputeCrc32Hash(fileVirtualPath.ToLower(), _codepage);
|
||||
if (!_crcToTableIndexMap.ContainsKey(crc))
|
||||
{
|
||||
throw new ArgumentException($"<{fileVirtualPath}> does not exists in the archive.");
|
||||
}
|
||||
|
||||
var entity = _tableEntities[_crcToTableIndexMap[crc]];
|
||||
CpkTableEntity entity = _tableEntities[_crcToTableIndexMap[crc]];
|
||||
|
||||
if (entity.IsDirectory())
|
||||
{
|
||||
@@ -221,7 +221,7 @@ namespace Core.DataReader.Cpk
|
||||
|
||||
private void BuildCrcIndexMap()
|
||||
{
|
||||
foreach (var (index, entity) in _tableEntities)
|
||||
foreach ((var index, CpkTableEntity entity) in _tableEntities)
|
||||
{
|
||||
_crcToTableIndexMap[entity.CRC] = index;
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Core.DataReader.Cpk
|
||||
FileOptions.RandomAccess);
|
||||
}
|
||||
|
||||
foreach (var entity in _tableEntities.Values)
|
||||
foreach (CpkTableEntity entity in _tableEntities.Values)
|
||||
{
|
||||
long extraInfoOffset = entity.StartPos + entity.PackedSize;
|
||||
var extraInfo = new byte[entity.ExtraInfoSize];
|
||||
@@ -286,13 +286,13 @@ namespace Core.DataReader.Cpk
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (rootPath != string.Empty) rootPath += CpkConstants.CpkDirectorySeparatorChar;
|
||||
if (rootPath != string.Empty) rootPath += CpkConstants.DirectorySeparator;
|
||||
|
||||
foreach (var childCrc in _fatherCrcToChildCrcTableIndexMap[fatherCrc])
|
||||
{
|
||||
var index = _crcToTableIndexMap[childCrc];
|
||||
var child = _tableEntities[index];
|
||||
var fileName = Encoding.GetEncoding(GBK_CODE_PAGE).GetString(_fileNameMap[child.CRC]);
|
||||
CpkTableEntity child = _tableEntities[index];
|
||||
var fileName = Encoding.GetEncoding(_codepage).GetString(_fileNameMap[child.CRC]);
|
||||
|
||||
var virtualPath = rootPath + fileName;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Core.DataReader.Cpk
|
||||
{
|
||||
public static class CpkConstants
|
||||
{
|
||||
public const char CpkDirectorySeparatorChar = '\\';
|
||||
public const char DirectorySeparator = '\\';
|
||||
|
||||
public const string FileExtension = ".cpk";
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ namespace Core.DataReader.Cpk
|
||||
{
|
||||
private const uint CRC_TABLE_MAX = 256;
|
||||
private const uint POLYNOMIAL = 0x04C11DB7; // CRC seed
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
|
||||
private static readonly uint[] CrcTable = new uint[CRC_TABLE_MAX];
|
||||
private bool _initialized;
|
||||
@@ -44,10 +43,10 @@ namespace Core.DataReader.Cpk
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
public uint ComputeCrc32Hash(string str)
|
||||
public uint ComputeCrc32Hash(string str, int codepage)
|
||||
{
|
||||
//Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
return ComputeCrc32HashInternal(Encoding.GetEncoding(GBK_CODE_PAGE).GetBytes(str));
|
||||
return ComputeCrc32HashInternal(Encoding.GetEncoding(codepage).GetBytes(str));
|
||||
}
|
||||
|
||||
private unsafe uint ComputeCrc32HashInternal(byte[] data)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Core.DataReader.Cvd
|
||||
|
||||
public static class CvdFileReader
|
||||
{
|
||||
public static CvdFile Read(byte[] data)
|
||||
public static CvdFile Read(byte[] data, int codepage)
|
||||
{
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
using var reader = new UnsafeBinaryReader(data);
|
||||
@@ -43,7 +43,7 @@ namespace Core.DataReader.Cvd
|
||||
var rootNodes = new List<CvdGeometryNode>();
|
||||
for (var i = 0; i < numberONodes; i++)
|
||||
{
|
||||
ReadGeometryNodes(reader, version, rootNodes, ref animationDuration);
|
||||
ReadGeometryNodes(reader, version, rootNodes, ref animationDuration, codepage);
|
||||
}
|
||||
|
||||
return new CvdFile(animationDuration, rootNodes.ToArray());
|
||||
@@ -53,12 +53,14 @@ namespace Core.DataReader.Cvd
|
||||
private static void ReadGeometryNodes(UnsafeBinaryReader reader,
|
||||
float version,
|
||||
List<CvdGeometryNode> rootNodes,
|
||||
ref float animationDuration)
|
||||
ref float animationDuration,
|
||||
int codepage)
|
||||
#else
|
||||
private static void ReadGeometryNodes(BinaryReader reader,
|
||||
float version,
|
||||
List<CvdGeometryNode> rootNodes,
|
||||
ref float animationDuration)
|
||||
ref float animationDuration,
|
||||
int codepage)
|
||||
#endif
|
||||
{
|
||||
CvdGeometryNode parentNode = default;
|
||||
@@ -66,7 +68,7 @@ namespace Core.DataReader.Cvd
|
||||
var isGeometryNode = reader.ReadByte();
|
||||
if (isGeometryNode == 1)
|
||||
{
|
||||
parentNode = ReadGeometryNode(reader, version, ref animationDuration);
|
||||
parentNode = ReadGeometryNode(reader, version, ref animationDuration, codepage);
|
||||
parentNode.IsGeometryNode = true;
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ namespace Core.DataReader.Cvd
|
||||
var children = new List<CvdGeometryNode>();
|
||||
for (var i = 0; i < numberOfChildNodes; i++)
|
||||
{
|
||||
ReadGeometryNodes(reader, version, children, ref animationDuration);
|
||||
ReadGeometryNodes(reader, version, children, ref animationDuration, codepage);
|
||||
}
|
||||
|
||||
parentNode.Children = children.ToArray();
|
||||
@@ -85,11 +87,13 @@ namespace Core.DataReader.Cvd
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static CvdGeometryNode ReadGeometryNode(UnsafeBinaryReader reader,
|
||||
float version,
|
||||
ref float animationDuration)
|
||||
ref float animationDuration,
|
||||
int codepage)
|
||||
#else
|
||||
private static CvdGeometryNode ReadGeometryNode(BinaryReader reader,
|
||||
float version,
|
||||
ref float animationDuration)
|
||||
ref float animationDuration,
|
||||
int codepage)
|
||||
#endif
|
||||
{
|
||||
var positionKeySize = Mathf.Max(
|
||||
@@ -118,7 +122,7 @@ namespace Core.DataReader.Cvd
|
||||
|
||||
var scale = reader.ReadSingle();
|
||||
|
||||
var mesh = ReadMesh(reader, version);
|
||||
CvdMesh mesh = ReadMesh(reader, version, codepage);
|
||||
if (mesh.AnimationTimeKeys.Last() > animationDuration) animationDuration = mesh.AnimationTimeKeys.Last();
|
||||
|
||||
var transformMatrix = new GameBoxMatrix4X4()
|
||||
@@ -178,7 +182,7 @@ namespace Core.DataReader.Cvd
|
||||
|
||||
for (var i = 0; i < frameInfos.Length; i++)
|
||||
{
|
||||
var (type, data) = frameInfos[i];
|
||||
(CvdAnimationKeyType type, var data) = frameInfos[i];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -232,14 +236,14 @@ namespace Core.DataReader.Cvd
|
||||
|
||||
for (var i = 0; i < frameInfos.Length; i++)
|
||||
{
|
||||
var (type, data) = frameInfos[i];
|
||||
(CvdAnimationKeyType type, var data) = frameInfos[i];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CvdAnimationKeyType.Tcb:
|
||||
{
|
||||
var rotationKey = Utility.ReadStruct<CvdTcbRotationKey>(data);
|
||||
var quaternion = Quaternion.AngleAxis(rotationKey.Angle, rotationKey.Axis);
|
||||
Quaternion quaternion = Quaternion.AngleAxis(rotationKey.Angle, rotationKey.Axis);
|
||||
rotationKeyFrames[i] = new CvdAnimationRotationKeyFrame()
|
||||
{
|
||||
KeyType = type,
|
||||
@@ -293,7 +297,7 @@ namespace Core.DataReader.Cvd
|
||||
|
||||
for (var i = 0; i < frameInfos.Length; i++)
|
||||
{
|
||||
var (type, data) = frameInfos[i];
|
||||
(CvdAnimationKeyType type, var data) = frameInfos[i];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -340,9 +344,9 @@ namespace Core.DataReader.Cvd
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static CvdMesh ReadMesh(UnsafeBinaryReader reader, float version)
|
||||
private static CvdMesh ReadMesh(UnsafeBinaryReader reader, float version, int codepage)
|
||||
#else
|
||||
private static CvdMesh ReadMesh(BinaryReader reader, float version)
|
||||
private static CvdMesh ReadMesh(BinaryReader reader, float version, int codepage)
|
||||
#endif
|
||||
{
|
||||
var numberOfFrames = reader.ReadInt32();
|
||||
@@ -357,9 +361,9 @@ namespace Core.DataReader.Cvd
|
||||
var vertices = new CvdVertex[numberOfVertices];
|
||||
for (var j = 0; j < numberOfVertices; j++)
|
||||
{
|
||||
var uv = reader.ReadVector2();
|
||||
var normal = reader.ReadVector3();
|
||||
var position = reader.ReadVector3();
|
||||
Vector2 uv = reader.ReadVector2();
|
||||
Vector3 normal = reader.ReadVector3();
|
||||
Vector3 position = reader.ReadVector3();
|
||||
|
||||
vertices[j] = new CvdVertex()
|
||||
{
|
||||
@@ -381,7 +385,7 @@ namespace Core.DataReader.Cvd
|
||||
var meshSections = new CvdMeshSection[numberOfMeshes];
|
||||
for (var i = 0; i < numberOfMeshes; i++)
|
||||
{
|
||||
meshSections[i] = ReadMeshSection(reader, version, frameVertices);
|
||||
meshSections[i] = ReadMeshSection(reader, version, frameVertices, codepage);
|
||||
}
|
||||
|
||||
return new CvdMesh()
|
||||
@@ -394,11 +398,13 @@ namespace Core.DataReader.Cvd
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static CvdMeshSection ReadMeshSection(UnsafeBinaryReader reader,
|
||||
float version,
|
||||
CvdVertex[][] allFrameVertices)
|
||||
CvdVertex[][] allFrameVertices,
|
||||
int codepage)
|
||||
#else
|
||||
private static CvdMeshSection ReadMeshSection(BinaryReader reader,
|
||||
float version,
|
||||
CvdVertex[][] allFrameVertices)
|
||||
CvdVertex[][] allFrameVertices,
|
||||
int codepage)
|
||||
#endif
|
||||
{
|
||||
var blendFlag = reader.ReadByte();
|
||||
@@ -412,7 +418,7 @@ namespace Core.DataReader.Cvd
|
||||
Power = reader.ReadSingle()
|
||||
};
|
||||
|
||||
var textureName = reader.ReadGbkString(64);
|
||||
var textureName = reader.ReadString(64, codepage);
|
||||
|
||||
var numberOfIndices = reader.ReadInt32();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Core.DataReader.Ini
|
||||
IniData iniData = parser.ReadData(reader);
|
||||
|
||||
var actions = new List<ActorAction>();
|
||||
foreach (var section in iniData.Sections
|
||||
foreach (SectionData section in iniData.Sections
|
||||
.Where(s => s.SectionName.StartsWith(ACTION_SECTION_HEADER_PREFIX)))
|
||||
{
|
||||
actions.Add(new ActorAction()
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Core.DataReader.Mv3
|
||||
|
||||
public static class Mv3FileReader
|
||||
{
|
||||
public static Mv3File Read(byte[] data)
|
||||
public static Mv3File Read(byte[] data, int codepage)
|
||||
{
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
using var reader = new UnsafeBinaryReader(data);
|
||||
@@ -54,26 +54,26 @@ namespace Core.DataReader.Mv3
|
||||
var animationEvents = new Mv3AnimationEvent[numberOfAnimationEvents];
|
||||
for (var i = 0; i < numberOfAnimationEvents; i++)
|
||||
{
|
||||
animationEvents[i] = ReadAnimationEvent(reader);
|
||||
animationEvents[i] = ReadAnimationEvent(reader, codepage);
|
||||
}
|
||||
|
||||
var tagNodes = new Mv3TagNode[numberOfTagNodes];
|
||||
for (var i = 0; i < numberOfTagNodes; i++)
|
||||
{
|
||||
tagNodes[i] = ReadTagNode(reader);
|
||||
tagNodes[i] = ReadTagNode(reader, codepage);
|
||||
}
|
||||
|
||||
var materials = new Mv3Material[numberOfMaterials];
|
||||
for (var i = 0; i < numberOfMaterials; i++)
|
||||
{
|
||||
materials[i] = ReadMaterial(reader);
|
||||
materials[i] = ReadMaterial(reader, codepage);
|
||||
}
|
||||
|
||||
var meshes = new Mv3Mesh[numberOfMeshes];
|
||||
var meshKeyFrames = new VertexAnimationKeyFrame[numberOfMeshes][];
|
||||
for (var i = 0; i < numberOfMeshes; i++)
|
||||
{
|
||||
var mesh = ReadMesh(reader);
|
||||
Mv3Mesh mesh = ReadMesh(reader, codepage);
|
||||
meshes[i] = mesh;
|
||||
meshKeyFrames[i] = CalculateKeyFrameVertices(mesh);
|
||||
}
|
||||
@@ -88,12 +88,12 @@ namespace Core.DataReader.Mv3
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static Mv3Mesh ReadMesh(UnsafeBinaryReader reader)
|
||||
private static Mv3Mesh ReadMesh(UnsafeBinaryReader reader, int codepage)
|
||||
#else
|
||||
private static Mv3Mesh ReadMesh(BinaryReader reader)
|
||||
private static Mv3Mesh ReadMesh(BinaryReader reader, int codepage)
|
||||
#endif
|
||||
{
|
||||
var name = reader.ReadGbkString(64);
|
||||
var name = reader.ReadString(64, codepage);
|
||||
var numberOfVertices = reader.ReadInt32();
|
||||
var boundBox = new GameBoxAABBox()
|
||||
{
|
||||
@@ -191,7 +191,7 @@ namespace Core.DataReader.Mv3
|
||||
|
||||
for (var i = 0; i < mv3Mesh.Attributes[0].IndexBuffers.Length; i++)
|
||||
{
|
||||
var indexBuffer = mv3Mesh.Attributes[0].IndexBuffers[i];
|
||||
Mv3IndexBuffer indexBuffer = mv3Mesh.Attributes[0].IndexBuffers[i];
|
||||
for (var j = 0; j < 3; j++)
|
||||
{
|
||||
var hash = indexBuffer.TriangleIndex[j] * texCoords.Length + indexBuffer.TexCoordIndex[j];
|
||||
@@ -205,8 +205,8 @@ namespace Core.DataReader.Mv3
|
||||
|
||||
for (var k = 0; k < mv3Mesh.Frames.Length; k++)
|
||||
{
|
||||
var frame = mv3Mesh.Frames[k];
|
||||
var vertex = frame.Vertices[indexBuffer.TriangleIndex[j]];
|
||||
Mv3VertFrame frame = mv3Mesh.Frames[k];
|
||||
Mv3Vert vertex = frame.Vertices[indexBuffer.TriangleIndex[j]];
|
||||
|
||||
keyFrameInfo[k].Add((GameBoxInterpreter
|
||||
.ToUnityVertex(new Vector3(vertex.X, vertex.Y, vertex.Z),
|
||||
@@ -238,12 +238,12 @@ namespace Core.DataReader.Mv3
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static Mv3TagNode ReadTagNode(UnsafeBinaryReader reader)
|
||||
private static Mv3TagNode ReadTagNode(UnsafeBinaryReader reader, int codepage)
|
||||
#else
|
||||
private static Mv3TagNode ReadTagNode(BinaryReader reader)
|
||||
private static Mv3TagNode ReadTagNode(BinaryReader reader, int codepage)
|
||||
#endif
|
||||
{
|
||||
var nodeName = reader.ReadGbkString(64);
|
||||
var nodeName = reader.ReadString(64, codepage);
|
||||
var flipScale = reader.ReadSingle();
|
||||
var numberOfFrames = reader.ReadInt32();
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace Core.DataReader.Mv3
|
||||
#endif
|
||||
{
|
||||
var tick = reader.ReadUInt32();
|
||||
var position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3());
|
||||
Vector3 position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3());
|
||||
|
||||
var rotation = new GameBoxQuaternion()
|
||||
{
|
||||
@@ -295,9 +295,9 @@ namespace Core.DataReader.Mv3
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static Mv3AnimationEvent ReadAnimationEvent(UnsafeBinaryReader reader)
|
||||
private static Mv3AnimationEvent ReadAnimationEvent(UnsafeBinaryReader reader, int codepage)
|
||||
#else
|
||||
private static Mv3AnimationEvent ReadAnimationEvent(BinaryReader reader)
|
||||
private static Mv3AnimationEvent ReadAnimationEvent(BinaryReader reader, int codepage)
|
||||
#endif
|
||||
{
|
||||
var tick = reader.ReadUInt32();
|
||||
@@ -306,14 +306,14 @@ namespace Core.DataReader.Mv3
|
||||
return new Mv3AnimationEvent()
|
||||
{
|
||||
Tick = tick,
|
||||
Name = Utility.ConvertToGbkString(name)
|
||||
Name = Utility.ConvertToString(name, codepage)
|
||||
};
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static Mv3Material ReadMaterial(UnsafeBinaryReader reader)
|
||||
private static Mv3Material ReadMaterial(UnsafeBinaryReader reader, int codepage)
|
||||
#else
|
||||
private static Mv3Material ReadMaterial(BinaryReader reader)
|
||||
private static Mv3Material ReadMaterial(BinaryReader reader, int codepage)
|
||||
#endif
|
||||
{
|
||||
var material = new GameBoxMaterial()
|
||||
@@ -342,7 +342,7 @@ namespace Core.DataReader.Mv3
|
||||
}
|
||||
else
|
||||
{
|
||||
textureName = reader.ReadGbkString(length);
|
||||
textureName = reader.ReadString(length, codepage);
|
||||
}
|
||||
|
||||
textureNames.Add(textureName);
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace Core.DataReader.Nav
|
||||
}
|
||||
}
|
||||
|
||||
var max = reader.ReadVector3();
|
||||
var min = reader.ReadVector3();
|
||||
Vector3 max = reader.ReadVector3();
|
||||
Vector3 min = reader.ReadVector3();
|
||||
|
||||
var width = reader.ReadInt32();
|
||||
var height = reader.ReadInt32();
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Core.DataReader.Pol
|
||||
|
||||
public static class PolFileReader
|
||||
{
|
||||
public static PolFile Read(byte[] data)
|
||||
public static PolFile Read(byte[] data, int codepage)
|
||||
{
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
using var reader = new UnsafeBinaryReader(data);
|
||||
@@ -41,7 +41,7 @@ namespace Core.DataReader.Pol
|
||||
{
|
||||
nodeInfos[i] = new PolGeometryNode
|
||||
{
|
||||
Name = reader.ReadGbkString(32),
|
||||
Name = reader.ReadString(32, codepage),
|
||||
Position = reader.ReadVector3(),
|
||||
Radius = reader.ReadSingle(),
|
||||
Offset = reader.ReadInt32()
|
||||
@@ -57,7 +57,7 @@ namespace Core.DataReader.Pol
|
||||
tagNodes = new TagNode[numberOfTagNodes];
|
||||
for (var i = 0; i < numberOfTagNodes; i++)
|
||||
{
|
||||
tagNodes[i] = ReadTagNodeInfo(reader);
|
||||
tagNodes[i] = ReadTagNodeInfo(reader, codepage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,27 +65,27 @@ namespace Core.DataReader.Pol
|
||||
var meshInfos = new PolMesh[numberOfNodes];
|
||||
for (var i = 0; i < numberOfNodes; i++)
|
||||
{
|
||||
meshInfos[i] = ReadMeshData(reader, version);
|
||||
meshInfos[i] = ReadMeshData(reader, version, codepage);
|
||||
}
|
||||
|
||||
return new PolFile(version, nodeInfos, meshInfos, tagNodes);
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static TagNode ReadTagNodeInfo(UnsafeBinaryReader reader)
|
||||
private static TagNode ReadTagNodeInfo(UnsafeBinaryReader reader, int codepage)
|
||||
#else
|
||||
private static TagNode ReadTagNodeInfo(BinaryReader reader)
|
||||
private static TagNode ReadTagNodeInfo(BinaryReader reader, int codepage)
|
||||
#endif
|
||||
{
|
||||
var name = reader.ReadGbkString(32);
|
||||
var transformMatrix = GameBoxInterpreter.ToUnityMatrix4x4(new GameBoxMatrix4X4()
|
||||
var name = reader.ReadString(32, codepage);
|
||||
Matrix4x4 transformMatrix = GameBoxInterpreter.ToUnityMatrix4x4(new GameBoxMatrix4X4()
|
||||
{
|
||||
Xx = reader.ReadSingle(), Xy = reader.ReadSingle(), Xz = reader.ReadSingle(), Xw = reader.ReadSingle(),
|
||||
Yx = reader.ReadSingle(), Yy = reader.ReadSingle(), Yz = reader.ReadSingle(), Yw = reader.ReadSingle(),
|
||||
Zx = reader.ReadSingle(), Zy = reader.ReadSingle(), Zz = reader.ReadSingle(), Zw = reader.ReadSingle(),
|
||||
Tx = reader.ReadSingle(), Ty = reader.ReadSingle(), Tz = reader.ReadSingle(), Tw = reader.ReadSingle()
|
||||
});
|
||||
var origin = GameBoxInterpreter.ToUnityPosition(transformMatrix.MultiplyPoint(Vector3.zero));
|
||||
Vector3 origin = GameBoxInterpreter.ToUnityPosition(transformMatrix.MultiplyPoint(Vector3.zero));
|
||||
|
||||
var type = reader.ReadInt32();
|
||||
var customColorStringLength = reader.ReadInt32();
|
||||
@@ -116,9 +116,9 @@ namespace Core.DataReader.Pol
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static PolMesh ReadMeshData(UnsafeBinaryReader reader, int version)
|
||||
private static PolMesh ReadMeshData(UnsafeBinaryReader reader, int version, int codepage)
|
||||
#else
|
||||
private static PolMesh ReadMeshData(BinaryReader reader, int version)
|
||||
private static PolMesh ReadMeshData(BinaryReader reader, int version, int codepage)
|
||||
#endif
|
||||
{
|
||||
var boundBox = new GameBoxAABBox()
|
||||
@@ -217,7 +217,7 @@ namespace Core.DataReader.Pol
|
||||
|
||||
for (var i = 0; i < numberOfTextures; i++)
|
||||
{
|
||||
textureInfos[i] = ReadTextureInfo(reader, version);
|
||||
textureInfos[i] = ReadTextureInfo(reader, version, codepage);
|
||||
}
|
||||
|
||||
return new PolMesh
|
||||
@@ -230,9 +230,9 @@ namespace Core.DataReader.Pol
|
||||
}
|
||||
|
||||
#if USE_UNSAFE_BINARY_READER
|
||||
private static PolTexture ReadTextureInfo(UnsafeBinaryReader reader, int version)
|
||||
private static PolTexture ReadTextureInfo(UnsafeBinaryReader reader, int version, int codepage)
|
||||
#else
|
||||
private static PolTexture ReadTextureInfo(BinaryReader reader, int version)
|
||||
private static PolTexture ReadTextureInfo(BinaryReader reader, int version, int codepage)
|
||||
#endif
|
||||
{
|
||||
var blendFlag = reader.ReadUInt32();
|
||||
@@ -255,7 +255,7 @@ namespace Core.DataReader.Pol
|
||||
|
||||
for (var i = 0; i < numberOfTextures; i++)
|
||||
{
|
||||
var textureName = reader.ReadGbkString(64);
|
||||
var textureName = reader.ReadString(64, codepage);
|
||||
textureNames[i] = textureName;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,18 +43,20 @@ namespace Core.DataReader.Sce
|
||||
{
|
||||
public SceIndex[] Indexes { get; }
|
||||
public Dictionary<uint, SceScriptBlock> ScriptBlocks { get; }
|
||||
public int Codepage { get; }
|
||||
|
||||
public SceFile(SceIndex[] indexes, SceScriptBlock[] scriptBlocks)
|
||||
public SceFile(SceIndex[] indexes, SceScriptBlock[] scriptBlocks, int codepage)
|
||||
{
|
||||
Indexes = indexes;
|
||||
|
||||
var scriptBlocksDic = new Dictionary<uint, SceScriptBlock>();
|
||||
foreach (var block in scriptBlocks)
|
||||
foreach (SceScriptBlock block in scriptBlocks)
|
||||
{
|
||||
scriptBlocksDic[block.Id] = block;
|
||||
}
|
||||
|
||||
ScriptBlocks = scriptBlocksDic;
|
||||
Codepage = codepage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Core.DataReader.Sce
|
||||
|
||||
public static class SceFileReader
|
||||
{
|
||||
public static SceFile Read(Stream stream)
|
||||
public static SceFile Read(Stream stream, int codepage)
|
||||
{
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
@@ -34,25 +34,25 @@ namespace Core.DataReader.Sce
|
||||
var indexes = new SceIndex[numberOfBlocks];
|
||||
for (var i = 0; i < numberOfBlocks; i++)
|
||||
{
|
||||
indexes[i] = ReadSceIndex(reader);
|
||||
indexes[i] = ReadSceIndex(reader, codepage);
|
||||
}
|
||||
|
||||
var scriptBlocks = new SceScriptBlock[numberOfBlocks];
|
||||
for (var i = 0; i < numberOfBlocks; i++)
|
||||
{
|
||||
scriptBlocks[i] = ReadScriptBlock(reader, indexes[i]);
|
||||
scriptBlocks[i] = ReadScriptBlock(reader, indexes[i], codepage);
|
||||
}
|
||||
|
||||
return new SceFile(indexes, scriptBlocks);
|
||||
return new SceFile(indexes, scriptBlocks, codepage);
|
||||
}
|
||||
|
||||
private static SceScriptBlock ReadScriptBlock(BinaryReader reader, SceIndex sceIndex)
|
||||
private static SceScriptBlock ReadScriptBlock(BinaryReader reader, SceIndex sceIndex, int codepage)
|
||||
{
|
||||
reader.BaseStream.Seek(sceIndex.Offset, SeekOrigin.Begin);
|
||||
|
||||
var id = reader.ReadUInt32();
|
||||
var descriptionLength = reader.ReadUInt16();
|
||||
var description = reader.ReadGbkString(descriptionLength);
|
||||
var description = reader.ReadString(descriptionLength, codepage);
|
||||
var numberOfUserVars = reader.ReadUInt16();
|
||||
|
||||
var userVarInfos = new SceUserVarInfo[numberOfUserVars];
|
||||
@@ -86,13 +86,13 @@ namespace Core.DataReader.Sce
|
||||
};
|
||||
}
|
||||
|
||||
private static SceIndex ReadSceIndex(BinaryReader reader)
|
||||
private static SceIndex ReadSceIndex(BinaryReader reader, int codepage)
|
||||
{
|
||||
return new SceIndex()
|
||||
{
|
||||
Id = reader.ReadUInt32(),
|
||||
Offset = reader.ReadUInt32(),
|
||||
Description = reader.ReadGbkString(64)
|
||||
Description = reader.ReadString(64, codepage)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Core.DataReader.Scn
|
||||
RotatingStoneBeam = 7, // 旋传石梁 (一字型)
|
||||
RotatingWall = 8, // 旋转墙 (折尺型,JG13)
|
||||
PreciseTrigger = 9, // 精确触发点
|
||||
Tuyere = 10, // 风口
|
||||
WindBlower = 10, // 风口
|
||||
Pushable = 11, // 推箱子
|
||||
SpecialMechanism = 12, // 主角特技机关
|
||||
ImpulsiveMechanism = 13, // 冲撞
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Core.DataReader.Scn
|
||||
|
||||
public static class ScnFileReader
|
||||
{
|
||||
public static ScnFile Read(Stream stream)
|
||||
public static ScnFile Read(Stream stream, int codepage)
|
||||
{
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace Core.DataReader.Scn
|
||||
|
||||
var sceneInfo = new ScnSceneInfo()
|
||||
{
|
||||
CityName = reader.ReadGbkString(32),
|
||||
Name = reader.ReadGbkString(32),
|
||||
Model = reader.ReadGbkString(32),
|
||||
CityName = reader.ReadString(32, codepage),
|
||||
Name = reader.ReadString(32, codepage),
|
||||
Model = reader.ReadString(32, codepage),
|
||||
SceneType = (ScnSceneType) reader.ReadInt32(),
|
||||
LightMap = reader.ReadInt32(),
|
||||
SkyBox = reader.ReadUInt32(),
|
||||
@@ -45,7 +45,7 @@ namespace Core.DataReader.Scn
|
||||
var npcInfos = new ScnNpcInfo[numberOfNpc];
|
||||
for (var i = 0; i < numberOfNpc; i++)
|
||||
{
|
||||
var npcInfo = ReadNpcInfo(reader);
|
||||
ScnNpcInfo npcInfo = ReadNpcInfo(reader, codepage);
|
||||
if (npcInfo.Unknown1[0] != 0 ||
|
||||
npcInfo.Unknown1[1] != 0 ||
|
||||
npcInfo.Unknown2[0] != 0 ||
|
||||
@@ -61,21 +61,21 @@ namespace Core.DataReader.Scn
|
||||
var objInfos = new ScnObjectInfo[numberOfObjects];
|
||||
for (var i = 0; i < numberOfObjects; i++)
|
||||
{
|
||||
var sceneObject = ReadObjectInfo(reader);
|
||||
ScnObjectInfo sceneObject = ReadObjectInfo(reader, codepage);
|
||||
objInfos[i] = sceneObject;
|
||||
}
|
||||
|
||||
return new ScnFile(sceneInfo, npcInfos, objInfos);
|
||||
}
|
||||
|
||||
private static ScnNpcInfo ReadNpcInfo(BinaryReader reader)
|
||||
private static ScnNpcInfo ReadNpcInfo(BinaryReader reader, int codepage)
|
||||
{
|
||||
return new ScnNpcInfo()
|
||||
{
|
||||
Id = reader.ReadByte(),
|
||||
Kind = (ScnActorKind)reader.ReadByte(),
|
||||
Name = reader.ReadGbkString(32),
|
||||
Texture = reader.ReadGbkString(32),
|
||||
Name = reader.ReadString(32, codepage),
|
||||
Texture = reader.ReadString(32, codepage),
|
||||
Unknown1 = reader.ReadBytes(2),
|
||||
FacingDirection = reader.ReadSingle(),
|
||||
OnLayer = reader.ReadByte(),
|
||||
@@ -86,7 +86,7 @@ namespace Core.DataReader.Scn
|
||||
InitBehaviour = (ScnActorBehaviour) reader.ReadInt32(),
|
||||
ScriptId = reader.ReadUInt32(),
|
||||
PositionY = reader.ReadSingle(),
|
||||
InitAction = reader.ReadGbkString(16),
|
||||
InitAction = reader.ReadString(16, codepage),
|
||||
MonsterId = reader.ReadUInt32Array(3),
|
||||
MonsterNumber = reader.ReadUInt16(),
|
||||
MonsterRepeat = reader.ReadUInt16(),
|
||||
@@ -102,7 +102,7 @@ namespace Core.DataReader.Scn
|
||||
};
|
||||
}
|
||||
|
||||
private static ScnObjectInfo ReadObjectInfo(BinaryReader reader)
|
||||
private static ScnObjectInfo ReadObjectInfo(BinaryReader reader, int codepage)
|
||||
{
|
||||
#if PAL3
|
||||
return new ScnObjectInfo()
|
||||
@@ -112,7 +112,7 @@ namespace Core.DataReader.Scn
|
||||
Times = reader.ReadByte(),
|
||||
Switch = reader.ReadByte(),
|
||||
|
||||
Name = reader.ReadGbkString(32),
|
||||
Name = reader.ReadString(32, codepage),
|
||||
TriggerType = reader.ReadUInt16(),
|
||||
NonBlocking = reader.ReadUInt16(),
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Core.DataReader.Scn
|
||||
NeedLv = reader.ReadUInt16(),
|
||||
NeedWu = reader.ReadUInt16(),
|
||||
NeedAllOpen = reader.ReadUInt16(),
|
||||
FailedMessage = reader.ReadGbkString(16),
|
||||
FailedMessage = reader.ReadString(16, codepage),
|
||||
|
||||
ScriptId = reader.ReadUInt32(),
|
||||
Path = new ScnPath()
|
||||
@@ -149,7 +149,7 @@ namespace Core.DataReader.Scn
|
||||
},
|
||||
|
||||
LinkedObject = reader.ReadUInt16(),
|
||||
DependentSceneName = reader.ReadGbkString(32),
|
||||
DependentSceneName = reader.ReadString(32, codepage),
|
||||
DependentId = reader.ReadUInt16(),
|
||||
|
||||
BoundBox = new GameBoxAABBox()
|
||||
@@ -159,7 +159,7 @@ namespace Core.DataReader.Scn
|
||||
},
|
||||
|
||||
XRotation = reader.ReadSingle(),
|
||||
SfxName = reader.ReadGbkString(8),
|
||||
SfxName = reader.ReadString(8, codepage),
|
||||
EffectModelType = reader.ReadUInt32(),
|
||||
|
||||
ScriptChangeActive = reader.ReadUInt32(),
|
||||
@@ -175,7 +175,7 @@ namespace Core.DataReader.Scn
|
||||
Times = reader.ReadByte(),
|
||||
Switch = reader.ReadByte(),
|
||||
|
||||
Name = reader.ReadGbkString(32),
|
||||
Name = reader.ReadString(32, codepage),
|
||||
TriggerType = reader.ReadUInt16(),
|
||||
NonBlocking = reader.ReadUInt16(),
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Core.DataReader.Scn
|
||||
NeedLv = reader.ReadUInt16(),
|
||||
NeedWu = reader.ReadUInt16(),
|
||||
NeedAllOpen = reader.ReadUInt16(),
|
||||
FailedMessage = reader.ReadGbkString(16),
|
||||
FailedMessage = reader.ReadString(16, codepage),
|
||||
|
||||
// TODO
|
||||
Unknown2 = reader.ReadBytes(4),
|
||||
@@ -218,7 +218,7 @@ namespace Core.DataReader.Scn
|
||||
},
|
||||
|
||||
LinkedObject = reader.ReadUInt16(),
|
||||
DependentSceneName = reader.ReadGbkString(32),
|
||||
DependentSceneName = reader.ReadString(32, codepage),
|
||||
DependentId = reader.ReadUInt16(),
|
||||
|
||||
BoundBox = new GameBoxAABBox()
|
||||
@@ -229,7 +229,7 @@ namespace Core.DataReader.Scn
|
||||
|
||||
XRotation = reader.ReadSingle(),
|
||||
ZRotation = reader.ReadSingle(),
|
||||
SfxName = reader.ReadGbkString(8),
|
||||
SfxName = reader.ReadString(8, codepage),
|
||||
EffectModelType = reader.ReadUInt32(),
|
||||
|
||||
ScriptChangeActive = reader.ReadUInt32(),
|
||||
|
||||
@@ -14,8 +14,6 @@ namespace Core.Extensions
|
||||
/// </summary>
|
||||
public static class BinaryReaderExtension
|
||||
{
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
|
||||
public static Vector3 ReadVector3(this BinaryReader binaryReader)
|
||||
{
|
||||
var x = binaryReader.ReadSingle();
|
||||
@@ -86,13 +84,13 @@ namespace Core.Extensions
|
||||
return new string(binaryReader.ReadChars(count));
|
||||
}
|
||||
|
||||
public static string ReadGbkString(this BinaryReader binaryReader, int count)
|
||||
public static string ReadString(this BinaryReader binaryReader, int count, int codepage)
|
||||
{
|
||||
var strBytes = binaryReader.ReadBytes(count);
|
||||
var i = 0;
|
||||
var length = strBytes.Length;
|
||||
while (i < length && strBytes[i] != 0) i++;
|
||||
return Encoding.GetEncoding(GBK_CODE_PAGE).GetString(strBytes, 0, i);
|
||||
return Encoding.GetEncoding(codepage).GetString(strBytes, 0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ namespace Core.FileSystem
|
||||
|
||||
public CpkFileSystem(string rootPath, CrcHash crcHash)
|
||||
{
|
||||
rootPath = !string.IsNullOrEmpty(rootPath) ? rootPath : throw new ArgumentNullException(nameof(rootPath));
|
||||
crcHash = crcHash ?? throw new ArgumentNullException(nameof(crcHash));
|
||||
|
||||
if (!rootPath.EndsWith(Path.DirectorySeparatorChar))
|
||||
{
|
||||
rootPath += Path.DirectorySeparatorChar;
|
||||
@@ -53,18 +56,19 @@ namespace Core.FileSystem
|
||||
/// Mount a Cpk archive to the file system.
|
||||
/// </summary>
|
||||
/// <param name="cpkFileRelativePath">CPK file relative path</param>
|
||||
public void Mount(string cpkFileRelativePath)
|
||||
/// <param name="codepage">Codepage CPK file uses for encoding text info</param>
|
||||
public void Mount(string cpkFileRelativePath, int codepage)
|
||||
{
|
||||
var cpkFileName = Path.GetFileName(cpkFileRelativePath).ToLower();
|
||||
|
||||
if (_cpkArchives.ContainsKey(cpkFileName.ToLower()))
|
||||
if (_cpkArchives.ContainsKey(cpkFileName))
|
||||
{
|
||||
Debug.LogWarning($"{cpkFileRelativePath} already mounted.");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"CpkFileSystem mounting: {_rootPath + cpkFileRelativePath}");
|
||||
var cpkArchive = new CpkArchive(_rootPath + cpkFileRelativePath, _crcHash);
|
||||
var cpkArchive = new CpkArchive(_rootPath + cpkFileRelativePath, _crcHash, codepage);
|
||||
cpkArchive.Init();
|
||||
_cpkArchives[cpkFileName] = cpkArchive;
|
||||
}
|
||||
@@ -79,7 +83,7 @@ namespace Core.FileSystem
|
||||
{
|
||||
ParseFileVirtualPath(fileVirtualPath, out var cpkFileName, out var relativeVirtualPath);
|
||||
|
||||
if (_cpkArchives.ContainsKey(cpkFileName.ToLower()))
|
||||
if (_cpkArchives.ContainsKey(cpkFileName))
|
||||
{
|
||||
segmentedArchiveName = null;
|
||||
return false;
|
||||
@@ -87,7 +91,7 @@ namespace Core.FileSystem
|
||||
|
||||
// Check if the file exists in any of the segmented cpk archives.
|
||||
foreach (var subCpkPath in _cpkArchives.Keys
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^".cpk".Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^CpkConstants.FileExtension.Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var relativePathInSubCpk = relativeVirtualPath.Replace(cpkFileName, subCpkPath);
|
||||
if (_cpkArchives[subCpkPath].FileExists(relativePathInSubCpk))
|
||||
@@ -111,14 +115,14 @@ namespace Core.FileSystem
|
||||
{
|
||||
ParseFileVirtualPath(fileVirtualPath, out var cpkFileName, out var relativeVirtualPath);
|
||||
|
||||
if (_cpkArchives.ContainsKey(cpkFileName.ToLower()))
|
||||
if (_cpkArchives.ContainsKey(cpkFileName))
|
||||
{
|
||||
return _cpkArchives[cpkFileName].FileExists(relativeVirtualPath);
|
||||
}
|
||||
|
||||
// Check if the file exists in any of the segmented cpk archives.
|
||||
foreach (var subCpkPath in _cpkArchives.Keys
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^".cpk".Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^CpkConstants.FileExtension.Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var relativePathInSubCpk = relativeVirtualPath.Replace(cpkFileName, subCpkPath);
|
||||
if (_cpkArchives[subCpkPath].FileExists(relativePathInSubCpk))
|
||||
@@ -145,7 +149,7 @@ namespace Core.FileSystem
|
||||
|
||||
// Find and read the file content in segmented cpk archives.
|
||||
foreach (var subCpkPath in _cpkArchives.Keys
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^".cpk".Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(_ => _.StartsWith(cpkFileName[..^CpkConstants.FileExtension.Length] + '_', StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var relativePathInSubCpk = relativeVirtualPath.Replace(cpkFileName, subCpkPath);
|
||||
if (_cpkArchives[subCpkPath].FileExists(relativePathInSubCpk))
|
||||
@@ -194,7 +198,7 @@ namespace Core.FileSystem
|
||||
/// </summary>
|
||||
public void DisposeAllInMemoryArchives()
|
||||
{
|
||||
foreach (var cpkArchive in _cpkArchives.Values)
|
||||
foreach (CpkArchive cpkArchive in _cpkArchives.Values)
|
||||
{
|
||||
cpkArchive.DisposeInMemoryArchive();
|
||||
}
|
||||
@@ -213,7 +217,7 @@ namespace Core.FileSystem
|
||||
{
|
||||
var rootNodes = archive.Value.GetRootEntries();
|
||||
results.Add(from result in SearchInternal(rootNodes, keyword)
|
||||
select archive.Key + CpkConstants.CpkDirectorySeparatorChar + result);
|
||||
select archive.Key + CpkConstants.DirectorySeparator + result);
|
||||
});
|
||||
|
||||
var resultList = new List<string>();
|
||||
@@ -226,17 +230,17 @@ namespace Core.FileSystem
|
||||
|
||||
private void ParseFileVirtualPath(string fullVirtualPath, out string cpkFileName, out string relativeVirtualPath)
|
||||
{
|
||||
if (!fullVirtualPath.Contains(CpkConstants.CpkDirectorySeparatorChar))
|
||||
if (!fullVirtualPath.Contains(CpkConstants.DirectorySeparator))
|
||||
{
|
||||
throw new ArgumentException($"File virtual path is invalid: {fullVirtualPath}.");
|
||||
}
|
||||
cpkFileName = fullVirtualPath[..fullVirtualPath.IndexOf(CpkConstants.CpkDirectorySeparatorChar)].ToLower();
|
||||
relativeVirtualPath = fullVirtualPath[(fullVirtualPath.IndexOf(CpkConstants.CpkDirectorySeparatorChar) + 1)..];
|
||||
cpkFileName = fullVirtualPath[..fullVirtualPath.IndexOf(CpkConstants.DirectorySeparator)].ToLower();
|
||||
relativeVirtualPath = fullVirtualPath[(fullVirtualPath.IndexOf(CpkConstants.DirectorySeparator) + 1)..];
|
||||
}
|
||||
|
||||
private IEnumerable<string> SearchInternal(IEnumerable<CpkEntry> nodes, string keyword)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
foreach (CpkEntry node in nodes)
|
||||
{
|
||||
if (node.IsDirectory)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace Core.FileSystem
|
||||
/// Mount a Cpk archive to the file system.
|
||||
/// </summary>
|
||||
/// <param name="cpkFileRelativePath">CPK file relative path</param>
|
||||
public void Mount(string cpkFileRelativePath);
|
||||
/// <param name="codepage">Codepage CPK file uses for encoding text info</param>
|
||||
public void Mount(string cpkFileRelativePath, int codepage);
|
||||
|
||||
/// <summary>
|
||||
/// Check if file exists in any of the segmented archives using virtual path.
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Core.Renderer
|
||||
|
||||
private IEnumerator PlaySpriteAnimationInternal(Sprite[] sprites, float fps)
|
||||
{
|
||||
foreach (var sprite in sprites)
|
||||
foreach (Sprite sprite in sprites)
|
||||
{
|
||||
if (!_isPlaying) yield break;
|
||||
_spriteRenderer.sprite = sprite;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Core.Renderer
|
||||
{
|
||||
throw new Exception("SkyBoxRenderer needs to be attached to a camera game object.");
|
||||
}
|
||||
var material = CreateSkyboxMaterial(textures);
|
||||
Material material = CreateSkyboxMaterial(textures);
|
||||
_skybox = mainCamera.gameObject.AddComponent<Skybox>();
|
||||
_skybox.material = material;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Core.Renderer
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
var rotation = _camera.transform.rotation;
|
||||
Quaternion rotation = _camera.transform.rotation;
|
||||
rotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f);
|
||||
transform.rotation = rotation;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{
|
||||
// Unity has a built-in shader that is useful for drawing
|
||||
// simple colored things.
|
||||
var shader = Shader.Find("Hidden/Internal-Colored");
|
||||
Shader shader = Shader.Find("Hidden/Internal-Colored");
|
||||
_lineMaterial = new Material(shader);
|
||||
_lineMaterial.hideFlags = HideFlags.HideAndDontSave;
|
||||
// Turn on alpha blending
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace Core.Utils
|
||||
|
||||
public sealed unsafe class UnsafeBinaryReader : IDisposable
|
||||
{
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
private byte* _dataPtr;
|
||||
private GCHandle _handle;
|
||||
|
||||
@@ -148,13 +147,13 @@ namespace Core.Utils
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public string ReadGbkString(int count)
|
||||
public string ReadString(int count, int codepage)
|
||||
{
|
||||
var strBytes = ReadBytes(count);
|
||||
var i = 0;
|
||||
var length = strBytes.Length;
|
||||
while (i < length && strBytes[i] != 0) i++;
|
||||
return Encoding.GetEncoding(GBK_CODE_PAGE).GetString(strBytes, 0, i);
|
||||
return Encoding.GetEncoding(codepage).GetString(strBytes, 0, i);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
@@ -14,14 +14,12 @@ namespace Core.Utils
|
||||
|
||||
public static class Utility
|
||||
{
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
|
||||
public static string ConvertToGbkString(byte[] charArray)
|
||||
public static string ConvertToString(byte[] charArray, int codepage)
|
||||
{
|
||||
var i = 0;
|
||||
var length = charArray.Length;
|
||||
while (i < length && charArray[i] != 0) i++;
|
||||
return Encoding.GetEncoding(GBK_CODE_PAGE).GetString(charArray, 0, i);
|
||||
return Encoding.GetEncoding(codepage).GetString(charArray, 0, i);
|
||||
}
|
||||
|
||||
public static Color32 ToColor32(byte[] rgba)
|
||||
@@ -159,7 +157,7 @@ namespace Core.Utils
|
||||
public static Bounds EncapsulateBounds(IEnumerable<Bounds> bounds)
|
||||
{
|
||||
var finalBounds = new Bounds(Vector3.zero, Vector3.zero);
|
||||
foreach (var b in bounds)
|
||||
foreach (Bounds b in bounds)
|
||||
{
|
||||
finalBounds.Encapsulate(b);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Editor
|
||||
PlayerSettings.productName = appName;
|
||||
PlayerSettings.companyName = GameConstants.CompanyName;
|
||||
|
||||
foreach (var targetGroup in GetAllSupportedTargetGroups())
|
||||
foreach (BuildTargetGroup targetGroup in GetAllSupportedTargetGroups())
|
||||
{
|
||||
PlayerSettings.SetApplicationIdentifier(targetGroup,
|
||||
$"{GameConstants.AppIdentifierPrefix}.{appName}");
|
||||
@@ -65,7 +65,7 @@ namespace Editor
|
||||
var gameIcon = Resources.Load<Texture2D>(gameIconPath);
|
||||
if (gameIcon == null) throw new Exception($"Game icon not found: {gameIconPath}");
|
||||
|
||||
foreach (var buildTarget in GetAllSupportedNamedBuildTargets())
|
||||
foreach (NamedBuildTarget buildTarget in GetAllSupportedNamedBuildTargets())
|
||||
{
|
||||
// Set app icon
|
||||
var iconSizes = PlayerSettings.GetIconSizes(buildTarget, IconKind.Application);
|
||||
@@ -88,7 +88,7 @@ namespace Editor
|
||||
|
||||
private static void AddSymbol(string symbolToAdd)
|
||||
{
|
||||
foreach (var targetGroup in GetAllSupportedTargetGroups())
|
||||
foreach (BuildTargetGroup targetGroup in GetAllSupportedTargetGroups())
|
||||
{
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);
|
||||
var allDefines = defines.Split(';').ToList();
|
||||
@@ -104,7 +104,7 @@ namespace Editor
|
||||
|
||||
private static void RemoveSymbol(string symbolToDelete)
|
||||
{
|
||||
foreach (var targetGroup in GetAllSupportedTargetGroups())
|
||||
foreach (BuildTargetGroup targetGroup in GetAllSupportedTargetGroups())
|
||||
{
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);
|
||||
var allDefines = defines.Split(';').ToList();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Editor.SourceGenerator.Base
|
||||
public static Type[] GetTypesOfInterface(Type interfaceType)
|
||||
{
|
||||
var result = new List<Type>();
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
result.AddRange(asm.GetTypes()
|
||||
.Where(t => t.IsClass && t.GetInterfaces().Contains(interfaceType)));
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Pal3.Actor
|
||||
return Info.Kind switch
|
||||
{
|
||||
ScnActorKind.Soldier => 4f,
|
||||
ScnActorKind.MainActor => 4f,
|
||||
ScnActorKind.MainActor => 2.5f,
|
||||
ScnActorKind.StoryNpc => 4f,
|
||||
ScnActorKind.HotelManager => 6f,
|
||||
ScnActorKind.Dealer => 6f,
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Pal3.Actor
|
||||
using Core.DataLoader;
|
||||
using Core.DataReader.Cpk;
|
||||
using Core.DataReader.Mv3;
|
||||
using Core.DataReader.Pol;
|
||||
using Core.Extensions;
|
||||
using Core.Renderer;
|
||||
using Core.Services;
|
||||
@@ -153,18 +154,18 @@ namespace Pal3.Actor
|
||||
_currentAction = actionName.ToLower();
|
||||
_mv3AnimationRenderer = gameObject.GetOrAddComponent<Mv3ModelRenderer>();
|
||||
|
||||
var actionType = ActorConstants.ActionNames
|
||||
ActorActionType actionType = ActorConstants.ActionNames
|
||||
.FirstOrDefault(_ => string.Equals(_.Value, actionName, StringComparison.OrdinalIgnoreCase)).Key;
|
||||
|
||||
if (mv3File.TagNodes is {Length: > 0} && _actor.GetWeaponName() is {} weaponName &&
|
||||
ActorConstants.ActionNameToWeaponArmTypeMap[actionType] != WeaponArmType.None)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var weaponPath = $"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.WeaponFolderName}{separator}{weaponName}{separator}{weaponName}.pol";
|
||||
|
||||
var (polFile, weaponTextureProvider) = _resourceProvider.GetPol(weaponPath);
|
||||
(PolFile polFile, ITextureResourceProvider weaponTextureProvider) = _resourceProvider.GetPol(weaponPath);
|
||||
_mv3AnimationRenderer.Init(mv3File, textureProvider, _tintColor,
|
||||
polFile, weaponTextureProvider, Color.white);
|
||||
}
|
||||
@@ -179,7 +180,7 @@ namespace Pal3.Actor
|
||||
_worldBounds = _mv3AnimationRenderer.GetWorldBounds();
|
||||
_localBounds = _mv3AnimationRenderer.GetLocalBounds();
|
||||
|
||||
var action = ActorConstants.ActionNames
|
||||
ActorActionType action = ActorConstants.ActionNames
|
||||
.FirstOrDefault(a => a.Value.Equals(_currentAction)).Key;
|
||||
|
||||
SetupShadow(action);
|
||||
@@ -222,7 +223,7 @@ namespace Pal3.Actor
|
||||
_collider = gameObject.AddComponent<CapsuleCollider>();
|
||||
}
|
||||
|
||||
var bounds = GetLocalBounds();
|
||||
Bounds bounds = GetLocalBounds();
|
||||
_collider.center = bounds.center;
|
||||
_collider.height = bounds.size.y;
|
||||
_collider.radius = bounds.size.x * 0.35f;
|
||||
@@ -238,20 +239,20 @@ namespace Pal3.Actor
|
||||
RigidbodyConstraints.FreezeRotation;
|
||||
}
|
||||
|
||||
var currentGameState = ServiceLocator.Instance.Get<GameStateManager>().GetCurrentState();
|
||||
GameState currentGameState = ServiceLocator.Instance.Get<GameStateManager>().GetCurrentState();
|
||||
_rigidbody.isKinematic = currentGameState != GameState.Gameplay || _isKinematic;
|
||||
}
|
||||
|
||||
private void RenderShadow()
|
||||
{
|
||||
_shadow = new GameObject("Shadow");
|
||||
var shadowTexture = _resourceProvider.GetShadowTexture();
|
||||
Texture2D shadowTexture = _resourceProvider.GetShadowTexture();
|
||||
_shadowSpriteRenderer = _shadow.AddComponent<SpriteRenderer>();
|
||||
_shadowSpriteRenderer.sprite = Sprite.Create(shadowTexture,
|
||||
new Rect(0, 0, shadowTexture.width, shadowTexture.height),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
_shadowSpriteRenderer.color = new Color(0f, 0f, 0f, 0.7f);
|
||||
var shadowTransform = _shadow.transform;
|
||||
Transform shadowTransform = _shadow.transform;
|
||||
shadowTransform.rotation = Quaternion.Euler(90f, 0f, 0f);
|
||||
shadowTransform.localScale = new Vector3(1.4f, 1.4f, 1f);
|
||||
shadowTransform.localPosition = new Vector3(0f, 0.07f, 0f);
|
||||
@@ -274,7 +275,7 @@ namespace Pal3.Actor
|
||||
var emojiGameObject = new GameObject($"Emoji_{emojiType.ToString()}");
|
||||
emojiGameObject.transform.SetParent(transform);
|
||||
emojiGameObject.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
|
||||
var actorHeadPosition = GetActorHeadWorldPosition();
|
||||
Vector3 actorHeadPosition = GetActorHeadWorldPosition();
|
||||
emojiGameObject.transform.position = new Vector3(actorHeadPosition.x,
|
||||
actorHeadPosition.y + 0.1f, // With a small Y offset
|
||||
actorHeadPosition.z);
|
||||
@@ -300,7 +301,7 @@ namespace Pal3.Actor
|
||||
|
||||
public Vector3 GetActorHeadWorldPosition()
|
||||
{
|
||||
var parentPosition = transform.position;
|
||||
Vector3 parentPosition = transform.position;
|
||||
|
||||
if (_mv3AnimationRenderer == null || !_mv3AnimationRenderer.IsVisible())
|
||||
{
|
||||
@@ -478,7 +479,7 @@ namespace Pal3.Actor
|
||||
}
|
||||
else if (command.NewState == GameState.Gameplay)
|
||||
{
|
||||
var playerActor = ServiceLocator.Instance.Get<PlayerManager>().GetPlayerActor();
|
||||
PlayerActorId playerActor = ServiceLocator.Instance.Get<PlayerManager>().GetPlayerActor();
|
||||
_isKinematic = _actor.Info.Id != (byte)playerActor;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Pal3.Actor
|
||||
|
||||
private void InitActorConfig(string name)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var defaultActorConfigFile = $"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.ActorFolderName}{separator}{name}{separator}{name}.ini";
|
||||
@@ -61,6 +61,7 @@ namespace Pal3.Actor
|
||||
|
||||
protected void ChangeName(string name)
|
||||
{
|
||||
if (_actorName == name) return;
|
||||
_actorName = name;
|
||||
InitActorConfig(name);
|
||||
}
|
||||
@@ -80,10 +81,10 @@ namespace Pal3.Actor
|
||||
|
||||
public (Mv3File mv3File, ITextureResourceProvider textureProvider) GetActionMv3(string actionName)
|
||||
{
|
||||
var action = _actorConfig.ActorActions
|
||||
ActorAction action = _actorConfig.ActorActions
|
||||
.First(act => act.ActionName.Equals(actionName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var mv3File = $"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.ActorFolderName}{separator}{_actorName}{separator}" +
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace Pal3.Actor
|
||||
ICommandExecutor<ActorSetScriptCommand>,
|
||||
#if PAL3A
|
||||
ICommandExecutor<ActorSetYPositionCommand>,
|
||||
ICommandExecutor<EffectAttachToActorCommand>,
|
||||
ICommandExecutor<EffectPlayCommand>,
|
||||
#endif
|
||||
ICommandExecutor<ActorChangeScaleCommand>
|
||||
{
|
||||
@@ -40,9 +38,16 @@ namespace Pal3.Actor
|
||||
get => _actor.IsActive;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
DeActivate();
|
||||
}
|
||||
|
||||
_actor.IsActive = value;
|
||||
if (value) Activate();
|
||||
else DeActivate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,15 +85,6 @@ namespace Pal3.Actor
|
||||
return _actor.Info.ScriptId != 0;
|
||||
}
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new PlayerInteractionTriggeredNotification());
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new ActorStopActionAndStandCommand(ActorConstants.PlayerActorVirtualID));
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunCommand((int) _actor.Info.ScriptId));
|
||||
}
|
||||
|
||||
private void Activate()
|
||||
{
|
||||
#if PAL3A
|
||||
@@ -109,24 +105,31 @@ namespace Pal3.Actor
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_actor.Info.InitBehaviour)
|
||||
// Perform init action
|
||||
if (!_actor.IsActive)
|
||||
{
|
||||
case ScnActorBehaviour.None:
|
||||
_currentBehaviour = ScnActorBehaviour.None;
|
||||
_actionController.PerformAction(_actor.GetInitAction());
|
||||
break;
|
||||
case ScnActorBehaviour.Hold:
|
||||
_currentBehaviour = ScnActorBehaviour.Hold;
|
||||
_actionController.PerformAction(_actor.GetInitAction());
|
||||
break;
|
||||
case ScnActorBehaviour.Wander:
|
||||
_currentBehaviour = ScnActorBehaviour.Wander;
|
||||
_actionController.PerformAction(_actor.GetIdleAction());
|
||||
break;
|
||||
case ScnActorBehaviour.PathFollow:
|
||||
_currentBehaviour = ScnActorBehaviour.PathFollow;
|
||||
_actionController.PerformAction(_actor.GetIdleAction());
|
||||
break;
|
||||
switch (_actor.Info.InitBehaviour)
|
||||
{
|
||||
case ScnActorBehaviour.None:
|
||||
_currentBehaviour = ScnActorBehaviour.None;
|
||||
_actionController.PerformAction(_actor.Info.Kind != ScnActorKind.HotelManager &&
|
||||
_actor.Info.Kind != ScnActorKind.StoryNpc
|
||||
? _actor.GetInitAction()
|
||||
: _actor.GetIdleAction());
|
||||
break;
|
||||
case ScnActorBehaviour.Hold:
|
||||
_currentBehaviour = ScnActorBehaviour.Hold;
|
||||
_actionController.PerformAction(_actor.GetInitAction());
|
||||
break;
|
||||
case ScnActorBehaviour.Wander:
|
||||
_currentBehaviour = ScnActorBehaviour.Wander;
|
||||
_actionController.PerformAction(_actor.GetIdleAction());
|
||||
break;
|
||||
case ScnActorBehaviour.PathFollow:
|
||||
_currentBehaviour = ScnActorBehaviour.PathFollow;
|
||||
_actionController.PerformAction(_actor.GetIdleAction());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentBehaviour == ScnActorBehaviour.PathFollow)
|
||||
@@ -198,46 +201,11 @@ namespace Pal3.Actor
|
||||
public void Execute(ActorSetYPositionCommand command)
|
||||
{
|
||||
if (command.ActorId != _actor.Info.Id) return;
|
||||
var oldPosition = transform.position;
|
||||
Vector3 oldPosition = transform.position;
|
||||
transform.position = new Vector3(oldPosition.x,
|
||||
command.YPosition / GameBoxInterpreter.GameBoxUnitToUnityUnit,
|
||||
oldPosition.z);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PAL3A
|
||||
private bool _effectAttachedToSelf = false;
|
||||
public void Execute(EffectAttachToActorCommand command)
|
||||
{
|
||||
if (_actor.Info.Id == command.ActorId) _effectAttachedToSelf = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PAL3A
|
||||
public void Execute(EffectPlayCommand command)
|
||||
{
|
||||
if (!_effectAttachedToSelf) return;
|
||||
|
||||
switch (command.EffectGroupId)
|
||||
{
|
||||
// 南宫煌形态切换为狼形态特效
|
||||
case 164:
|
||||
{
|
||||
_actor.ChangeName(ActorConstants.NanGongHuangWolfModeActorName);
|
||||
if (_actor.IsActive) _actionController.PerformAction(_actor.GetIdleAction(), overwrite: true);
|
||||
break;
|
||||
}
|
||||
// 南宫煌形态切换为人形态特效
|
||||
case 315:
|
||||
{
|
||||
_actor.ChangeName(ActorConstants.NanGongHuangHumanModeActorName);
|
||||
if (_actor.IsActive) _actionController.PerformAction(_actor.GetIdleAction(), overwrite: true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_effectAttachedToSelf = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace Pal3.Actor
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
using Command.SceCommands;
|
||||
using Core.DataReader.Nav;
|
||||
using Core.DataReader.Scn;
|
||||
using Core.GameBox;
|
||||
using MetaData;
|
||||
@@ -52,7 +53,7 @@ namespace Pal3.Actor
|
||||
private WaitUntilCanceled _movementWaiter;
|
||||
|
||||
private bool _isDuringCollision;
|
||||
private Vector3 _lastKnownValidPositionDuringCollision;
|
||||
private Vector3 _lastKnownValidPositionWhenCollisionEnter;
|
||||
|
||||
private Func<int, byte[], HashSet<Vector2Int>> _getAllActiveActorBlockingTilePositions;
|
||||
|
||||
@@ -65,14 +66,14 @@ namespace Pal3.Actor
|
||||
_currentLayerIndex = actor.Info.OnLayer;
|
||||
_getAllActiveActorBlockingTilePositions = getAllActiveActorBlockingTilePositions;
|
||||
|
||||
var initPosition = GameBoxInterpreter.ToUnityPosition(new Vector3(actor.Info.PositionX,
|
||||
Vector3 initPosition = GameBoxInterpreter.ToUnityPosition(new Vector3(actor.Info.PositionX,
|
||||
actor.Info.PositionY, actor.Info.PositionZ));
|
||||
|
||||
var tilePosition = _tilemap.GetTilePosition(initPosition, _currentLayerIndex);
|
||||
Vector2Int tilePosition = _tilemap.GetTilePosition(initPosition, _currentLayerIndex);
|
||||
if (actor.Info.InitBehaviour != ScnActorBehaviour.Hold &&
|
||||
_tilemap.IsTilePositionInsideTileMap(tilePosition, _currentLayerIndex))
|
||||
{
|
||||
var tile = _tilemap.GetTile(tilePosition, _currentLayerIndex);
|
||||
NavTile tile = _tilemap.GetTile(tilePosition, _currentLayerIndex);
|
||||
|
||||
if (tile.IsWalkable())
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace Pal3.Actor
|
||||
{
|
||||
// Snap to the nearest adjacent tile if exists
|
||||
var nextToWalkableTile =_tilemap.TryGetAdjacentWalkableTile(tilePosition,
|
||||
_currentLayerIndex, out var nearestTile);
|
||||
_currentLayerIndex, out Vector2Int nearestTile);
|
||||
transform.position = nextToWalkableTile ?
|
||||
_tilemap.GetWorldPosition(nearestTile, _currentLayerIndex) :
|
||||
initPosition;
|
||||
@@ -126,18 +127,22 @@ namespace Pal3.Actor
|
||||
private void Update()
|
||||
{
|
||||
if (_currentPath.IsEndOfPath()) return;
|
||||
|
||||
var result = MoveTowards(_currentPath.GetCurrentWayPoint(), _currentPath.MovementMode, _currentPath.IgnoreObstacle);
|
||||
|
||||
if (result == MovementResult.Blocked)
|
||||
MovementResult result = MoveTowards(_currentPath.GetCurrentWayPoint(), _currentPath.MovementMode,
|
||||
_currentPath.IgnoreObstacle);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
ReachingToEndOfPath();
|
||||
}
|
||||
else if (result == MovementResult.Completed)
|
||||
{
|
||||
if (!_currentPath.MoveToNextWayPoint())
|
||||
{
|
||||
case MovementResult.Blocked:
|
||||
ReachingToEndOfPath();
|
||||
break;
|
||||
case MovementResult.Completed:
|
||||
{
|
||||
if (!_currentPath.MoveToNextWayPoint())
|
||||
{
|
||||
ReachingToEndOfPath();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,18 +156,18 @@ namespace Pal3.Actor
|
||||
// player actor's rigidbody.
|
||||
if (_isDuringCollision && _actionController.GetRigidBody() is {isKinematic: false})
|
||||
{
|
||||
var currentPosition = transform.position;
|
||||
var tilePosition = _tilemap.GetTilePosition(currentPosition, _currentLayerIndex);
|
||||
Vector3 currentPosition = transform.position;
|
||||
Vector2Int tilePosition = _tilemap.GetTilePosition(currentPosition, _currentLayerIndex);
|
||||
if (!_tilemap.IsTilePositionInsideTileMap(tilePosition, _currentLayerIndex))
|
||||
{
|
||||
transform.position = _lastKnownValidPositionDuringCollision;
|
||||
transform.position = _lastKnownValidPositionWhenCollisionEnter;
|
||||
}
|
||||
else
|
||||
{
|
||||
var currentTile = _tilemap.GetTile(tilePosition, _currentLayerIndex);
|
||||
NavTile currentTile = _tilemap.GetTile(tilePosition, _currentLayerIndex);
|
||||
if (!currentTile.IsWalkable())
|
||||
{
|
||||
transform.position = _lastKnownValidPositionDuringCollision;
|
||||
transform.position = _lastKnownValidPositionWhenCollisionEnter;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,7 +175,6 @@ namespace Pal3.Actor
|
||||
currentTile.Y / GameBoxInterpreter.GameBoxUnitToUnityUnit,
|
||||
currentPosition.z);
|
||||
transform.position = adjustedPosition;
|
||||
_lastKnownValidPositionDuringCollision = adjustedPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,7 +183,24 @@ namespace Pal3.Actor
|
||||
private void OnCollisionEnter(Collision _)
|
||||
{
|
||||
_isDuringCollision = true;
|
||||
_lastKnownValidPositionDuringCollision = transform.position;
|
||||
|
||||
Vector3 currentActorPosition = transform.position;
|
||||
Vector2Int currentTilePosition = _tilemap.GetTilePosition(currentActorPosition, _currentLayerIndex);
|
||||
|
||||
if (_tilemap.IsTilePositionInsideTileMap(currentTilePosition, _currentLayerIndex) &&
|
||||
_tilemap.GetTile(currentActorPosition, _currentLayerIndex).IsWalkable())
|
||||
{
|
||||
_lastKnownValidPositionWhenCollisionEnter = currentActorPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastKnownValidPositionWhenCollisionEnter =
|
||||
_tilemap.TryGetAdjacentWalkableTile(currentTilePosition,
|
||||
_currentLayerIndex,
|
||||
out Vector2Int nearestWalkableTilePosition)
|
||||
? _tilemap.GetWorldPosition(nearestWalkableTilePosition, _currentLayerIndex)
|
||||
: currentActorPosition; // Highly unlikely to happen, but this is the best effort
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionExit(Collision _)
|
||||
@@ -224,7 +245,7 @@ namespace Pal3.Actor
|
||||
|
||||
public void MoveToTapPoint(Dictionary<int, Vector3> tapPoints, bool isDoubleTap)
|
||||
{
|
||||
var targetPosition = Vector3.zero;
|
||||
Vector3 targetPosition = Vector3.zero;
|
||||
var targetPositionFound = false;
|
||||
if (tapPoints.ContainsKey(_currentLayerIndex))
|
||||
{
|
||||
@@ -257,7 +278,7 @@ namespace Pal3.Actor
|
||||
|
||||
private bool IsNearPortalAreaOfLayer(Vector3 position, int layerIndex)
|
||||
{
|
||||
var tilePosition = _tilemap.GetTilePosition(position, layerIndex);
|
||||
Vector2Int tilePosition = _tilemap.GetTilePosition(position, layerIndex);
|
||||
|
||||
if (_tilemap.IsInsidePortalArea(tilePosition, layerIndex)) return true;
|
||||
|
||||
@@ -269,9 +290,9 @@ namespace Pal3.Actor
|
||||
private bool IsNotObstacleAtLayer(Vector3 position, int layerIndex, out float y)
|
||||
{
|
||||
y = 0;
|
||||
var tilePosition = _tilemap.GetTilePosition(position, layerIndex);
|
||||
Vector2Int tilePosition = _tilemap.GetTilePosition(position, layerIndex);
|
||||
if (!_tilemap.IsTilePositionInsideTileMap(tilePosition, layerIndex)) return false;
|
||||
var tile = _tilemap.GetTile(tilePosition, layerIndex);
|
||||
NavTile tile = _tilemap.GetTile(tilePosition, layerIndex);
|
||||
if (!tile.IsWalkable()) return false;
|
||||
y = tile.Y / GameBoxInterpreter.GameBoxUnitToUnityUnit;
|
||||
return true;
|
||||
@@ -279,8 +300,8 @@ namespace Pal3.Actor
|
||||
|
||||
public MovementResult MoveTowards(Vector3 targetPosition, int movementMode, bool ignoreObstacle = false)
|
||||
{
|
||||
var currentTransform = transform;
|
||||
var currentPosition = currentTransform.position;
|
||||
Transform currentTransform = transform;
|
||||
Vector3 currentPosition = currentTransform.position;
|
||||
|
||||
// TODO: Use speed info from datascript\scene.txt file
|
||||
//var speed = _actor.Info.Speed == 0 ? 2f : _actor.Info.Speed;
|
||||
@@ -289,7 +310,7 @@ namespace Pal3.Actor
|
||||
|
||||
if (!_actor.IsMainActor()) moveSpeed /= 2f;
|
||||
|
||||
var newPosition = Vector3.MoveTowards(currentPosition, targetPosition, moveSpeed * Time.deltaTime);
|
||||
Vector3 newPosition = Vector3.MoveTowards(currentPosition, targetPosition, moveSpeed * Time.deltaTime);
|
||||
|
||||
var canGotoPosition = CanGotoPosition(currentPosition, newPosition, out var newYPosition);
|
||||
|
||||
@@ -404,7 +425,7 @@ namespace Pal3.Actor
|
||||
// Special handling for final rotation after moving backwards
|
||||
if (_currentPath.MovementMode == 2)
|
||||
{
|
||||
var actorTransform = transform;
|
||||
Transform actorTransform = transform;
|
||||
actorTransform.forward = -actorTransform.forward;
|
||||
}
|
||||
|
||||
@@ -437,7 +458,7 @@ namespace Pal3.Actor
|
||||
string specialAction = null)
|
||||
{
|
||||
Vector2Int[] path = Array.Empty<Vector2Int>();
|
||||
var fromTile = _tilemap.GetTilePosition(transform.position, _currentLayerIndex);
|
||||
Vector2Int fromTile = _tilemap.GetTilePosition(transform.position, _currentLayerIndex);
|
||||
var obstacles = _getAllActiveActorBlockingTilePositions(_currentLayerIndex, new [] {_actor.Info.Id});
|
||||
|
||||
var pathFindingThread = new Thread(() =>
|
||||
@@ -465,7 +486,7 @@ namespace Pal3.Actor
|
||||
_tilemap.GetWorldPosition(position, _currentLayerIndex),
|
||||
};
|
||||
|
||||
SetupPath(directWayPoints, mode, endOfPathAction, ignoreObstacle: true);
|
||||
SetupPath(directWayPoints, mode, endOfPathAction, ignoreObstacle: true, specialAction);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -503,8 +524,22 @@ namespace Pal3.Actor
|
||||
{
|
||||
if (_actor.Info.Id != command.ActorId) return;
|
||||
CancelCurrentMovement();
|
||||
transform.position = _tilemap.GetWorldPosition(new Vector2Int(command.TileXPosition,
|
||||
command.TileZPosition), _currentLayerIndex);
|
||||
|
||||
var tilePosition = new Vector2Int(command.TileXPosition, command.TileZPosition);
|
||||
|
||||
// Check if position at current layer exists,
|
||||
// if not, auto switch to next layer (if tile at next layer is walkable)
|
||||
if (_tilemap.GetLayerCount() > 1)
|
||||
{
|
||||
var isTileInsideCurrentLayer = _tilemap.IsTilePositionInsideTileMap(tilePosition, _currentLayerIndex);
|
||||
var isTileInsideAtNextLayer = _tilemap.IsTilePositionInsideTileMap(tilePosition, (_currentLayerIndex + 1) % 2);
|
||||
if (!isTileInsideCurrentLayer && isTileInsideAtNextLayer)
|
||||
{
|
||||
SetNavLayer((_currentLayerIndex + 1) % 2);
|
||||
}
|
||||
}
|
||||
|
||||
transform.position = _tilemap.GetWorldPosition(tilePosition, _currentLayerIndex);
|
||||
}
|
||||
|
||||
public void Execute(ActorPathToCommand command)
|
||||
@@ -539,7 +574,7 @@ namespace Pal3.Actor
|
||||
{
|
||||
if (_actor.Info.Id != command.ActorId) return;
|
||||
var moveDistance = command.Distance / GameBoxInterpreter.GameBoxUnitToUnityUnit;
|
||||
var newPosition = transform.position + (-transform.forward * moveDistance);
|
||||
Vector3 newPosition = transform.position + (-transform.forward * moveDistance);
|
||||
MoveTo(newPosition, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Pal3.Actor
|
||||
|
||||
public void Execute(FlyingActorFlyToCommand command)
|
||||
{
|
||||
var targetPosition = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
Vector3 targetPosition = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
|
||||
if (Vector3.Distance(transform.position, PlayerActorNpcInfo.InitPosition) < float.Epsilon)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace Pal3.Actor
|
||||
|
||||
private IEnumerator Fly(Vector3 targetPosition, float duration, WaitUntilCanceled waiter = null)
|
||||
{
|
||||
var oldPosition = transform.position;
|
||||
Vector3 oldPosition = transform.position;
|
||||
|
||||
// Facing towards target position, ignoring y
|
||||
transform.forward = (new Vector3(targetPosition.x, 0f, targetPosition.z)
|
||||
@@ -68,7 +68,7 @@ namespace Pal3.Actor
|
||||
var timePast = 0f;
|
||||
while (timePast < duration)
|
||||
{
|
||||
var newPosition = oldPosition;
|
||||
Vector3 newPosition = oldPosition;
|
||||
newPosition += (timePast / duration) * (targetPosition - oldPosition);
|
||||
|
||||
transform.position = newPosition;
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace Pal3.Actor
|
||||
|
||||
private Vector3 GetTargetStayPosition()
|
||||
{
|
||||
var targetFacingDirection = _target.transform.forward;
|
||||
var xOffsetDirection = Quaternion.Euler(0f, 90f, 0f) * targetFacingDirection;
|
||||
Vector3 targetFacingDirection = _target.transform.forward;
|
||||
Vector3 xOffsetDirection = Quaternion.Euler(0f, 90f, 0f) * targetFacingDirection;
|
||||
|
||||
return _target.transform.position +
|
||||
(-targetFacingDirection * FOLLOW_TARGET_MIN_DISTANCE) +
|
||||
@@ -95,7 +95,7 @@ namespace Pal3.Actor
|
||||
transform.position = GetTargetStayPosition();
|
||||
}
|
||||
|
||||
var myNewPosition = GetTargetStayPosition();
|
||||
Vector3 myNewPosition = GetTargetStayPosition();
|
||||
|
||||
if (Vector3.Distance(myNewPosition, transform.position) > FOLLOW_TARGET_MAX_DISTANCE)
|
||||
{
|
||||
|
||||
@@ -12,12 +12,14 @@ namespace Pal3.Actor
|
||||
using MetaData;
|
||||
using UnityEngine;
|
||||
|
||||
public class LongKuiController : MonoBehaviour,
|
||||
public sealed class LongKuiController : MonoBehaviour,
|
||||
ICommandExecutor<LongKuiSwitchModeCommand>
|
||||
{
|
||||
private Actor _actor;
|
||||
private ActorActionController _actionController;
|
||||
|
||||
private int _currentMode = 0;
|
||||
|
||||
public void Init(Actor actor, ActorActionController actionController)
|
||||
{
|
||||
_actor = actor;
|
||||
@@ -33,12 +35,20 @@ namespace Pal3.Actor
|
||||
{
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public int GetCurrentMode()
|
||||
{
|
||||
return _currentMode;
|
||||
}
|
||||
|
||||
public void Execute(LongKuiSwitchModeCommand command)
|
||||
{
|
||||
_currentMode = command.Mode;
|
||||
|
||||
_actor.ChangeName(command.Mode == 0 ?
|
||||
ActorConstants.LongKuiHumanModeActorName :
|
||||
ActorConstants.LongKuiGhostModeActorName);
|
||||
|
||||
if (_actor.IsActive)
|
||||
{
|
||||
_actionController.PerformAction(_actor.GetIdleAction(), overwrite: true);
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Pal3.Audio
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Command;
|
||||
@@ -14,6 +15,7 @@ namespace Pal3.Audio
|
||||
using Command.SceCommands;
|
||||
using Core.DataLoader;
|
||||
using Core.DataReader.Cpk;
|
||||
using Core.DataReader.Scn;
|
||||
using Core.Extensions;
|
||||
using Data;
|
||||
using MetaData;
|
||||
@@ -21,39 +23,45 @@ namespace Pal3.Audio
|
||||
using State;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour,
|
||||
public sealed class AudioManager : MonoBehaviour,
|
||||
ICommandExecutor<PlaySfxCommand>,
|
||||
ICommandExecutor<PlayMusicCommand>,
|
||||
ICommandExecutor<PlaySfxAtGameObjectRequest>,
|
||||
ICommandExecutor<AttachSfxToGameObjectRequest>,
|
||||
ICommandExecutor<StopSfxPlayingAtGameObjectRequest>,
|
||||
ICommandExecutor<GameStateChangedNotification>,
|
||||
ICommandExecutor<StopMusicCommand>,
|
||||
ICommandExecutor<ScenePreLoadingNotification>,
|
||||
ICommandExecutor<ScenePostLoadingNotification>,
|
||||
ICommandExecutor<ResetGameStateCommand>
|
||||
{
|
||||
public float MusicVolume { get; set; } = 0.7f;
|
||||
public float SoundVolume { get; set; } = 0.6f;
|
||||
public float DefaultMusicVolume { get; set; } = 0.45f;
|
||||
public float DefaultSoundVolume { get; set; } = 0.65f;
|
||||
|
||||
private Camera _mainCamera;
|
||||
private AudioSource _musicPlayer;
|
||||
private AudioSource _sfxPlayer;
|
||||
private GameResourceProvider _resourceProvider;
|
||||
private SceneManager _sceneManager;
|
||||
|
||||
private const string STOP_MUSIC_NAME = "NONE";
|
||||
private string _currentMusicClipName = string.Empty;
|
||||
private string _currentScriptMusic = string.Empty;
|
||||
private readonly List<string> _playingSfxSourceNames = new ();
|
||||
|
||||
// TODO: Fix and remove this hack
|
||||
private const string PLAYER_ACTOR_MOVEMENT_SFX_AUDIO_SOURCE_NAME = "PlayerActorMovementSfx";
|
||||
private bool _playerMovementSfxInProgress;
|
||||
|
||||
private CancellationTokenSource _sceneAudioCts = new ();
|
||||
|
||||
public void Init(GameResourceProvider resourceProvider,
|
||||
public void Init(Camera mainCamera,
|
||||
GameResourceProvider resourceProvider,
|
||||
SceneManager sceneManager,
|
||||
AudioSource musicSource,
|
||||
AudioSource sfxSource)
|
||||
AudioSource musicSource)
|
||||
{
|
||||
_resourceProvider = resourceProvider;
|
||||
_sceneManager = sceneManager;
|
||||
_musicPlayer = musicSource;
|
||||
_sfxPlayer = sfxSource;
|
||||
_mainCamera = mainCamera != null ? mainCamera : throw new ArgumentNullException(nameof(mainCamera));
|
||||
_resourceProvider = resourceProvider ?? throw new ArgumentNullException(nameof(resourceProvider));
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
_musicPlayer = musicSource != null ? musicSource : throw new ArgumentNullException(nameof(musicSource));
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -66,7 +74,7 @@ namespace Pal3.Audio
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
private void PlaySceneMusic(string cityName, string sceneName)
|
||||
private IEnumerator PlaySceneMusic(string cityName, string sceneName)
|
||||
{
|
||||
var key = $"{cityName}_{sceneName}";
|
||||
var musicName = string.Empty;
|
||||
@@ -83,28 +91,31 @@ namespace Pal3.Audio
|
||||
{
|
||||
_currentMusicClipName = string.Empty;
|
||||
_musicPlayer.Stop();
|
||||
return;
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (_musicPlayer.isPlaying &&
|
||||
string.Equals(_currentMusicClipName, musicName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return;
|
||||
yield break;
|
||||
}
|
||||
|
||||
_currentMusicClipName = musicName;
|
||||
var musicFileVirtualPath = GetMusicFileVirtualPath(musicName);
|
||||
var musicFileCachePath = _resourceProvider.GetMp3FilePathInCacheFolder(musicFileVirtualPath);
|
||||
StartCoroutine(PlayMusic(musicFileVirtualPath, musicFileCachePath, -1));
|
||||
yield return PlayMusic(musicFileVirtualPath, musicFileCachePath, -1);
|
||||
}
|
||||
|
||||
public IEnumerator PlayAudioClip(AudioSource audioSource,
|
||||
private IEnumerator PlayAudioClip(AudioSource audioSource,
|
||||
AudioClip audioClip,
|
||||
int loopCount,
|
||||
float interval,
|
||||
float volume,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (loopCount <= 0)
|
||||
if (audioSource == null || !audioSource.enabled) yield break;
|
||||
|
||||
if (loopCount == -1 && interval == 0f)
|
||||
{
|
||||
if (audioSource.clip != null)
|
||||
{
|
||||
@@ -117,44 +128,99 @@ namespace Pal3.Audio
|
||||
audioSource.loop = true;
|
||||
audioSource.Play();
|
||||
}
|
||||
else if (loopCount == -1 && interval > 0f)
|
||||
{
|
||||
while (!cancellationToken.IsCancellationRequested && audioSource != null)
|
||||
{
|
||||
audioSource.PlayOneShot(audioClip, volume);
|
||||
yield return new WaitForSeconds(audioClip.length + interval);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--loopCount >= 0 && !cancellationToken.IsCancellationRequested)
|
||||
while (--loopCount >= 0 && !cancellationToken.IsCancellationRequested && audioSource != null)
|
||||
{
|
||||
audioSource.PlayOneShot(audioClip, volume);
|
||||
yield return new WaitForSeconds(audioClip.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator PlaySfx(string sfxFilePath, int loopCount, CancellationToken cancellationToken)
|
||||
{
|
||||
yield return AudioClipLoader.LoadAudioClip(sfxFilePath, AudioType.WAV, audioClip =>
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested) return;
|
||||
StartCoroutine(PlayAudioClip(_sfxPlayer, audioClip, loopCount, SoundVolume, cancellationToken));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Spatial Audio
|
||||
public IEnumerator PlaySfx(string sfxFilePath, int loopCount, GameObject parent, CancellationToken cancellationToken)
|
||||
private IEnumerator AttachSfxToGameObjectAndPlaySfx(GameObject parent,
|
||||
string sfxFilePath,
|
||||
string audioSourceName,
|
||||
int loopCount,
|
||||
float volume,
|
||||
float interval = 0f,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
yield return AudioClipLoader.LoadAudioClip(sfxFilePath, AudioType.WAV, audioClip =>
|
||||
if (parent == null || cancellationToken.IsCancellationRequested) yield break;
|
||||
|
||||
AudioClip sfxAudioClip = null;
|
||||
|
||||
yield return _resourceProvider.LoadAudioClip(sfxFilePath, AudioType.WAV, audioClip =>
|
||||
{
|
||||
if (parent == null || cancellationToken.IsCancellationRequested) return;
|
||||
|
||||
var audioSource = parent.GetOrAddComponent<AudioSource>();
|
||||
audioSource.spatialBlend = 1.0f;
|
||||
audioSource.rolloffMode = AudioRolloffMode.Linear;
|
||||
audioSource.maxDistance = 75f;
|
||||
|
||||
StartCoroutine(PlayAudioClip(audioSource, audioClip, loopCount, SoundVolume, cancellationToken));
|
||||
sfxAudioClip = audioClip;
|
||||
});
|
||||
|
||||
if (parent == null ||
|
||||
cancellationToken.IsCancellationRequested ||
|
||||
sfxAudioClip == null) yield break;
|
||||
|
||||
if (parent != _mainCamera.gameObject &&
|
||||
audioSourceName == PLAYER_ACTOR_MOVEMENT_SFX_AUDIO_SOURCE_NAME &&
|
||||
_playerMovementSfxInProgress == false)
|
||||
{
|
||||
yield break; // Means movement sfx is already stopped before it started due to the delay of the coroutine
|
||||
}
|
||||
|
||||
if (parent == _mainCamera.gameObject &&
|
||||
!_playingSfxSourceNames.Contains(audioSourceName))
|
||||
{
|
||||
yield break; // Means sfx is already stopped before it started due to the delay of the coroutine
|
||||
}
|
||||
|
||||
GameObject audioSourceParent;
|
||||
Transform audioSourceParentTransform = parent.transform.Find(audioSourceName);
|
||||
if (audioSourceParentTransform != null)
|
||||
{
|
||||
audioSourceParent = audioSourceParentTransform.gameObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
audioSourceParent = new GameObject(audioSourceName);
|
||||
audioSourceParent.transform.parent = parent.transform;
|
||||
audioSourceParent.transform.position = parent.transform.position;
|
||||
}
|
||||
|
||||
var audioSource = audioSourceParent.GetOrAddComponent<AudioSource>();
|
||||
audioSource.spatialBlend = 1.0f;
|
||||
audioSource.rolloffMode = AudioRolloffMode.Linear;
|
||||
audioSource.maxDistance = 75f;
|
||||
|
||||
yield return PlayAudioClip(audioSource, sfxAudioClip, loopCount, interval, volume, cancellationToken);
|
||||
}
|
||||
|
||||
private IEnumerator StartWithDelay(
|
||||
float delayInSeconds,
|
||||
IEnumerator coroutine,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (delayInSeconds > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(delayInSeconds);
|
||||
}
|
||||
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
yield return coroutine;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMusicFileVirtualPath(string musicName)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
return $"{FileConstants.MusicCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.MusicCpkPathInfo.relativePath}{separator}{musicName}.mp3";
|
||||
}
|
||||
@@ -162,74 +228,152 @@ namespace Pal3.Audio
|
||||
public IEnumerator PlayMusic(string musicFileVirtualPath, string musicFileCachePath, int loopCount)
|
||||
{
|
||||
yield return _resourceProvider.ExtractAndMoveMp3FileToCacheFolder(musicFileVirtualPath, musicFileCachePath);
|
||||
yield return AudioClipLoader.LoadAudioClip(musicFileCachePath, AudioType.MPEG, audioClip =>
|
||||
AudioClip musicClip = null;
|
||||
yield return _resourceProvider.LoadAudioClip(musicFileCachePath, AudioType.MPEG, audioClip =>
|
||||
{
|
||||
StartCoroutine(PlayAudioClip(_musicPlayer, audioClip, loopCount, MusicVolume,
|
||||
new CancellationToken(false))); // Should not stop music during scene switch
|
||||
musicClip = audioClip;
|
||||
});
|
||||
if (musicClip == null) yield break;
|
||||
StartCoroutine(PlayAudioClip(_musicPlayer, musicClip, loopCount, 0f, DefaultMusicVolume,
|
||||
new CancellationToken(false))); // Should not stop music during scene switch
|
||||
}
|
||||
|
||||
private IEnumerator PlaySfxAfterDelay(string sfxFilePath,
|
||||
float startDelayInSeconds,
|
||||
int loopCount,
|
||||
GameObject parent,
|
||||
CancellationToken cancellationToken)
|
||||
private void DestroyAllSfxAudioSource()
|
||||
{
|
||||
if (startDelayInSeconds > 0)
|
||||
// Destroy current playing sfx
|
||||
foreach (Transform audioSourceParentTransform in _playingSfxSourceNames
|
||||
.Select(sfxName => _mainCamera.transform.Find(sfxName))
|
||||
.Where(audioSourceParentTransform => audioSourceParentTransform != null))
|
||||
{
|
||||
yield return new WaitForSeconds(startDelayInSeconds);
|
||||
if (audioSourceParentTransform.GetComponent<AudioSource>() is { } audioSource)
|
||||
{
|
||||
audioSource.Stop();
|
||||
|
||||
if (audioSource.clip != null)
|
||||
{
|
||||
Destroy(audioSource.clip);
|
||||
}
|
||||
}
|
||||
|
||||
Destroy(audioSourceParentTransform.gameObject);
|
||||
}
|
||||
|
||||
_playingSfxSourceNames.Clear();
|
||||
}
|
||||
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
private void ChangeAllSfxAudioSourceMuteSetting(bool mute)
|
||||
{
|
||||
foreach (Transform audioSourceParentTransform in _playingSfxSourceNames
|
||||
.Select(sfxName => _mainCamera.transform.Find(sfxName))
|
||||
.Where(audioSourceParentTransform => audioSourceParentTransform != null))
|
||||
{
|
||||
yield return PlaySfx(sfxFilePath,
|
||||
loopCount,
|
||||
parent,
|
||||
cancellationToken);
|
||||
if (audioSourceParentTransform.GetComponent<AudioSource>() is { } audioSource)
|
||||
{
|
||||
audioSource.mute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(PlaySfxCommand command)
|
||||
{
|
||||
var sfxName = command.SfxName;
|
||||
#if PAL3
|
||||
var sfxName = command.SfxName.ToLower();
|
||||
#elif PAL3A
|
||||
var sfxName = command.SfxName.ToUpper();
|
||||
#endif
|
||||
|
||||
var loopCount = command.LoopCount;
|
||||
|
||||
// TODO: Start/stop walk/run sfx based on actor behaviour
|
||||
if (command.SfxName.Contains("we022", StringComparison.OrdinalIgnoreCase))
|
||||
#if PAL3
|
||||
// Fix actor movement sfx name
|
||||
if (sfxName.Equals("we021", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
loopCount = 3;
|
||||
sfxName = "we021a";
|
||||
}
|
||||
|
||||
// TODO: Change walk/run sfx based on tile type
|
||||
if (command.SfxName.Equals("we022", StringComparison.OrdinalIgnoreCase))
|
||||
if (sfxName.Equals("we022", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
sfxName = "we022b";
|
||||
sfxName = "we022a";
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: This sfx will be triggered to loop forever after actor
|
||||
// leaving the hotel. Maybe we should play it by attaching
|
||||
// the sound to the hotel position?
|
||||
if (command.SfxName.Equals("wc019", StringComparison.OrdinalIgnoreCase) &&
|
||||
command.LoopCount == -1)
|
||||
switch (loopCount)
|
||||
{
|
||||
return;
|
||||
case 0: // start playing sfx indefinitely for the given sfxName
|
||||
_playingSfxSourceNames.Add(sfxName);
|
||||
StartCoroutine(AttachSfxToGameObjectAndPlaySfx(_mainCamera.gameObject,
|
||||
_resourceProvider.GetSfxFilePath(sfxName),
|
||||
sfxName, // use sfx name as audio source name
|
||||
loopCount: -1, // loop indefinitely
|
||||
DefaultSoundVolume,
|
||||
interval: 0f,
|
||||
_sceneAudioCts.Token));
|
||||
break;
|
||||
case -1: // stop playing sfx by sfxName
|
||||
_playingSfxSourceNames.Remove(sfxName);
|
||||
Execute(new StopSfxPlayingAtGameObjectRequest(
|
||||
_mainCamera.gameObject,
|
||||
sfxName,
|
||||
disposeSource: true));
|
||||
break;
|
||||
default:
|
||||
{
|
||||
_playingSfxSourceNames.Add(sfxName);
|
||||
var sfxFilePath = _resourceProvider.GetSfxFilePath(sfxName);
|
||||
CancellationToken cancellationToken = _sceneAudioCts.Token;
|
||||
StartCoroutine(AttachSfxToGameObjectAndPlaySfx(_mainCamera.gameObject,
|
||||
sfxFilePath,
|
||||
sfxName, // use sfx name as audio source name
|
||||
loopCount,
|
||||
DefaultSoundVolume,
|
||||
interval: 0f,
|
||||
cancellationToken));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var sfxFilePath = _resourceProvider.GetSfxFilePath(sfxName);
|
||||
var cancellationToken = _sceneAudioCts.Token;
|
||||
StartCoroutine(PlaySfx(sfxFilePath, loopCount, cancellationToken));
|
||||
}
|
||||
|
||||
public void Execute(PlaySfxAtGameObjectRequest request)
|
||||
public void Execute(AttachSfxToGameObjectRequest request)
|
||||
{
|
||||
if (request.AudioSourceName == PLAYER_ACTOR_MOVEMENT_SFX_AUDIO_SOURCE_NAME)
|
||||
{
|
||||
_playerMovementSfxInProgress = true;
|
||||
}
|
||||
|
||||
var sfxFilePath = _resourceProvider.GetSfxFilePath(request.SfxName);
|
||||
var cancellationToken = _sceneAudioCts.Token;
|
||||
StartCoroutine(PlaySfxAfterDelay(sfxFilePath,
|
||||
request.StartDelayInSeconds,
|
||||
request.LoopCount,
|
||||
request.Parent,
|
||||
CancellationToken cancellationToken = _sceneAudioCts.Token;
|
||||
StartCoroutine(StartWithDelay(request.StartDelayInSeconds,
|
||||
AttachSfxToGameObjectAndPlaySfx(request.Parent,
|
||||
sfxFilePath,
|
||||
request.AudioSourceName,
|
||||
request.LoopCount,
|
||||
request.Volume,
|
||||
request.Interval,
|
||||
cancellationToken),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
public void Execute(StopSfxPlayingAtGameObjectRequest command)
|
||||
{
|
||||
if (command.AudioSourceName == PLAYER_ACTOR_MOVEMENT_SFX_AUDIO_SOURCE_NAME)
|
||||
{
|
||||
_playerMovementSfxInProgress = false;
|
||||
}
|
||||
|
||||
Transform audioSourceParentTransform = command.Parent.transform.Find(command.AudioSourceName);
|
||||
if (audioSourceParentTransform == null) return;
|
||||
|
||||
GameObject audioSourceParent = audioSourceParentTransform.gameObject;
|
||||
var audioSource = audioSourceParent.GetComponentInChildren<AudioSource>();
|
||||
if (audioSource == default) return;
|
||||
|
||||
audioSource.Stop();
|
||||
audioSource.clip = null;
|
||||
|
||||
if (command.DisposeSource)
|
||||
{
|
||||
Destroy(audioSourceParent);
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(PlayMusicCommand command)
|
||||
{
|
||||
@@ -242,7 +386,9 @@ namespace Pal3.Audio
|
||||
|
||||
// TODO: Disable combat music since combat system has not been implemented yet.
|
||||
if (MusicConstants.CombatMusicInfo.Any(musicInfo =>
|
||||
command.MusicName.Equals(musicInfo.Value, StringComparison.OrdinalIgnoreCase)))
|
||||
command.MusicName.Equals(musicInfo.Value, StringComparison.OrdinalIgnoreCase)) ||
|
||||
command.MusicName.Equals("PI25A", StringComparison.OrdinalIgnoreCase) ||
|
||||
command.MusicName.Equals("PI25", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -266,19 +412,13 @@ namespace Pal3.Audio
|
||||
_currentScriptMusic = string.Empty;
|
||||
_currentMusicClipName = string.Empty;
|
||||
|
||||
var sceneInfo = _sceneManager.GetCurrentScene().GetSceneInfo();
|
||||
PlaySceneMusic(sceneInfo.CityName, sceneInfo.Name);
|
||||
ScnSceneInfo sceneInfo = _sceneManager.GetCurrentScene().GetSceneInfo();
|
||||
StartCoroutine(PlaySceneMusic(sceneInfo.CityName, sceneInfo.Name));
|
||||
}
|
||||
|
||||
public void Execute(ScenePreLoadingNotification command)
|
||||
{
|
||||
if (_sfxPlayer.clip != null)
|
||||
{
|
||||
_sfxPlayer.loop = false;
|
||||
_sfxPlayer.Stop();
|
||||
Destroy(_sfxPlayer.clip);
|
||||
}
|
||||
|
||||
DestroyAllSfxAudioSource();
|
||||
_sceneAudioCts.Cancel();
|
||||
_sceneAudioCts = new CancellationTokenSource();
|
||||
}
|
||||
@@ -287,15 +427,15 @@ namespace Pal3.Audio
|
||||
{
|
||||
if (string.IsNullOrEmpty(_currentScriptMusic))
|
||||
{
|
||||
PlaySceneMusic(command.NewSceneInfo.CityName, command.NewSceneInfo.Name);
|
||||
StartCoroutine(PlaySceneMusic(command.NewSceneInfo.CityName, command.NewSceneInfo.Name));
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(ResetGameStateCommand command)
|
||||
{
|
||||
DestroyAllSfxAudioSource();
|
||||
_currentScriptMusic = string.Empty;
|
||||
_musicPlayer.Stop();
|
||||
_sfxPlayer.Stop();
|
||||
}
|
||||
|
||||
public void Execute(GameStateChangedNotification command)
|
||||
@@ -308,12 +448,12 @@ namespace Pal3.Audio
|
||||
}
|
||||
|
||||
_musicPlayer.mute = true;
|
||||
_sfxPlayer.mute = true;
|
||||
ChangeAllSfxAudioSourceMuteSetting(true);
|
||||
}
|
||||
else
|
||||
else if (command.PreviousState == GameState.VideoPlaying)
|
||||
{
|
||||
if (_musicPlayer.mute) _musicPlayer.mute = false;
|
||||
if (_sfxPlayer.mute) _sfxPlayer.mute = false;
|
||||
_musicPlayer.mute = false;
|
||||
ChangeAllSfxAudioSourceMuteSetting(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace Pal3.Camera
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using Command;
|
||||
@@ -24,7 +25,7 @@ namespace Pal3.Camera
|
||||
using UnityEngine.InputSystem.OnScreen;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CameraManager : MonoBehaviour,
|
||||
public sealed class CameraManager : MonoBehaviour,
|
||||
ICommandExecutor<CameraSetTransformCommand>,
|
||||
ICommandExecutor<CameraSetDefaultTransformCommand>,
|
||||
ICommandExecutor<CameraShakeEffectCommand>,
|
||||
@@ -73,28 +74,34 @@ namespace Pal3.Camera
|
||||
private PlayerInputActions _inputActions;
|
||||
private PlayerGamePlayController _gamePlayController;
|
||||
private SceneManager _sceneManager;
|
||||
private GameStateManager _gameStateManager;
|
||||
private bool _freeToRotate;
|
||||
|
||||
private GameObject _lookAtGameObject;
|
||||
|
||||
private int _currentAppliedDefaultTransformOption = 0;
|
||||
|
||||
private RectTransform _joyStickRect;
|
||||
private float _joyStickMovementRange;
|
||||
private bool _isTouchEnabled;
|
||||
|
||||
private bool _cameraAnimationInProgress;
|
||||
private CancellationTokenSource _asyncCameraAnimationCts = new ();
|
||||
private CancellationTokenSource _cameraFadeAnimationCts = new ();
|
||||
|
||||
public void Init(PlayerInputActions inputActions,
|
||||
PlayerGamePlayController gamePlayController,
|
||||
SceneManager sceneManager,
|
||||
GameStateManager gameStateManager,
|
||||
Camera mainCamera,
|
||||
Canvas touchControlUI,
|
||||
Image curtainImage)
|
||||
{
|
||||
_inputActions = inputActions;
|
||||
_gamePlayController = gamePlayController;
|
||||
_sceneManager = sceneManager;
|
||||
|
||||
_inputActions = inputActions ?? throw new ArgumentNullException(nameof(inputActions));
|
||||
_gamePlayController = gamePlayController != null ? gamePlayController : throw new ArgumentNullException(nameof(gamePlayController));
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
_gameStateManager = gameStateManager ?? throw new ArgumentNullException(nameof(gameStateManager));
|
||||
|
||||
_camera = mainCamera;
|
||||
_camera!.fieldOfView = HorizontalToVerticalFov(24.05f, 4f/3f);
|
||||
|
||||
@@ -132,10 +139,10 @@ namespace Pal3.Camera
|
||||
_gamePlayController.GetPlayerActorLastKnownPosition();
|
||||
|
||||
var yOffset = new Vector3(0f, _lookAtPointYOffset, 0f);
|
||||
var targetPosition = _lastLookAtPoint + _cameraOffset;
|
||||
var currentPosition = _camera.transform.position;
|
||||
Vector3 targetPosition = _lastLookAtPoint + _cameraOffset;
|
||||
Vector3 currentPosition = _camera.transform.position;
|
||||
|
||||
var previousLookAtPoint = _lastLookAtPoint + (currentPosition - targetPosition);
|
||||
Vector3 previousLookAtPoint = _lastLookAtPoint + (currentPosition - targetPosition);
|
||||
|
||||
if (Vector3.Distance(targetPosition, currentPosition) > CAMERA_SMOOTH_FOLLOW_MAX_DISTANCE ||
|
||||
_shouldResetVelocity)
|
||||
@@ -192,7 +199,7 @@ namespace Pal3.Camera
|
||||
{
|
||||
var touchStartPosition = _inputActions.Gameplay.Touch0Start.ReadValue<Vector2>();
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
_joyStickRect, touchStartPosition, null, out var localPoint);
|
||||
_joyStickRect, touchStartPosition, null, out Vector2 localPoint);
|
||||
if (localPoint.x < -_joyStickMovementRange ||
|
||||
localPoint.x > _joyStickRect.rect.width + _joyStickMovementRange ||
|
||||
localPoint.y < -_joyStickMovementRange ||
|
||||
@@ -207,7 +214,7 @@ namespace Pal3.Camera
|
||||
{
|
||||
var touchStartPosition = _inputActions.Gameplay.Touch1Start.ReadValue<Vector2>();
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
_joyStickRect, touchStartPosition, null, out var localPoint);
|
||||
_joyStickRect, touchStartPosition, null, out Vector2 localPoint);
|
||||
if (localPoint.x < -_joyStickMovementRange ||
|
||||
localPoint.x > _joyStickRect.rect.width + _joyStickMovementRange ||
|
||||
localPoint.y < -_joyStickMovementRange ||
|
||||
@@ -252,8 +259,8 @@ namespace Pal3.Camera
|
||||
{
|
||||
_cameraAnimationInProgress = true;
|
||||
var curveType = (AnimationCurveType) mode;
|
||||
var cameraTransform = _camera.transform;
|
||||
var oldPosition = cameraTransform.position;
|
||||
Transform cameraTransform = _camera.transform;
|
||||
Vector3 oldPosition = cameraTransform.position;
|
||||
yield return AnimationHelper.MoveTransform(cameraTransform, position, duration, curveType, cancellationToken);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
@@ -272,7 +279,7 @@ namespace Pal3.Camera
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
_cameraAnimationInProgress = true;
|
||||
var lookAtPoint = _lastLookAtPoint;
|
||||
Vector3 lookAtPoint = _lastLookAtPoint;
|
||||
yield return AnimationHelper.OrbitTransformAroundCenterPoint(_camera.transform,
|
||||
toRotation,
|
||||
lookAtPoint,
|
||||
@@ -312,11 +319,11 @@ namespace Pal3.Camera
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
_cameraAnimationInProgress = true;
|
||||
var oldPosition = _camera.transform.position;
|
||||
Vector3 oldPosition = _camera.transform.position;
|
||||
var oldDistance = Vector3.Distance(oldPosition, _lastLookAtPoint);
|
||||
var cameraDirection = (oldPosition - _lastLookAtPoint).normalized;
|
||||
var newPosition = oldPosition + cameraDirection * (distance - oldDistance);
|
||||
var cameraTransform = _camera.transform;
|
||||
Vector3 cameraDirection = (oldPosition - _lastLookAtPoint).normalized;
|
||||
Vector3 newPosition = oldPosition + cameraDirection * (distance - oldDistance);
|
||||
Transform cameraTransform = _camera.transform;
|
||||
|
||||
yield return AnimationHelper.MoveTransform(cameraTransform,
|
||||
newPosition,
|
||||
@@ -332,7 +339,11 @@ namespace Pal3.Camera
|
||||
waiter?.CancelWait();
|
||||
}
|
||||
|
||||
public IEnumerator Fade(bool fadeIn, float duration, Color color, WaitUntilCanceled waiter = null)
|
||||
public IEnumerator Fade(bool fadeIn,
|
||||
float duration,
|
||||
Color color,
|
||||
WaitUntilCanceled waiter = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
_curtainImage.color = color;
|
||||
|
||||
@@ -343,13 +354,21 @@ namespace Pal3.Camera
|
||||
alpha =>
|
||||
{
|
||||
_curtainImage.color = new Color(color.r, color.g, color.b, alpha);
|
||||
});
|
||||
}, cancellationToken);
|
||||
|
||||
_curtainImage.color = new Color(color.r, color.g, color.b, to);
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
_curtainImage.color = new Color(color.r, color.g, color.b, to);
|
||||
}
|
||||
|
||||
waiter?.CancelWait();
|
||||
}
|
||||
|
||||
public int GetCurrentAppliedDefaultTransformOption()
|
||||
{
|
||||
return _currentAppliedDefaultTransformOption;
|
||||
}
|
||||
|
||||
public void ApplySceneSettings(ScnSceneInfo sceneInfo)
|
||||
{
|
||||
switch (sceneInfo.SceneType)
|
||||
@@ -417,10 +436,10 @@ namespace Pal3.Camera
|
||||
|
||||
var yOffset = new Vector3(0f, _lookAtPointYOffset, 0f);
|
||||
|
||||
var cameraDirection = (rotation * Vector3.forward).normalized;
|
||||
var cameraPosition = _lastLookAtPoint + cameraDirection * -distance + yOffset;
|
||||
Vector3 cameraDirection = (rotation * Vector3.forward).normalized;
|
||||
Vector3 cameraPosition = _lastLookAtPoint + cameraDirection * -distance + yOffset;
|
||||
|
||||
var cameraTransform = _camera.transform;
|
||||
Transform cameraTransform = _camera.transform;
|
||||
cameraTransform.rotation = rotation;
|
||||
cameraTransform.position = cameraPosition;
|
||||
|
||||
@@ -433,6 +452,7 @@ namespace Pal3.Camera
|
||||
|
||||
_lastLookAtPoint = _gamePlayController.GetPlayerActorLastKnownPosition();
|
||||
ApplyDefaultSettings(command.Option);
|
||||
_currentAppliedDefaultTransformOption = command.Option;
|
||||
_free = true;
|
||||
}
|
||||
|
||||
@@ -442,9 +462,9 @@ namespace Pal3.Camera
|
||||
|
||||
_lookAtGameObject = null;
|
||||
|
||||
var cameraPosition = GameBoxInterpreter.ToUnityPosition(
|
||||
Vector3 cameraPosition = GameBoxInterpreter.ToUnityPosition(
|
||||
new Vector3(command.X, command.Y, command.Z));
|
||||
var cameraTransform = _camera.transform;
|
||||
Transform cameraTransform = _camera.transform;
|
||||
cameraTransform.position = cameraPosition;
|
||||
cameraTransform.rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
|
||||
@@ -452,7 +472,10 @@ namespace Pal3.Camera
|
||||
(command.Distance / GameBoxInterpreter.GameBoxUnitToUnityUnit);
|
||||
_cameraOffset = cameraPosition - _lastLookAtPoint;
|
||||
|
||||
_free = false;
|
||||
if (_gameStateManager.GetCurrentState() != GameState.Gameplay)
|
||||
{
|
||||
_free = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(CameraFreeCommand command)
|
||||
@@ -479,7 +502,7 @@ namespace Pal3.Camera
|
||||
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Orbit(rotation, command.Duration, (AnimationCurveType)command.CurveType, 0f, waiter));
|
||||
}
|
||||
|
||||
@@ -495,14 +518,14 @@ namespace Pal3.Camera
|
||||
{
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Rotate(rotation, command.Duration, (AnimationCurveType)command.CurveType, waiter));
|
||||
}
|
||||
#if PAL3A
|
||||
else
|
||||
{
|
||||
_asyncCameraAnimationCts = new CancellationTokenSource();
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Rotate(rotation,
|
||||
command.Duration,
|
||||
(AnimationCurveType)command.CurveType,
|
||||
@@ -525,13 +548,13 @@ namespace Pal3.Camera
|
||||
{
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Orbit(rotation, command.Duration, (AnimationCurveType)command.CurveType, distanceDelta, waiter));
|
||||
}
|
||||
else
|
||||
{
|
||||
_asyncCameraAnimationCts = new CancellationTokenSource();
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Orbit(rotation,
|
||||
command.Duration,
|
||||
(AnimationCurveType)command.CurveType,
|
||||
@@ -555,13 +578,13 @@ namespace Pal3.Camera
|
||||
{
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Orbit(rotation, command.Duration, (AnimationCurveType)command.CurveType, distanceDelta, waiter));
|
||||
}
|
||||
else
|
||||
{
|
||||
_asyncCameraAnimationCts = new CancellationTokenSource();
|
||||
var rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
Quaternion rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
|
||||
StartCoroutine(Orbit(rotation,
|
||||
command.Duration,
|
||||
(AnimationCurveType)command.CurveType,
|
||||
@@ -574,38 +597,38 @@ namespace Pal3.Camera
|
||||
|
||||
public void Execute(CameraFadeInCommand command)
|
||||
{
|
||||
if (!_asyncCameraAnimationCts.IsCancellationRequested) _asyncCameraAnimationCts.Cancel();
|
||||
|
||||
if (!_cameraFadeAnimationCts.IsCancellationRequested) _cameraFadeAnimationCts.Cancel();
|
||||
_cameraFadeAnimationCts = new CancellationTokenSource();
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
StartCoroutine(Fade(true, FADE_ANIMATION_DURATION, Color.black, waiter));
|
||||
StartCoroutine(Fade(true, FADE_ANIMATION_DURATION, Color.black, waiter, _cameraFadeAnimationCts.Token));
|
||||
}
|
||||
|
||||
public void Execute(CameraFadeInWhiteCommand command)
|
||||
{
|
||||
if (!_asyncCameraAnimationCts.IsCancellationRequested) _asyncCameraAnimationCts.Cancel();
|
||||
|
||||
if (!_cameraFadeAnimationCts.IsCancellationRequested) _cameraFadeAnimationCts.Cancel();
|
||||
_cameraFadeAnimationCts = new CancellationTokenSource();
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
StartCoroutine(Fade(true, FADE_ANIMATION_DURATION, Color.white, waiter));
|
||||
StartCoroutine(Fade(true, FADE_ANIMATION_DURATION, Color.white, waiter, _cameraFadeAnimationCts.Token));
|
||||
}
|
||||
|
||||
public void Execute(CameraFadeOutCommand command)
|
||||
{
|
||||
if (!_asyncCameraAnimationCts.IsCancellationRequested) _asyncCameraAnimationCts.Cancel();
|
||||
|
||||
if (!_cameraFadeAnimationCts.IsCancellationRequested) _cameraFadeAnimationCts.Cancel();
|
||||
_cameraFadeAnimationCts = new CancellationTokenSource();
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
StartCoroutine(Fade(false, FADE_ANIMATION_DURATION, Color.black, waiter));
|
||||
StartCoroutine(Fade(false, FADE_ANIMATION_DURATION, Color.black, waiter, _cameraFadeAnimationCts.Token));
|
||||
}
|
||||
|
||||
public void Execute(CameraFadeOutWhiteCommand command)
|
||||
{
|
||||
if (!_asyncCameraAnimationCts.IsCancellationRequested) _asyncCameraAnimationCts.Cancel();
|
||||
|
||||
if (!_cameraFadeAnimationCts.IsCancellationRequested) _cameraFadeAnimationCts.Cancel();
|
||||
_cameraFadeAnimationCts = new CancellationTokenSource();
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
StartCoroutine(Fade(false, FADE_ANIMATION_DURATION, Color.white, waiter));
|
||||
StartCoroutine(Fade(false, FADE_ANIMATION_DURATION, Color.white, waiter, _cameraFadeAnimationCts.Token));
|
||||
}
|
||||
|
||||
public void Execute(CameraPushCommand command)
|
||||
@@ -649,14 +672,14 @@ namespace Pal3.Camera
|
||||
{
|
||||
var waiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(waiter));
|
||||
var position = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
Vector3 position = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
StartCoroutine(Move(position, command.Duration, command.Mode, waiter));
|
||||
}
|
||||
#if PAL3A
|
||||
else
|
||||
{
|
||||
_asyncCameraAnimationCts = new CancellationTokenSource();
|
||||
var position = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
Vector3 position = GameBoxInterpreter.ToUnityPosition(new Vector3(command.X, command.Y, command.Z));
|
||||
StartCoroutine(Move(position,
|
||||
command.Duration,
|
||||
command.Mode,
|
||||
@@ -675,6 +698,7 @@ namespace Pal3.Camera
|
||||
|
||||
public void Execute(ScenePreLoadingNotification notification)
|
||||
{
|
||||
_currentAppliedDefaultTransformOption = 0;
|
||||
ApplySceneSettings(notification.NewSceneInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Pal3.Command
|
||||
/// </summary>
|
||||
public void Dispatch(TCommand command)
|
||||
{
|
||||
var commandExecutorType = typeof(ICommandExecutor<>).MakeGenericType(command.GetType());
|
||||
Type commandExecutorType = typeof(ICommandExecutor<>).MakeGenericType(command.GetType());
|
||||
|
||||
var executed = false;
|
||||
foreach (var commandExecutor in _commandExecutorRegistry.GetRegisteredExecutors(commandExecutorType))
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Pal3.Command
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var executorType in executorTypes)
|
||||
foreach (Type executorType in executorTypes)
|
||||
{
|
||||
if (_executors.ContainsKey(executorType))
|
||||
{
|
||||
@@ -110,7 +110,7 @@ namespace Pal3.Command
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var executorType in executorTypes)
|
||||
foreach (Type executorType in executorTypes)
|
||||
{
|
||||
if (!_executors.ContainsKey(executorType))
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace Pal3.Command
|
||||
/// <returns>ICommandExecutors</returns>
|
||||
public IEnumerable<ICommandExecutor<T>> GetRegisteredExecutors<T>() where T : TCommand
|
||||
{
|
||||
var handlerType = typeof(ICommandExecutor<T>);
|
||||
Type handlerType = typeof(ICommandExecutor<T>);
|
||||
|
||||
if (!_executors.ContainsKey(handlerType)) yield break;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Command
|
||||
{
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
public static class CommandExtensions
|
||||
{
|
||||
public static string ToString(ICommand command)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
Type type = command.GetType();
|
||||
|
||||
builder.Append(type.Name[..^"Command".Length]);
|
||||
builder.Append(' ');
|
||||
|
||||
foreach (PropertyInfo propertyInfo in type.GetProperties())
|
||||
{
|
||||
builder.Append(propertyInfo.GetValue(command));
|
||||
builder.Append(' ');
|
||||
}
|
||||
|
||||
var commandStr = builder.ToString();
|
||||
if (commandStr.EndsWith(' ')) commandStr = commandStr[..^1];
|
||||
return commandStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c053d9f1ea1a49569557705e30028a3c
|
||||
timeCreated: 1664709809
|
||||
+19
-8
@@ -8,21 +8,32 @@ namespace Pal3.Command.InternalCommands
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlaySfxAtGameObjectRequest : ICommand
|
||||
public class AttachSfxToGameObjectRequest : ICommand
|
||||
{
|
||||
public PlaySfxAtGameObjectRequest(string sfxName, int loopCount, float startDelayInSeconds, GameObject parent)
|
||||
public AttachSfxToGameObjectRequest(GameObject parent,
|
||||
string sfxName,
|
||||
string audioSourceName,
|
||||
int loopCount,
|
||||
float volume,
|
||||
float startDelayInSeconds,
|
||||
float interval)
|
||||
{
|
||||
SfxName = sfxName;
|
||||
LoopCount = loopCount;
|
||||
StartDelayInSeconds = startDelayInSeconds;
|
||||
Parent = parent;
|
||||
SfxName = sfxName;
|
||||
AudioSourceName = audioSourceName;
|
||||
LoopCount = loopCount;
|
||||
Volume = volume;
|
||||
StartDelayInSeconds = startDelayInSeconds;
|
||||
Interval = interval;
|
||||
}
|
||||
|
||||
|
||||
[JsonIgnore] public GameObject Parent { get; }
|
||||
public string SfxName { get; }
|
||||
public string AudioSourceName { get; }
|
||||
public int LoopCount { get; }
|
||||
public float Volume { get; }
|
||||
public float StartDelayInSeconds { get; }
|
||||
public float Interval { get; }
|
||||
|
||||
[JsonIgnore]
|
||||
public GameObject Parent { get; }
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -9,11 +9,13 @@ namespace Pal3.Command.InternalCommands
|
||||
|
||||
public class GameStateChangedNotification : ICommand
|
||||
{
|
||||
public GameStateChangedNotification(GameState newState)
|
||||
public GameStateChangedNotification(GameState previousState, GameState newState)
|
||||
{
|
||||
PreviousState = previousState;
|
||||
NewState = newState;
|
||||
}
|
||||
|
||||
public GameState PreviousState { get; }
|
||||
public GameState NewState { get; }
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
namespace Pal3.Command.InternalCommands
|
||||
{
|
||||
using Script;
|
||||
|
||||
public class ScriptFailedToRunNotification : ICommand
|
||||
{
|
||||
public ScriptFailedToRunNotification(uint scriptId)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Command.InternalCommands
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
public class StopSfxPlayingAtGameObjectRequest : ICommand
|
||||
{
|
||||
public StopSfxPlayingAtGameObjectRequest(GameObject parent, string audioSourceName, bool disposeSource)
|
||||
{
|
||||
Parent = parent;
|
||||
AudioSourceName = audioSourceName;
|
||||
DisposeSource = disposeSource;
|
||||
}
|
||||
|
||||
[JsonIgnore] public GameObject Parent { get; }
|
||||
public string AudioSourceName { get; }
|
||||
public bool DisposeSource { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b48e5e2f4b24106a4a1173a6c0e2fcb
|
||||
timeCreated: 1664693748
|
||||
@@ -63,6 +63,14 @@ namespace Pal3.Command
|
||||
new ActorChangeTextureCommand(actorId, textureName));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("ActorChangeTransparency", "更改角色透明度,参数:角色ID,透明度(0-1f)")]
|
||||
public static void ActorChangeTransparency(System.Int32 actorId, System.Single alpha)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new ActorChangeTransparencyCommand(actorId, alpha));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("ActorEnablePlayerControl", "设置玩家控制哪个主角,参数:主角ID")]
|
||||
public static void ActorEnablePlayerControl(System.Int32 actorId)
|
||||
@@ -647,6 +655,14 @@ namespace Pal3.Command
|
||||
new InventoryRemoveItemCommand(itemId));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("MiniGameStartGhostHunting", "PAL3A捉鬼(龙葵)游戏")]
|
||||
public static void MiniGameStartGhostHunting()
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new MiniGameStartGhostHuntingCommand());
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("NavigationBeeFlyTo", "控制引路蜂飞向指定位置参数:Nav层,TileMap中X坐标,TileMap中Z坐标")]
|
||||
public static void NavigationBeeFlyTo(System.Int32 navLayerIndex, System.Int32 tileXPosition, System.Int32 tileZPosition)
|
||||
@@ -688,7 +704,7 @@ namespace Pal3.Command
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("PlaySfx", "播放音效,参数:音效名,循环次数")]
|
||||
[ConsoleMethodAttribute("PlaySfx", "播放音效,参数:音效名,循环次数(0表示开始无限循环,-1表示结束循环)")]
|
||||
public static void PlaySfx(System.String sfxName, System.Int32 loopCount)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
@@ -703,6 +719,14 @@ namespace Pal3.Command
|
||||
new PlayVideoCommand(name));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("SceneActivateObject2", "设置某个物件出现或隐藏,参数:场景名,物件ID,是否出现(0隐藏,1出现)")]
|
||||
public static void SceneActivateObject2(System.String sceneName, System.Int32 objectId, System.Int32 isActive)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new SceneActivateObject2Command(sceneName, objectId, isActive));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("SceneActivateObject", "设置某个物件出现或隐藏,参数:物件ID,是否出现(0隐藏,1出现)")]
|
||||
public static void SceneActivateObject(System.Int32 objectId, System.Int32 isActive)
|
||||
@@ -1063,6 +1087,22 @@ namespace Pal3.Command
|
||||
new StopMusicCommand());
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("TaskComplete", "完成主线或支线任务,参数:任务ID")]
|
||||
public static void TaskComplete(System.String taskId)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new TaskCompleteCommand(taskId));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("TaskOpen", "开启主线或支线任务,参数:任务ID")]
|
||||
public static void TaskOpen(System.String taskId)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new TaskOpenCommand(taskId));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("TeamAddOrRemoveActor", "设置某个主角是否在队伍中出现,参数:主角ID,是否出现(1出现0不出现)")]
|
||||
public static void TeamAddOrRemoveActor(System.Int32 actorId, System.Int32 isIn)
|
||||
@@ -1159,14 +1199,6 @@ namespace Pal3.Command
|
||||
new UIShowSmeltingMenuCommand(smeltingScriptId));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown160", "PAL3A捉鬼游戏")]
|
||||
public static void Unknown160()
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand160());
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown162", "???")]
|
||||
public static void Unknown162(System.Single unknown1, System.Single unknown2, System.Single unknown3, System.Single unknown4, System.Single unknown5, System.Single unknown6, System.Single unknown7)
|
||||
@@ -1175,14 +1207,6 @@ namespace Pal3.Command
|
||||
new UnknownCommand162(unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown163", "???")]
|
||||
public static void Unknown163(System.String sceneName, System.Int32 objectId, System.Int32 enable)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand163(sceneName, objectId, enable));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown166", "???")]
|
||||
public static void Unknown166(System.Int32 unknown1, System.Int32 unknown2)
|
||||
@@ -1199,22 +1223,6 @@ namespace Pal3.Command
|
||||
new UnknownCommand167(unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7, unknown8));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown169", "???")]
|
||||
public static void Unknown169(System.String unknown)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand169(unknown));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown170", "???")]
|
||||
public static void Unknown170(System.String unknown)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand170(unknown));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown176", "???")]
|
||||
public static void Unknown176(System.Int32 unknown1, System.Int32 unknown2, System.Int32 unknown3)
|
||||
@@ -1223,14 +1231,6 @@ namespace Pal3.Command
|
||||
new UnknownCommand176(unknown1, unknown2, unknown3));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown177", "王蓬絮开启朱仙变???")]
|
||||
public static void Unknown177(System.Int32 enable)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand177(enable));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown181", "???")]
|
||||
public static void Unknown181(System.Single unknown1, System.Single unknown2, System.Single unknown3, System.Single unknown4)
|
||||
@@ -1247,14 +1247,6 @@ namespace Pal3.Command
|
||||
new UnknownCommand182(unknown));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown184", "更改角色透明度???")]
|
||||
public static void Unknown184(System.Int32 actorId, System.Single transparency)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new UnknownCommand184(actorId, transparency));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown185", "PAL3A算命UI???")]
|
||||
public static void Unknown185(System.Int32 unknown1, System.Int32 unknown2, System.Int32 unknown3, System.Int32 unknown4, System.Int32 unknown5, System.Int32 unknown6, System.Int32 unknown7, System.Int32 unknown8)
|
||||
@@ -1296,7 +1288,7 @@ namespace Pal3.Command
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("Unknown194", "PAL3游戏结束的最后一个指令,目测是播放制作人信息???")]
|
||||
[ConsoleMethodAttribute("Unknown194", "PAL3游戏结束的最后一个指令")]
|
||||
public static void Unknown194()
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
@@ -1359,6 +1351,14 @@ namespace Pal3.Command
|
||||
new UnknownCommand216());
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("WangPengXuEnableCombatTransform", "设置开启/关闭王蓬絮战斗中变身(朱仙变),参数:0关闭,1开启")]
|
||||
public static void WangPengXuEnableCombatTransform(System.Int32 enabled)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
new WangPengXuEnableCombatTransformCommand(enabled));
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("ResetGameState", "Execute ResetGameStateCommand.")]
|
||||
public static void ResetGameState()
|
||||
|
||||
@@ -736,7 +736,7 @@ namespace Pal3.Command
|
||||
}
|
||||
|
||||
// <auto-generated/>
|
||||
[ConsoleMethodAttribute("PlaySfx", "播放音效,参数:音效名,循环次数")]
|
||||
[ConsoleMethodAttribute("PlaySfx", "播放音效,参数:音效名,循环次数(0表示开始无限循环,-1表示结束循环)")]
|
||||
public static void PlaySfx(System.String sfxName, System.Int32 loopCount)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Pal3.Command
|
||||
return SceCommandTypeCache[hashKey];
|
||||
}
|
||||
|
||||
foreach (var commandType in CommandTypes)
|
||||
foreach (Type commandType in CommandTypes)
|
||||
{
|
||||
if (commandType.GetCustomAttribute(typeof(SceCommandAttribute))
|
||||
is SceCommandAttribute attribute && attribute.Id == commandId)
|
||||
|
||||
+6
-5
@@ -6,17 +6,18 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(184, "更改角色透明度???")]
|
||||
public class UnknownCommand184 : ICommand
|
||||
[SceCommand(184, "更改角色透明度," +
|
||||
"参数:角色ID,透明度(0-1f)")]
|
||||
public class ActorChangeTransparencyCommand : ICommand
|
||||
{
|
||||
public UnknownCommand184(int actorId, float transparency)
|
||||
public ActorChangeTransparencyCommand(int actorId, float alpha)
|
||||
{
|
||||
ActorId = actorId;
|
||||
Transparency = transparency;
|
||||
Alpha = alpha;
|
||||
}
|
||||
|
||||
public int ActorId { get; }
|
||||
public float Transparency { get; }
|
||||
public float Alpha { get; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
+3
-3
@@ -6,10 +6,10 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(160, "PAL3A捉鬼游戏")]
|
||||
public class UnknownCommand160 : ICommand
|
||||
[SceCommand(160, "PAL3A捉鬼(龙葵)游戏")]
|
||||
public class MiniGameStartGhostHuntingCommand : ICommand
|
||||
{
|
||||
public UnknownCommand160() { }
|
||||
public MiniGameStartGhostHuntingCommand() { }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
[SceCommand(79, "播放音效," +
|
||||
"参数:音效名,循环次数")]
|
||||
"参数:音效名,循环次数(0表示开始无限循环,-1表示结束循环)")]
|
||||
public class PlaySfxCommand : ICommand
|
||||
{
|
||||
public PlaySfxCommand(string sfxName, int loopCount)
|
||||
|
||||
+7
-6
@@ -6,22 +6,23 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(163, "???")]
|
||||
public class UnknownCommand163 : ICommand
|
||||
[SceCommand(163, "设置某个物件出现或隐藏," +
|
||||
"参数:场景名,物件ID,是否出现(0隐藏,1出现)")]
|
||||
public class SceneActivateObject2Command : ICommand
|
||||
{
|
||||
public UnknownCommand163(
|
||||
public SceneActivateObject2Command(
|
||||
string sceneName,
|
||||
int objectId,
|
||||
int enable)
|
||||
int isActive)
|
||||
{
|
||||
SceneName = sceneName;
|
||||
ObjectId = objectId;
|
||||
Enable = enable;
|
||||
IsActive = isActive;
|
||||
}
|
||||
|
||||
public string SceneName { get; }
|
||||
public int ObjectId { get; }
|
||||
public int Enable { get; }
|
||||
public int IsActive { get; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
+6
-6
@@ -6,16 +6,16 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(177, "王蓬絮开启朱仙变???")]
|
||||
public class UnknownCommand177: ICommand
|
||||
[SceCommand(170, "完成主线或支线任务," +
|
||||
"参数:任务ID")]
|
||||
public class TaskCompleteCommand : ICommand
|
||||
{
|
||||
public UnknownCommand177(
|
||||
int enable)
|
||||
public TaskCompleteCommand(string taskId)
|
||||
{
|
||||
Enable = enable;
|
||||
TaskId = taskId;
|
||||
}
|
||||
|
||||
public int Enable { get; }
|
||||
public string TaskId { get; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
+6
-5
@@ -6,15 +6,16 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(170, "???")]
|
||||
public class UnknownCommand170 : ICommand
|
||||
[SceCommand(169, "开启主线或支线任务," +
|
||||
"参数:任务ID")]
|
||||
public class TaskOpenCommand : ICommand
|
||||
{
|
||||
public UnknownCommand170(string unknown)
|
||||
public TaskOpenCommand(string taskId)
|
||||
{
|
||||
Unknown = unknown;
|
||||
TaskId = taskId;
|
||||
}
|
||||
|
||||
public string Unknown { get; }
|
||||
public string TaskId { get; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(194, "PAL3游戏结束的最后一个指令,目测是播放制作人信息???")]
|
||||
[SceCommand(194, "PAL3游戏结束的最后一个指令")]
|
||||
public class UnknownCommand194 : ICommand
|
||||
{
|
||||
public UnknownCommand194() { }
|
||||
|
||||
+7
-5
@@ -6,15 +6,17 @@
|
||||
namespace Pal3.Command.SceCommands
|
||||
{
|
||||
#if PAL3A
|
||||
[SceCommand(169, "???")]
|
||||
public class UnknownCommand169 : ICommand
|
||||
[SceCommand(177, "设置开启/关闭王蓬絮战斗中变身(朱仙变)," +
|
||||
"参数:0关闭,1开启")]
|
||||
public class WangPengXuEnableCombatTransformCommand: ICommand
|
||||
{
|
||||
public UnknownCommand169(string unknown)
|
||||
public WangPengXuEnableCombatTransformCommand(
|
||||
int enabled)
|
||||
{
|
||||
Unknown = unknown;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public string Unknown { get; }
|
||||
public int Enabled { get; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File renamed without changes.
@@ -14,7 +14,7 @@ namespace Pal3.Data
|
||||
/// <summary>
|
||||
/// Cache/dispose Cpk archive into memory based on scenarios.
|
||||
/// </summary>
|
||||
public class FileSystemCacheManager :
|
||||
public sealed class FileSystemCacheManager : IDisposable,
|
||||
ICommandExecutor<ScenePreLoadingNotification>
|
||||
{
|
||||
private readonly ICpkFileSystem _fileSystem;
|
||||
@@ -23,7 +23,7 @@ namespace Pal3.Data
|
||||
|
||||
public FileSystemCacheManager(ICpkFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
|
||||
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Pal3.Data
|
||||
// Dispose current scene cpk
|
||||
if (!string.IsNullOrEmpty(_currentSceneCityName))
|
||||
{
|
||||
var currentSceneFolderPath = _currentSceneCityName + ".cpk" + CpkConstants.CpkDirectorySeparatorChar
|
||||
var currentSceneFolderPath = _currentSceneCityName + CpkConstants.FileExtension + CpkConstants.DirectorySeparator
|
||||
+ _currentSceneName;
|
||||
|
||||
if (_fileSystem.FileExistsInSegmentedArchive(currentSceneFolderPath, out string segmentedArchiveName))
|
||||
@@ -52,13 +52,13 @@ namespace Pal3.Data
|
||||
}
|
||||
else
|
||||
{
|
||||
_fileSystem.DisposeInMemoryArchive(_currentSceneCityName + ".cpk");
|
||||
_fileSystem.DisposeInMemoryArchive(_currentSceneCityName + CpkConstants.FileExtension);
|
||||
}
|
||||
}
|
||||
|
||||
// Load new scene cpk into memory
|
||||
{
|
||||
var newSceneFolderPath = newSceneCityName + ".cpk" + CpkConstants.CpkDirectorySeparatorChar
|
||||
var newSceneFolderPath = newSceneCityName + CpkConstants.FileExtension + CpkConstants.DirectorySeparator
|
||||
+ newSceneName;
|
||||
|
||||
if (_fileSystem.FileExistsInSegmentedArchive(newSceneFolderPath, out string segmentedArchiveName))
|
||||
@@ -67,7 +67,7 @@ namespace Pal3.Data
|
||||
}
|
||||
else
|
||||
{
|
||||
_fileSystem.LoadArchiveIntoMemory(newSceneCityName + ".cpk");
|
||||
_fileSystem.LoadArchiveIntoMemory(newSceneCityName + CpkConstants.FileExtension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Pal3.Data
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -34,27 +33,51 @@ namespace Pal3.Data
|
||||
/// Single resource provider for accessing game data.
|
||||
/// Also manages the lifecycle of the resource it provides.
|
||||
/// </summary>
|
||||
public class GameResourceProvider : ICommandExecutor<ScenePreLoadingNotification>
|
||||
public class GameResourceProvider : IDisposable,
|
||||
ICommandExecutor<ScenePreLoadingNotification>
|
||||
{
|
||||
private const string CACHE_FOLDER_NAME = "CacheData";
|
||||
private const string MV3_ACTOR_CONFIG_HEADER = ";#MV3#";
|
||||
|
||||
private readonly ICpkFileSystem _fileSystem;
|
||||
private readonly ITextureLoaderFactory _textureLoaderFactory;
|
||||
private readonly int _codepage;
|
||||
private TextureCache _textureCache;
|
||||
private readonly Dictionary<string, Sprite> _spriteCache = new ();
|
||||
private readonly Dictionary<string, (PolFile PolFile, ITextureResourceProvider TextureProvider)> _polCache = new ();
|
||||
private readonly Dictionary<string, (CvdFile PolFile, ITextureResourceProvider TextureProvider)> _cvdCache = new ();
|
||||
private readonly Dictionary<string, (Mv3File mv3File, ITextureResourceProvider textureProvider)> _mv3Cache = new ();
|
||||
private readonly Dictionary<string, ActorConfigFile> _actorConfigCache = new (); // Cache forever
|
||||
private readonly Dictionary<string, AudioClip> _audioClipCache = new ();
|
||||
|
||||
// Cache player actor movement sfx audio clips
|
||||
private readonly HashSet<string> _audioClipCacheList = new ()
|
||||
{
|
||||
#if PAL3
|
||||
"we021a.wav",
|
||||
"we021b.wav",
|
||||
"we021c.wav",
|
||||
"we021d.wav",
|
||||
"we022a.wav",
|
||||
"we022b.wav",
|
||||
"we022c.wav",
|
||||
"we022d.wav",
|
||||
#elif PAL3A
|
||||
"WE007.WAV",
|
||||
"WE008.WAV"
|
||||
#endif
|
||||
};
|
||||
|
||||
// No need to deallocate the shadow texture since it is been used almost every where.
|
||||
private static readonly Texture2D ShadowTexture = Resources.Load<Texture2D>("Textures/shadow");
|
||||
|
||||
public GameResourceProvider(ICpkFileSystem fileSystem, ITextureLoaderFactory textureLoaderFactory)
|
||||
public GameResourceProvider(ICpkFileSystem fileSystem,
|
||||
ITextureLoaderFactory textureLoaderFactory,
|
||||
int codepage)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_textureLoaderFactory = textureLoaderFactory;
|
||||
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
|
||||
_textureLoaderFactory = textureLoaderFactory ?? throw new ArgumentNullException(nameof(textureLoaderFactory));
|
||||
_codepage = codepage;
|
||||
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
||||
}
|
||||
|
||||
@@ -65,6 +88,7 @@ namespace Pal3.Data
|
||||
_polCache.Clear();
|
||||
_mv3Cache.Clear();
|
||||
_actorConfigCache.Clear();
|
||||
_audioClipCache.Clear();
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
@@ -95,9 +119,9 @@ namespace Pal3.Data
|
||||
polFilePath = polFilePath.ToLower();
|
||||
if (_polCache.ContainsKey(polFilePath)) return _polCache[polFilePath];
|
||||
var polData = _fileSystem.ReadAllBytes(polFilePath);
|
||||
var polFile = PolFileReader.Read(polData);
|
||||
var relativePath = Utility.GetDirectoryName(polFilePath, CpkConstants.CpkDirectorySeparatorChar);
|
||||
var textureProvider = GetTextureResourceProvider(relativePath);
|
||||
PolFile polFile = PolFileReader.Read(polData, _codepage);
|
||||
var relativePath = Utility.GetDirectoryName(polFilePath, CpkConstants.DirectorySeparator);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(relativePath);
|
||||
_polCache[polFilePath] = (polFile, textureProvider);
|
||||
return (polFile, textureProvider);
|
||||
}
|
||||
@@ -107,9 +131,9 @@ namespace Pal3.Data
|
||||
cvdFilePath = cvdFilePath.ToLower();
|
||||
if (_cvdCache.ContainsKey(cvdFilePath)) return _cvdCache[cvdFilePath];
|
||||
var cvdData =_fileSystem.ReadAllBytes(cvdFilePath);
|
||||
var cvdFile = CvdFileReader.Read(cvdData);
|
||||
var relativePath = Utility.GetDirectoryName(cvdFilePath, CpkConstants.CpkDirectorySeparatorChar);
|
||||
var textureProvider = GetTextureResourceProvider(relativePath);
|
||||
CvdFile cvdFile = CvdFileReader.Read(cvdData, _codepage);
|
||||
var relativePath = Utility.GetDirectoryName(cvdFilePath, CpkConstants.DirectorySeparator);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(relativePath);
|
||||
_cvdCache[cvdFilePath] = (cvdFile, textureProvider);
|
||||
return (cvdFile, textureProvider);
|
||||
}
|
||||
@@ -119,18 +143,18 @@ namespace Pal3.Data
|
||||
mv3FilePath = mv3FilePath.ToLower();
|
||||
if (_mv3Cache.ContainsKey(mv3FilePath)) return _mv3Cache[mv3FilePath];
|
||||
var mv3Data = _fileSystem.ReadAllBytes(mv3FilePath);
|
||||
var mv3File = Mv3FileReader.Read(mv3Data);
|
||||
var relativePath = Utility.GetDirectoryName(mv3FilePath, CpkConstants.CpkDirectorySeparatorChar);
|
||||
var textureProvider = GetTextureResourceProvider(relativePath);
|
||||
Mv3File mv3File = Mv3FileReader.Read(mv3Data, _codepage);
|
||||
var relativePath = Utility.GetDirectoryName(mv3FilePath, CpkConstants.DirectorySeparator);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(relativePath);
|
||||
_mv3Cache[mv3FilePath] = (mv3File, textureProvider);
|
||||
return (mv3File, textureProvider);
|
||||
}
|
||||
|
||||
public NavFile GetNav(string sceneFileName, string sceneName)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
#if PAL3
|
||||
var navFilePath = $"{sceneFileName}.cpk{separator}" +
|
||||
var navFilePath = $"{sceneFileName}{CpkConstants.FileExtension}{separator}" +
|
||||
$"{sceneName}{separator}{sceneName}.nav";
|
||||
#elif PAL3A
|
||||
var navFilePath = $"{FileConstants.ScnCpkPathInfo.cpkName}{separator}SCN{separator}" +
|
||||
@@ -143,41 +167,41 @@ namespace Pal3.Data
|
||||
|
||||
public ScnFile GetScn(string sceneFileName, string sceneName)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
#if PAL3
|
||||
var scnFilePath = $"{sceneFileName}.cpk{separator}{sceneName}.scn";
|
||||
var scnFilePath = $"{sceneFileName}{CpkConstants.FileExtension}{separator}{sceneName}.scn";
|
||||
#elif PAL3A
|
||||
var scnFilePath = $"{FileConstants.ScnCpkPathInfo.cpkName}{separator}SCN{separator}" +
|
||||
$"{sceneFileName}{separator}{sceneFileName}_{sceneName}.scn";
|
||||
#endif
|
||||
using var scnFileStream = new MemoryStream(_fileSystem.ReadAllBytes(scnFilePath));
|
||||
return ScnFileReader.Read(scnFileStream);
|
||||
return ScnFileReader.Read(scnFileStream, _codepage);
|
||||
}
|
||||
|
||||
public SceFile GetSceneSce(string sceneFileName)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
#if PAL3
|
||||
var sceFilePath = $"{sceneFileName}.cpk{separator}{sceneFileName}.sce";
|
||||
var sceFilePath = $"{sceneFileName}{CpkConstants.FileExtension}{separator}{sceneFileName}.sce";
|
||||
#elif PAL3A
|
||||
var sceFilePath = $"{FileConstants.SceCpkPathInfo.cpkName}{separator}Sce{separator}{sceneFileName}.sce";
|
||||
#endif
|
||||
using var sceFileStream = new MemoryStream(_fileSystem.ReadAllBytes(sceFilePath));
|
||||
return SceFileReader.Read(sceFileStream);
|
||||
return SceFileReader.Read(sceFileStream, _codepage);
|
||||
}
|
||||
|
||||
public SceFile GetSystemSce()
|
||||
{
|
||||
using var sceFileStream = new MemoryStream(
|
||||
_fileSystem.ReadAllBytes(ScriptConstants.SystemSceFileVirtualPath));
|
||||
return SceFileReader.Read(sceFileStream);
|
||||
return SceFileReader.Read(sceFileStream, _codepage);
|
||||
}
|
||||
|
||||
public SceFile GetBigMapSce()
|
||||
{
|
||||
using var sceFileStream = new MemoryStream(
|
||||
_fileSystem.ReadAllBytes(ScriptConstants.BigMapSceFileVirtualPath));
|
||||
return SceFileReader.Read(sceFileStream);
|
||||
return SceFileReader.Read(sceFileStream, _codepage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -189,8 +213,8 @@ namespace Pal3.Data
|
||||
{
|
||||
return Application.persistentDataPath + Path.DirectorySeparatorChar + CACHE_FOLDER_NAME
|
||||
+ Path.DirectorySeparatorChar + musicFileVirtualPath.Replace(
|
||||
CpkConstants.CpkDirectorySeparatorChar, Path.DirectorySeparatorChar)
|
||||
.Replace(".cpk", string.Empty);
|
||||
CpkConstants.DirectorySeparator, Path.DirectorySeparatorChar)
|
||||
.Replace(CpkConstants.FileExtension, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -232,28 +256,53 @@ namespace Pal3.Data
|
||||
public string GetSfxFilePath(string sfxName)
|
||||
{
|
||||
#if PAL3
|
||||
sfxName = sfxName.ToLower();
|
||||
string sfxFileName = (sfxName + ".wav").ToLower();
|
||||
#elif PAL3A
|
||||
sfxName = sfxName.ToUpper();
|
||||
string sfxFileName = (sfxName + ".wav").ToUpper();
|
||||
#endif
|
||||
var sfxFileRelativePath = $"{FileConstants.SfxFolderName}{Path.DirectorySeparatorChar}" +
|
||||
$"{sfxName}.wav";
|
||||
|
||||
var sfxFileRelativePath = $"{FileConstants.SfxFolderName}{Path.DirectorySeparatorChar}" + sfxFileName;
|
||||
|
||||
var rootPath = _fileSystem.GetRootPath();
|
||||
var sfxFilePath = $"{rootPath}{sfxFileRelativePath}";
|
||||
|
||||
return sfxFilePath;
|
||||
}
|
||||
|
||||
public IEnumerator LoadAudioClip(string filePath, AudioType audioType, Action<AudioClip> callback)
|
||||
{
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
var shouldCache = _audioClipCacheList.Contains(fileName);
|
||||
|
||||
if (shouldCache && _audioClipCache.ContainsKey(fileName))
|
||||
{
|
||||
if (_audioClipCache[fileName] != null) // check if clip has been destroyed
|
||||
{
|
||||
callback?.Invoke(_audioClipCache[fileName]);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
yield return AudioClipLoader.LoadAudioClip(filePath, audioType, audioClip =>
|
||||
{
|
||||
if (shouldCache && audioClip != null)
|
||||
{
|
||||
_audioClipCache[fileName] = audioClip;
|
||||
}
|
||||
|
||||
callback?.Invoke(audioClip);
|
||||
});
|
||||
}
|
||||
|
||||
private Texture2D GetActorAvatarTexture(string actorName, string avatarTextureName)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var roleAvatarTextureRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.ActorFolderName}{separator}{actorName}{separator}";
|
||||
|
||||
var textureProvider = GetTextureResourceProvider(roleAvatarTextureRelativePath);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(roleAvatarTextureRelativePath);
|
||||
return textureProvider.GetTexture($"{avatarTextureName}.tga");
|
||||
}
|
||||
|
||||
@@ -263,15 +312,16 @@ namespace Pal3.Data
|
||||
|
||||
if (_spriteCache.ContainsKey(cacheKey))
|
||||
{
|
||||
var sprite = _spriteCache[cacheKey];
|
||||
Sprite sprite = _spriteCache[cacheKey];
|
||||
if (sprite.texture != null) return sprite;
|
||||
}
|
||||
|
||||
var texture = GetActorAvatarTexture(
|
||||
Texture2D texture = GetActorAvatarTexture(
|
||||
actorName, avatarName);
|
||||
|
||||
var avatarSprite = Sprite.Create(texture,
|
||||
new Rect(0f, 0f, texture.width, texture.height),
|
||||
// Cut 2f to hide artifacts near edges for some of the avatar textures
|
||||
new Rect(2f, 0f, texture.width - 2f, texture.height),
|
||||
new Vector2(0.5f, 0f));
|
||||
|
||||
_spriteCache[cacheKey] = avatarSprite;
|
||||
@@ -280,36 +330,36 @@ namespace Pal3.Data
|
||||
|
||||
private Texture2D GetEmojiSpriteSheetTexture(ActorEmojiType emojiType)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var emojiSpriteSheetRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.UIFolderName}{separator}{FileConstants.EmojiFolderName}{separator}";
|
||||
|
||||
var textureProvider = GetTextureResourceProvider(emojiSpriteSheetRelativePath);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(emojiSpriteSheetRelativePath);
|
||||
return textureProvider.GetTexture($"EM_{(int)emojiType:00}.tga");
|
||||
}
|
||||
|
||||
public Texture2D GetCaptionTexture(string name)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var captionTextureRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.CaptionFolderName}{separator}";
|
||||
|
||||
// No need to cache caption texture since it is a one time thing
|
||||
var textureProvider = GetTextureResourceProvider(captionTextureRelativePath, useCache: false);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(captionTextureRelativePath, useCache: false);
|
||||
return textureProvider.GetTexture($"{name}.tga");
|
||||
}
|
||||
|
||||
public Texture2D[] GetSkyBoxTextures(int skyBoxId)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var relativePath = string.Format(SceneConstants.SkyBoxTexturePathFormat.First(), skyBoxId);
|
||||
|
||||
var textureProvider = GetTextureResourceProvider(
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(
|
||||
Utility.GetDirectoryName(relativePath, separator));
|
||||
|
||||
var textures = new Texture2D[SceneConstants.SkyBoxTexturePathFormat.Length];
|
||||
@@ -317,7 +367,7 @@ namespace Pal3.Data
|
||||
{
|
||||
var textureNameFormat = Utility.GetFileName(
|
||||
string.Format(SceneConstants.SkyBoxTexturePathFormat[i], skyBoxId), separator);
|
||||
var texture = textureProvider.GetTexture(string.Format(textureNameFormat, i));
|
||||
Texture2D texture = textureProvider.GetTexture(string.Format(textureNameFormat, i));
|
||||
// Set wrap mode to clamp to remove "edges" between sides
|
||||
texture.wrapMode = TextureWrapMode.Clamp;
|
||||
textures[i] = texture;
|
||||
@@ -328,22 +378,22 @@ namespace Pal3.Data
|
||||
|
||||
public Texture2D GetEffectTexture(string name)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var effectFolderRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.EffectFolderName}{separator}";
|
||||
|
||||
var textureProvider = GetTextureResourceProvider(effectFolderRelativePath);
|
||||
var effectTexture = textureProvider.GetTexture(name);
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(effectFolderRelativePath);
|
||||
Texture2D effectTexture = textureProvider.GetTexture(name);
|
||||
Utility.ApplyTransparencyBasedOnColorLuminance(effectTexture);
|
||||
return effectTexture;
|
||||
}
|
||||
|
||||
public Sprite[] GetEmojiSprites(ActorEmojiType emojiType)
|
||||
{
|
||||
var textureInfo = ActorEmojiConstants.TextureInfo[emojiType];
|
||||
var spriteSheet = GetEmojiSpriteSheetTexture(emojiType);
|
||||
(int Width, int Height, int Frames) textureInfo = ActorEmojiConstants.TextureInfo[emojiType];
|
||||
Texture2D spriteSheet = GetEmojiSpriteSheetTexture(emojiType);
|
||||
|
||||
var widthIndex = 0f;
|
||||
var sprites = new Sprite[textureInfo.Frames];
|
||||
@@ -354,7 +404,7 @@ namespace Pal3.Data
|
||||
|
||||
if (_spriteCache.ContainsKey(cacheKey))
|
||||
{
|
||||
var sprite = _spriteCache[cacheKey];
|
||||
Sprite sprite = _spriteCache[cacheKey];
|
||||
if (sprite.texture != null)
|
||||
{
|
||||
sprites[i] = sprite;
|
||||
@@ -390,7 +440,7 @@ namespace Pal3.Data
|
||||
|
||||
if (string.Equals(MV3_ACTOR_CONFIG_HEADER, configHeaderStr))
|
||||
{
|
||||
var config = ActorConfigFileReader.Read(configData);
|
||||
ActorConfigFile config = ActorConfigFileReader.Read(configData);
|
||||
_actorConfigCache[actorConfigFilePath] = config;
|
||||
return config;
|
||||
}
|
||||
@@ -415,7 +465,7 @@ namespace Pal3.Data
|
||||
|
||||
var supportedVideoFormats = UnitySupportedVideoFormats.GetSupportedVideoFormats(Application.platform);
|
||||
|
||||
foreach (var file in new DirectoryInfo(videoFolder).GetFiles($"*.*", SearchOption.AllDirectories))
|
||||
foreach (FileInfo file in new DirectoryInfo(videoFolder).GetFiles($"*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
var fileExtension = Path.GetExtension(file.Name);
|
||||
if (supportedVideoFormats.Contains(fileExtension.ToLower()) &&
|
||||
@@ -431,8 +481,8 @@ namespace Pal3.Data
|
||||
|
||||
public Texture2D[] GetEffectTextures(GraphicsEffect effect, string texturePathFormat)
|
||||
{
|
||||
var separator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
var textureProvider = GetTextureResourceProvider(
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(
|
||||
Utility.GetDirectoryName(texturePathFormat, separator));
|
||||
|
||||
if (effect == GraphicsEffect.Fire)
|
||||
@@ -442,7 +492,7 @@ namespace Pal3.Data
|
||||
for (var i = 0; i < numberOfFrames; i++)
|
||||
{
|
||||
var textureNameFormat = Utility.GetFileName(texturePathFormat, separator);
|
||||
var texture = textureProvider.GetTexture(string.Format(textureNameFormat, i + 1));
|
||||
Texture2D texture = textureProvider.GetTexture(string.Format(textureNameFormat, i + 1));
|
||||
textures[i] = texture;
|
||||
}
|
||||
|
||||
@@ -452,6 +502,19 @@ namespace Pal3.Data
|
||||
return Array.Empty<Texture2D>();
|
||||
}
|
||||
|
||||
public Texture2D GetCursorTexture()
|
||||
{
|
||||
var separator = CpkConstants.DirectorySeparator;
|
||||
|
||||
var cursorSpriteRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{separator}" +
|
||||
$"{FileConstants.UIFolderName}{separator}{FileConstants.CursorFolderName}{separator}";
|
||||
|
||||
ITextureResourceProvider textureProvider = GetTextureResourceProvider(cursorSpriteRelativePath);
|
||||
Texture2D cursorTexture = textureProvider.GetTexture($"jt.tga");
|
||||
return cursorTexture;
|
||||
}
|
||||
|
||||
private string _currentSceneCityName;
|
||||
public void Execute(ScenePreLoadingNotification notification)
|
||||
{
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace Pal3.Data
|
||||
public void DisposeAll()
|
||||
{
|
||||
Debug.Log($"Disposing all cached textures: {_textureCache.Count}");
|
||||
foreach (var textureTuple in _textureCache.Values)
|
||||
foreach ((Texture2D texture, _) in _textureCache.Values)
|
||||
{
|
||||
UnityEngine.Object.Destroy(textureTuple.texutre);
|
||||
UnityEngine.Object.Destroy(texture);
|
||||
}
|
||||
_textureCache.Clear();
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace Pal3.Data
|
||||
string relativePath,
|
||||
TextureCache textureCache = null)
|
||||
{
|
||||
if (!relativePath.EndsWith(CpkConstants.CpkDirectorySeparatorChar))
|
||||
if (!relativePath.EndsWith(CpkConstants.DirectorySeparator))
|
||||
{
|
||||
relativePath += CpkConstants.CpkDirectorySeparatorChar;
|
||||
relativePath += CpkConstants.DirectorySeparator;
|
||||
}
|
||||
|
||||
_fileSystem = fileSystem;
|
||||
@@ -39,9 +39,9 @@ namespace Pal3.Data
|
||||
{
|
||||
if (_textureCache != null && _textureCache.Contains(textureFullPath))
|
||||
{
|
||||
var textureInfo = _textureCache.GetTextureFromCache(textureFullPath);
|
||||
hasAlphaChannel = textureInfo.hasAlphaChannel;
|
||||
return textureInfo.texture;
|
||||
(Texture2D texture, bool hasAlpha) = _textureCache.GetTextureFromCache(textureFullPath);
|
||||
hasAlphaChannel = hasAlpha;
|
||||
return texture;
|
||||
}
|
||||
|
||||
hasAlphaChannel = false;
|
||||
@@ -100,8 +100,8 @@ namespace Pal3.Data
|
||||
}
|
||||
|
||||
// Get dds texture
|
||||
var textureLoader = _textureLoaderFactory.GetTextureLoader(".dds");
|
||||
var texture = base.GetTexture(_fileSystem, ddsTexturePath, textureLoader, out hasAlphaChannel);
|
||||
ITextureLoader textureLoader = _textureLoaderFactory.GetTextureLoader(".dds");
|
||||
Texture2D texture = base.GetTexture(_fileSystem, ddsTexturePath, textureLoader, out hasAlphaChannel);
|
||||
if (texture != null)
|
||||
{
|
||||
_textureCache?.Add(ddsTexturePath, texture, hasAlphaChannel);
|
||||
|
||||
@@ -17,10 +17,11 @@ namespace Pal3.Dev
|
||||
using Scene;
|
||||
using Script;
|
||||
using State;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MazeSkipper :
|
||||
public sealed class MazeSkipper : IDisposable,
|
||||
ICommandExecutor<ScenePostLoadingNotification>,
|
||||
ICommandExecutor<GameStateChangedNotification>
|
||||
{
|
||||
@@ -894,17 +895,19 @@ namespace Pal3.Dev
|
||||
Button mazeEntranceButton,
|
||||
Button mazeExitButton)
|
||||
{
|
||||
_gameStateManager = gameStateManager;
|
||||
_sceneManager = sceneManager;
|
||||
_mazeSkipperCanvasGroup = mazeSkipperCanvasGroup;
|
||||
_mazeEntranceButton = mazeEntranceButton;
|
||||
_mazeExitButton = mazeExitButton;
|
||||
_gameStateManager = gameStateManager ?? throw new ArgumentNullException(nameof(gameStateManager));
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
_mazeSkipperCanvasGroup = mazeSkipperCanvasGroup != null ? mazeSkipperCanvasGroup : throw new ArgumentNullException(nameof(mazeSkipperCanvasGroup));
|
||||
_mazeEntranceButton = mazeEntranceButton != null ? mazeEntranceButton : throw new ArgumentNullException(nameof(mazeEntranceButton));
|
||||
_mazeExitButton = mazeExitButton != null ? mazeExitButton : throw new ArgumentNullException(nameof(mazeExitButton));
|
||||
|
||||
_mazeSkipperCanvasGroup.alpha = 0f;
|
||||
_mazeSkipperCanvasGroup.interactable = false;
|
||||
|
||||
_mazeEntranceButton.colors = UITheme.GetButtonColors();
|
||||
_mazeEntranceButton.onClick
|
||||
.AddListener(EntranceButtonClicked);
|
||||
_mazeExitButton.colors = UITheme.GetButtonColors();
|
||||
_mazeExitButton.onClick
|
||||
.AddListener(ExitButtonClicked);
|
||||
|
||||
@@ -915,7 +918,7 @@ namespace Pal3.Dev
|
||||
{
|
||||
if (_gameStateManager.GetCurrentState() != GameState.Gameplay) return;
|
||||
if (_sceneManager.GetCurrentScene() is not { } currentScene) return;
|
||||
foreach (var command in _skipperCommands[GetCommandHashKeyPrefix(currentScene.GetSceneInfo()) + "0"])
|
||||
foreach (ICommand command in _skipperCommands[GetCommandHashKeyPrefix(currentScene.GetSceneInfo()) + "0"])
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(command);
|
||||
}
|
||||
@@ -944,7 +947,7 @@ namespace Pal3.Dev
|
||||
var mainStoryVarValue = int.Parse(commandKey[cmdHashKeyPrefix.Length..]);
|
||||
if (mainStoryVarCurrentValue == mainStoryVarValue)
|
||||
{
|
||||
foreach (var command in _skipperCommands[commandKey])
|
||||
foreach (ICommand command in _skipperCommands[commandKey])
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(command);
|
||||
}
|
||||
@@ -953,7 +956,7 @@ namespace Pal3.Dev
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var command in _skipperCommands[cmdHashKeyPrefix + "1"])
|
||||
foreach (ICommand command in _skipperCommands[cmdHashKeyPrefix + "1"])
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(command);
|
||||
}
|
||||
@@ -962,12 +965,11 @@ namespace Pal3.Dev
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
_mazeEntranceButton.onClick
|
||||
.RemoveListener(EntranceButtonClicked);
|
||||
_mazeExitButton.onClick
|
||||
.RemoveListener(ExitButtonClicked);
|
||||
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
private string GetCommandHashKeyPrefix(ScnSceneInfo sceneInfo)
|
||||
@@ -986,7 +988,7 @@ namespace Pal3.Dev
|
||||
|
||||
if (_sceneManager.GetCurrentScene() is not { } currentScene) return;
|
||||
|
||||
var currentSceneInfo = currentScene.GetSceneInfo();
|
||||
ScnSceneInfo currentSceneInfo = currentScene.GetSceneInfo();
|
||||
var cmdHashKeyPrefix = GetCommandHashKeyPrefix(currentSceneInfo);
|
||||
|
||||
if (command.NewState == GameState.Gameplay &&
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace Pal3.Dev
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Command;
|
||||
@@ -17,12 +18,14 @@ namespace Pal3.Dev
|
||||
using Script;
|
||||
using State;
|
||||
using TMPro;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.DualShock;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StorySelector : MonoBehaviour,
|
||||
public sealed class StorySelector : MonoBehaviour,
|
||||
ICommandExecutor<ToggleStorySelectorRequest>,
|
||||
ICommandExecutor<GameSwitchToMainMenuCommand>
|
||||
{
|
||||
@@ -32,6 +35,7 @@ namespace Pal3.Dev
|
||||
private ScriptManager _scriptManager;
|
||||
private GameStateManager _gameStateManager;
|
||||
private SceneManager _sceneManager;
|
||||
private SaveManager _saveManager;
|
||||
private CanvasGroup _storySelectorCanvas;
|
||||
private GameObject _storySelectorButtonPrefab;
|
||||
|
||||
@@ -39,7 +43,10 @@ namespace Pal3.Dev
|
||||
|
||||
private readonly Dictionary<string, string> _storySelections = new()
|
||||
{
|
||||
{"退出", ""},
|
||||
{"关闭", ""},
|
||||
{"退出游戏", ""},
|
||||
{"继续游戏", ""},
|
||||
{"保存当前游戏进度", ""},
|
||||
{"新的游戏", ""},
|
||||
#if PAL3
|
||||
{"永安当-去客房找赵文昌", @"
|
||||
@@ -1130,25 +1137,6 @@ namespace Pal3.Dev
|
||||
BigMapEnableRegion 5 2
|
||||
BigMapEnableRegion 6 1
|
||||
CameraFadeIn"},
|
||||
{"胜州-纳林河源", @"
|
||||
ScriptVarSetValue -32768 50800
|
||||
SceneLoad q05 q05
|
||||
ActorActivate -1 1
|
||||
ActorEnablePlayerControl -1
|
||||
PlayerEnableInput 1
|
||||
ActorSetNavLayer -1 0
|
||||
ActorSetTilePosition -1 150 85
|
||||
TeamAddOrRemoveActor 2 1
|
||||
TeamAddOrRemoveActor 1 1
|
||||
TeamAddOrRemoveActor 4 1
|
||||
BigMapEnableRegion 0 2
|
||||
BigMapEnableRegion 1 2
|
||||
BigMapEnableRegion 2 2
|
||||
BigMapEnableRegion 4 2
|
||||
BigMapEnableRegion 5 2
|
||||
BigMapEnableRegion 6 1
|
||||
BigMapEnableRegion 7 2
|
||||
CameraFadeIn"},
|
||||
{"胜州祭坛欢庆盛典", @"
|
||||
ScriptVarSetValue -32768 51100
|
||||
SceneLoad q05 q05
|
||||
@@ -1262,24 +1250,6 @@ namespace Pal3.Dev
|
||||
BigMapEnableRegion 8 2
|
||||
BigMapEnableRegion 9 1
|
||||
CameraFadeIn"},
|
||||
{"血濡回魂-石村", @"
|
||||
ScriptVarSetValue -32768 71700
|
||||
SceneLoad Q07 Q07y
|
||||
ActorActivate -1 1
|
||||
ActorEnablePlayerControl -1
|
||||
PlayerEnableInput 1
|
||||
ActorSetNavLayer -1 0
|
||||
ActorSetTilePosition -1 142 169
|
||||
BigMapEnableRegion 0 2
|
||||
BigMapEnableRegion 1 2
|
||||
BigMapEnableRegion 2 2
|
||||
BigMapEnableRegion 4 2
|
||||
BigMapEnableRegion 5 2
|
||||
BigMapEnableRegion 6 1
|
||||
BigMapEnableRegion 7 2
|
||||
BigMapEnableRegion 8 2
|
||||
BigMapEnableRegion 9 1
|
||||
CameraFadeIn"},
|
||||
{"血濡回魂-梦醒", @"
|
||||
ScriptVarSetValue -32768 72001
|
||||
SceneLoad m07 3
|
||||
@@ -1447,6 +1417,7 @@ namespace Pal3.Dev
|
||||
BigMapEnableRegion 9 1
|
||||
BigMapEnableRegion 10 2
|
||||
BigMapEnableRegion 11 1
|
||||
CameraSetDefaultTransform 2
|
||||
CameraFadeIn"},
|
||||
{"新安当", @"
|
||||
ScriptVarSetValue -32768 101500
|
||||
@@ -1895,23 +1866,26 @@ namespace Pal3.Dev
|
||||
SceneManager sceneManager,
|
||||
GameStateManager gameStateManager,
|
||||
ScriptManager scriptManager,
|
||||
SaveManager saveManager,
|
||||
CanvasGroup storySelectorCanvas,
|
||||
GameObject storySelectorButtonPrefab)
|
||||
{
|
||||
_inputManager = inputManager;
|
||||
_eventSystem = eventSystem;
|
||||
_sceneManager = sceneManager;
|
||||
_gameStateManager = gameStateManager;
|
||||
_inputManager = inputManager ?? throw new ArgumentNullException(nameof(inputManager));
|
||||
_eventSystem = eventSystem != null ? eventSystem : throw new ArgumentNullException(nameof(eventSystem));
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
_gameStateManager = gameStateManager ?? throw new ArgumentNullException(nameof(gameStateManager));
|
||||
_playerInputActions = inputManager.GetPlayerInputActions();
|
||||
_scriptManager = scriptManager;
|
||||
_storySelectorCanvas = storySelectorCanvas;
|
||||
_storySelectorButtonPrefab = storySelectorButtonPrefab;
|
||||
_scriptManager = scriptManager ?? throw new ArgumentNullException(nameof(scriptManager));
|
||||
_saveManager = saveManager ?? throw new ArgumentNullException(nameof(saveManager));
|
||||
_storySelectorCanvas = storySelectorCanvas != null ? storySelectorCanvas : throw new ArgumentNullException(nameof(storySelectorCanvas));
|
||||
_storySelectorButtonPrefab = storySelectorButtonPrefab != null ? storySelectorButtonPrefab : throw new ArgumentNullException(nameof(storySelectorButtonPrefab));
|
||||
|
||||
_storySelectorCanvas.alpha = 0f;
|
||||
_storySelectorCanvas.interactable = false;
|
||||
|
||||
_playerInputActions.Gameplay.ToggleStorySelector.performed += ToggleStorySelectorOnPerformed;
|
||||
_playerInputActions.Cutscene.ToggleStorySelector.performed += ToggleStorySelectorOnPerformed;
|
||||
_playerInputActions.Cutscene.ExitCurrentShowingMenu.performed += HideStorySelectorOnPerformed;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -1924,16 +1898,34 @@ namespace Pal3.Dev
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
_playerInputActions.Gameplay.ToggleStorySelector.performed -= ToggleStorySelectorOnPerformed;
|
||||
_playerInputActions.Cutscene.ToggleStorySelector.performed -= ToggleStorySelectorOnPerformed;
|
||||
_playerInputActions.Cutscene.ExitCurrentShowingMenu.performed -= HideStorySelectorOnPerformed;
|
||||
}
|
||||
|
||||
private void ToggleStorySelectorOnPerformed(InputAction.CallbackContext obj)
|
||||
private void ToggleStorySelectorOnPerformed(InputAction.CallbackContext _)
|
||||
{
|
||||
ToggleStorySelector();
|
||||
}
|
||||
|
||||
private void HideStorySelectorOnPerformed(InputAction.CallbackContext _)
|
||||
{
|
||||
if (_sceneManager.GetCurrentScene() == null) return;
|
||||
|
||||
if (_storySelectorCanvas.interactable)
|
||||
{
|
||||
Hide();
|
||||
_gameStateManager.GoToState(GameState.Gameplay);
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleStorySelector()
|
||||
{
|
||||
if (_storySelectorCanvas.interactable) Hide();
|
||||
if (_sceneManager.GetCurrentScene() == null) return;
|
||||
|
||||
if (_storySelectorCanvas.interactable)
|
||||
{
|
||||
Hide();
|
||||
_gameStateManager.GoToState(GameState.Gameplay);
|
||||
}
|
||||
else if (_gameStateManager.GetCurrentState() == GameState.Gameplay)
|
||||
{
|
||||
Show();
|
||||
@@ -1943,48 +1935,43 @@ namespace Pal3.Dev
|
||||
public void Show()
|
||||
{
|
||||
_gameStateManager.GoToState(GameState.Cutscene);
|
||||
|
||||
var hideCloseButton = _sceneManager.GetCurrentScene() == null;
|
||||
|
||||
foreach (var story in _storySelections)
|
||||
{
|
||||
var selectionButton = Instantiate(_storySelectorButtonPrefab, _storySelectorCanvas.transform);
|
||||
if (hideCloseButton && story.Key is "关闭" or "保存当前游戏进度") continue;
|
||||
|
||||
#if !UNITY_STANDALONE || UNITY_EDITOR
|
||||
if (story.Key == "退出游戏") continue;
|
||||
#endif
|
||||
|
||||
GameObject selectionButton = Instantiate(_storySelectorButtonPrefab, _storySelectorCanvas.transform);
|
||||
|
||||
var buttonTextUI = selectionButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||
buttonTextUI.text = story.Key;
|
||||
selectionButton.GetComponent<Button>().onClick
|
||||
.AddListener(delegate { StorySelectionButtonClicked(story.Key);});
|
||||
_selectionButtons.Add(selectionButton);
|
||||
}
|
||||
|
||||
// Setup button navigation
|
||||
for (var i = 0; i < _selectionButtons.Count; i++)
|
||||
{
|
||||
var button = _selectionButtons[i].GetComponent<Button>();
|
||||
var buttonNavigation = button.navigation;
|
||||
buttonNavigation.mode = Navigation.Mode.Explicit;
|
||||
|
||||
if (i == 0)
|
||||
if (story.Key is "关闭" or "保存当前游戏进度" or "退出游戏" or "新的游戏" or "继续游戏")
|
||||
{
|
||||
buttonNavigation.selectOnLeft = _selectionButtons[^1].GetComponent<Button>();
|
||||
buttonNavigation.selectOnRight = _selectionButtons[i + 1].GetComponent<Button>();
|
||||
buttonTextUI.fontStyle = FontStyles.Underline;
|
||||
}
|
||||
else if (i == _selectionButtons.Count - 1)
|
||||
{
|
||||
buttonNavigation.selectOnLeft = _selectionButtons[i - 1].GetComponent<Button>();
|
||||
buttonNavigation.selectOnRight = _selectionButtons[0].GetComponent<Button>();
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonNavigation.selectOnLeft = _selectionButtons[i - 1].GetComponent<Button>();
|
||||
buttonNavigation.selectOnRight = _selectionButtons[i + 1].GetComponent<Button>();
|
||||
}
|
||||
|
||||
|
||||
var button = selectionButton.GetComponent<Button>();
|
||||
Navigation buttonNavigation = button.navigation;
|
||||
buttonNavigation.mode = Navigation.Mode.Horizontal | Navigation.Mode.Vertical;
|
||||
button.navigation = buttonNavigation;
|
||||
button.colors = UITheme.GetButtonColors();
|
||||
button.onClick.AddListener(delegate { StorySelectionButtonClicked(story.Key);});
|
||||
_selectionButtons.Add(selectionButton);
|
||||
}
|
||||
|
||||
var firstButton = _selectionButtons.First().GetComponent<Button>();
|
||||
_eventSystem.firstSelectedGameObject = firstButton.gameObject;
|
||||
|
||||
var lastActiveInputDevice = _inputManager.GetLastActiveInputDevice();
|
||||
InputDevice lastActiveInputDevice = _inputManager.GetLastActiveInputDevice();
|
||||
if (lastActiveInputDevice == Keyboard.current ||
|
||||
lastActiveInputDevice == Gamepad.current)
|
||||
lastActiveInputDevice == Gamepad.current ||
|
||||
lastActiveInputDevice == DualShockGamepad.current)
|
||||
{
|
||||
firstButton.Select();
|
||||
}
|
||||
@@ -1997,13 +1984,43 @@ namespace Pal3.Dev
|
||||
{
|
||||
switch (story)
|
||||
{
|
||||
case "退出":
|
||||
case "关闭":
|
||||
if (_sceneManager.GetCurrentScene() == null) return;
|
||||
_gameStateManager.GoToState(GameState.Gameplay);
|
||||
break;
|
||||
case "退出游戏":
|
||||
Application.Quit();
|
||||
break;
|
||||
case "新的游戏":
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ResetGameStateCommand());
|
||||
StartNewGame();
|
||||
break;
|
||||
case "继续游戏":
|
||||
if (!_saveManager.SaveFileExists())
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ResetGameStateCommand());
|
||||
StartNewGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
var commands = _saveManager.LoadFromSaveFile();
|
||||
if (commands == null)
|
||||
{
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ResetGameStateCommand());
|
||||
StartNewGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecuteCommands(commands);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "保存当前游戏进度":
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(_saveManager.SaveGameStateToFile()
|
||||
? new UIDisplayNoteCommand("游戏保存成功")
|
||||
: new UIDisplayNoteCommand("游戏保存失败"));
|
||||
_gameStateManager.GoToState(GameState.Gameplay);
|
||||
break;
|
||||
default:
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ResetGameStateCommand());
|
||||
ExecuteCommands(_storySelections[story]);
|
||||
@@ -2040,13 +2057,12 @@ namespace Pal3.Dev
|
||||
_storySelectorCanvas.alpha = 0f;
|
||||
_storySelectorCanvas.interactable = false;
|
||||
|
||||
foreach (var button in _selectionButtons)
|
||||
foreach (GameObject button in _selectionButtons)
|
||||
{
|
||||
button.GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
Destroy(button);
|
||||
}
|
||||
_selectionButtons.Clear();
|
||||
_gameStateManager.GoToState(GameState.Gameplay);
|
||||
}
|
||||
|
||||
public void Execute(ToggleStorySelectorRequest command)
|
||||
|
||||
@@ -15,7 +15,10 @@ namespace Pal3.Dev
|
||||
|
||||
public static class UnknownSceCommandAnalyzer
|
||||
{
|
||||
public static void AnalyzeCommand(BinaryReader reader, int commandId, ushort parameterFlag)
|
||||
public static void AnalyzeCommand(BinaryReader reader,
|
||||
int commandId,
|
||||
ushort parameterFlag,
|
||||
int codepage)
|
||||
{
|
||||
Debug.LogError($"Unknown Command Id: {commandId} ParameterFlag: {parameterFlag}");
|
||||
|
||||
@@ -33,10 +36,10 @@ namespace Pal3.Dev
|
||||
|
||||
if (flag is 0b0000 or 0b0001 or 0b0011)
|
||||
{
|
||||
var nextCmdType = SceCommandTypeResolver.GetType(id, flag);
|
||||
Type nextCmdType = SceCommandTypeResolver.GetType(id, flag);
|
||||
if (nextCmdType != null)
|
||||
{
|
||||
var command = SceCommandParser.ParseSceCommand(reader, id, flag);
|
||||
ICommand command = SceCommandParser.ParseSceCommand(reader, id, flag, codepage);
|
||||
Debug.Log($"Possible length: {length}, " +
|
||||
$"next command: {nextCmdType.Name}-{id}-{flag}-{JsonConvert.SerializeObject(command)}");
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
namespace Pal3.Effect
|
||||
{
|
||||
using System;
|
||||
using Actor;
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
using Command.SceCommands;
|
||||
using MetaData;
|
||||
using Scene;
|
||||
using UnityEngine;
|
||||
|
||||
public sealed class EffectManager : MonoBehaviour,
|
||||
ICommandExecutor<EffectAttachToActorCommand>,
|
||||
ICommandExecutor<EffectPlayCommand>,
|
||||
ICommandExecutor<ResetGameStateCommand>
|
||||
{
|
||||
private SceneManager _sceneManager;
|
||||
private int _targetActorId = -1;
|
||||
|
||||
public void Init(SceneManager sceneManager)
|
||||
{
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public void Execute(EffectAttachToActorCommand command)
|
||||
{
|
||||
if (command.ActorId == ActorConstants.PlayerActorVirtualID) return;
|
||||
_targetActorId = command.ActorId;
|
||||
}
|
||||
|
||||
public void Execute(EffectPlayCommand command)
|
||||
{
|
||||
if (_targetActorId == -1) return;
|
||||
|
||||
#if PAL3A
|
||||
switch (command.EffectGroupId)
|
||||
{
|
||||
// 南宫煌形态切换为狼形态特效
|
||||
case 164:
|
||||
{
|
||||
Scene scene = _sceneManager.GetCurrentScene();
|
||||
Actor actor = scene.GetActor((byte)_targetActorId);
|
||||
actor.ChangeName(ActorConstants.NanGongHuangWolfModeActorName);
|
||||
if (actor.IsActive)
|
||||
{
|
||||
var actorActionController = scene.GetActorGameObject((byte)_targetActorId)
|
||||
.GetComponent<ActorActionController>();
|
||||
actorActionController.PerformAction(actor.GetIdleAction(), overwrite: true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// 南宫煌形态切换为人形态特效
|
||||
case 315:
|
||||
{
|
||||
Scene scene = _sceneManager.GetCurrentScene();
|
||||
Actor actor = scene.GetActor((byte)_targetActorId);
|
||||
actor.ChangeName(ActorConstants.NanGongHuangHumanModeActorName);
|
||||
if (actor.IsActive)
|
||||
{
|
||||
var actorActionController = scene.GetActorGameObject((byte)_targetActorId)
|
||||
.GetComponent<ActorActionController>();
|
||||
actorActionController.PerformAction(actor.GetIdleAction(), overwrite: true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_targetActorId = -1;
|
||||
}
|
||||
|
||||
public void Execute(ResetGameStateCommand command)
|
||||
{
|
||||
_targetActorId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fd7881019bb4e87a3a4a29f9cf86e03
|
||||
timeCreated: 1664300817
|
||||
@@ -6,6 +6,7 @@
|
||||
namespace Pal3.Effect
|
||||
{
|
||||
using System;
|
||||
using Core.DataLoader;
|
||||
using Core.Renderer;
|
||||
using Data;
|
||||
using MetaData;
|
||||
@@ -22,11 +23,11 @@ namespace Pal3.Effect
|
||||
public void Init(GameResourceProvider resourceProvider, uint effectParameter)
|
||||
{
|
||||
var fireEffectType = (FireEffectType)effectParameter;
|
||||
var info = EffectConstants.FireEffectInfo[fireEffectType];
|
||||
(string TexturePathFormat, string ModelPath, float Size) info = EffectConstants.FireEffectInfo[fireEffectType];
|
||||
|
||||
if (!string.IsNullOrEmpty(info.ModelPath))
|
||||
{
|
||||
var poly = resourceProvider.GetPol(info.ModelPath);
|
||||
(Core.DataReader.Pol.PolFile PolFile, ITextureResourceProvider TextureProvider) poly = resourceProvider.GetPol(info.ModelPath);
|
||||
_sceneObjectRenderer = gameObject.AddComponent<PolyModelRenderer>();
|
||||
_sceneObjectRenderer.Render(poly.PolFile, poly.TextureProvider, Color.white);
|
||||
}
|
||||
@@ -39,7 +40,7 @@ namespace Pal3.Effect
|
||||
var sprites = new Sprite[_effectTextures.Length];
|
||||
for (var i = 0; i < _effectTextures.Length; i++)
|
||||
{
|
||||
var texture = _effectTextures[i];
|
||||
Texture2D texture = _effectTextures[i];
|
||||
var sprite = Sprite.Create(texture,
|
||||
new Rect(0f, 0f, texture.width, texture.height),
|
||||
new Vector2(0.5f, 0f));
|
||||
@@ -48,7 +49,7 @@ namespace Pal3.Effect
|
||||
|
||||
var fps = EffectConstants.EffectAnimationInfo[GraphicsEffect.Fire].Fps;
|
||||
|
||||
var parentPosition = transform.position;
|
||||
Vector3 parentPosition = transform.position;
|
||||
|
||||
var yPosition = parentPosition.y;
|
||||
if (_sceneObjectRenderer != null)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Pal3.Effect
|
||||
|
||||
public void Init(GameResourceProvider resourceProvider, uint _)
|
||||
{
|
||||
var baseTexture = resourceProvider.GetEffectTexture(PORTAL_BASE_TEXTURE_NAME);
|
||||
Texture2D baseTexture = resourceProvider.GetEffectTexture(PORTAL_BASE_TEXTURE_NAME);
|
||||
|
||||
_spriteRenderer = gameObject.AddComponent<SpriteRenderer>();
|
||||
_spriteRenderer.sprite = Sprite.Create(baseTexture,
|
||||
|
||||
@@ -5,24 +5,27 @@
|
||||
|
||||
namespace Pal3.Effect
|
||||
{
|
||||
using System;
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
using Command.SceCommands;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
public class PostProcessManager : MonoBehaviour,
|
||||
public sealed class PostProcessManager : MonoBehaviour,
|
||||
ICommandExecutor<EffectSetScreenEffectCommand>,
|
||||
ICommandExecutor<ResetGameStateCommand>
|
||||
{
|
||||
private PostProcessVolume _postProcessVolume;
|
||||
private PostProcessLayer _postProcessLayer;
|
||||
|
||||
private int _currentAppliedEffectMode = -1;
|
||||
|
||||
public void Init(PostProcessVolume volume,
|
||||
PostProcessLayer postProcessLayer)
|
||||
{
|
||||
_postProcessVolume = volume;
|
||||
_postProcessLayer = postProcessLayer;
|
||||
_postProcessVolume = volume != null ? volume : throw new ArgumentNullException(nameof(volume));
|
||||
_postProcessLayer = postProcessLayer != null ? postProcessLayer : throw new ArgumentNullException(nameof(postProcessLayer));
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -35,6 +38,11 @@ namespace Pal3.Effect
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public int GetCurrentAppliedEffectMode()
|
||||
{
|
||||
return _currentAppliedEffectMode;
|
||||
}
|
||||
|
||||
public void Execute(EffectSetScreenEffectCommand command)
|
||||
{
|
||||
switch (command.Mode)
|
||||
@@ -68,6 +76,8 @@ namespace Pal3.Effect
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_currentAppliedEffectMode = command.Mode;
|
||||
}
|
||||
|
||||
public void Execute(ResetGameStateCommand command)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
namespace Pal3.Feature
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
@@ -17,7 +18,7 @@ namespace Pal3.Feature
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CaptionRenderer : MonoBehaviour,
|
||||
public sealed class CaptionRenderer : MonoBehaviour,
|
||||
ICommandExecutor<UIDisplayCaptionCommand>
|
||||
{
|
||||
private const float CAPTION_ANIMATION_DURATION = 10f;
|
||||
@@ -33,9 +34,10 @@ namespace Pal3.Feature
|
||||
PlayerInputActions playerInputActions,
|
||||
Image captionImage)
|
||||
{
|
||||
_gameResourceProvider = gameResourceProvider;
|
||||
_playerInputActions = playerInputActions;
|
||||
_captionImage = captionImage;
|
||||
_gameResourceProvider = gameResourceProvider ?? throw new ArgumentNullException(nameof(gameResourceProvider));
|
||||
_playerInputActions = playerInputActions ?? throw new ArgumentNullException(nameof(playerInputActions));
|
||||
_captionImage = captionImage != null ? captionImage : throw new ArgumentNullException(nameof(captionImage));
|
||||
|
||||
_captionImage.preserveAspect = true;
|
||||
_playerInputActions.Cutscene.Continue.performed += CutsceneContinueOnPerformed;
|
||||
}
|
||||
@@ -61,7 +63,7 @@ namespace Pal3.Feature
|
||||
_skipCaptionWaiter = new WaitUntilCanceled(this);
|
||||
CommandDispatcher<ICommand>.Instance.Dispatch(new ScriptRunnerWaitRequest(_skipCaptionWaiter));
|
||||
|
||||
var texture = _gameResourceProvider.GetCaptionTexture(textureName);
|
||||
Texture2D texture = _gameResourceProvider.GetCaptionTexture(textureName);
|
||||
var sprite = Sprite.Create(texture,
|
||||
new Rect(0f, 0f, texture.width, texture.height),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
@@ -5,22 +5,25 @@
|
||||
|
||||
namespace Pal3.Feature
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
using Command.SceCommands;
|
||||
using MetaData;
|
||||
|
||||
public class FavorManager :
|
||||
public sealed class FavorManager : IDisposable,
|
||||
ICommandExecutor<FavorAddCommand>,
|
||||
ICommandExecutor<ResetGameStateCommand>
|
||||
{
|
||||
private const int DEFAULT_FAVOR_AMOUNT = 20;
|
||||
private const int BASE_FAVOR_AMOUNT = 20;
|
||||
|
||||
private readonly Dictionary<int, int> _actorFavor = new ();
|
||||
|
||||
public FavorManager()
|
||||
{
|
||||
Init();
|
||||
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
||||
}
|
||||
|
||||
@@ -29,14 +32,24 @@ namespace Pal3.Feature
|
||||
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
||||
}
|
||||
|
||||
public int GetCalculatedFavor(int actorId)
|
||||
private void Init()
|
||||
{
|
||||
if (_actorFavor.ContainsKey(actorId))
|
||||
foreach (var actorId in Enum.GetValues(typeof(PlayerActorId)).Cast<int>())
|
||||
{
|
||||
return DEFAULT_FAVOR_AMOUNT + _actorFavor[actorId];
|
||||
if (actorId == 0) continue; // Skip for the main actor
|
||||
_actorFavor[actorId] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return DEFAULT_FAVOR_AMOUNT;
|
||||
public Dictionary<int, int> GetAllActorFavorInfo()
|
||||
{
|
||||
return _actorFavor;
|
||||
}
|
||||
|
||||
public int GetFavorByActor(int actorId)
|
||||
{
|
||||
return _actorFavor.ContainsKey(actorId) ?
|
||||
_actorFavor[actorId] + BASE_FAVOR_AMOUNT : BASE_FAVOR_AMOUNT;
|
||||
}
|
||||
|
||||
public void Execute(FavorAddCommand command)
|
||||
@@ -54,6 +67,7 @@ namespace Pal3.Feature
|
||||
public void Execute(ResetGameStateCommand command)
|
||||
{
|
||||
_actorFavor.Clear();
|
||||
Init();
|
||||
}
|
||||
|
||||
public int GetMostFavorableActorId()
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Pal3.Feature
|
||||
using Script;
|
||||
using UnityEngine;
|
||||
|
||||
public class HotelManager : MonoBehaviour,
|
||||
public sealed class HotelManager : MonoBehaviour,
|
||||
ICommandExecutor<UIShowHotelMenuCommand>
|
||||
{
|
||||
private ScriptManager _scriptManager;
|
||||
@@ -22,8 +22,8 @@ namespace Pal3.Feature
|
||||
|
||||
public void Init(ScriptManager scriptManager, SceneManager sceneManager)
|
||||
{
|
||||
_scriptManager = scriptManager;
|
||||
_sceneManager = sceneManager;
|
||||
_scriptManager = scriptManager ?? throw new ArgumentNullException(nameof(scriptManager));
|
||||
_sceneManager = sceneManager ?? throw new ArgumentNullException(nameof(sceneManager));
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -58,8 +58,8 @@ namespace Pal3.Feature
|
||||
Rest("Q01", "xn01", (uint)command.AfterRestScriptId);
|
||||
}
|
||||
}
|
||||
|
||||
if (command.HotelScriptName.Equals("DealScript\\rest\\q13rest.txt"))
|
||||
else if (command.HotelScriptName.Equals("DealScript\\rest\\q13rest.txt",
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (vars[ScriptConstants.MainStoryVariableName] == 120301)
|
||||
{
|
||||
@@ -68,7 +68,8 @@ namespace Pal3.Feature
|
||||
}
|
||||
}
|
||||
#elif PAL3A
|
||||
if (command.HotelScriptName.Equals("DealScript\\rest\\q10rest.txt"))
|
||||
if (command.HotelScriptName.Equals("DealScript\\rest\\q10rest.txt",
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (vars[ScriptConstants.MainStoryVariableName] == 140300)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Pal3
|
||||
/// The Game Resource initializer
|
||||
/// Initialize file system etc.
|
||||
/// </summary>
|
||||
public class GameResourceInitializer : MonoBehaviour
|
||||
public sealed class GameResourceInitializer : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private UnityEngine.Camera uiCamera;
|
||||
[SerializeField] private GameObject startingComponent;
|
||||
@@ -36,7 +36,8 @@ namespace Pal3
|
||||
[SerializeField] private TextMeshProUGUI loadingText;
|
||||
|
||||
private const string CUSTOM_GAME_FOLDER_PATH_FILE_NAME = "CustomGameFolderPath.txt";
|
||||
|
||||
private const int GBK_CODE_PAGE = 936; // GBK Encoding's code page
|
||||
|
||||
private string GetCustomGameFolderPathFilePath()
|
||||
{
|
||||
return Application.persistentDataPath +
|
||||
@@ -100,14 +101,17 @@ namespace Pal3
|
||||
|
||||
loadingText.text = "Loading game assets...";
|
||||
|
||||
yield return InitResource(GetGameFolderPath(), crcHash);
|
||||
// TODO: let user to choose language? Or auto-detect encoding?
|
||||
var codepage = GBK_CODE_PAGE;
|
||||
|
||||
yield return InitResource(GetGameFolderPath(), crcHash, codepage);
|
||||
}
|
||||
|
||||
private IEnumerator InitResource(string gameRootPath, CrcHash crcHash)
|
||||
private IEnumerator InitResource(string gameRootPath, CrcHash crcHash, int codepage)
|
||||
{
|
||||
ICpkFileSystem cpkFileSystem = null;
|
||||
// Init file system
|
||||
yield return InitFileSystem(gameRootPath, crcHash, (fileSystem) =>
|
||||
yield return InitFileSystem(gameRootPath, crcHash, codepage, (fileSystem) =>
|
||||
{
|
||||
cpkFileSystem = fileSystem;
|
||||
});
|
||||
@@ -119,11 +123,11 @@ namespace Pal3
|
||||
ServiceLocator.Instance.Register<ITextureLoaderFactory>(textureLoaderFactory);
|
||||
|
||||
// Init Game resource provider
|
||||
var resourceProvider = new GameResourceProvider(cpkFileSystem, new TextureLoaderFactory());
|
||||
var resourceProvider = new GameResourceProvider(cpkFileSystem, new TextureLoaderFactory(), codepage);
|
||||
ServiceLocator.Instance.Register(resourceProvider);
|
||||
|
||||
// Instantiate starting component
|
||||
var startingGameObject = Instantiate(startingComponent, null);
|
||||
GameObject startingGameObject = Instantiate(startingComponent, null);
|
||||
startingGameObject.name = startingComponent.name;
|
||||
|
||||
yield return FadeTextAndBackgroundImage();
|
||||
@@ -147,7 +151,10 @@ namespace Pal3
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
private IEnumerator InitFileSystem(string gameRootPath, CrcHash crcHash, Action<ICpkFileSystem> callback)
|
||||
private IEnumerator InitFileSystem(string gameRootPath,
|
||||
CrcHash crcHash,
|
||||
int codepage,
|
||||
Action<ICpkFileSystem> callback)
|
||||
{
|
||||
ICpkFileSystem cpkFileSystem = null;
|
||||
var path = gameRootPath;
|
||||
@@ -159,9 +166,9 @@ namespace Pal3
|
||||
{
|
||||
var timer = new Stopwatch();
|
||||
timer.Start();
|
||||
cpkFileSystem = InitializeCpkFileSystem(path, crcHash);
|
||||
cpkFileSystem = InitializeCpkFileSystem(path, crcHash, codepage);
|
||||
timer.Stop();
|
||||
Debug.Log($"All files mounted successfully. Total time: {timer.Elapsed.TotalSeconds:0.000}s");
|
||||
Debug.Log($"All cpk files mounted successfully under {path}. Total time: {timer.Elapsed.TotalSeconds:0.000}s");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -198,7 +205,7 @@ namespace Pal3
|
||||
|
||||
if (!string.IsNullOrEmpty(gameRootPath))
|
||||
{
|
||||
StartCoroutine(InitResource(gameRootPath, crcHash));
|
||||
StartCoroutine(InitResource(gameRootPath, crcHash, codepage));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -221,7 +228,7 @@ namespace Pal3
|
||||
backgroundImage.enabled = false;
|
||||
}
|
||||
|
||||
private ICpkFileSystem InitializeCpkFileSystem(string gameRootPath, CrcHash crcHash)
|
||||
private ICpkFileSystem InitializeCpkFileSystem(string gameRootPath, CrcHash crcHash, int codepage)
|
||||
{
|
||||
var cpkFileSystem = new CpkFileSystem(gameRootPath, crcHash);
|
||||
|
||||
@@ -237,7 +244,7 @@ namespace Pal3
|
||||
|
||||
filesToMount.Add(musicCpk);
|
||||
|
||||
foreach (var sceneCpkPathInfo in FileConstants.SceneCpkPathInfos)
|
||||
foreach ((string cpkName, string relativePath) sceneCpkPathInfo in FileConstants.SceneCpkPathInfos)
|
||||
{
|
||||
var sceneCpkPath = sceneCpkPathInfo.relativePath + Path.DirectorySeparatorChar +
|
||||
sceneCpkPathInfo.cpkName;
|
||||
@@ -255,7 +262,7 @@ namespace Pal3
|
||||
|
||||
foreach (var cpkFilePath in filesToMount)
|
||||
{
|
||||
cpkFileSystem.Mount(cpkFilePath);
|
||||
cpkFileSystem.Mount(cpkFilePath, codepage);
|
||||
}
|
||||
|
||||
return cpkFileSystem;
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
|
||||
namespace Pal3.Input
|
||||
{
|
||||
using System;
|
||||
using Command;
|
||||
using Command.InternalCommands;
|
||||
using State;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InputManager
|
||||
public sealed class InputManager : IDisposable
|
||||
{
|
||||
private readonly PlayerInputActions _playerInputActions;
|
||||
private InputDevice _lastActiveInputDevice;
|
||||
|
||||
public InputManager(PlayerInputActions playerInputActions)
|
||||
{
|
||||
_playerInputActions = playerInputActions;
|
||||
_playerInputActions = playerInputActions ?? throw new ArgumentNullException(nameof(playerInputActions));
|
||||
SwitchCurrentActionMap(GameState.UI);
|
||||
InputSystem.onActionChange += OnInputActionChange;
|
||||
}
|
||||
@@ -25,7 +26,6 @@ namespace Pal3.Input
|
||||
public void Dispose()
|
||||
{
|
||||
InputSystem.onActionChange -= OnInputActionChange;
|
||||
_playerInputActions.Dispose();
|
||||
}
|
||||
|
||||
public PlayerInputActions GetPlayerInputActions()
|
||||
@@ -43,7 +43,7 @@ namespace Pal3.Input
|
||||
if (change == InputActionChange.ActionPerformed)
|
||||
{
|
||||
var inputAction = (InputAction) action;
|
||||
var lastControl = inputAction.activeControl;
|
||||
InputControl lastControl = inputAction.activeControl;
|
||||
if (_lastActiveInputDevice != lastControl.device)
|
||||
{
|
||||
_lastActiveInputDevice = lastControl.device;
|
||||
@@ -57,7 +57,7 @@ namespace Pal3.Input
|
||||
{
|
||||
_playerInputActions.Disable();
|
||||
|
||||
var inputActionMap = state switch
|
||||
InputActionMap inputActionMap = state switch
|
||||
{
|
||||
GameState.Gameplay => _playerInputActions.Gameplay.Get(),
|
||||
GameState.Cutscene => _playerInputActions.Cutscene.Get(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.3.0
|
||||
// version 1.4.3
|
||||
// from Assets/Scripts/Pal3/Input/PlayerInputActions.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
@@ -472,6 +472,17 @@ namespace Pal3.Input
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""4460ae52-4a0c-496b-9d61-4675024a3498"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ToggleStorySelector"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""954e0003-1b73-4c17-a01a-4dccbafa8ca9"",
|
||||
@@ -526,6 +537,15 @@ namespace Pal3.Input
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""ExitCurrentShowingMenu"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""f4c71292-8ed0-4ea2-9f78-bf137d63f607"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
@@ -595,6 +615,17 @@ namespace Pal3.Input
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""30885317-9959-46c4-a930-1a29c0e33b47"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ToggleStorySelector"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""6404737e-bf57-43a9-83a5-3fa155e78c1b"",
|
||||
@@ -616,6 +647,28 @@ namespace Pal3.Input
|
||||
""action"": ""ToggleBigMap"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""9a0e1e31-3aac-4131-8cc6-f1a87d113db6"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ExitCurrentShowingMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""046969fe-1445-429a-b8ca-1a687dbdd20d"",
|
||||
""path"": ""<Gamepad>/buttonEast"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ExitCurrentShowingMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -655,6 +708,17 @@ namespace Pal3.Input
|
||||
""action"": ""SkipVideo"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""5ea955e9-ed45-4e99-a2e5-d663e5807fdb"",
|
||||
""path"": ""<Gamepad>/buttonSouth"",
|
||||
""interactions"": ""MultiTap"",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""SkipVideo"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1156,6 +1220,7 @@ namespace Pal3.Input
|
||||
m_Cutscene_Continue = m_Cutscene.FindAction("Continue", throwIfNotFound: true);
|
||||
m_Cutscene_ToggleBigMap = m_Cutscene.FindAction("ToggleBigMap", throwIfNotFound: true);
|
||||
m_Cutscene_ToggleStorySelector = m_Cutscene.FindAction("ToggleStorySelector", throwIfNotFound: true);
|
||||
m_Cutscene_ExitCurrentShowingMenu = m_Cutscene.FindAction("ExitCurrentShowingMenu", throwIfNotFound: true);
|
||||
// VideoPlaying
|
||||
m_VideoPlaying = asset.FindActionMap("VideoPlaying", throwIfNotFound: true);
|
||||
m_VideoPlaying_SkipVideo = m_VideoPlaying.FindAction("SkipVideo", throwIfNotFound: true);
|
||||
@@ -1386,6 +1451,7 @@ namespace Pal3.Input
|
||||
private readonly InputAction m_Cutscene_Continue;
|
||||
private readonly InputAction m_Cutscene_ToggleBigMap;
|
||||
private readonly InputAction m_Cutscene_ToggleStorySelector;
|
||||
private readonly InputAction m_Cutscene_ExitCurrentShowingMenu;
|
||||
public struct CutsceneActions
|
||||
{
|
||||
private @PlayerInputActions m_Wrapper;
|
||||
@@ -1393,6 +1459,7 @@ namespace Pal3.Input
|
||||
public InputAction @Continue => m_Wrapper.m_Cutscene_Continue;
|
||||
public InputAction @ToggleBigMap => m_Wrapper.m_Cutscene_ToggleBigMap;
|
||||
public InputAction @ToggleStorySelector => m_Wrapper.m_Cutscene_ToggleStorySelector;
|
||||
public InputAction @ExitCurrentShowingMenu => m_Wrapper.m_Cutscene_ExitCurrentShowingMenu;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Cutscene; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
@@ -1411,6 +1478,9 @@ namespace Pal3.Input
|
||||
@ToggleStorySelector.started -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnToggleStorySelector;
|
||||
@ToggleStorySelector.performed -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnToggleStorySelector;
|
||||
@ToggleStorySelector.canceled -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnToggleStorySelector;
|
||||
@ExitCurrentShowingMenu.started -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnExitCurrentShowingMenu;
|
||||
@ExitCurrentShowingMenu.performed -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnExitCurrentShowingMenu;
|
||||
@ExitCurrentShowingMenu.canceled -= m_Wrapper.m_CutsceneActionsCallbackInterface.OnExitCurrentShowingMenu;
|
||||
}
|
||||
m_Wrapper.m_CutsceneActionsCallbackInterface = instance;
|
||||
if (instance != null)
|
||||
@@ -1424,6 +1494,9 @@ namespace Pal3.Input
|
||||
@ToggleStorySelector.started += instance.OnToggleStorySelector;
|
||||
@ToggleStorySelector.performed += instance.OnToggleStorySelector;
|
||||
@ToggleStorySelector.canceled += instance.OnToggleStorySelector;
|
||||
@ExitCurrentShowingMenu.started += instance.OnExitCurrentShowingMenu;
|
||||
@ExitCurrentShowingMenu.performed += instance.OnExitCurrentShowingMenu;
|
||||
@ExitCurrentShowingMenu.canceled += instance.OnExitCurrentShowingMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1590,6 +1663,7 @@ namespace Pal3.Input
|
||||
void OnContinue(InputAction.CallbackContext context);
|
||||
void OnToggleBigMap(InputAction.CallbackContext context);
|
||||
void OnToggleStorySelector(InputAction.CallbackContext context);
|
||||
void OnExitCurrentShowingMenu(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface IVideoPlayingActions
|
||||
{
|
||||
|
||||
@@ -448,6 +448,17 @@
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "4460ae52-4a0c-496b-9d61-4675024a3498",
|
||||
"path": "<Keyboard>/escape",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "ToggleStorySelector",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "954e0003-1b73-4c17-a01a-4dccbafa8ca9",
|
||||
@@ -502,6 +513,15 @@
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "ExitCurrentShowingMenu",
|
||||
"type": "Button",
|
||||
"id": "f4c71292-8ed0-4ea2-9f78-bf137d63f607",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
@@ -571,6 +591,17 @@
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "30885317-9959-46c4-a930-1a29c0e33b47",
|
||||
"path": "<Keyboard>/escape",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "ToggleStorySelector",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "6404737e-bf57-43a9-83a5-3fa155e78c1b",
|
||||
@@ -592,6 +623,28 @@
|
||||
"action": "ToggleBigMap",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "9a0e1e31-3aac-4131-8cc6-f1a87d113db6",
|
||||
"path": "<Keyboard>/escape",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "ExitCurrentShowingMenu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "046969fe-1445-429a-b8ca-1a687dbdd20d",
|
||||
"path": "<Gamepad>/buttonEast",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "ExitCurrentShowingMenu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -631,6 +684,17 @@
|
||||
"action": "SkipVideo",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "5ea955e9-ed45-4e99-a2e5-d663e5807fdb",
|
||||
"path": "<Gamepad>/buttonSouth",
|
||||
"interactions": "MultiTap",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "SkipVideo",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -453,14 +453,14 @@ namespace Pal3.MetaData
|
||||
{ ActorActionType.Skill1, WeaponArmType.RightHanded }, // 特技1
|
||||
{ ActorActionType.Skill2, WeaponArmType.RightHanded }, // 特技2
|
||||
{ ActorActionType.UseItemRecover, WeaponArmType.None }, // 恢复物品
|
||||
{ ActorActionType.UseItemAttack, WeaponArmType.RightHanded }, // 攻击物品
|
||||
{ ActorActionType.UseItemAttack, WeaponArmType.None }, // 攻击物品
|
||||
{ ActorActionType.WeaponSkill, WeaponArmType.RightHanded }, // 武器技
|
||||
{ ActorActionType.StartDefence, WeaponArmType.RightHanded }, // 开始防御
|
||||
{ ActorActionType.Defence, WeaponArmType.RightHanded }, // 防御
|
||||
{ ActorActionType.DefenceBeAttack, WeaponArmType.RightHanded }, // 攻击被防住
|
||||
{ ActorActionType.Dodge, WeaponArmType.RightHanded }, // 回避
|
||||
{ ActorActionType.Freeze, WeaponArmType.None }, // 眠定
|
||||
{ ActorActionType.Dying, WeaponArmType.None }, // 濒死
|
||||
{ ActorActionType.Dying, WeaponArmType.RightHanded }, // 濒死
|
||||
{ ActorActionType.Dead, WeaponArmType.None }, // 死亡
|
||||
{ ActorActionType.Flee, WeaponArmType.None }, // 逃跑等到
|
||||
{ ActorActionType.Win, WeaponArmType.RightHanded }, // 胜利
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Pal3.MetaData
|
||||
|
||||
public static class EffectConstants
|
||||
{
|
||||
private static readonly char PathSeparator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
private static readonly char PathSeparator = CpkConstants.DirectorySeparator;
|
||||
|
||||
private static readonly string EffectScnRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{PathSeparator}" +
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace Pal3.MetaData
|
||||
public const string CaptionFolderName = "caption";
|
||||
|
||||
public const string EmojiFolderName = "EMOTE";
|
||||
|
||||
public const string CursorFolderName = "cursor";
|
||||
|
||||
public const string MovieFolderName = "movie";
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
namespace Pal3.MetaData
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Core.DataReader.Cpk;
|
||||
|
||||
public static class SceneConstants
|
||||
{
|
||||
private static readonly char PathSeparator = CpkConstants.CpkDirectorySeparatorChar;
|
||||
private static readonly char PathSeparator = CpkConstants.DirectorySeparator;
|
||||
|
||||
private static readonly string EffectScnRelativePath =
|
||||
$"{FileConstants.BaseDataCpkPathInfo.cpkName}{PathSeparator}" +
|
||||
@@ -24,5 +25,92 @@ namespace Pal3.MetaData
|
||||
EffectScnRelativePath + "skybox" + PathSeparator + "{0:00}" + PathSeparator + "{0:00}_up.tga",
|
||||
EffectScnRelativePath + "skybox" + PathSeparator + "{0:00}" + PathSeparator + "{0:00}_dn.tga",
|
||||
};
|
||||
|
||||
#if PAL3
|
||||
public static readonly List<(string cpkName, string sceneName)> SceneCpkNameInfos = new()
|
||||
{
|
||||
("M01.cpk", "璧山"),
|
||||
("M02.cpk", "九龙坡"),
|
||||
("M03.cpk", "大渡口"),
|
||||
("M04.cpk", "船·长江"),
|
||||
("M05.cpk", "船·海"),
|
||||
("M06.cpk", "蓬莱"),
|
||||
("m08.cpk", "九顶山"),
|
||||
("M09.cpk", "霹雳堂总舵"),
|
||||
("m10.cpk", "古藤林"),
|
||||
("m11.cpk", "蜀山故道"),
|
||||
("M15.cpk", "神魔之井"),
|
||||
("M16.cpk", "神树"),
|
||||
("M17.cpk", "锁妖塔"),
|
||||
("M18.cpk", "草海"),
|
||||
("M19.cpk", "灵山仙人洞"),
|
||||
("M20.cpk", "熔岩地狱"),
|
||||
("M21.cpk", "黄泉路"),
|
||||
("M22.cpk", "冰风谷"),
|
||||
("M23.cpk", "海底城"),
|
||||
("M24.cpk", "剑冢"),
|
||||
("M25.cpk", "新仙界"),
|
||||
("M26.cpk", "星森"),
|
||||
("Q01.cpk", "渝州"),
|
||||
("Q02.cpk", "宾化"),
|
||||
("Q03.cpk", "镇江"),
|
||||
("Q04.cpk", "蓬莱御剑堂"),
|
||||
("Q05.cpk", "唐家堡"),
|
||||
("Q06.cpk", "德阳"),
|
||||
("Q07.cpk", "安宁村"),
|
||||
("Q08.cpk", "蜀山派"),
|
||||
("Q09.cpk", "雷州"),
|
||||
("Q10.cpk", "神界天门"),
|
||||
("Q11.cpk", "蛮州"),
|
||||
("Q12.cpk", "古城镇"),
|
||||
("Q13.cpk", "酆都"),
|
||||
("Q14.cpk", "鬼界外围"),
|
||||
("Q15.cpk", "雪岭镇"),
|
||||
("Q16.cpk", "安溪"),
|
||||
("Q17.cpk", "船"),
|
||||
("T01.cpk", ""),
|
||||
("T02.cpk", ""),
|
||||
};
|
||||
#elif PAL3A
|
||||
public static readonly List<(string cpkName, string sceneName)> SceneCpkNameInfos = new()
|
||||
{
|
||||
("m01.cpk", "登云麓"),
|
||||
("m02.cpk", "地脉门户"),
|
||||
("m03.cpk", "绿萝嶂"),
|
||||
("m04.cpk", "少阳三焦"),
|
||||
("m05.cpk", "厥阴心包"),
|
||||
("m06.cpk", "纳林河源"),
|
||||
("m07.cpk", "阳名百纳"),
|
||||
("m08.cpk", "双溪"),
|
||||
("m09.cpk", "太阴归尘"),
|
||||
("m10.cpk", "蜀山故道"),
|
||||
("m11.cpk", "锁妖塔"),
|
||||
("m12.cpk", "太阳华池"),
|
||||
("m13.cpk", "魔界之门"),
|
||||
("m14.cpk", "少阴凝碧"),
|
||||
("m15.cpk", "月光城"),
|
||||
("m16.cpk", "少阳参天"),
|
||||
("m17.cpk", "厥阴蔽日"),
|
||||
("m18.cpk", "盘古之心"),
|
||||
("m19.cpk", "里蜀山内城"),
|
||||
("m20.cpk", "秘密储藏室"),
|
||||
("m21.cpk", "火灵珠祭坛"),
|
||||
("q01.cpk", "唐家堡"),
|
||||
("q02.cpk", "蜀山派"),
|
||||
("q02_01.cpk", "蜀山派"),
|
||||
("q02_02.cpk", "蜀山派"),
|
||||
("q02_03.cpk", "蜀山派"),
|
||||
("q03.cpk", "绿萝山"),
|
||||
("q04.cpk", "里蜀山"),
|
||||
("q05.cpk", "胜州"),
|
||||
("q06.cpk", "京城"),
|
||||
("q07.cpk", "石村"),
|
||||
("q08.cpk", "蜀山故道大营"),
|
||||
("q09.cpk", "渝州"),
|
||||
("q10.cpk", "施洞"),
|
||||
("q11.cpk", "蜀山前山"),
|
||||
("y01.cpk", ""),
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,12 @@
|
||||
|
||||
namespace Pal3.MiniGame
|
||||
{
|
||||
using System;
|
||||
using Command;
|
||||
using Command.SceCommands;
|
||||
|
||||
public class AppraisalsMiniGame : ICommandExecutor<MiniGameStartAppraisalsCommand>
|
||||
public sealed class AppraisalsMiniGame : IDisposable,
|
||||
ICommandExecutor<MiniGameStartAppraisalsCommand>
|
||||
{
|
||||
public AppraisalsMiniGame()
|
||||
{
|
||||
|
||||
Loaded 100 of 149 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user