using BestHTTP; using Newtonsoft.Json; using System; using System.Collections.Generic; public enum Protocol { //0~100 Àӽà ÇÁ·ÎÅäÄÝ Test = 0, AddUser = 1, Downlode = 100,//±âȹ µ¥ÀÌÅÍ ´Ù¿î·Îµå Login = 101,//À¯Àú ·Î±×ÀÎ EquipChange = 200,//Àåºñ º¯°æ DeckChange = 201,//Àåºñ º¯°æ NicknameChange = 202,//´Ð³×ÀÓ º¯°æ BuyShopItem = 300,//»óÁ¡ ¾ÆÀÌÅÛ ±¸¸Å } #region 100 : Downlode public class DownlodeReq { public string version { get; set; } public DownlodeReq() { version = Statics.version; } } public class DownlodeResp : Request { private Protocol protocol = Protocol.Downlode; public string data { get; set; } public string version { get; set; } public void Request(Action onRequestFinished) { CreateRequest(protocol, onRequestFinished, new DownlodeReq(), HTTPMethods.Post, null); } } #endregion #region 101 : Login public class LoginReq { public string mail { get; set; } public string uuid { get; set; } public LoginReq(string mail, string uuid) { this.mail = mail; this.uuid = uuid; } } public class LoginResp : Request { private Protocol protocol = Protocol.Login; public string uuid { get; set; } public string session { get; set; } public string nickname { get; set; } public uint gold { get; set; } public uint cash { get; set; } public bool new_user { get; set; } public List dynamic_data { get; set; } public List deck_unit { get; set; } public List deck_info { get; set; } public List equipment { get; set; } public List consumable_item { get; set; } public List etc_item { get; set; } public List reset_shop_item { get; set; } public List shop_item { get; set; } public void Request(LoginReq loginReq, Action onRequestFinished, Action errorRequestFinished) { CreateRequest(protocol, onRequestFinished, loginReq, HTTPMethods.Post, errorRequestFinished); } } #endregion #region 200 : EquipChange public class EquipChangeReq { public string uuid { get; set; } public int unit_id { get; set; } public int equipment_id { get; set; } public bool is_equipment { get; set; } public EquipChangeReq(int unit_id, int equipment_id, bool is_equipment) { this.uuid = Statics.uuid; this.unit_id = unit_id; this.equipment_id = equipment_id; this.is_equipment = is_equipment; } } public class EquipChangeResp : Request { private Protocol protocol = Protocol.EquipChange; public Equipment equipment { get; set; } public DeckUnitInfo deck_unit_info { get; set; } public Equipment change_equipment { get; set; } public void Request(Action onRequestFinished, int unit_id, int equipment_id, bool is_equipment) { 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 int deck_id { get; set; } public int[] deck_unit { get; set; } public DeckChangeReq(int deck_id, int[] 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, int deck_id, int[] deck_unit) { CreateRequest(protocol, onRequestFinished, new DeckChangeReq(deck_id, deck_unit), HTTPMethods.Post, null); } } #endregion #region 202 : NicknameChange public class NicknameChangeReq { public string uuid { get; set; } public string newNickname { get; set; } public NicknameChangeReq(string newNickname) { this.uuid = Statics.uuid; this.newNickname = newNickname; } } public class NicknameChangeResp : Request { private Protocol protocol = Protocol.NicknameChange; public string nickname { get; set; } public uint cash { get; set; } public void Request(Action onRequestFinished, string newNickname) { CreateRequest(protocol, onRequestFinished, new NicknameChangeReq(newNickname), HTTPMethods.Post, null); } } #endregion #region 300 : BuyShopItem public class BuyShopItemReq { public string uuid { get; set; } public int shopItemIndex { get; set; } public int reset_id { get; set; } public BuyShopItemReq(int shopItemIndex, int reset_id) { this.uuid = Statics.uuid; this.shopItemIndex = shopItemIndex; this.reset_id = reset_id; } } public class BuyShopItemResp : Request { private Protocol protocol = Protocol.BuyShopItem; public int addGold { get; set; } public int addCash { get; set; } public uint gold { get; set; } public uint cash { get; set; } public List deck_unit { get; set; } public List equipment { get; set; } public List consumableItem { get; set; } public List etcItem { get; set; } public void Request(Action onRequestFinished, int shopItemIndex, int reset_id) { CreateRequest(protocol, onRequestFinished, new BuyShopItemReq(shopItemIndex, reset_id), HTTPMethods.Post, null); } } #endregion 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_data_id { get; set; } public int equip0_id { get; set; } public int equip1_id { get; set; } public int equip2_id { get; set; } public int equip3_id { get; set; } public int equip4_id { get; set; } public int equip5_id { get; set; } [JsonIgnore] public int level { get; set; } [JsonIgnore] public int saveExp { get; set; } public int exp { get; set; } public DeckUnitInfo Update(DeckUnitInfo item) { this.equip0_id = item.equip0_id; this.equip1_id = item.equip1_id; this.equip2_id = item.equip2_id; this.equip3_id = item.equip3_id; this.equip4_id = item.equip4_id; this.equip5_id = item.equip5_id; this.exp = item.exp; return this; } public void Update(int exp, int level) { if (exp != 0) this.saveExp = exp; if (level != 0) this.level = level; } } public class Equipment { public int id { get; set; } public int equip_unit { get; set; } public int rand_stats { get; set; } public int equipment_data_id { get; set; } public void Update(Equipment item) { this.equip_unit = item.equip_unit; //this.rand_stats = item.rand_stats; } } public class DeckInfo { public int 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 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; } } public class ConsumableItem { public int id { get; set; } public int consumable_item_data_id { get; set; } public int count { get; set; } } public class EtcItem { public int id { get; set; } public int etc_item_data_id { get; set; } public int count { get; set; } } public class ResetShopItem { public int id { get; set; } public int reset_shop_item_data_id { get; set; } public string name { get; set; } public int shop_index { get; set; } public eBuyType buy_type { get; set; } public int buy { get; set; } public int reward { get; set; } public int buy_count { get; set; } public int count { get; set; } public DateTime end_date { get; set; } } public class ShopItem { public int id { get; set; } public int shop_item_data_id { get; set; } public DateTime end_date { get; set; } }