Merge branch 'shop'
This commit is contained in:
commit
9d97accd5b
@ -27,6 +27,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8200704089772688228}
|
||||
m_Father: {fileID: 0}
|
||||
@ -72,6 +73,7 @@ Transform:
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3486965691320864245}
|
||||
m_RootOrder: 0
|
||||
@ -5205,6 +5207,16 @@ Tilemap:
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
dummyAlignment: 0
|
||||
m_AllTileFlags: 1073741825
|
||||
- first: {x: 12, y: -11, z: 0}
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 750
|
||||
m_TileSpriteIndex: 5
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
dummyAlignment: 0
|
||||
m_AllTileFlags: 1073741825
|
||||
- first: {x: 14, y: -11, z: 0}
|
||||
second:
|
||||
serializedVersion: 2
|
||||
@ -9087,6 +9099,8 @@ Tilemap:
|
||||
m_Data: {fileID: 11400000, guid: d90c4377fe799d24a907e16c49d733cc, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: c0ff3f7c040bfc041a2a0e4aa11c36a1, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: 5c6bb9f647437dd4abf63fe1280c5512, type: 2}
|
||||
m_TileSpriteArray:
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 3105379272556981734, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
@ -9098,7 +9112,7 @@ Tilemap:
|
||||
m_Data: {fileID: 6696878938533527509, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: -3159373967292191595, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
- m_RefCount: 1
|
||||
- m_RefCount: 2
|
||||
m_Data: {fileID: 6995023442814134182, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 5081585780740693538, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
@ -10589,7 +10603,7 @@ Tilemap:
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: -179191534720846178, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
m_TileMatrixArray:
|
||||
- m_RefCount: 750
|
||||
- m_RefCount: 751
|
||||
m_Data:
|
||||
e00: 1
|
||||
e01: 0
|
||||
@ -10608,7 +10622,7 @@ Tilemap:
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_TileColorArray:
|
||||
- m_RefCount: 750
|
||||
- m_RefCount: 751
|
||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
@ -10645,6 +10659,7 @@ TilemapRenderer:
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 0
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
@ -10682,7 +10697,7 @@ TilemapRenderer:
|
||||
m_Mode: 0
|
||||
m_DetectChunkCullingBounds: 0
|
||||
m_MaskInteraction: 0
|
||||
--- !u!114 &2835299736381380299
|
||||
--- !u!114 &4797349935403030433
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
8
Assets/Resources/Dialogue/Shop.meta
Normal file
8
Assets/Resources/Dialogue/Shop.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e26afc3f871ece49983af659133aaf6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/Dialogue/Shop/ANG.meta
Normal file
8
Assets/Resources/Dialogue/Shop/ANG.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d1f01af9ffb9b448a1854c5ef4bbbd3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/Resources/Dialogue/Shop/ANG/ShopDialAng.asset
Normal file
25
Assets/Resources/Dialogue/Shop/ANG/ShopDialAng.asset
Normal file
@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
||||
m_Name: ShopDialAng
|
||||
m_EditorClassIdentifier:
|
||||
SpeakerName:
|
||||
CurrentStep: 0
|
||||
DialogueSteps:
|
||||
- Header:
|
||||
WasDisplayed: 0
|
||||
ListOfSentences:
|
||||
- Sentence: Hello, are you interested in buying something?
|
||||
Buttons: []
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b370999d245bbf4ab85d24fd050f82a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/Dialogue/Shop/PL.meta
Normal file
8
Assets/Resources/Dialogue/Shop/PL.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7d7a10db705ca246966a3d308760393
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/Resources/Dialogue/Shop/PL/ShopDialPl.asset
Normal file
25
Assets/Resources/Dialogue/Shop/PL/ShopDialPl.asset
Normal file
@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
||||
m_Name: ShopDialPl
|
||||
m_EditorClassIdentifier:
|
||||
SpeakerName:
|
||||
CurrentStep: 0
|
||||
DialogueSteps:
|
||||
- Header:
|
||||
WasDisplayed: 0
|
||||
ListOfSentences:
|
||||
- Sentence: "Witaj, czy chcia\u0142 by\u015B co\u015B kupi\u0107?"
|
||||
Buttons: []
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
8
Assets/Resources/Dialogue/Shop/PL/ShopDialPl.asset.meta
Normal file
8
Assets/Resources/Dialogue/Shop/PL/ShopDialPl.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e071e06365862a4b8b5762b14ff8555
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -103,4 +103,16 @@ MonoBehaviour:
|
||||
Buttons: []
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 4759712171538235750, guid: 417d111e604a8124cb960805d809e513, type: 3}
|
||||
m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp
|
||||
m_MethodName: StepEndAction
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
|
@ -12,6 +12,7 @@ GameObject:
|
||||
- component: {fileID: 4759712171538235752}
|
||||
- component: {fileID: 4759712171538235748}
|
||||
- component: {fileID: 4759712171538235749}
|
||||
- component: {fileID: 1190203389089447339}
|
||||
- component: {fileID: -8463239967595622325}
|
||||
- component: {fileID: 4759712171538235750}
|
||||
- component: {fileID: 7232042190984337245}
|
||||
@ -33,6 +34,7 @@ Transform:
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -1.9412931, y: -2.068871, z: 133.20683}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -48,6 +50,7 @@ SpriteRenderer:
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
@ -125,6 +128,26 @@ CircleCollider2D:
|
||||
m_Offset: {x: 0, y: 0}
|
||||
serializedVersion: 2
|
||||
m_Radius: 1.5
|
||||
--- !u!95 &1190203389089447339
|
||||
Animator:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4759712171538235754}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: 4e408ead2b862ca4685d5ace7011f083, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!114 &-8463239967595622325
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -138,6 +161,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Name: Wizard
|
||||
State: 1
|
||||
--- !u!114 &4759712171538235750
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -193,7 +217,7 @@ MonoBehaviour:
|
||||
isAfterAction: 0
|
||||
isDuringConversation: 0
|
||||
actionRadius: 1
|
||||
state: 1
|
||||
state: 5
|
||||
--- !u!114 &-7576677615092044163
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -213,4 +237,5 @@ MonoBehaviour:
|
||||
walkable: 0
|
||||
worldPosition: {x: 0, y: 0, z: 0}
|
||||
gridPosition: {x: 0, y: 0}
|
||||
isChasing: 0
|
||||
path: []
|
||||
|
@ -28,6 +28,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5110571134592049265}
|
||||
m_Father: {fileID: 0}
|
||||
@ -130,6 +131,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.95, y: 4.5, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5110571134455525713}
|
||||
m_RootOrder: 0
|
||||
|
@ -28,6 +28,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1.2, y: 6, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2835830911057077560}
|
||||
m_RootOrder: 0
|
||||
@ -107,6 +108,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 5, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2835830911057077560}
|
||||
m_RootOrder: 1
|
||||
@ -186,6 +188,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.95, y: 0.2, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2835830909972040045}
|
||||
- {fileID: 2835830910843601522}
|
||||
|
@ -786,7 +786,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -794,15 +794,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -846,11 +846,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 477.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -72.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -924,7 +924,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -932,15 +932,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -984,11 +984,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 277.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -72.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1062,7 +1062,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1070,15 +1070,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1122,11 +1122,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 77.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -72.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1200,7 +1200,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1208,15 +1208,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1260,11 +1260,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 377.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -72.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1338,7 +1338,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1346,15 +1346,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1398,11 +1398,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 177.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -72.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1476,7 +1476,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1484,15 +1484,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1536,11 +1536,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 77.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -227.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1614,7 +1614,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1622,15 +1622,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1674,11 +1674,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 77.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -457.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1752,7 +1752,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1760,15 +1760,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1812,11 +1812,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 77.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -342.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@ -1882,7 +1882,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
@ -1890,15 +1890,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 65
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@ -1942,11 +1942,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 77.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -112.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6050866944478881893, guid: 27d62cf80d88f774abdf05e1c1663f1c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
|
8
Assets/Resources/UiPanels/Shop.meta
Normal file
8
Assets/Resources/UiPanels/Shop.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 298e71b7ba16d154cb08695f420aee2f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
357
Assets/Resources/UiPanels/Shop/ChestSlot.prefab
Normal file
357
Assets/Resources/UiPanels/Shop/ChestSlot.prefab
Normal file
@ -0,0 +1,357 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3818338909570481462
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3818338909570481463}
|
||||
- component: {fileID: 3818338909570481461}
|
||||
- component: {fileID: 3818338909570481460}
|
||||
m_Layer: 5
|
||||
m_Name: number_held
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3818338909570481463
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338909570481462}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3818338910890019851}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 16.7, y: -20.2}
|
||||
m_SizeDelta: {x: 30, y: 15.3012}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3818338909570481461
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338909570481462}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3818338909570481460
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338909570481462}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: '0
|
||||
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &3818338910890019850
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3818338910890019851}
|
||||
- component: {fileID: 3818338910890019849}
|
||||
- component: {fileID: 3818338910890019848}
|
||||
- component: {fileID: 7379342322136183382}
|
||||
- component: {fileID: 6370833506293926211}
|
||||
m_Layer: 5
|
||||
m_Name: ChestSlot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3818338910890019851
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338910890019850}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3818338911641453617}
|
||||
- {fileID: 3818338909570481463}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 55, y: -55}
|
||||
m_SizeDelta: {x: 60, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3818338910890019849
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338910890019850}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3818338910890019848
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338910890019850}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: a45fb5c08be526a4dabe2e91e53f4d15, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &7379342322136183382
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338910890019850}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 3818338910890019848}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &6370833506293926211
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338910890019850}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6bf41236973acd14caf4428b908d0674, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
slotItemNumberText: {fileID: 3818338909570481460}
|
||||
itemImage: {fileID: 3818338911641453630}
|
||||
_PanelController: {fileID: 0}
|
||||
_number: 0
|
||||
_item: {fileID: 0}
|
||||
countStackableItems: 0
|
||||
--- !u!1 &3818338911641453616
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3818338911641453617}
|
||||
- component: {fileID: 3818338911641453631}
|
||||
- component: {fileID: 3818338911641453630}
|
||||
m_Layer: 5
|
||||
m_Name: inventory_image
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3818338911641453617
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338911641453616}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3818338910890019851}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3818338911641453631
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338911641453616}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3818338911641453630
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3818338911641453616}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
7
Assets/Resources/UiPanels/Shop/ChestSlot.prefab.meta
Normal file
7
Assets/Resources/UiPanels/Shop/ChestSlot.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a433c7b5b00f9b4489a10db4051c7b7
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1830
Assets/Resources/UiPanels/Shop/ShopPanel.prefab
Normal file
1830
Assets/Resources/UiPanels/Shop/ShopPanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Resources/UiPanels/Shop/ShopPanel.prefab.meta
Normal file
7
Assets/Resources/UiPanels/Shop/ShopPanel.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a159d0aaa20a84d47bd3b412db2822e4
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
36
Assets/Scene Sprites/HouseInside/inside_5 1.asset
Normal file
36
Assets/Scene Sprites/HouseInside/inside_5 1.asset
Normal file
@ -0,0 +1,36 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 13312, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: inside_5 1
|
||||
m_EditorClassIdentifier:
|
||||
m_Sprite: {fileID: 6995023442814134182, guid: e7698f36d680635418599dd2745a3e61, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Transform:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_InstancedGameObject: {fileID: 0}
|
||||
m_Flags: 1
|
||||
m_ColliderType: 1
|
8
Assets/Scene Sprites/HouseInside/inside_5 1.asset.meta
Normal file
8
Assets/Scene Sprites/HouseInside/inside_5 1.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c6bb9f647437dd4abf63fe1280c5512
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -66,6 +66,7 @@ public class AnimatedDoorBehaviour : TriggerDoor
|
||||
SaveController.GetComponent<SaveController>().SaveHealth();
|
||||
|
||||
SaveController.GetComponent<SaveController>().SaveChests();
|
||||
SaveController.GetComponent<SaveController>().SaveShops();
|
||||
|
||||
// 2. Change scene
|
||||
SceneManager.LoadScene(gateway.nextMapName);
|
||||
|
@ -47,6 +47,8 @@ public class DoorBehaviour : MonoBehaviour
|
||||
SaveController.GetComponent<SaveController>().SaveHealth();
|
||||
|
||||
SaveController.GetComponent<SaveController>().SaveChests();
|
||||
SaveController.GetComponent<SaveController>().SaveShops();
|
||||
|
||||
// 2. Change scene
|
||||
SceneManager.LoadScene(gateway.nextMapName);
|
||||
}
|
||||
|
@ -2,39 +2,38 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(NPC))]
|
||||
public class NPCFollowing : MonoBehaviour
|
||||
{
|
||||
private Rigidbody2D myRigidbody;
|
||||
public Animator anim;
|
||||
|
||||
public Transform homePosition;
|
||||
public Vector3 homePosition;
|
||||
public Transform targetPosition;
|
||||
|
||||
public AStarPathfindingAgent agent;
|
||||
|
||||
public GameObject player;
|
||||
//public GameObject player;
|
||||
|
||||
public bool approaching = false;
|
||||
public bool isAfterAction = false;
|
||||
public bool isDuringConversation = false;
|
||||
public float actionRadius = 1.0f;
|
||||
|
||||
public NPCStateEnum state = NPCStateEnum.Pending;
|
||||
public float actionRadius = 1.5f;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
//agent = GetComponent<AStarPathfindingAgent>();
|
||||
agent = GetComponent<AStarPathfindingAgent>();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
isAfterAction = System.Convert.ToBoolean(PlayerPrefs.GetInt(gameObject.GetComponent<NPC>().name + ".FirstDialogue"));
|
||||
state = NPCStateEnum.Walking;
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Walking;
|
||||
|
||||
myRigidbody = GetComponent<Rigidbody2D>();
|
||||
anim = GetComponent<Animator>();
|
||||
|
||||
homePosition = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
|
||||
targetPosition = GameObject.FindWithTag("Player").transform;
|
||||
}
|
||||
|
||||
@ -47,64 +46,53 @@ public class NPCFollowing : MonoBehaviour
|
||||
public void CheckDistance()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
|
||||
if (isAfterAction == false)
|
||||
{
|
||||
if (approaching && Vector2.Distance(targetPosition.position, transform.position) >= actionRadius)
|
||||
{
|
||||
Debug.Log(agent);
|
||||
agent.FindPath();
|
||||
//transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
|
||||
|
||||
StartCoroutine(agent.FollowPath());
|
||||
}
|
||||
/* else if (Vector2.Distance(target.position, transform.position) > chaseRadius)
|
||||
{
|
||||
|
||||
//Debug.Log(Vector2.Distance(transform.position, path[currentPoint].position));
|
||||
|
||||
if (Vector2.Distance(transform.position, path[currentPoint].position) > roundingDistance)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
transform.position = Vector2.MoveTowards(transform.position, path[currentPoint].position, 2 * Time.deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
changeGoal();
|
||||
}
|
||||
}*/
|
||||
else if (approaching)
|
||||
{
|
||||
//start dialogue here we want uga bunga
|
||||
|
||||
state = NPCStateEnum.Talking;
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Talking;
|
||||
}
|
||||
}
|
||||
|
||||
else if (!approaching && isAfterAction)
|
||||
{
|
||||
if (Vector2.Distance(transform.position, homePosition.position) > 1)
|
||||
if (Vector2.Distance(transform.position, homePosition) > 0.05)
|
||||
{
|
||||
transform.position = Vector2.MoveTowards(transform.position, homePosition.position, 2 * Time.deltaTime);
|
||||
transform.position = Vector2.MoveTowards(transform.position, homePosition, 2 * Time.deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
state = NPCStateEnum.Pending;
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Pending;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
// don't listen when component is disabled
|
||||
if (!gameObject.GetComponent<NPCFollowing>().enabled)
|
||||
return;
|
||||
|
||||
if (approaching && !isAfterAction)
|
||||
{
|
||||
gameObject.GetComponent<NpcDialogueManager>().Dialogue.BreakDialogueStep();
|
||||
isDuringConversation = false;
|
||||
state = NPCStateEnum.Walking;
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Walking;
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleState()
|
||||
{
|
||||
switch (state)
|
||||
switch (gameObject.GetComponent<NPC>().State)
|
||||
{
|
||||
case NPCStateEnum.Walking:
|
||||
{
|
||||
@ -141,13 +129,8 @@ public class NPCFollowing : MonoBehaviour
|
||||
{
|
||||
approaching = false;
|
||||
isAfterAction = true;
|
||||
isDuringConversation = false;
|
||||
PlayerPrefs.SetInt(gameObject.name + ".FirstDialogue", System.Convert.ToInt32(isAfterAction));
|
||||
state = NPCStateEnum.Walking;
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Walking;
|
||||
}
|
||||
|
||||
public void SaveCheckpoint()
|
||||
{
|
||||
//PlayerPrefs.SetInt(enemyName + "-S", isKilled);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ public class AStarPathfindingAgent : MonoBehaviour
|
||||
myAnim.SetBool("Left", false);
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(current, target, speed * Time.deltaTime);
|
||||
Debug.Log(current + "target:" + target);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9890013e3eb0ea54b90ab8d093688ac6, type: 3}
|
||||
m_Name: Ground - Wizard House
|
||||
m_EditorClassIdentifier:
|
||||
Tiles:
|
||||
- {fileID: 11400000, guid: 8c3ddee63bc5db14db29c992ee3723b7, type: 2}
|
||||
- {fileID: 11400000, guid: 0ee6194169e25d549b4d73f743602734, type: 2}
|
||||
- {fileID: 11400000, guid: 329a66bde198f1940b719c63b8a3a0e6, type: 2}
|
||||
walkable: 1
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 968830a9b677b6e46bbc887a37627ac6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -24,11 +24,6 @@ public class ChestController : MonoBehaviour
|
||||
ChestUIManager.Instance.CurrentChestName = null;
|
||||
|
||||
ChestUIManager.Instance.ClosePanel();
|
||||
|
||||
// Close additiona panels
|
||||
if (EquipmentUIManager.Instance.GetPanelStatus()) EquipmentUIManager.Instance.ClosePanel();
|
||||
|
||||
if (InventoryUIManager.Instance.GetPanelStatus()) InventoryUIManager.Instance.ClosePanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ public class DialogueController
|
||||
/// <returns></returns>
|
||||
public bool ShowNextPanel(DialogueController parentDialController)
|
||||
{
|
||||
Debug.Log(listOfDialogue.Count);
|
||||
if (listOfDialogue.Count == 0)
|
||||
{
|
||||
CloseCurrentPanel(parentDialController);
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.Events;
|
||||
|
||||
[Serializable]
|
||||
[CreateAssetMenu(fileName = "New Dialogue", menuName = "Dialogue/New Dialogue")]
|
||||
@ -24,6 +24,20 @@ public class Dialogue : ScriptableObject, IDialogue
|
||||
DialogueSteps.ForEach(step => step.Header = speakerName);
|
||||
}
|
||||
|
||||
#region finish action api
|
||||
public void SetActionAfterDialogueStep(int dialogueStepNo, UnityEvent _endOfDialogueStepAction)
|
||||
{
|
||||
if(DialogueSteps.Count >= dialogueStepNo)
|
||||
DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_endOfDialogueStepAction);
|
||||
}
|
||||
public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction)
|
||||
{
|
||||
if (DialogueSteps.Count >= dialogueStepNo)
|
||||
DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region dialogue displaying api
|
||||
public void StartDialogue()
|
||||
{
|
||||
// 1. Build
|
||||
@ -101,6 +115,7 @@ public class Dialogue : ScriptableObject, IDialogue
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Function to build each step of dialogue
|
||||
@ -114,4 +129,14 @@ public class Dialogue : ScriptableObject, IDialogue
|
||||
dialogueStep.Build();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function to reset rememebered dialogue status
|
||||
///
|
||||
/// (Scriptable objects clones are overwritten during clone modification)
|
||||
/// </summary>
|
||||
public void ResetDialogue()
|
||||
{
|
||||
DialogueSteps.ForEach(step => step.WasDisplayed = false);
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,17 @@ public class DialogueStepModel
|
||||
public DialogueController DialogueController { get; protected set; }
|
||||
|
||||
|
||||
public DialogueStepModel() { }
|
||||
public DialogueStepModel()
|
||||
{
|
||||
// Add marked step as displayed action as first!
|
||||
EndOfDialogueStepAction.AddListener(() => { MarkAsDisplayed(); });
|
||||
}
|
||||
|
||||
public DialogueStepModel(DialogueController _dialogueController)
|
||||
{
|
||||
// Add marked step as displayed action as first!
|
||||
EndOfDialogueStepAction.AddListener(() => { MarkAsDisplayed(); });
|
||||
|
||||
DialogueController = _dialogueController;
|
||||
}
|
||||
|
||||
@ -51,12 +58,22 @@ public class DialogueStepModel
|
||||
DialogueController.AddSentence(DialogueModel);
|
||||
}
|
||||
|
||||
// 3. Bind finishing action
|
||||
|
||||
// 3.1 Add marked step as displayed action
|
||||
EndOfDialogueStepAction.AddListener(() => WasDisplayed = true);
|
||||
|
||||
// 3.2 Bind actions
|
||||
// 3 Bind ending actions
|
||||
DialogueController.SetActionAfterDialogueEnds(EndOfDialogueStepAction);
|
||||
}
|
||||
|
||||
public void SetActionAfterDialogueStep(UnityEvent _endOfDialogueStepAction)
|
||||
{
|
||||
EndOfDialogueStepAction = _endOfDialogueStepAction;
|
||||
}
|
||||
|
||||
public void SetActionAfterDialogueStep(Action _finishDialogueAction)
|
||||
{
|
||||
EndOfDialogueStepAction.AddListener(new UnityAction(_finishDialogueAction));
|
||||
}
|
||||
|
||||
public void MarkAsDisplayed()
|
||||
{
|
||||
WasDisplayed = true;
|
||||
}
|
||||
}
|
@ -147,6 +147,16 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function to reset rememebered dialogue status
|
||||
///
|
||||
/// (Scriptable objects clones are overwritten during clone modification)
|
||||
/// </summary>
|
||||
public void ResetDialogue()
|
||||
{
|
||||
Dialogues.ForEach(dial => dial.Value.DialogueSteps.ForEach(step => step.WasDisplayed = false));
|
||||
}
|
||||
|
||||
public (int, int) DialogueStepStatus()
|
||||
{
|
||||
var currentDialogueStepIndex = Dialogues
|
||||
|
@ -6,5 +6,12 @@ public class NPC : MonoBehaviour
|
||||
{
|
||||
|
||||
public string Name;
|
||||
|
||||
|
||||
public NPCStateEnum State = NPCStateEnum.Pending;
|
||||
|
||||
|
||||
public void ChangeState(NPCStateEnum _newState)
|
||||
{
|
||||
State = _newState;
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
[Serializable]
|
||||
[RequireComponent(typeof(NPC))]
|
||||
public class NpcDialogueManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public string SpeakerName;
|
||||
|
||||
[SerializeField]
|
||||
public MultiDialogue DialogueTemplate;
|
||||
public LanguageDetector<MultiDialogue> languageDetector;
|
||||
|
||||
/* We user object CLONED TO PREVENT overwritting changes in main object inassets */
|
||||
[SerializeField]
|
||||
@ -23,8 +23,10 @@ public class NpcDialogueManager : MonoBehaviour
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Dialogue = Instantiate(DialogueTemplate);
|
||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
||||
Dialogue.SetSpeakerName(SpeakerName);
|
||||
|
||||
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial
|
||||
}
|
||||
|
||||
public void Update() { }
|
||||
|
142
Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs
Normal file
142
Assets/Scripts/REFACTORING/Application/NPC/NpcShopManager.cs
Normal file
@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[RequireComponent(typeof(NPC))]
|
||||
public class NpcShopManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public LanguageDetector<Dialogue> languageDetector;
|
||||
|
||||
/* We user object CLONED TO PREVENT overwritting changes in main object inassets */
|
||||
public Dialogue Dialogue;
|
||||
|
||||
[SerializeField]
|
||||
public Shop shop;
|
||||
|
||||
bool CanShopBeOpened = false;
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
// 1. Set npc state to trading
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Trading;
|
||||
|
||||
// 2. Init dialogue model
|
||||
CreateInstanceBasedOnLanguage();
|
||||
|
||||
//this.RegisterShop();
|
||||
// if its new game or we dont have any save from this map - use deffault shop settings / content
|
||||
// else overwrite value by saved one
|
||||
if (OnMapAppearanceMethod.GameStatus == GameStatus.NewGame ||
|
||||
(OnMapAppearanceMethod.Gateway != OnMapAppearanceMethodEnum.NewGame || ShopUIManager.Instance.GetList().Count == 0)
|
||||
)
|
||||
// 0. Register shop in scene shop manager
|
||||
this.RegisterShop();
|
||||
//ShopUIManager.Instance.Add(shop);
|
||||
else
|
||||
shop = ShopUIManager.Instance.GetList().Where(shop => {
|
||||
return shop.Npc == gameObject.GetComponent<NPC>().name && shop.Map == SceneManager.GetActiveScene().name;
|
||||
}).First();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
/*
|
||||
* Conditions:
|
||||
* - player must be in range of shopping
|
||||
* - user must press specific keyboard button
|
||||
* - dialogue panel must be closed
|
||||
* - shop panel must be closed
|
||||
*/
|
||||
if (CanShopBeOpened && Input.GetKeyDown(ShopUIManager.Instance.keyToOpen) && Dialogue.DialogueSteps.First().DialogueController?.CurrentPanel == null && !ShopUIManager.Instance.GetPanelStatus())
|
||||
{
|
||||
// Open dialogue panel (Shop will be opened later)
|
||||
Dialogue.StartDialogue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
// don't listen when component is disabled
|
||||
if (!gameObject.GetComponent<NpcShopManager>().enabled)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Conditions:
|
||||
* - agent in collision must be player
|
||||
* - npc bust me in Trading mode
|
||||
* - shop must be currently closed
|
||||
*/
|
||||
if (collision.gameObject.tag == "Player" && gameObject.GetComponent<NPC>().State == NPCStateEnum.Trading && !ShopUIManager.Instance.GetPanelStatus())
|
||||
{
|
||||
CanShopBeOpened = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
// don't listen when component is disabled
|
||||
if (!gameObject.GetComponent<NpcShopManager>().enabled)
|
||||
return;
|
||||
|
||||
if (collision.gameObject.tag == "Player")
|
||||
{
|
||||
CanShopBeOpened = false;
|
||||
|
||||
if (Dialogue.DialogueSteps.First().DialogueController?.CurrentPanel != null)
|
||||
Dialogue.BreakDialogueStep();
|
||||
|
||||
|
||||
CloseShop();
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateInstanceBasedOnLanguage()
|
||||
{
|
||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
||||
Dialogue.SetSpeakerName(gameObject.GetComponent<NPC>().name);
|
||||
Dialogue.SetActionAfterDialogueStep(0, Dialogue.ResetDialogue);
|
||||
Dialogue.SetActionAfterDialogueStep(0, OpenShop);
|
||||
}
|
||||
|
||||
public void RegisterShop()
|
||||
{
|
||||
// 1. Set owner name
|
||||
shop.Npc = gameObject.name;
|
||||
|
||||
// 2. Create new Shop instance in scene registry list
|
||||
((SceneShopDataManager)SceneShopDataManager.Instance)
|
||||
.RegisterShop(
|
||||
new Shop(
|
||||
SceneManager.GetActiveScene().name,
|
||||
gameObject.name,
|
||||
shop.GetContent()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void OpenShop()
|
||||
{
|
||||
if (EquipmentUIManager.Instance.GetPanelStatus()) EquipmentUIManager.Instance.ClosePanel();
|
||||
|
||||
|
||||
// Set info about current shop in shop UI manager (and wait for event - pressing E)
|
||||
|
||||
// Open shopa action - invoked as dialogue end action
|
||||
ShopUIManager.Instance.CurrentShopOwnerName = gameObject.GetComponent<NPC>().name;
|
||||
ShopUIManager.Instance.OpenPanel();
|
||||
|
||||
}
|
||||
|
||||
public void CloseShop()
|
||||
{
|
||||
ShopUIManager.Instance.CurrentShopOwnerName = "";
|
||||
|
||||
ShopUIManager.Instance.ClosePanel();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 965172500144077489774a33c2fa0660
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Application/Panel/Shop.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Panel/Shop.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c41b592443b53b45b36340468fcd02e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,100 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using UnityEngine;
|
||||
|
||||
public class SaveShopManager : SaveModelSystem<Shop>
|
||||
{
|
||||
public override bool SaveModelItem(Shop model)
|
||||
{
|
||||
return base.SaveModelItem(model);
|
||||
}
|
||||
|
||||
public override bool SaveModelList(List<Shop> list)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
Debug.Log("Saved Shops at " + Path);
|
||||
|
||||
if (!Directory.Exists(Path)) Directory.CreateDirectory(Path);
|
||||
|
||||
/* Main logic of conversion data format */
|
||||
var data = ConvertObjectsListToListOfDataModels(list);
|
||||
|
||||
FileStream stream = new FileStream(
|
||||
Path + GetFileName(ObjectListName),
|
||||
FileMode.Create
|
||||
);
|
||||
|
||||
formatter.Serialize(stream, data);
|
||||
stream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Shop LoadModelItem()
|
||||
{
|
||||
return base.LoadModelItem();
|
||||
}
|
||||
|
||||
public override List<Shop> LoadModelList()
|
||||
{
|
||||
string path = Path + GetFileName(ObjectListName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
FileStream stream = new FileStream(path, FileMode.Open);
|
||||
|
||||
List<ShopData> questsList = formatter.Deserialize(stream) as List<ShopData>;
|
||||
stream.Close();
|
||||
|
||||
return ConvertListOfDataModelsToListOfObject(questsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Save file not found in " + path);
|
||||
}
|
||||
|
||||
return new List<Shop>();
|
||||
}
|
||||
|
||||
// Support function
|
||||
|
||||
// 1. From model to data format
|
||||
public static ShopData ConvertObjectToDataModel(Shop model)
|
||||
{
|
||||
return new ShopData(model);
|
||||
}
|
||||
|
||||
public static List<ShopData> ConvertObjectsListToListOfDataModels(List<Shop> modelsList)
|
||||
{
|
||||
List<ShopData> convertedList = new List<ShopData>();
|
||||
|
||||
foreach (Shop model in modelsList)
|
||||
{
|
||||
convertedList.Add(ConvertObjectToDataModel(model));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
// 2. From data to model format
|
||||
public static Shop ConvertDataModelToObject(ShopData dataModel)
|
||||
{
|
||||
return (Shop)dataModel.MapDataToObject();
|
||||
}
|
||||
|
||||
public static List<Shop> ConvertListOfDataModelsToListOfObject(List<ShopData> dataModelsList)
|
||||
{
|
||||
List<Shop> convertedList = new List<Shop>();
|
||||
|
||||
foreach (ShopData dataModel in dataModelsList)
|
||||
{
|
||||
convertedList.Add(ConvertDataModelToObject(dataModel));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb95e6324ffd5c3438985ff99f6ac077
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneShopDataLoader : SceneBaseDataLoader<Shop>
|
||||
{
|
||||
public SceneShopDataLoader(string _objectListName, string _objectFolderName)
|
||||
{
|
||||
SaveModelSystem = new SaveShopManager();
|
||||
SaveModelSystem.ObjectFolderName = _objectFolderName;
|
||||
SaveModelSystem.ObjectListName = _objectListName;
|
||||
}
|
||||
|
||||
/*
|
||||
public void LoadInventoryItemsList()
|
||||
{
|
||||
string path = SaveSystem.GetSavePath();
|
||||
|
||||
if (!Directory.Exists(path)) // if not exists thats mean there was nothing saved yet - nothing to load
|
||||
return;
|
||||
|
||||
FileInfo[] fileInfo = new DirectoryInfo(path).GetFiles();
|
||||
|
||||
foreach(FileInfo file in fileInfo)
|
||||
{
|
||||
if(file.Name != this.ItemsListName + ".fun")
|
||||
continue;
|
||||
|
||||
Dictionary<int, EquippableItemPrefabAssetData> equippableItemsList = SaveInventorySystem.LoadInventoryItemsList(this.ItemsListName);
|
||||
|
||||
// itemEntry.Value.MapDataToObject() - map data format to object
|
||||
|
||||
// save object
|
||||
foreach(KeyValuePair<int, EquippableItemPrefabAssetData> itemEntry in equippableItemsList)
|
||||
{
|
||||
InventoryManager.Instance.SetupItemInInventory(itemEntry.Key, itemEntry.Value.MapDataToEquippableItemPrefarbAsset().equippableItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveInventoryItems()
|
||||
{
|
||||
// Case I - if we remember all list
|
||||
// 1) if after removed item form DynamicList is empty - remove all file
|
||||
// 2) if after removed item form DynamciList there are another one - save updated list again
|
||||
if(InventoryManager.Instance._items.Count > 0) {
|
||||
|
||||
// 1. Map From Dictionary<int, Item>' to 'Dictionary<int, EquippableItemPrefabAsset>'
|
||||
Dictionary<int, EquippableItemPrefabAsset> mappedList = new Dictionary<int, EquippableItemPrefabAsset>();
|
||||
|
||||
foreach(KeyValuePair<int, Item> itemElement in InventoryManager.Instance._items)
|
||||
{
|
||||
mappedList[itemElement.Key] = new EquippableItemPrefabAsset(
|
||||
itemElement.Value.Name,
|
||||
itemElement.Value.ItemModel.name,
|
||||
new Vector3(0,0,0),
|
||||
(EquippableItem) itemElement.Value
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Save Items
|
||||
SaveInventorySystem.SaveInventoryItemsList(mappedList, this.ItemsListName);
|
||||
} else {
|
||||
string _path = SaveSystem.GetSavePath() + "/" + this.ItemsListName + ".fun";
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Log("File to remove: " + _path);
|
||||
|
||||
if(File.Exists(_path))
|
||||
{
|
||||
File.Delete(_path);
|
||||
}
|
||||
}
|
||||
catch (IOException ioExp)
|
||||
{
|
||||
Debug.LogError(ioExp.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// Case II - if we rememenber object per file
|
||||
// 1) remove specyfic file
|
||||
//
|
||||
// Unfortunatelly we don't use this way of saving items yet :D
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
protected override List<Shop> LoadDynamicData()
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return SaveModelSystem.LoadModelList();
|
||||
}
|
||||
|
||||
protected override bool SaveDynamicData(List<Shop> _elements)
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return base.SaveDynamicData(_elements);
|
||||
}
|
||||
|
||||
protected override List<Shop> LoadGenericData() { throw new NotImplementedException(); }
|
||||
|
||||
protected override bool SaveGenericData(List<Shop> _elements) { throw new NotImplementedException(); }
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46738cb8cf9b480eb99dce24e8d1e80e
|
||||
timeCreated: 1670938286
|
@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[System.Serializable]
|
||||
public class SceneShopDataManager : SceneBaseDataManager<Shop>
|
||||
{
|
||||
protected override string OBJECT_FOLDER_NAME { get { return "Shop"; } }
|
||||
protected override string OBJECT_LIST_NAME { get { return "ShopList"; } }
|
||||
|
||||
[SerializeField] protected new ShopUIManager UiManager;
|
||||
|
||||
// Instead of build elements on scene we collect shops distracted on scene from npc's
|
||||
//[SerializeField] List<Shop> ElementsToBuildOnSceneList = new List<Shop>();
|
||||
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Debug.Log("Create: " + gameObject);
|
||||
|
||||
Instance = this;
|
||||
|
||||
Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
Debug.Log("Start SceneShopData manager");
|
||||
|
||||
//TaskUIManager.FindOrCreateInstance();
|
||||
UiManager = ShopUIManager.Instance;
|
||||
|
||||
if (UiManager == null)
|
||||
throw new NullReferenceException("ShopUIManager not found!!!");
|
||||
|
||||
DynamicDataList = (new ShopDataListManager()).SetUiManager(ref UiManager);
|
||||
|
||||
DataLoader = new SceneShopDataLoader(OBJECT_LIST_NAME, OBJECT_FOLDER_NAME);
|
||||
|
||||
base.Start();
|
||||
}
|
||||
|
||||
// TODO - save ChestPrefabAsset (we need to save coords...) but in manager handle Chest data..
|
||||
//
|
||||
protected override void AfterStart()
|
||||
{
|
||||
if(OnMapAppearanceMethod.GameStatus == GameStatus.NewGame)
|
||||
{
|
||||
if (OnMapAppearanceMethod.Gateway != OnMapAppearanceMethodEnum.NewGame)
|
||||
UseDynamicSettings(); // if there is nothing saved we will use UseDefaultSettings
|
||||
else
|
||||
UseDefaultSettings();
|
||||
}else
|
||||
{
|
||||
UseDynamicSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected SceneBaseDataManager<ChestPrefabAsset> GetObjectType()
|
||||
{
|
||||
return GameObject.FindObjectOfType<SceneChestDataManager>();
|
||||
}
|
||||
|
||||
protected SceneBaseDataManager<ChestPrefabAsset> CreateInstance(ref GameObject managerGameObject)
|
||||
{
|
||||
return managerGameObject.AddComponent<SceneChestDataManager>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void UseDefaultSettings()
|
||||
{
|
||||
// we dont need to convert anything
|
||||
// Instead of build elements on scene we collect shops distracted on scene from npc's
|
||||
}
|
||||
|
||||
protected override void UseDynamicSettings()
|
||||
{
|
||||
// when chest detect player in near arrea and player press "c"
|
||||
// open panel -> chest controller handle Open panel in Scene Chest Manager passing info about what Chest Palyer want to open
|
||||
// Manager Build panel and pass info about chest content
|
||||
|
||||
LoadDynamicData();
|
||||
|
||||
|
||||
// VERy VERY provisional SOLUTION
|
||||
if (DynamicDataList.GetList().Count == 0)
|
||||
{
|
||||
UseDefaultSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
UiManager.SetList(DynamicDataList.GetList());
|
||||
}
|
||||
|
||||
// TODO SHOP API
|
||||
public void RegisterShop(Shop newShop)
|
||||
{
|
||||
if (DynamicDataList.GetList().Where(shop => shop.Npc == newShop.Npc && shop.Map == SceneManager.GetActiveScene().name).Any())
|
||||
Debug.LogError("In Shop Manager there is register this shop already");
|
||||
else
|
||||
{
|
||||
DynamicDataList.AddElementToList(newShop);
|
||||
|
||||
UiManager.SetList(DynamicDataList.GetList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO manager api
|
||||
// open panel extend function
|
||||
// close panel extend function
|
||||
|
||||
|
||||
// TODO chest api
|
||||
// add to chest - find chest by its name np
|
||||
// remove from chest - select chest by its name -
|
||||
// chesk item in chest - check chest by tis name
|
||||
|
||||
|
||||
public override bool SaveDynamicData()
|
||||
{
|
||||
// TODO
|
||||
// how to get list
|
||||
// 1. List in UI manager should be synchronized with list in this manager
|
||||
|
||||
foreach (Shop shop in UiManager.GetList())
|
||||
{
|
||||
DynamicDataList.GetList().Where(el => el.Map == shop.Map && el.Npc == shop.Npc).ToList().ForEach(el => el = shop);
|
||||
}
|
||||
|
||||
//DynamicDataList.SetList(tmp);
|
||||
|
||||
// approach:
|
||||
// 1. get from outside, update local list && us it
|
||||
// 2. Handle list synchronized all the time & pass local list
|
||||
return SaveData(DynamicDataList.GetList(), SceneElementTypeEnum.Dynamic);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40e9faa037584ea2bfba8168125f3fde
|
||||
timeCreated: 1670937942
|
@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ShopDataListManager : DataListManager<Shop> // or maybe EquippableItem - but its get conflicts...
|
||||
{
|
||||
[SerializeField] protected new ShopUIManager uiManager;
|
||||
|
||||
public new DataListManager<Shop> SetUiManager(ref ShopUIManager _uiManager)
|
||||
{
|
||||
uiManager = _uiManager;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add shop to list
|
||||
/// </summary>
|
||||
/// <param name="newElement"></param>
|
||||
public override void AddElementToList(Shop newElement)
|
||||
{
|
||||
Elements.Add(newElement);
|
||||
}
|
||||
|
||||
public override void RemoveElementFromList(Shop element)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
//public void AddElement
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df6947d3e5006b242a8d0f4d9e352aac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cf4c4c44d6cc154bb21b10b864fefb5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class LanguageDetector<T>
|
||||
{
|
||||
[SerializeField]
|
||||
public List<IndexValuePair<SystemLanguageEnum, T>> InstanceTemplates;
|
||||
|
||||
|
||||
public T DetectInstanceBasedOnLanguage()
|
||||
{
|
||||
/*if (!PlayerPrefs.HasKey("language"))
|
||||
throw new Exception("Language not setted !!!");*/
|
||||
|
||||
switch (PlayerPrefs.GetString("language"))
|
||||
{
|
||||
case "English":
|
||||
{
|
||||
return InstanceTemplates.Where(template => template.Key == SystemLanguageEnum.English).First().Value;
|
||||
}
|
||||
case "Polish":
|
||||
{
|
||||
return InstanceTemplates.Where(template => template.Key == SystemLanguageEnum.Polish).First().Value;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return InstanceTemplates.Where(template => template.Key == SystemLanguageEnum.Polish).First().Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d1b9bde94433a94fae37ee26490c838
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -73,8 +73,6 @@ public abstract class SceneBaseDataLoader<T> : SceneDataLoaderInterface<T>
|
||||
|
||||
protected virtual bool SaveDynamicData(List<T> _elements)
|
||||
{
|
||||
Debug.Log(SaveModelSystem.Path);
|
||||
|
||||
try
|
||||
{
|
||||
SaveModelSystem.SaveModelList(_elements);
|
||||
|
@ -2,10 +2,13 @@
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public abstract class DraggablePanelController : PanelController<IndexValuePair<int, EquippableItem>>, DraggablePanelInterface
|
||||
{
|
||||
public bool AllowToUseItemInPanel = true;
|
||||
|
||||
[SerializeField] protected new List<ISlot> ChildBoxList = new List<ISlot>();
|
||||
|
||||
protected static UIWarehouseManager _uiManager;
|
||||
@ -27,11 +30,13 @@ public abstract class DraggablePanelController : PanelController<IndexValuePair<
|
||||
slot.OnEndDragEvent += EndDrag;
|
||||
slot.OnDragEvent += Drag;
|
||||
slot.OnDropEvent += Drop;
|
||||
slot.OnPointerClickEvent += MouseClick;
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
public void BeginDrag(ItemSlot itemSlot)
|
||||
#region drag & drop handler
|
||||
public virtual void BeginDrag(ItemSlot itemSlot)
|
||||
{
|
||||
if (itemSlot.Item != null)
|
||||
{
|
||||
@ -39,7 +44,7 @@ public abstract class DraggablePanelController : PanelController<IndexValuePair<
|
||||
}
|
||||
}
|
||||
|
||||
public void Drag(ItemSlot itemSlot)
|
||||
public virtual void Drag(ItemSlot itemSlot)
|
||||
{
|
||||
DraggedSlotController.Instance.UpdatePosition(Input.mousePosition);
|
||||
}
|
||||
@ -91,6 +96,51 @@ public abstract class DraggablePanelController : PanelController<IndexValuePair<
|
||||
DraggedSlotController.Instance.UpdateItem(null);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void MouseClick(ItemSlot itemSlot, PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Right && eventData.clickCount == 1)
|
||||
{
|
||||
SingleRightMouseClick(itemSlot);
|
||||
}
|
||||
|
||||
if (eventData.button == PointerEventData.InputButton.Right && eventData.clickCount == 2)
|
||||
{
|
||||
DoubleRightMouseClick(itemSlot);
|
||||
}
|
||||
|
||||
if (eventData.button == PointerEventData.InputButton.Left && eventData.clickCount == 1)
|
||||
{
|
||||
SingleLeftMouseClick(itemSlot);
|
||||
}
|
||||
|
||||
if (eventData.button == PointerEventData.InputButton.Left && eventData.clickCount == 2)
|
||||
{
|
||||
DoubleLeftMouseClick(itemSlot);
|
||||
}
|
||||
}
|
||||
|
||||
#region mouse handler
|
||||
public virtual void SingleRightMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void DoubleRightMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void SingleLeftMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void DoubleLeftMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public ISlot GetDraggedSlot()
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public interface DraggablePanelInterface
|
||||
{
|
||||
@ -18,6 +19,8 @@ public interface DraggablePanelInterface
|
||||
|
||||
public void Drop(ItemSlot dropItemSlot);
|
||||
|
||||
public void MouseClick(ItemSlot itemSlot, PointerEventData eventData);
|
||||
|
||||
// supports function to use in Drop
|
||||
public ISlot GetDraggedSlot();
|
||||
}
|
@ -19,15 +19,35 @@ public abstract class WarehousePanelController : DraggablePanelController
|
||||
((ItemSlot)ChildBoxList.Where(slot => slot.Number == itemSlot.Number).First()).ResetSlot();
|
||||
else
|
||||
((ItemSlot)ChildBoxList.Where(slot => slot.Number == itemSlot.Number).First()).SetItem(itemSlot.Item);
|
||||
|
||||
|
||||
// 2. Rebuild/apply UiManager content (list of items) base on slots values after its updating
|
||||
|
||||
// 2.1 Make copy because Add -> base.Add() -> base.Add() -> UpdateList() rebuild content ad pass "new" list (in this case with only one - firtst passed - item) to ChestContentUiMangaer.Element
|
||||
UpdatePanelContent();
|
||||
}
|
||||
|
||||
public override void DoubleLeftMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
if(AllowToUseItemInPanel)
|
||||
itemSlot.Item?.InvokeEffectAction();
|
||||
}
|
||||
|
||||
|
||||
public override void BuildPanelContent(List<IndexValuePair<int, EquippableItem>> elements)
|
||||
{
|
||||
base.BuildPanelContent(elements);
|
||||
|
||||
ClearSlots();
|
||||
}
|
||||
|
||||
public void UpdatePanelContent()
|
||||
{
|
||||
// 2.1 Make copy because Add -> base.Add() -> base.Add() -> UpdateList() rebuild content ad pass "new" list (in this case with only one - firtst passed - item) to ChestContentUiMangaer.Element
|
||||
var ChildBoxListCopy = new List<IndexValuePair<int, EquippableItem>>(ChildBoxList.Where(slot => slot.Item != null).Select(slot => new IndexValuePair<int, EquippableItem>(slot.Number, slot.Item)).ToList());
|
||||
|
||||
UiManager.RemoveAll();
|
||||
|
||||
foreach(IndexValuePair<int, EquippableItem> slot in ChildBoxListCopy)
|
||||
foreach (IndexValuePair<int, EquippableItem> slot in ChildBoxListCopy)
|
||||
{
|
||||
if (slot.Value != null)
|
||||
{
|
||||
@ -41,13 +61,6 @@ public abstract class WarehousePanelController : DraggablePanelController
|
||||
}
|
||||
}
|
||||
|
||||
public override void BuildPanelContent(List<IndexValuePair<int, EquippableItem>> elements)
|
||||
{
|
||||
base.BuildPanelContent(elements);
|
||||
|
||||
ClearSlots();
|
||||
}
|
||||
|
||||
public override void ClearSlots()
|
||||
{
|
||||
foreach (ItemSlot ChestSlot in ChildBoxList)
|
||||
|
@ -71,6 +71,8 @@ public abstract class UIBaseManager<T> : MonoBehaviour, ManagerInterface<T>
|
||||
|
||||
DynamicPanel.transform.localPosition = uiPanelTemplate.transform.position; // prevent overwritten position by... environment???
|
||||
|
||||
DynamicPanel.name = uiPanelTemplate.name;
|
||||
|
||||
SetupPanel();
|
||||
|
||||
return true;
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce25c90d4bfc30849b2f0c4d83a0c5cb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
||||
|
||||
interface IModelMapper<T>
|
||||
{
|
||||
public abstract T MapDataToObject(string prefarbAssetName);
|
||||
|
||||
public abstract T MapDataToObject();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6b77778b83103e4086ee2bd0e833032
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Application/Shop.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Shop.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48fd614d22204de49ada0e5287d3f5ba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public enum ShopItemCardMode
|
||||
{
|
||||
Buy,
|
||||
Sell
|
||||
}
|
||||
|
||||
class ShopItemCardKeeper : MonoBehaviour
|
||||
{
|
||||
[Header("Current Item")]
|
||||
public EquippableItem SelectedItem;
|
||||
public int OriginSlotNumver;
|
||||
|
||||
[Header("Shopping Card")]
|
||||
[SerializeField] private Button _buyButton;
|
||||
[SerializeField] private Button _sellButton;
|
||||
|
||||
|
||||
[Header("Item Preveiw Section")]
|
||||
[SerializeField] public ShopItemCardMode ShopMode;
|
||||
[SerializeField] private TextMeshProUGUI _itemPreviewName;
|
||||
[SerializeField] private TextMeshProUGUI _itemPreviewDescription;
|
||||
[SerializeField] private TextMeshProUGUI _itemPreviewStats;
|
||||
[SerializeField] private TextMeshProUGUI _itemPreviewStatsValue;
|
||||
[SerializeField] private Text _itemPreviewPrice;
|
||||
|
||||
|
||||
public void ShowItemDetails(ItemSlot itemSlot, ShopItemCardMode mode = ShopItemCardMode.Buy)
|
||||
{
|
||||
SelectedItem = itemSlot.Item;
|
||||
OriginSlotNumver = itemSlot.Number;
|
||||
|
||||
ShopMode = mode;
|
||||
|
||||
gameObject.active = true;
|
||||
|
||||
BildCardContent();
|
||||
}
|
||||
|
||||
public void BildCardContent()
|
||||
{
|
||||
// Clear poanel
|
||||
if (!SelectedItem)
|
||||
{
|
||||
_itemPreviewName.text = "";
|
||||
_itemPreviewDescription.text = "";
|
||||
_itemPreviewStats.text = "";
|
||||
_itemPreviewStatsValue.text = "";
|
||||
_itemPreviewPrice.text = "";
|
||||
|
||||
_buyButton.gameObject.SetActive(false);
|
||||
_sellButton.gameObject.SetActive(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_itemPreviewName.text = SelectedItem.Name;
|
||||
|
||||
_itemPreviewDescription.text = SelectedItem.Description;
|
||||
|
||||
_itemPreviewStats.text = BuildItemStats();
|
||||
_itemPreviewStatsValue.text = SelectedItem.Value.ToString();
|
||||
|
||||
_itemPreviewPrice.text = $"Price: {CountPrice()}";
|
||||
|
||||
switch(ShopMode)
|
||||
{
|
||||
case ShopItemCardMode.Buy:
|
||||
{
|
||||
_sellButton.gameObject.SetActive(false);
|
||||
|
||||
_buyButton.gameObject.SetActive(true);
|
||||
|
||||
break;
|
||||
}
|
||||
case ShopItemCardMode.Sell:
|
||||
{
|
||||
_buyButton.gameObject.SetActive(false);
|
||||
|
||||
_sellButton.gameObject.SetActive(true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string BuildItemStats()
|
||||
{
|
||||
if(SelectedItem.EquipmentType == EquipmentTypeEnum.Weapon)
|
||||
return $"Attack: \n";
|
||||
|
||||
if (SelectedItem.EquipmentType == EquipmentTypeEnum.Helmet || SelectedItem.EquipmentType == EquipmentTypeEnum.Chest)
|
||||
return $"Deffence: \n";
|
||||
|
||||
if (SelectedItem.EquipmentType == EquipmentTypeEnum.Boots)
|
||||
return $"Speed: \n";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public int CountPrice()
|
||||
{
|
||||
return SelectedItem.Price;
|
||||
}
|
||||
|
||||
public void BuyItem()
|
||||
{
|
||||
Debug.Log("Buy item");
|
||||
|
||||
if (!_buyButton.IsActive())
|
||||
return;
|
||||
|
||||
// TODO - CHECK PLAYER ACCOUNT
|
||||
|
||||
// 1. Buy transaction
|
||||
// 1.1.1 Add to player Inventory Panel + refresh view
|
||||
InventoryUIManager.Instance.Add(SelectedItem);
|
||||
|
||||
if (InventoryUIManager.Instance.GetPanelStatus())
|
||||
GameObject.FindObjectOfType<InventoryPanelController>().BuildPanelContent(InventoryUIManager.Instance.GetList());
|
||||
|
||||
// 1.1.2 Save chnages in Inventory Panel
|
||||
SceneInventoryDataManager.Instance.SaveDynamicData();
|
||||
|
||||
// 1.2.1 Remove item from Shop Panel
|
||||
ShopContentUIManager.Instance.RemoveByPosition(OriginSlotNumver);
|
||||
|
||||
if (ShopUIManager.Instance.GetPanelStatus())
|
||||
GameObject.FindObjectOfType<ShopPanelController>().BuildPanelContent(ShopContentUIManager.Instance.GetList());
|
||||
|
||||
// 1.2.2 Save chnages in Shop Panel
|
||||
SceneInventoryDataManager.Instance.SaveDynamicData();
|
||||
|
||||
|
||||
|
||||
// 2. TODO - Player gold change & save
|
||||
}
|
||||
|
||||
public void SellItem()
|
||||
{
|
||||
Debug.Log("Sell item");
|
||||
|
||||
if (!_sellButton.IsActive())
|
||||
return;
|
||||
|
||||
// 1. Sell transaction
|
||||
// 1.1.1 Remove from player Inventory Panel by position + refresh view
|
||||
InventoryUIManager.Instance.RemoveByPosition(OriginSlotNumver);
|
||||
|
||||
if (InventoryUIManager.Instance.GetPanelStatus())
|
||||
GameObject.FindObjectOfType<InventoryPanelController>().BuildPanelContent(InventoryUIManager.Instance.GetList());
|
||||
|
||||
// 1.1.2 Save chnages in Inventory Panel
|
||||
SceneInventoryDataManager.Instance.SaveDynamicData();
|
||||
|
||||
|
||||
// 2. TODO - Player gold change & save
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e2866969bce0b54dbc4690d51aa19aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -49,6 +49,12 @@ public class ChestUIManager : UIBaseManager<Chest>
|
||||
|
||||
ChestContentUIManager.Instance.DynamicPanel = null;
|
||||
|
||||
// Close additionals panels
|
||||
if (EquipmentUIManager.Instance.GetPanelStatus()) EquipmentUIManager.Instance.ClosePanel();
|
||||
|
||||
if (InventoryUIManager.Instance.GetPanelStatus()) InventoryUIManager.Instance.ClosePanel();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,23 @@ public class EquipmentUIManager : UIWarehouseManager
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OpenPanel()
|
||||
{
|
||||
/**
|
||||
* We dont want to be able to open Inventory Panel when shop is opened
|
||||
*/
|
||||
if (ShopUIManager.Instance.GetPanelStatus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OpenPanel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public override void SetupPanel()
|
||||
{
|
||||
base.SetupPanel();
|
||||
|
@ -23,6 +23,10 @@ public class ChestPanelController : WarehousePanelController
|
||||
// - remove item from position
|
||||
// - find item in warehouse
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AllowToUseItemInPanel = false;
|
||||
}
|
||||
|
||||
// 1. Prepare empty panel
|
||||
public override void BuildPanelSlots()
|
||||
|
@ -92,9 +92,7 @@ public class EquipmentPanelController : DraggablePanelController
|
||||
|
||||
var ChildBoxListCopy = new List<IndexValuePair<int, EquippableItem>>(ChildBoxList.Where(slot => slot.Item != null).Select(slot => new IndexValuePair<int, EquippableItem>(slot.Number, slot.Item)).ToList());
|
||||
|
||||
Debug.Log(ChildBoxListCopy.Count());
|
||||
UiManager.RemoveAll();
|
||||
Debug.Log(ChildBoxListCopy.Count());
|
||||
|
||||
foreach (IndexValuePair<int, EquippableItem> slot in ChildBoxListCopy)
|
||||
{
|
||||
@ -105,7 +103,7 @@ public class EquipmentPanelController : DraggablePanelController
|
||||
}
|
||||
else
|
||||
{
|
||||
UiManager.Add(new IndexValuePair<int, EquippableItem>(slot.Key, null));
|
||||
UiManager.Add(new IndexValuePair<int, EquippableItem>(slot.Key, null)); // ONLY DIFFERENCE BETWEEN UpdatePanelContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,4 +88,11 @@ public class InventoryPanelController : WarehousePanelController
|
||||
ChildBoxList[element.Key].SetItem(element.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SingleLeftMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
// mark item as selected in shop panel
|
||||
if (ShopContentUIManager.Instance.DynamicPanel)
|
||||
ShopContentUIManager.Instance.DynamicPanel.transform.Find("ItemDetails").GetComponent<ShopItemCardKeeper>().ShowItemDetails(itemSlot, ShopItemCardMode.Sell);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,117 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using System;
|
||||
|
||||
|
||||
public class ShopPanelController : WarehousePanelController
|
||||
{
|
||||
protected override UIBaseManager<IndexValuePair<int, EquippableItem>> FetchUiManager()
|
||||
{
|
||||
return GameObject.FindObjectOfType<ShopContentUIManager>();
|
||||
}
|
||||
|
||||
// build panel sunction
|
||||
// - setup - main function to build panel on screen
|
||||
// - setPanelISlots - build slots on panel dependiong on declared amount
|
||||
// - setPanelItems - invoking building items on slots
|
||||
|
||||
// api for drag and drop
|
||||
// - set item on position
|
||||
// - remove item from position
|
||||
// - find item in warehouse
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AllowToUseItemInPanel = false;
|
||||
}
|
||||
|
||||
// 1. Prepare empty panel
|
||||
public override void BuildPanelSlots()
|
||||
{
|
||||
if (_panelContent == null)
|
||||
throw new Exception("Panel content is not attaches");
|
||||
|
||||
for (int _position = 0; _position < UiManager.SLOTS_NUMBER; _position++)
|
||||
{
|
||||
//ISlot newSlot = SetupSlot(_position, _panel);
|
||||
GameObject newSlot = BuildSlot(_position, _panelContent);
|
||||
|
||||
// Set new Slot instance
|
||||
ChildBoxList.Add(newSlot.GetComponent<ShopSlot>());
|
||||
|
||||
// Assign events
|
||||
ChildBoxList[_position] = SetupDragAndDropToSlot(ChildBoxList[_position]);
|
||||
}
|
||||
}
|
||||
|
||||
public override GameObject BuildSlot(int key, GameObject _parent)
|
||||
{
|
||||
if (ChildBoxTemplate == null)
|
||||
throw new Exception("chestslotbox_template is empty");
|
||||
|
||||
GameObject _newItemSlot = MonoBehaviour.Instantiate(ChildBoxTemplate, _parent.transform.position, Quaternion.identity); //.GetComponent<InventorySlot>();
|
||||
|
||||
_newItemSlot.transform.SetParent(_parent.transform);
|
||||
_newItemSlot.transform.localScale = new Vector3(1.15f, 1.15f, 1.15f);
|
||||
|
||||
_newItemSlot.GetComponent<ShopSlot>().SetupSlot(key, null, this);
|
||||
|
||||
return _newItemSlot;
|
||||
}
|
||||
|
||||
|
||||
// 2. Set up panel additn items to it
|
||||
public override void SetUp(List<IndexValuePair<int, EquippableItem>> elements)
|
||||
{
|
||||
// Build panel content template
|
||||
BuildPanelSlots();
|
||||
|
||||
// Fill with items
|
||||
BuildPanelContent(elements);
|
||||
}
|
||||
|
||||
|
||||
public override void BuildPanelContent(List<IndexValuePair<int, EquippableItem>> elements)
|
||||
{
|
||||
|
||||
base.BuildPanelContent(elements);
|
||||
|
||||
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
||||
{
|
||||
Debug.Log($"key: {element.Key} - value: {element.Value}");
|
||||
ChildBoxList[element.Key].SetItem(new EquippableItem(element.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//clear deffault efects
|
||||
public override void BeginDrag(ItemSlot itemSlot)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Drag(ItemSlot itemSlot)
|
||||
{
|
||||
}
|
||||
|
||||
public override void EndDrag(ItemSlot itemSlot)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Drop(ItemSlot dropItemSlot)
|
||||
{
|
||||
}
|
||||
public override void SingleLeftMouseClick(ItemSlot itemSlot)
|
||||
{
|
||||
// set item as selected
|
||||
if (ShopContentUIManager.Instance.DynamicPanel)
|
||||
ShopContentUIManager.Instance.DynamicPanel.transform.Find("ItemDetails").GetComponent<ShopItemCardKeeper>().ShowItemDetails(itemSlot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Chest content manager
|
||||
// gest new elements list after open chest
|
||||
// remove: -> remove from list, (binding) update list in chest
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66c5355517f64f558a08ba75b98d4fb0
|
||||
timeCreated: 1670939743
|
3
Assets/Scripts/REFACTORING/Application/UI/Shop.meta
Normal file
3
Assets/Scripts/REFACTORING/Application/UI/Shop.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1e52654453b412e87f740d47e3757ee
|
||||
timeCreated: 1670938603
|
@ -0,0 +1,113 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ShopContentUIManager : UIWarehouseManager
|
||||
{
|
||||
public static new ShopContentUIManager Instance { get; protected set; }
|
||||
|
||||
public override int SLOTS_NUMBER { get { return 24; } }
|
||||
|
||||
public const string ITEM_LOCALIZATION = "UiPanels/";
|
||||
public const string PANEL_NAME = null;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(Instance);
|
||||
Debug.Log("destroiy shop UI");
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
/*
|
||||
public override void UpdateList()
|
||||
{
|
||||
// TODO something like rebuild associated panel content
|
||||
// depending on which class we use it mayu be Inventory / Chest / Shop Panel Controller
|
||||
DynamicPanel.GetComponent<InventoryPanelController>(); //.Refresh() -- rebuild content
|
||||
}*/
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// use empty function to override parent Update
|
||||
// to prevent using Open Panel and Close Panel!!!
|
||||
// this UI manager mustn't open panel - only manage passed chest content and return updated data
|
||||
}
|
||||
|
||||
public bool OpenPanel() { return true; }
|
||||
public bool ClosePanel() { return true; }
|
||||
protected override GameObject GetTemplatePanel() { throw new System.NotImplementedException(); }
|
||||
|
||||
|
||||
public override void SetupPanel()
|
||||
{
|
||||
base.SetupPanel();
|
||||
|
||||
// setup models list
|
||||
DynamicPanel.GetComponent<ShopPanelController>().SetUp(Elements);
|
||||
}
|
||||
|
||||
public override void UpdateList()
|
||||
{
|
||||
DynamicPanel.GetComponent<ShopPanelController>().BuildPanelContent(Elements);
|
||||
}
|
||||
|
||||
#region adust parent function
|
||||
public override void Add(IndexValuePair<int, EquippableItem> itemOnSlot)
|
||||
{
|
||||
base.Add(itemOnSlot);
|
||||
|
||||
UpdateShopContent();
|
||||
}
|
||||
|
||||
public override void Add(EquippableItem item)
|
||||
{
|
||||
base.Add(item);
|
||||
|
||||
UpdateShopContent();
|
||||
}
|
||||
|
||||
public override void RemoveByPosition(int keyPosition)
|
||||
{
|
||||
base.RemoveByPosition(keyPosition);
|
||||
|
||||
UpdateShopContent();
|
||||
}
|
||||
|
||||
public override int RemoveByItemId(int itemId)
|
||||
{
|
||||
var result = base.RemoveByItemId(itemId);
|
||||
|
||||
UpdateShopContent();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override int RemoveByItemName(string itemName)
|
||||
{
|
||||
var result = base.RemoveByItemName(itemName);
|
||||
|
||||
UpdateShopContent();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void RemoveAll()
|
||||
{
|
||||
Elements.Clear();
|
||||
|
||||
UpdateShopContent();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void UpdateShopContent()
|
||||
{
|
||||
ShopUIManager.Instance.UpdateShopContent(SceneManager.GetActiveScene().name, ShopUIManager.Instance.CurrentShopOwnerName, Elements);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 703bf6cf8b4d9d949a3bf7543e072e30
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
110
Assets/Scripts/REFACTORING/Application/UI/Shop/ShopUIManager.cs
Normal file
110
Assets/Scripts/REFACTORING/Application/UI/Shop/ShopUIManager.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[Serializable]
|
||||
public class ShopUIManager : UIBaseManager<Shop>
|
||||
{
|
||||
public new static ShopUIManager Instance { get; private set; }
|
||||
|
||||
public const string ITEM_LOCALIZATION = "UiPanels/Shop/";
|
||||
public const string PANEL_NAME = "ShopPanel";
|
||||
//public int SLOTS_NUMBER => 24;
|
||||
|
||||
/// <summary>
|
||||
/// Keys pair to detect chest
|
||||
/// </summary>
|
||||
[Space]
|
||||
[Header("Current shop unique keys")]
|
||||
public string CurrentShopOwnerName = null; // OR NPC NAME
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OpenPanel()
|
||||
{
|
||||
if (CurrentShopOwnerName == null || CurrentShopOwnerName == "")
|
||||
{
|
||||
Debug.Log($"You re not in range of any shop");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open additionals panels
|
||||
if (!InventoryUIManager.Instance.GetPanelStatus()) InventoryUIManager.Instance.OpenPanel();
|
||||
|
||||
return base.OpenPanel();
|
||||
}
|
||||
|
||||
public override bool ClosePanel()
|
||||
{
|
||||
base.ClosePanel();
|
||||
|
||||
ShopContentUIManager.Instance.DynamicPanel = null;
|
||||
|
||||
CurrentShopOwnerName = "";
|
||||
|
||||
// Close additionals panels
|
||||
if (InventoryUIManager.Instance.GetPanelStatus()) InventoryUIManager.Instance.ClosePanel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void SetupPanel()
|
||||
{
|
||||
base.SetupPanel();
|
||||
|
||||
var shop = FindShopInCollection(SceneManager.GetActiveScene().name, CurrentShopOwnerName);
|
||||
if (shop == null)
|
||||
throw new Exception($"Shop {CurrentShopOwnerName} not found");
|
||||
|
||||
Debug.Log("Shop UI setupPanel");
|
||||
|
||||
ShopContentUIManager.Instance.SetList(shop.GetContent());
|
||||
ShopContentUIManager.Instance.DynamicPanel = DynamicPanel;
|
||||
ShopContentUIManager.Instance.SetupPanel();
|
||||
}
|
||||
|
||||
public override void UpdateList()
|
||||
{
|
||||
if (CurrentShopOwnerName == null || CurrentShopOwnerName == "")
|
||||
throw new Exception($"You re not in collision with any chest");
|
||||
|
||||
|
||||
var shop = FindShopInCollection(SceneManager.GetActiveScene().name, CurrentShopOwnerName);
|
||||
if (shop == null)
|
||||
throw new Exception($"Chest {CurrentShopOwnerName} not found");
|
||||
|
||||
ShopContentUIManager.Instance.SetList(shop.GetContent());
|
||||
ShopContentUIManager.Instance.DynamicPanel = DynamicPanel;
|
||||
ShopContentUIManager.Instance.UpdateList();
|
||||
}
|
||||
|
||||
public void UpdateShopContent(string mapName, string shopOwnerName, List<IndexValuePair<int, EquippableItem>> chestContent)
|
||||
{
|
||||
Elements.Where(shop => shop.Map == mapName && shop.Npc == shopOwnerName).ToList().ForEach(shop => shop.SetContent(chestContent));
|
||||
}
|
||||
|
||||
protected override GameObject GetTemplatePanel()
|
||||
{
|
||||
// Resources = default path - Asset/Resources ... .obj
|
||||
return Resources.Load(ITEM_LOCALIZATION + PANEL_NAME) as GameObject;
|
||||
}
|
||||
|
||||
private Shop FindShopInCollection(string _mapName, string _shopOwnerName)
|
||||
{
|
||||
Elements.ForEach(el => Debug.Log(el.Npc + " - " + el.Map));
|
||||
return Elements.Find(shop => shop.Map == _mapName && shop.Npc == _shopOwnerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d0be1073753419b9be341d0f373ba56
|
||||
timeCreated: 1670938751
|
@ -0,0 +1,5 @@
|
||||
public enum SystemLanguageEnum
|
||||
{
|
||||
Polish,
|
||||
English
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a2d284cc5c4464418386d1b5484d6a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -21,7 +21,7 @@ public class EquippableItem : Item
|
||||
|
||||
public EquippableItem(Item _item) : base(_item) {}
|
||||
|
||||
public EquippableItem(EquippableItem _item) : base(_item.name, _item.description, _item.level, _item.itemModel, _item.image)
|
||||
public EquippableItem(EquippableItem _item) : base(_item.name, _item.description, _item.level, _item.value, _item.price, _item.itemModel, _item.image)
|
||||
{
|
||||
StrengthBonus = _item.StrengthBonus;
|
||||
AgilityBonus = _item.AgilityBonus;
|
||||
@ -31,6 +31,6 @@ public class EquippableItem : Item
|
||||
EquipmentType = _item.EquipmentType;
|
||||
}
|
||||
|
||||
public EquippableItem(string _name, string _description, int _level, GameObject _itemModel, Sprite _image) : base(_name, _description, _level, _itemModel, _image) { }
|
||||
public EquippableItem(string _name, string _description, int _level, int _value, int _price, GameObject _itemModel, Sprite _image) : base(_name, _description, _level, _value, _price, _itemModel, _image) { }
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[System.Serializable]
|
||||
@ -35,6 +37,13 @@ public class Item : ScriptableObject
|
||||
set { level = value; }
|
||||
}
|
||||
|
||||
public int value;
|
||||
public int Value
|
||||
{
|
||||
get { return value; }
|
||||
set { this.value = value; }
|
||||
}
|
||||
|
||||
public Sprite image;
|
||||
public Sprite Image
|
||||
{
|
||||
@ -50,6 +59,15 @@ public class Item : ScriptableObject
|
||||
set { itemModel = value; }
|
||||
}
|
||||
|
||||
public int price;
|
||||
public int Price
|
||||
{
|
||||
get { return price; }
|
||||
set { price = value; }
|
||||
}
|
||||
|
||||
|
||||
public UnityEvent useEffect = new UnityEvent();
|
||||
public Item() {}
|
||||
|
||||
public Item(Item _item)
|
||||
@ -57,32 +75,37 @@ public class Item : ScriptableObject
|
||||
this.Name = _item.Name;
|
||||
this.Description = _item.Description;
|
||||
this.Level = _item.Level;
|
||||
this.Value = _item.Value;
|
||||
this.Price = _item.price;
|
||||
this.ItemModel = _item.ItemModel;
|
||||
this.Image = _item.Image;
|
||||
}
|
||||
|
||||
public Item(string _name, string _description, int _level, GameObject _itemModel, Sprite _image)
|
||||
public Item(string _name, string _description, int _level, int _value, GameObject _itemModel, Sprite _image)
|
||||
{
|
||||
this.Name = _name;
|
||||
this.Description = _description;
|
||||
this.Level = _level;
|
||||
this.Value = _value;
|
||||
this.ItemModel = _itemModel;
|
||||
this.Image = _image;
|
||||
}
|
||||
|
||||
// public void SaveItem()
|
||||
// {
|
||||
// SaveItemSystem.SaveItem(this);
|
||||
// }
|
||||
public Item(string _name, string _description, int _level, int _value, int _price, GameObject _itemModel, Sprite _image)
|
||||
{
|
||||
this.Name = _name;
|
||||
this.Description = _description;
|
||||
this.Level = _level;
|
||||
this.Value = _value;
|
||||
this.Price = _price;
|
||||
this.ItemModel = _itemModel;
|
||||
this.Image = _image;
|
||||
}
|
||||
|
||||
// public void LoadItem()
|
||||
// {
|
||||
// ItemData data = SaveItemSystem.LoadIten();
|
||||
|
||||
// id = data.id;
|
||||
// name = data.name;
|
||||
// description = data.description;
|
||||
// level = data.level;
|
||||
|
||||
// }
|
||||
public void InvokeEffectAction()
|
||||
{
|
||||
Debug.Log($"Use {name} effect");
|
||||
useEffect.Invoke();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,12 @@ public abstract class ItemData : ModelData<Item, Item>
|
||||
[SerializeField]
|
||||
public int level;
|
||||
|
||||
[SerializeField]
|
||||
public int value;
|
||||
|
||||
[SerializeField]
|
||||
public int price;
|
||||
|
||||
[SerializeField]
|
||||
public string imageName;
|
||||
|
||||
@ -21,6 +27,8 @@ public abstract class ItemData : ModelData<Item, Item>
|
||||
{
|
||||
description = item.description;
|
||||
level = item.level;
|
||||
value = item.value;
|
||||
price = item.price;
|
||||
imageName = item.image.name;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ public interface ISlot
|
||||
event Action<ItemSlot> OnEndDragEvent;
|
||||
event Action<ItemSlot> OnDragEvent;
|
||||
event Action<ItemSlot> OnDropEvent;
|
||||
event Action<ItemSlot, PointerEventData> OnPointerClickEvent;
|
||||
//(B)Islot // as B
|
||||
|
||||
public void SetupSlot(int _number, EquippableItem _item, WarehousePanelController _PanelController);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
@ -6,7 +6,7 @@ using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using System; // for Action type
|
||||
|
||||
public class ItemSlot : MonoBehaviour, ISlot, IBeginDragHandler, IEndDragHandler, IDragHandler, IDropHandler
|
||||
public class ItemSlot : MonoBehaviour, ISlot, IBeginDragHandler, IEndDragHandler, IDragHandler, IDropHandler, IPointerClickHandler
|
||||
{
|
||||
[Header("UI Stuff to change")]
|
||||
[SerializeField] private TextMeshProUGUI slotItemNumberText;
|
||||
@ -47,6 +47,7 @@ public class ItemSlot : MonoBehaviour, ISlot, IBeginDragHandler, IEndDragHandler
|
||||
public event Action<ItemSlot> OnEndDragEvent;
|
||||
public event Action<ItemSlot> OnDragEvent;
|
||||
public event Action<ItemSlot> OnDropEvent;
|
||||
public event Action<ItemSlot, PointerEventData> OnPointerClickEvent;
|
||||
|
||||
/* public ItemSlot() { }
|
||||
public ItemSlot(int number, EquippableItem item = null)
|
||||
@ -54,15 +55,15 @@ public class ItemSlot : MonoBehaviour, ISlot, IBeginDragHandler, IEndDragHandler
|
||||
Number = number;
|
||||
Item = item;
|
||||
}*/
|
||||
/*
|
||||
public ItemSlot(ItemSlot slot)
|
||||
{
|
||||
Number = slot.Number;
|
||||
Item = slot.Item;
|
||||
/*
|
||||
public ItemSlot(ItemSlot slot)
|
||||
{
|
||||
Number = slot.Number;
|
||||
Item = slot.Item;
|
||||
|
||||
slotItemNumberText = slot.slotItemNumberText;
|
||||
itemImage = slot.itemImage;
|
||||
}*/
|
||||
slotItemNumberText = slot.slotItemNumberText;
|
||||
itemImage = slot.itemImage;
|
||||
}*/
|
||||
|
||||
public void SetupSlot(int _number, EquippableItem _item, WarehousePanelController _PanelController)
|
||||
{
|
||||
@ -154,5 +155,11 @@ public class ItemSlot : MonoBehaviour, ISlot, IBeginDragHandler, IEndDragHandler
|
||||
if(OnDropEvent != null)
|
||||
OnDropEvent(this);
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (OnPointerClickEvent != null)
|
||||
OnPointerClickEvent(this, eventData);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
26
Assets/Scripts/REFACTORING/Models/Panel/Slot/ShopSlot.cs
Normal file
26
Assets/Scripts/REFACTORING/Models/Panel/Slot/ShopSlot.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class ShopSlot : ItemSlot
|
||||
{
|
||||
/* public ShopSlot(int number, Item item): base(number, item)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
public override bool CanReceiveItem(Item item)
|
||||
{
|
||||
return true;
|
||||
|
||||
// // allow to put item only when slot is empty
|
||||
// if(Item == null)
|
||||
// return true;
|
||||
|
||||
// EquippableItem equippableItem = item as EquippableItem;
|
||||
// return equippableItem == null;
|
||||
// // what when player try drop putted equipment fowart to chest
|
||||
// // what when player try put item on unempty field
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bf41236973acd14caf4428b908d0674
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -2,7 +2,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public abstract class ModelData<T, V>
|
||||
public abstract class ModelData<T, V> : IModelMapper<T>
|
||||
{
|
||||
[SerializeField]
|
||||
public int id;
|
||||
@ -18,6 +18,8 @@ public abstract class ModelData<T, V>
|
||||
|
||||
protected virtual string MODEL_LOCALIZATION => "";
|
||||
|
||||
public ModelData() { }
|
||||
|
||||
public ModelData(int _id, string _name)
|
||||
{
|
||||
id = _id;
|
||||
@ -30,10 +32,9 @@ public abstract class ModelData<T, V>
|
||||
name = _name;
|
||||
modelName = _modelName; // name of the prefab
|
||||
}
|
||||
protected abstract V TryFindResource(string modelName);
|
||||
|
||||
public abstract T MapDataToObject(string prefarbAssetName);
|
||||
|
||||
public abstract T MapDataToObject();
|
||||
|
||||
protected abstract V TryFindResource(string modelName);
|
||||
}
|
8
Assets/Scripts/REFACTORING/Models/Shop.meta
Normal file
8
Assets/Scripts/REFACTORING/Models/Shop.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af03d81ce8418c445a237cd953ac7746
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
91
Assets/Scripts/REFACTORING/Models/Shop/Shop.cs
Normal file
91
Assets/Scripts/REFACTORING/Models/Shop/Shop.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class Shop
|
||||
{
|
||||
[NonSerialized]
|
||||
public string Npc;
|
||||
|
||||
[NonSerialized]
|
||||
public string Map;
|
||||
|
||||
[SerializeField]
|
||||
public List<IndexValuePair<int, EquippableItem>> Content = new List<IndexValuePair<int, EquippableItem>>();
|
||||
|
||||
public Shop(string _map)
|
||||
{
|
||||
Map = _map;
|
||||
}
|
||||
|
||||
public Shop(string _map, string _npc)
|
||||
{
|
||||
Map = _map;
|
||||
Npc = _npc;
|
||||
}
|
||||
|
||||
public Shop(string _map, string _npc, List<IndexValuePair<int, EquippableItem>> _content)
|
||||
{
|
||||
Map = _map;
|
||||
Npc = _npc;
|
||||
Content = _content;
|
||||
}
|
||||
|
||||
public void SetContent(List<IndexValuePair<int, EquippableItem>> _content)
|
||||
{
|
||||
Content = _content;
|
||||
}
|
||||
|
||||
public List<IndexValuePair<int, EquippableItem>> GetContent()
|
||||
{
|
||||
return Content;
|
||||
}
|
||||
|
||||
#region item
|
||||
public void AddItemToShop(Item _item)
|
||||
{
|
||||
int firstEmptyPosition = FindFirstEmptyPosition();
|
||||
|
||||
Content.Add(new IndexValuePair<int, EquippableItem>(firstEmptyPosition, (EquippableItem)_item));
|
||||
}
|
||||
|
||||
public void AddItemToShopOnPosition(int _position, Item _item)
|
||||
{
|
||||
Content.Add(new IndexValuePair<int, EquippableItem>(_position, (EquippableItem)_item));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region equippable item
|
||||
public void AddItemToShop(EquippableItem _item)
|
||||
{
|
||||
int firstEmptyPosition = FindFirstEmptyPosition();
|
||||
|
||||
Content.Add(new IndexValuePair<int, EquippableItem>(firstEmptyPosition, _item));
|
||||
}
|
||||
|
||||
public void AddItemToShopOnPosition(int _position, EquippableItem _item)
|
||||
{
|
||||
Content.Add(new IndexValuePair<int, EquippableItem>(_position, _item));
|
||||
}
|
||||
#endregion
|
||||
|
||||
public int FindFirstEmptyPosition()
|
||||
{
|
||||
if (Content.Any())
|
||||
{
|
||||
for (int i = 0; i < Content.Count(); i++)
|
||||
{
|
||||
if (Content.Count(el => el.Key == i && el.Value != null) != 0)
|
||||
continue;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
11
Assets/Scripts/REFACTORING/Models/Shop/Shop.cs.meta
Normal file
11
Assets/Scripts/REFACTORING/Models/Shop/Shop.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0490e96226021924b891436f9071aca7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
55
Assets/Scripts/REFACTORING/Models/Shop/ShopData.cs
Normal file
55
Assets/Scripts/REFACTORING/Models/Shop/ShopData.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class ShopData : IModelMapper<Shop>
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
public List<IndexValuePair<int, EquippableItemData>> content = new List<IndexValuePair<int, EquippableItemData>>();
|
||||
|
||||
[SerializeField]
|
||||
public string Map;
|
||||
|
||||
[SerializeField]
|
||||
public string NpcName;
|
||||
|
||||
public ShopData(Shop shop)
|
||||
{
|
||||
Map = shop.Map;
|
||||
NpcName = shop.Npc;
|
||||
|
||||
foreach (IndexValuePair<int, EquippableItem> item in shop.Content)
|
||||
{
|
||||
content.Add(
|
||||
new IndexValuePair<int, EquippableItemData>(item.Key, new EquippableItemData(item.Value))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public Shop MapDataToObject()
|
||||
{
|
||||
var shop = new Shop(Map, NpcName);
|
||||
|
||||
shop.Content.Clear();
|
||||
|
||||
foreach (IndexValuePair<int, EquippableItemData> item in content)
|
||||
{
|
||||
var castedObject = item.Value.MapDataToObject() as EquippableItem;
|
||||
|
||||
if (castedObject == null)
|
||||
shop.Content.Add(
|
||||
new IndexValuePair<int, EquippableItem>(item.Key, new EquippableItem(item.Value.MapDataToObject()))
|
||||
);
|
||||
else
|
||||
shop.Content.Add(
|
||||
new IndexValuePair<int, EquippableItem>(item.Key, castedObject)
|
||||
);
|
||||
}
|
||||
|
||||
return shop;
|
||||
}
|
||||
|
||||
public Shop MapDataToObject(string prefarbAssetName) { throw new System.NotImplementedException(); }
|
||||
}
|
11
Assets/Scripts/REFACTORING/Models/Shop/ShopData.cs.meta
Normal file
11
Assets/Scripts/REFACTORING/Models/Shop/ShopData.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28e57ba1626c78244b20f9ee261cac1c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,6 +3,10 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/*
|
||||
* IMPOSRTANT
|
||||
* All methods must be binded in buttons actions list responsible for saving
|
||||
*/
|
||||
public class SaveController : MonoBehaviour
|
||||
{
|
||||
public void SaveScene()
|
||||
@ -26,6 +30,7 @@ public class SaveController : MonoBehaviour
|
||||
player.GetComponent<Player>().SaveCheckpoint();
|
||||
}
|
||||
|
||||
#region palyer panels data
|
||||
public void SavePlayerEquipmentItems() // toDO change name to save Equipment - save items will save items on map eg after drops
|
||||
{
|
||||
EquipmentDataManager.Instance.SaveDynamicData();
|
||||
@ -42,6 +47,7 @@ public class SaveController : MonoBehaviour
|
||||
{
|
||||
SceneInventoryDataManager.Instance.SaveDynamicData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void SaveChests()
|
||||
{
|
||||
@ -50,4 +56,10 @@ public class SaveController : MonoBehaviour
|
||||
if(SceneChestDataManager.Instance)
|
||||
SceneChestDataManager.Instance.SaveDynamicData();
|
||||
}
|
||||
|
||||
public void SaveShops()
|
||||
{
|
||||
if(SceneShopDataManager.Instance)
|
||||
SceneShopDataManager.Instance.SaveDynamicData();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user