장비 장착 시스템 작업 완료

This commit is contained in:
김판돌 2023-12-16 17:26:20 +09:00
parent 54e72eb24b
commit 1120439b4e
7971 changed files with 3430 additions and 1311320 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ public class ItemPrefab : MonoBehaviour
private Equipment equipment;
private EquipmentData equipmentData;
public long getId { get { return equipment.id; } }
public void SetData(Equipment equipment)
{
@ -16,4 +17,11 @@ public class ItemPrefab : MonoBehaviour
equipmentData = Statics.excelDatas.equipmentData[equipment.equipment_data_id];
image.sprite = Statics.stringIcons[equipmentData.name];
}
public void SelectItem()
{
UnitSetUiCtrl.Instance.ItemSet(this, equipment, equipmentData);
}
}

View File

@ -120,6 +120,7 @@ public class MainCtrl : MonoBehaviour
if(data.status.Equals(200))
{
PlayerPrefs.SetString("uuid", data.uuid);
Statics.uuid = data.uuid;
List<DeckUnitInfo> units = data.deck_unit;
foreach (DeckUnitInfo item in units)
{

View File

@ -20,9 +20,9 @@ public class EquipmentData : Excel
public enum ePart
{
Weapon = 0, //公扁
Armor, //방어구
Shoes, //신발
Earrings, //귀걸이
Bracelet, //팔찌
Armor, //갑옷
Gloves, //장갑
Headpiece, //투구
Shield, //방패
Ring //馆瘤
}

View File

@ -15,6 +15,8 @@ public enum Protocol
Downlode = 100,//기획 데이터 다운로드
Login = 101,//유저 로그인
EquipChange = 200,//Àåºñ º¯°æ
}
#region 100 : Downlode
@ -79,42 +81,70 @@ public class DynamicData
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 long id { get; set; }
public long unit_id { get; set; }
public long user_id { get; set; }
public long equip0_id { get; set; }
public long equip1_id { get; set; }
public long equip2_id { get; set; }
public long equip3_id { get; set; }
public long equip4_id { get; set; }
public long equip5_id { get; set; }
public int level { get; set; }
public int exp { get; set; }
public long exp { get; set; }
}
public class Equipment
{
public int id { get; set; }
public int unit_id { get; set; }
public int equip_unit { get; set; }
public long id { get; set; }
public long unit_id { get; set; }
public long equip_unit { get; set; }
public int rand_stats { get; set; }
public int equipment_data_id { get; set; }
public long equipment_data_id { get; set; }
}
public class DeckInfo
{
public int id { get; set; }
public int user_id { get; set; }
public long id { get; set; }
public long user_id { get; set; }
public int deck_type { get; set; }
public int deck_unit0_id { get; set; }
public int deck_unit1_id { get; set; }
public int deck_unit2_id { get; set; }
public int deck_unit3_id { get; set; }
public int deck_unit4_id { get; set; }
public int deck_unit5_id { get; set; }
public int deck_unit6_id { get; set; }
public int deck_unit7_id { get; set; }
public int deck_unit8_id { get; set; }
public long deck_unit0_id { get; set; }
public long deck_unit1_id { get; set; }
public long deck_unit2_id { get; set; }
public long deck_unit3_id { get; set; }
public long deck_unit4_id { get; set; }
public long deck_unit5_id { get; set; }
public long deck_unit6_id { get; set; }
public long deck_unit7_id { get; set; }
public long deck_unit8_id { get; set; }
}
#endregion
#region 200 : EquipChange
public class EquipChangeReq
{
public string uuid { get; set; }
public long unit_id { get; set; }
public long equipment_id { get; set; }
public EquipChangeReq(long unit_id, long equipment_id)
{
this.uuid = Statics.uuid;
this.unit_id = unit_id;
this.equipment_id = equipment_id;
}
}
public class EquipChangeResp : Request<EquipChangeResp>
{
private Protocol protocol = Protocol.EquipChange;
public Equipment equipment { get; set; }
public DeckUnitInfo deck_unit_info { get; set; }
public void Request(Action<EquipChangeResp> onRequestFinished, long unit_id, long equipment_id)
{
CreateRequest(protocol, onRequestFinished, new EquipChangeReq(unit_id, equipment_id), HTTPMethods.Post, null);
}
}
#endregion

View File

