From 8cf05ebad8b03ddc4b2a3952e768d3f01722cf51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Sat, 9 Mar 2024 19:42:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9C=A0=EB=8B=9B=20=EB=A0=88=EB=B2=A8=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=EC=8B=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/1_Script/System/Http/Protocol.cs | 24 +++++++++++-- Client/Assets/1_Script/System/ItemManager.cs | 36 ++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Client/Assets/1_Script/System/Http/Protocol.cs b/Client/Assets/1_Script/System/Http/Protocol.cs index 93c68b08..ddca45dc 100644 --- a/Client/Assets/1_Script/System/Http/Protocol.cs +++ b/Client/Assets/1_Script/System/Http/Protocol.cs @@ -215,10 +215,18 @@ public class DeckUnitInfo public long equip3_id { get; set; } public long equip4_id { get; set; } public long equip5_id { get; set; } + [JsonIgnore] public int level { get; set; } + [JsonIgnore] + public long saveExp { get; set; } public long exp { get; set; } + [JsonIgnore] + public int rating { get; set; } + [JsonIgnore] + public long saveCount { get; set; } + public long count { get; set; } - public void Update(DeckUnitInfo item) + public DeckUnitInfo Update(DeckUnitInfo item) { this.equip0_id = item.equip0_id; this.equip1_id = item.equip1_id; @@ -226,8 +234,20 @@ public class DeckUnitInfo this.equip3_id = item.equip3_id; this.equip4_id = item.equip4_id; this.equip5_id = item.equip5_id; - this.level = item.level; this.exp = item.exp; + this.count = item.count; + return this; + } + public void Update(long exp, int level, long count, int rating) + { + if (exp != 0) + this.saveExp = exp; + if (level != 0) + this.level = level; + if (rating != 0) + this.rating = rating; + if (count != 0) + this.saveCount = count; } } diff --git a/Client/Assets/1_Script/System/ItemManager.cs b/Client/Assets/1_Script/System/ItemManager.cs index 5ce85637..e9952331 100644 --- a/Client/Assets/1_Script/System/ItemManager.cs +++ b/Client/Assets/1_Script/System/ItemManager.cs @@ -23,6 +23,8 @@ public class ItemBox public List etcItem { get { return _etcItem; } } public ItemBox(List deckUnitInfo, List equipment, List consumableItem, List etcItem) { + //¾ÆÀÌÅÛ ¼¼ÆÃ + if (deckUnitInfo == null) _deckUnitInfo = new List(); else @@ -42,6 +44,38 @@ public class ItemBox _etcItem = new List(); else _etcItem = etcItem.OrderBy(n => n.id).ToList(); + + //À¯´Ö °æÇèÄ¡ ¼¼ÆÃ + foreach(DeckUnitInfo item in _deckUnitInfo) + { + UpdateUnitSpec(item); + } + } + + /// + /// À¯´Ö ½ºÆÑ ¾÷µ¥ÀÌÆ® + /// + public void UpdateUnitSpec(DeckUnitInfo unit) + { + long saveExp = unit.exp; + long defaultExp = 1024; + long saveCount = unit.count; + long defaultCount = 4; + int level = 1; + int rating = 0; + while(saveExp > defaultExp) + { + saveExp -= defaultExp; + defaultExp = (long)(1.2f * defaultExp); + level++; + } + while (saveCount > defaultCount) + { + saveCount -= defaultCount; + defaultCount = 2 * defaultCount; + rating++; + } + unit.Update(saveExp, level, saveCount, rating); } /// @@ -94,7 +128,7 @@ public class ItemBox /// public void UpdateDeckUnitInfo(DeckUnitInfo item) { - FindDeckUnitInfo(item.id).Update(item); + UpdateUnitSpec(FindDeckUnitInfo(item.id).Update(item)); } ///