장비 장착 시스템 작업

This commit is contained in:
김판돌 2023-12-15 22:25:02 +09:00
parent fddeb252d2
commit 54e72eb24b
10 changed files with 162 additions and 143 deletions

View File

@ -883,7 +883,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 15}
m_Pivot: {x: 0, y: 1}
--- !u!114 &71006699
MonoBehaviour:
@ -4194,10 +4194,10 @@ RectTransform:
- {fileID: 135725657}
m_Father: {fileID: 1704405201}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 236.24997, y: -50}
m_SizeDelta: {x: 137.49998, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &471455235
MonoBehaviour:
@ -4310,7 +4310,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &478833967
RectTransform:
m_ObjectHideFlags: 0
@ -4413,7 +4413,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495178026}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@ -4846,7 +4846,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &544367043
RectTransform:
m_ObjectHideFlags: 0
@ -4920,6 +4920,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ee90d53fc12612d4aa55db0c969e7750, type: 3}
m_Name:
m_EditorClassIdentifier:
name: {fileID: 240131346}
attribute: {fileID: 895153475}
hp: {fileID: 1700456133}
defense: {fileID: 391353530}
attack: {fileID: 670737922}
defensePenetration: {fileID: 1942030932}
attackSpeed: {fileID: 1436751118}
moveSpeed: {fileID: 2135110125}
critical: {fileID: 1413790507}
criticalDamage: {fileID: 1540832816}
damageReduction: {fileID: 312252491}
level: {fileID: 995375598}
maxLevel: {fileID: 841949203}
itemPrefab: {fileID: 3615028656093890924, guid: 43ebb3ab3b5855c409fdcbb8c5bf7cf8, type: 3}
itemContent: {fileID: 71006698}
unitPrefab: {fileID: 6262298531716698382, guid: b9647f0b07b490c4cae9b18f67e515c3, type: 3}
@ -5520,10 +5533,10 @@ RectTransform:
- {fileID: 1927561720}
m_Father: {fileID: 1704405201}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 541.24994, y: -50}
m_SizeDelta: {x: 137.49998, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &688769572
MonoBehaviour:
@ -7797,10 +7810,10 @@ RectTransform:
- {fileID: 123309700}
m_Father: {fileID: 1704405201}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 83.74999, y: -50}
m_SizeDelta: {x: 137.49998, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &938232308
MonoBehaviour:
@ -9468,38 +9481,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1412458708}
m_CullTransparentMesh: 1
--- !u!1 &1412594693
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1412594694}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1412594694
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1412594693}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.82, y: -4.72, z: 0}
m_LocalScale: {x: 5, y: 5, z: 5}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1461490336}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1413790505
GameObject:
m_ObjectHideFlags: 0
@ -10002,84 +9983,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1448222619}
m_CullTransparentMesh: 1
--- !u!1001 &1461490335
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1412594694}
m_Modifications:
- target: {fileID: 1148537335103272, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_Name
value: Champion MonkPanda (1)
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalScale.x
value: 0.001
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalScale.y
value: 0.001
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalScale.z
value: 0.001
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
--- !u!4 &1461490336 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4432944664231488, guid: cacd54f1e0aca294a9883e39051012c0, type: 3}
m_PrefabInstance: {fileID: 1461490335}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1505892100
GameObject:
m_ObjectHideFlags: 0
@ -12024,7 +11927,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1818855957
RectTransform:
m_ObjectHideFlags: 0
@ -12406,7 +12309,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0.00015598314}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 20}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1872095652
MonoBehaviour:
@ -13755,10 +13658,10 @@ RectTransform:
- {fileID: 661024661}
m_Father: {fileID: 1704405201}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 388.74997, y: -50}
m_SizeDelta: {x: 137.49998, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2002614648
MonoBehaviour:
@ -14584,5 +14487,4 @@ SceneRoots:
- {fileID: 54711397}
- {fileID: 131930850}
- {fileID: 948626530}
- {fileID: 1412594694}
- {fileID: 786105030}

View File

@ -13,7 +13,7 @@ public class ItemPrefab : MonoBehaviour
public void SetData(Equipment equipment)
{
this.equipment = equipment;
equipmentData = Statics.excelDatas.equipmentData[equipment.equip_unit];
equipmentData = Statics.excelDatas.equipmentData[equipment.equipment_data_id];
image.sprite = Statics.stringIcons[equipmentData.name];
}
}

View File

@ -125,6 +125,10 @@ public class MainCtrl : MonoBehaviour
{
Statics.deckUnit.Add(item.id, item);
}
foreach(var item in data.dynamic_data)
{
Statics.dynamic.Add(item.name, item.value);
}
Statics.deck_info = data.deck_info;
Statics.equipment = data.equipment;
GameManager.Instance.NextScene(GameManager.eScene.Game);

View File

