재화 소모작업 수정

This commit is contained in:
김판돌 2024-02-24 16:51:58 +09:00
parent e2106dd216
commit 7b5ff4e647
5 changed files with 100 additions and 25 deletions

View File

@ -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:

View File

@ -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<DeckUnitInfo> units = data.deck_unit;
List<DeckUnitInfo> 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

View File

@ -17,6 +17,7 @@ public enum Protocol
Login = 101,//À¯Àú ·Î±×ÀÎ
EquipChange = 200,//Àåºñ º¯°æ
DeckChange = 201,//Àåºñ º¯°æ
}
#region 100 : Downlode
@ -61,6 +62,8 @@ public class LoginResp : Request<LoginResp>
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<DynamicData> dynamic_data { get; set; }
public List<DeckUnitInfo> deck_unit { get; set; }
public List<DeckInfo> 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<EquipChangeResp>
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<DeckChangeResp>
{
private Protocol protocol = Protocol.DeckChange;
public DeckInfo deck_info { get; set; }
public void Request(Action<DeckChangeResp> onRequestFinished, long deck_id, long[] deck_unit)
{
CreateRequest(protocol, onRequestFinished, new DeckChangeReq(deck_id, deck_unit), HTTPMethods.Post, null);
}
}
#endregion

View File

@ -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<string, string> dynamic = new Dictionary<string, string>();
public static Dictionary<long, DeckUnitInfo> deckUnit = new Dictionary<long, DeckUnitInfo>();
//유저 기본 정보
public static string nickname;
public static ulong gold;
public static ulong cash;
//유저가 세팅한 덱 정보
public static List<DeckInfo> deck_info;

View File

@ -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<UnitSetUiCtrl>
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()
{