diff --git a/Client/Assets/0_Scenes/Game.unity b/Client/Assets/0_Scenes/Game.unity index 3251dada..5b65b4fd 100644 --- a/Client/Assets/0_Scenes/Game.unity +++ b/Client/Assets/0_Scenes/Game.unity @@ -6169,10 +6169,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: @@ -6940,7 +6940,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 @@ -7956,10 +7956,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: @@ -10737,10 +10737,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: @@ -17289,7 +17289,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: @@ -19094,10 +19094,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: diff --git a/Client/Assets/1_Script/MainCtrl.cs b/Client/Assets/1_Script/MainCtrl.cs index 24f1bae8..ebf1a33f 100644 --- a/Client/Assets/1_Script/MainCtrl.cs +++ b/Client/Assets/1_Script/MainCtrl.cs @@ -1,6 +1,7 @@ using UnityEngine; using TMPro; using System.Collections.Generic; +using System.Linq; public class MainCtrl : MonoBehaviour { @@ -121,17 +122,24 @@ public class MainCtrl : MonoBehaviour { PlayerPrefs.SetString("uuid", data.uuid); Statics.uuid = data.uuid; - List units = data.deck_unit; + List units = data.deck_unit.OrderBy(n => n.unit_id).ToList(); + Statics.deck_info = data.deck_info.OrderBy(n => n.id).ToList(); + Statics.equipment = data.equipment.OrderBy(n => n.equipment_data_id).ToList(); + //À¯´ÖÁ¤º¸ Set foreach (DeckUnitInfo item in units) { Statics.deckUnit.Add(item.id, item); } + //´ÙÀ̳ª¹Í µ¥ÀÌÅÍ Set foreach(var item in data.dynamic_data) { Statics.dynamic.Add(item.name, item.value); } - Statics.deck_info = data.deck_info; - Statics.equipment = data.equipment; + + Statics.nickname = data.nickname; + Statics.gold = data.gold; + Statics.cash = data.cash; + GameManager.Instance.NextScene(GameManager.eScene.Game); } else diff --git a/Client/Assets/1_Script/System/Http/Protocol.cs b/Client/Assets/1_Script/System/Http/Protocol.cs index 83a194e9..fcf051d4 100644 --- a/Client/Assets/1_Script/System/Http/Protocol.cs +++ b/Client/Assets/1_Script/System/Http/Protocol.cs @@ -17,6 +17,7 @@ public enum Protocol Login = 101,//À¯Àú ·Î±×ÀÎ EquipChange = 200,//Àåºñ º¯°æ + DeckChange = 201,//Àåºñ º¯°æ } #region 100 : Downlode @@ -61,6 +62,8 @@ public class LoginResp : Request private Protocol protocol = Protocol.Login; public string uuid { get; set; } public string nickname { get; set; } + public ulong gold { get; set; } + public ulong cash { get; set; } public List dynamic_data { get; set; } public List deck_unit { get; set; } public List deck_info { get; set; } @@ -115,6 +118,21 @@ public class DeckInfo public long deck_unit7_id { get; set; } public long deck_unit8_id { get; set; } + public void newDataSet(DeckInfo newData) + { + this.id = newData.id; + this.deck_type = newData.deck_type; + this.deck_unit0_id = newData.deck_unit0_id; + this.deck_unit1_id = newData.deck_unit1_id; + this.deck_unit2_id = newData.deck_unit2_id; + this.deck_unit3_id = newData.deck_unit3_id; + this.deck_unit4_id = newData.deck_unit4_id; + this.deck_unit5_id = newData.deck_unit5_id; + this.deck_unit6_id = newData.deck_unit6_id; + this.deck_unit7_id = newData.deck_unit7_id; + this.deck_unit8_id = newData.deck_unit8_id; + } + } #endregion @@ -147,4 +165,31 @@ public class EquipChangeResp : Request CreateRequest(protocol, onRequestFinished, new EquipChangeReq(unit_id, equipment_id, is_equipment), HTTPMethods.Post, null); } } +#endregion + +#region 201 : DeckChange +public class DeckChangeReq +{ + public string uuid { get; set; } + public long deck_id { get; set; } + public long[] deck_unit { get; set; } + + public DeckChangeReq(long deck_id, long[] deck_unit) + { + this.uuid = Statics.uuid; + this.deck_id = deck_id; + this.deck_unit = deck_unit; + } +} + +public class DeckChangeResp : Request +{ + private Protocol protocol = Protocol.DeckChange; + public DeckInfo deck_info { get; set; } + + public void Request(Action onRequestFinished, long deck_id, long[] deck_unit) + { + CreateRequest(protocol, onRequestFinished, new DeckChangeReq(deck_id, deck_unit), HTTPMethods.Post, null); + } +} #endregion \ No newline at end of file diff --git a/Client/Assets/1_Script/System/Statics.cs b/Client/Assets/1_Script/System/Statics.cs index eadcb428..f42ad60b 100644 --- a/Client/Assets/1_Script/System/Statics.cs +++ b/Client/Assets/1_Script/System/Statics.cs @@ -5,14 +5,11 @@ using UnityEngine.UI; public class Statics { #if UNITY_EDITOR - //public static readonly string url = "https://127.0.0.1:4860"; - public static readonly string url = "https://game.pandoli365.com"; + public static readonly string url = "https://127.0.0.1:4860"; #else public static readonly string url = "https://game.pandoli365.com"; #endif - - public static string version = ""; public static ExcelDatas excelDatas; @@ -27,6 +24,10 @@ public class Statics public static Dictionary dynamic = new Dictionary(); public static Dictionary deckUnit = new Dictionary(); + //À¯Àú ±âº» Á¤º¸ + public static string nickname; + public static ulong gold; + public static ulong cash; //À¯Àú°¡ ¼¼ÆÃÇÑ µ¦ Á¤º¸ public static List deck_info; diff --git a/Client/Assets/1_Script/UnitSetUiCtrl.cs b/Client/Assets/1_Script/UnitSetUiCtrl.cs index 7213197f..23cd7a0c 100644 --- a/Client/Assets/1_Script/UnitSetUiCtrl.cs +++ b/Client/Assets/1_Script/UnitSetUiCtrl.cs @@ -1,4 +1,8 @@ +using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.GM; +using MEC; +using Newtonsoft.Json; using System.Collections.Generic; +using System.Data; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -555,6 +559,23 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour public void DeckSaveButton() { //³×Æ®¿öÅ© Åë½Å ÇÊ¿ä + DeckChangeResp request = new DeckChangeResp(); + long[] deckUnits = new long[9]; + for(int n = 0; n < DeckPrefabs.Length; n++) + { + deckUnits[n] = DeckPrefabs[n].GetUnitId; + } + request.Request((data) => + { + int n = Statics.deck_info.FindIndex(n => n.id == data.deck_info.id); + if (n == -1) + { + Debug.LogError($"null Data id : {data.deck_info.id}"); + return; + } + Statics.deck_info[n].newDataSet(data.deck_info); + + }, Statics.deck_info[0].id, deckUnits); } public void DeckResetButton() {