@ -59,6 +59,7 @@ public class LoginResp : Request<LoginResp>
private Protocol protocol = Protocol.Login;
public string uuid { get; set; }
public string nickname { get; set; }
public List<DynamicData> dynamic_data { get; set; }
public List<DeckUnitInfo> deck_unit { get; set; }
public List<DeckInfo> deck_info { get; set; }
public List<Equipment> equipment { get; set; }
@ -69,11 +70,26 @@ public class LoginResp : Request<LoginResp>
}
}
public class DynamicData
{
public int id { get; set; }
public string name { get; set; }
public string value { get; set; }
}
public class DeckUnitInfo
{
public int id { get; set; }
public int unit_id { get; set; }
public int user_id { get; set; }
public int equip0 { get; set; }
public int equip1 { get; set; }
public int equip2 { get; set; }
public int equip3 { get; set; }
public int equip4 { get; set; }
public int equip5 { get; set; }
public int level { get; set; }
public int exp { get; set; }
}
public class Equipment
@ -82,6 +98,7 @@ public class Equipment
public int unit_id { get; set; }
public int equip_unit { get; set; }
public int rand_stats { get; set; }
public int equipment_data_id { get; set; }
}
public class DeckInfo

View File

@ -1,8 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SelectWindows : SingletonMonoBehaviour<SelectWindows>
{

View File

@ -1,6 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

View File

@ -17,6 +17,7 @@ public class Statics
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
//서버에서 내려주는 데이터들
public static Dictionary<string, string> dynamic = new Dictionary<string, string>();
public static Dictionary<int, DeckUnitInfo> deckUnit = new Dictionary<int, DeckUnitInfo>();
//유저가 세팅한 덱 정보

View File

@ -10,12 +10,19 @@ public class UnitPrefab : MonoBehaviour
UnitData unitData;
GameObject unit;
UnitCtrl unitCtrl;
DeckUnitInfo deckUnitInfo;
public void SetData(DeckUnitInfo deckUnitInfo)
{
this.deckUnitInfo = deckUnitInfo;
unitData = Statics.excelDatas.unitData[deckUnitInfo.unit_id];
unit = Statics.stringUnits[unitData.name];
unitCtrl = unit.GetComponent<UnitCtrl>();
image.sprite = unitCtrl.unitSprite;
}
public void SelectUnit()
{
UnitSetUiCtrl.Instance.StatusSet(unitData, deckUnitInfo);
}
}

View File

@ -1,8 +1,24 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class UnitSetUiCtrl : MonoBehaviour
public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
{
[SerializeField] TMP_Text name;
[SerializeField] TMP_Text attribute;
[SerializeField] TMP_Text hp;
[SerializeField] TMP_Text defense;
[SerializeField] TMP_Text attack;
[SerializeField] TMP_Text defensePenetration;
[SerializeField] TMP_Text attackSpeed;
[SerializeField] TMP_Text moveSpeed;
[SerializeField] TMP_Text critical;
[SerializeField] TMP_Text criticalDamage;
[SerializeField] TMP_Text damageReduction;
[SerializeField] TMP_Text level;
[SerializeField] TMP_Text maxLevel;
[SerializeField] GameObject itemPrefab;
[SerializeField] Transform itemContent;
[SerializeField] GameObject unitPrefab;
@ -20,8 +36,9 @@ public class UnitSetUiCtrl : MonoBehaviour
List<ItemPrefab> onItemPrefabList;
List<UnitPrefab> onUnitPrefabList;
private void Awake()
protected override void OnAwake()
{
maxLevel.text = Statics.dynamic["maxLevel"];
onItemPrefabList = new List<ItemPrefab>();
onUnitPrefabList = new List<UnitPrefab>();
itemPrefabList = new GameObjectPool<ItemPrefab>(5, () =>
@ -46,6 +63,9 @@ public class UnitSetUiCtrl : MonoBehaviour
onItemPrefabList.Clear();
foreach (var item in Statics.equipment)
{
//ÀåÂøµÈ ¾ÆÀÌÅÛ ½ºÅµ
if (item.equip_unit != 0)
continue;
ItemPrefab prefab = itemPrefabList.pop();
prefab.SetData(item);
prefab.gameObject.SetActive(true);
@ -59,6 +79,7 @@ public class UnitSetUiCtrl : MonoBehaviour
prefab.gameObject.SetActive(true);
onUnitPrefabList.Add(prefab);
}
onUnitPrefabList[0].SelectUnit();
}
private void OnDisable()
@ -103,4 +124,20 @@ public class UnitSetUiCtrl : MonoBehaviour
objEquipment.SetActive(false);
objDeck.SetActive(false);
}
public void StatusSet(UnitData unitData, DeckUnitInfo deckUnitInfo)
{
level.text = deckUnitInfo.level.ToString();
name.text = unitData.name;
attribute.text = "None";
hp.text = (unitData.hp).ToString();
defense.text = (unitData.defense).ToString();
attack.text = (unitData.attack).ToString();
defensePenetration.text = "0%";
attackSpeed.text = (unitData.attack_speed).ToString();
moveSpeed.text = (unitData.move_speed).ToString();
critical.text = "0%";
criticalDamage.text = "50%";
damageReduction.text = "0%";
}
}

View File

@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 203990141783548481}
- component: {fileID: 4685290738526370478}
- component: {fileID: 7437585731462741064}
- component: {fileID: 2015982223014234570}
m_Layer: 5
m_Name: Unit
m_TagString: Untagged
@ -90,6 +91,62 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
image: {fileID: 408122529383440926}
--- !u!114 &2015982223014234570
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6262298531716698382}
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: 0
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: 4685290738526370478}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 7437585731462741064}
m_TargetAssemblyTypeName: UnitPrefab, Assembly-CSharp
m_MethodName: SelectUnit
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
--- !u!1 &8937056069279271503
GameObject:
m_ObjectHideFlags: 0