diff --git a/Assets/Battle/BattleStatus.cs b/Assets/Battle/BattleStatus.cs index efeeb66..0cf6601 100644 --- a/Assets/Battle/BattleStatus.cs +++ b/Assets/Battle/BattleStatus.cs @@ -1,3 +1,4 @@ public enum BattleStatus { + None, Stun, } diff --git a/Assets/Battle/UI/BattleParticipantUI.prefab b/Assets/Battle/UI/BattleParticipantUI.prefab index eac7329..d0882a7 100644 --- a/Assets/Battle/UI/BattleParticipantUI.prefab +++ b/Assets/Battle/UI/BattleParticipantUI.prefab @@ -78,154 +78,6 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: 56 ---- !u!1 &3426763279947371280 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2365314723301749520} - - component: {fileID: 2687845506595039125} - - component: {fileID: 7861691439794345590} - m_Layer: 5 - m_Name: BG - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &2365314723301749520 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3426763279947371280} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5364248411365301727} - 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: -53.76, y: 60.32} - m_SizeDelta: {x: 16.523172, y: 17.074677} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &2687845506595039125 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3426763279947371280} - m_CullTransparentMesh: 0 ---- !u!114 &7861691439794345590 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3426763279947371280} - 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: 0, g: 0, b: 0, a: 0.30588236} - m_RaycastTarget: 1 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: ff1a435c8e6ef4a46aeb34ba613ce13d, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 0 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!1 &3730468488252910637 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7872829101071880504} - - component: {fileID: 7145260895785022369} - - component: {fileID: 1306121800800203574} - m_Layer: 5 - m_Name: StunIcon - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7872829101071880504 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3730468488252910637} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5364248411365301727} - 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: -53.76, y: 60.32} - m_SizeDelta: {x: 16.522865, y: 17.07425} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7145260895785022369 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3730468488252910637} - m_CullTransparentMesh: 0 ---- !u!114 &1306121800800203574 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3730468488252910637} - 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: 0.9715784, b: 0.3160377, a: 1} - m_RaycastTarget: 1 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: dc422435e5172774ca9ddc33364d1a6f, type: 3} - m_Type: 0 - m_PreserveAspect: 1 - m_FillCenter: 1 - m_FillMethod: 0 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &5172729878808660606 GameObject: m_ObjectHideFlags: 0 @@ -368,10 +220,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_Children: - - {fileID: 2365314723301749520} - - {fileID: 7872829101071880504} - - {fileID: 501555061161187130} + m_Children: [] m_Father: {fileID: 6071241564507600362} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -392,9 +241,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d86314823afd5c34396777dcb49e6093, type: 3} m_Name: m_EditorClassIdentifier: - backgroundImage: {fileID: 7861691439794345590} - stunImage: {fileID: 1306121800800203574} - turnsText: {fileID: 2986296803404415245} + iconPrefab: {fileID: 6208964397351173773, guid: 8fb5f8d629dd9f446b650ae8dec722fd, + type: 3} --- !u!1 &5574000899179897583 GameObject: m_ObjectHideFlags: 0 @@ -792,81 +640,3 @@ MonoBehaviour: blockGroup: {fileID: 5194869534592792291} blockText: {fileID: 1400733402613879005} statusUI: {fileID: 2488458570692802998} ---- !u!1 &7709810175605034872 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 501555061161187130} - - component: {fileID: 2941542102252663832} - - component: {fileID: 2986296803404415245} - m_Layer: 5 - m_Name: TurnsText - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &501555061161187130 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7709810175605034872} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5364248411365301727} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -61.9, y: 69.1} - m_SizeDelta: {x: 13, y: 13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &2941542102252663832 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7709810175605034872} - m_CullTransparentMesh: 0 ---- !u!114 &2986296803404415245 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7709810175605034872} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.8490566, g: 0.8490566, b: 0.8490566, a: 1} - m_RaycastTarget: 1 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 11 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 1 - m_MaxSize: 40 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: 1 diff --git a/Assets/Battle/UI/StatusIconUI.cs b/Assets/Battle/UI/StatusIconUI.cs new file mode 100644 index 0000000..c62d045 --- /dev/null +++ b/Assets/Battle/UI/StatusIconUI.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class StatusIconUI : MonoBehaviour +{ + public Image backgroundImage; + public Image statusImage; + public Text turnsText; + + private BattleStatus status; + + public void Init(BattleStatus status) { + this.status = status; + Sprite sprite = Resources.Load(GetStatusResourcePath(status)); + this.statusImage.sprite = sprite; + } + + private static string GetStatusResourcePath(BattleStatus status) { + return "BattleIcons/StatusIcon" + status; + } + + public void SetAmount(int amount, int index) { + this.turnsText.text = "" + amount; + this.transform.localPosition = new Vector2(-index * 22, 0); + } +} diff --git a/Assets/Battle/UI/StatusIconUI.cs.meta b/Assets/Battle/UI/StatusIconUI.cs.meta new file mode 100644 index 0000000..42847b2 --- /dev/null +++ b/Assets/Battle/UI/StatusIconUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f84df067a82ee724db7f5f6d540b763a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/UI/StatusIconUI.prefab b/Assets/Battle/UI/StatusIconUI.prefab new file mode 100644 index 0000000..04017cc --- /dev/null +++ b/Assets/Battle/UI/StatusIconUI.prefab @@ -0,0 +1,282 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3754972562415848510 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4281238062213505659} + - component: {fileID: 3152261815036323414} + - component: {fileID: 7136396516334039098} + m_Layer: 5 + m_Name: StatusImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4281238062213505659 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3754972562415848510} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4953025043275218043} + 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: -53.76, y: 60.32} + m_SizeDelta: {x: 16.522865, y: 17.07425} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3152261815036323414 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3754972562415848510} + m_CullTransparentMesh: 0 +--- !u!114 &7136396516334039098 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3754972562415848510} + 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: 0.9715784, b: 0.3160377, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4862312622906587433 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5860468315807561554} + - component: {fileID: 5846930683640278414} + - component: {fileID: 6468669935091445453} + m_Layer: 5 + m_Name: BG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5860468315807561554 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4862312622906587433} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4953025043275218043} + 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: -53.76, y: 60.32} + m_SizeDelta: {x: 16.523172, y: 17.074677} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5846930683640278414 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4862312622906587433} + m_CullTransparentMesh: 0 +--- !u!114 &6468669935091445453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4862312622906587433} + 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: 0, g: 0, b: 0, a: 0.30588236} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ff1a435c8e6ef4a46aeb34ba613ce13d, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4899148264470914132 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4513950216736118280} + - component: {fileID: 2266425032839502649} + - component: {fileID: 8950700567175101678} + m_Layer: 5 + m_Name: TurnsText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4513950216736118280 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4899148264470914132} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4953025043275218043} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -61.9, y: 69.1} + m_SizeDelta: {x: 13, y: 13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2266425032839502649 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4899148264470914132} + m_CullTransparentMesh: 0 +--- !u!114 &8950700567175101678 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4899148264470914132} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.8490566, g: 0.8490566, b: 0.8490566, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 11 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 1 +--- !u!1 &7853854689515474510 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4953025043275218043} + - component: {fileID: 6208964397351173773} + m_Layer: 5 + m_Name: StatusIconUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4953025043275218043 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7853854689515474510} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5860468315807561554} + - {fileID: 4281238062213505659} + - {fileID: 4513950216736118280} + m_Father: {fileID: 0} + 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: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6208964397351173773 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7853854689515474510} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f84df067a82ee724db7f5f6d540b763a, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundImage: {fileID: 6468669935091445453} + statusImage: {fileID: 7136396516334039098} + turnsText: {fileID: 8950700567175101678} diff --git a/Assets/Battle/UI/StatusIconUI.prefab.meta b/Assets/Battle/UI/StatusIconUI.prefab.meta new file mode 100644 index 0000000..0af1202 --- /dev/null +++ b/Assets/Battle/UI/StatusIconUI.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8fb5f8d629dd9f446b650ae8dec722fd +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/UI/StatusUI.cs b/Assets/Battle/UI/StatusUI.cs index 697b1fb..e46309d 100644 --- a/Assets/Battle/UI/StatusUI.cs +++ b/Assets/Battle/UI/StatusUI.cs @@ -1,25 +1,27 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; using UnityEngine.UI; public class StatusUI : MonoBehaviour { - public Image backgroundImage; - public Image stunImage; - public Text turnsText; + public StatusIconUI iconPrefab; private BattleParticipant battleParticipant; + private Dictionary icons; + public void Init(BattleParticipant battleParticipant) { this.battleParticipant = battleParticipant; + this.icons = new Dictionary(); this.battleParticipant.OnStatusChanged += this.NotifyBattleStatusChanged; } // Start is called before the first frame update - void Start() - { + void Start() { UpdateAppearance(); } @@ -32,16 +34,28 @@ public class StatusUI : MonoBehaviour } private void UpdateAppearance() { - int statusCount = 0; - if (battleParticipant.HasStatus(BattleStatus.Stun)) { - statusCount++; - this.stunImage.enabled = true; - this.turnsText.enabled = true; - this.turnsText.text = "" + battleParticipant.GetStatusAmount(BattleStatus.Stun); - } else { - this.stunImage.enabled = false; - this.turnsText.enabled = false; + int index = 0; + foreach (BattleStatus status in Enum.GetValues(typeof(BattleStatus)).Cast()) { + if (status == BattleStatus.None) { + continue; + } + + StatusIconUI iconUI = null; + this.icons.TryGetValue(status, out iconUI); + if (this.battleParticipant.HasStatus(status)) { + if (iconUI == null) { + iconUI = Instantiate(this.iconPrefab.gameObject, this.transform).GetComponent(); + iconUI.Init(status); + this.icons[status] = iconUI; + } + iconUI.SetAmount(this.battleParticipant.GetStatusAmount(status), index); + index++; + } else { + if (iconUI != null) { + Destroy(iconUI.gameObject); + this.icons.Remove(status); + } + } } - this.backgroundImage.enabled = (statusCount > 0); } } diff --git a/Assets/Resources/BattleIcons.meta b/Assets/Resources/BattleIcons.meta new file mode 100644 index 0000000..a493ace --- /dev/null +++ b/Assets/Resources/BattleIcons.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d191fe76c552b94b869e5dbbe21627a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/BattleIcons/BuffIconPower.png b/Assets/Resources/BattleIcons/BuffIconPower.png new file mode 100644 index 0000000..a7a0358 Binary files /dev/null and b/Assets/Resources/BattleIcons/BuffIconPower.png differ diff --git a/Assets/Battle/UI/stun_icon.png.meta b/Assets/Resources/BattleIcons/BuffIconPower.png.meta similarity index 98% rename from Assets/Battle/UI/stun_icon.png.meta rename to Assets/Resources/BattleIcons/BuffIconPower.png.meta index 7e2b60c..517e9df 100644 --- a/Assets/Battle/UI/stun_icon.png.meta +++ b/Assets/Resources/BattleIcons/BuffIconPower.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dc422435e5172774ca9ddc33364d1a6f +guid: ab37d9d620a49cc42bfe4a39a7194a3b TextureImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/Assets/Battle/UI/stun_icon.png b/Assets/Resources/BattleIcons/StatusIconStun.png similarity index 100% rename from Assets/Battle/UI/stun_icon.png rename to Assets/Resources/BattleIcons/StatusIconStun.png diff --git a/Assets/Resources/BattleIcons/StatusIconStun.png.meta b/Assets/Resources/BattleIcons/StatusIconStun.png.meta new file mode 100644 index 0000000..a263686 --- /dev/null +++ b/Assets/Resources/BattleIcons/StatusIconStun.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: a85ef4ac75648404cbf5b1fd218dc37b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TODO.txt b/TODO.txt index 5d95afb..3798e2d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -11,6 +11,7 @@ Battle - Make Enchantments be dropped as an effect like Defaults - No need to start coroutine for targeting - Indicate which Default is triggering +- Merge BattleClock with BattleState Story - Make dialogue show letter by letter.