@ -12,13 +12,14 @@ public class Statics
public static ExcelDatas excelDatas;
public static Dictionary <string, GameObject> stringUnits = new Dictionary<string,GameObject>();
public static Dictionary <int, GameObject> intUnits = new Dictionary<int,GameObject>();
public static Dictionary <long, GameObject> intUnits = new Dictionary<long, GameObject>();
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
//서버에서 내려주는 데이터들
public static string uuid;
public static Dictionary<string, string> dynamic = new Dictionary<string, string>();
public static Dictionary<int, DeckUnitInfo> deckUnit = new Dictionary<int, DeckUnitInfo>();
public static Dictionary<long, DeckUnitInfo> deckUnit = new Dictionary<long, DeckUnitInfo>();
//유저가 세팅한 덱 정보
public static List<DeckInfo> deck_info;

View File

@ -23,6 +23,6 @@ public class UnitPrefab : MonoBehaviour
public void SelectUnit()
{
UnitSetUiCtrl.Instance.StatusSet(unitData, deckUnitInfo);
UnitSetUiCtrl.Instance.StatusSet(this, unitData, deckUnitInfo, unitCtrl);
}
}

View File

@ -1,9 +1,12 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using static UnityEditor.Progress;
public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
{
//스텟 정보 ui
[SerializeField] TMP_Text name;
[SerializeField] TMP_Text attribute;
[SerializeField] TMP_Text hp;
@ -19,23 +22,50 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
[SerializeField] TMP_Text level;
[SerializeField] TMP_Text maxLevel;
//유닛 프리펩및 위치
[SerializeField] GameObject itemPrefab;
[SerializeField] Transform itemContent;
[SerializeField] GameObject unitPrefab;
[SerializeField] Transform unitContent;
//각종 세팅 ui
[SerializeField] GameObject objInfo;
[SerializeField] GameObject objItemView;
[SerializeField] GameObject objEquipment;
[SerializeField] GameObject objDeck;
//케릭터 카메라
[SerializeField] Transform CamContent;
[SerializeField] GameObject UnitObject;
//아이템 정보
[SerializeField] GameObject itemInfo;
[SerializeField] Image itemImage;
[SerializeField] TMP_Text itemName;
[SerializeField] GameObject status0;
[SerializeField] TMP_Text status0Status;
[SerializeField] TMP_Text status0Value;
[SerializeField] GameObject status1;
[SerializeField] TMP_Text status1Status;
[SerializeField] TMP_Text status1Value;
[SerializeField] GameObject status2;
[SerializeField] TMP_Text status2Status;
[SerializeField] TMP_Text status2Value;
[SerializeField] GameObject status3;
[SerializeField] TMP_Text status3Status;
[SerializeField] TMP_Text status3Value;
GameObjectPool<ItemPrefab> itemPrefabList;
GameObjectPool<UnitPrefab> unitPrefabList;
List<ItemPrefab> onItemPrefabList;
List<UnitPrefab> onUnitPrefabList;
Equipment selectItem;
ItemPrefab selectItemPrefab;
DeckUnitInfo selectUnit;
UnitPrefab selectUnitPrefab;
protected override void OnAwake()
{
maxLevel.text = Statics.dynamic["maxLevel"];
@ -102,6 +132,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
objItemView.SetActive(false);
objEquipment.SetActive(false);
objDeck.SetActive(false);
itemInfo.SetActive(false);
}
public void ButtonEquipment()
{
@ -109,6 +140,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
objItemView.SetActive(true);
objEquipment.SetActive(true);
objDeck.SetActive(false);
itemInfo.SetActive(false);
}
public void ButtonDeck()
{
@ -116,6 +148,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
objItemView.SetActive(false);
objEquipment.SetActive(false);
objDeck.SetActive(true);
itemInfo.SetActive(false);
}
public void ButtoncHaracteristic()
{
@ -123,10 +156,13 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
objItemView.SetActive(false);
objEquipment.SetActive(false);
objDeck.SetActive(false);
itemInfo.SetActive(false);
}
public void StatusSet(UnitData unitData, DeckUnitInfo deckUnitInfo)
public void StatusSet(UnitPrefab unitPrefab, UnitData unitData, DeckUnitInfo deckUnitInfo, UnitCtrl unitCtrl)
{
this.selectUnitPrefab = unitPrefab;
this.selectUnit = deckUnitInfo;
level.text = deckUnitInfo.level.ToString();
name.text = unitData.name;
attribute.text = "None";
@ -139,5 +175,172 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
critical.text = "0%";
criticalDamage.text = "50%";
damageReduction.text = "0%";
//카메라 유닛 생성
if(UnitObject != null)
Destroy(UnitObject);
UnitObject = Instantiate(unitCtrl.gameObject, CamContent);
UnitObject.GetComponent<UnitCtrl>().enabled = false;
}
public void ItemSet(ItemPrefab itemPrefab, Equipment equipment, EquipmentData equipmentData)
{
this.selectItemPrefab = itemPrefab;
this.selectItem = equipment;
itemInfo.SetActive(true);
itemImage.sprite = Statics.stringIcons[equipmentData.name];
itemName.text = equipmentData.name;
status0.SetActive(true);
status0Status.text = StatusText(equipmentData.part, equipment.rand_stats);
status0Value.text = ValueText(equipmentData, equipment.rand_stats);
status1.SetActive(false);
status2.SetActive(false);
status3.SetActive(false);
}
private string StatusText(ePart part, int randStats)
{
switch (part)
{
case ePart.Weapon: //무기
switch (randStats)
{
case 0:
return "공격력";
case 1:
return "방어 관통력";
case 2:
return "치명타 대미지";
default:
return "";
}
case ePart.Armor: //갑옷
switch (randStats)
{
case 0:
return "방어력";
case 1:
return "체력";
case 2:
return "대미지 감소";
default:
return "";
}
case ePart.Gloves: //장갑
switch (randStats)
{
case 0:
return "이동속도";
case 1:
return "공격속도";
case 2:
return "공격력";
default:
return "";
}
case ePart.Headpiece: //투구
switch (randStats)
{
case 0:
return "공격력";
case 1:
return "방어관통력";
case 2:
return "체력";
default:
return "";
}
case ePart.Shield: //보조장비
switch (randStats)
{
case 0:
return "방어력";
case 1:
return "대미지감소";
case 2:
return "체력";
default:
return "";
}
case ePart.Ring: //반지
switch (randStats)
{
case 0:
return "치명타확률";
case 1:
return "이동속도";
case 2:
return "공격속도";
default:
return "";
}
default:
return "";
}
}
private string ValueText(EquipmentData equipmentData, int randStats)
{
switch (randStats)
{
case 1:
return equipmentData.stats1.ToString();
case 2:
return equipmentData.stats2.ToString();
case 3:
return equipmentData.stats3.ToString();
//case 4:
// return equipmentData.stats4.ToString();
default:
return "0";
}
}
public void equipItem()
{
itemInfo.SetActive(false);
EquipChangeResp request = new EquipChangeResp();
request.Request((data) =>
{
//신규 정보로 데이터 교체
for(int n = 0; n < Statics.equipment.Count; n++)
{
if (Statics.equipment[n].id == data.equipment.id)
{
Statics.equipment[n] = data.equipment;
break;
}
}
Statics.deckUnit.Remove(data.deck_unit_info.id);
Statics.deckUnit.Add(data.deck_unit_info.id, data.deck_unit_info);
//세팅되어있는 데이터 수정
selectUnitPrefab.SetData(data.deck_unit_info);
if(data.equipment.unit_id != 0)
{
//생성
ItemPrefab prefab = itemPrefabList.pop();
prefab.SetData(data.equipment);
prefab.gameObject.SetActive(true);
onItemPrefabList.Add(prefab);
}
else
{
//삭제
for(int n = 0; n < onItemPrefabList.Count; n++)
{
if (onItemPrefabList[n].getId == data.equipment.id)
{
onItemPrefabList[n].gameObject.SetActive(false);
itemPrefabList.push(onItemPrefabList[n]);
onItemPrefabList.RemoveAt(n);
break;
}
}
}
}, selectUnit.id, selectItem.id);
}
}

View File

@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 4500346798473581018}
- component: {fileID: 4889204206815743372}
- component: {fileID: 4527511323705376602}
- component: {fileID: 6185815176258306364}
m_Layer: 5
m_Name: Item
m_TagString: Untagged
@ -90,6 +91,62 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
image: {fileID: 5892357763898247590}
--- !u!114 &6185815176258306364
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3615028656093890924}
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: 4889204206815743372}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 4527511323705376602}
m_TargetAssemblyTypeName: ItemPrefab, Assembly-CSharp
m_MethodName: SelectItem
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 &8105354903029470659
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

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