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,//´Ð³×ÀÓ º¯°æ } #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 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; } public List equipment { 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 long unit_id { get; set; } public long equipment_id { get; set; } public bool is_equipment { get; set; } public EquipChangeReq(long unit_id, long 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, long unit_id, long 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 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 #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 ulong cash { get; set; } public void Request(Action onRequestFinished, string newNickname) { CreateRequest(protocol, onRequestFinished, new NicknameChangeReq(newNickname), 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 long id { get; set; } public long unit_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 long exp { get; set; } } public class Equipment { public long id { get; set; } public long equip_unit { get; set; } public int rand_stats { get; set; } public long equipment_data_id { get; set; } } public class DeckInfo { public long id { get; set; } public int deck_type { 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; } 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; } }