150 lines
3.7 KiB
C#
150 lines
3.7 KiB
C#
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,//장비 변경
|
|
}
|
|
|
|
#region 100 : Downlode
|
|
public class DownlodeReq
|
|
{
|
|
public string version { get; set; }
|
|
|
|
public DownlodeReq()
|
|
{
|
|
version = Statics.version;
|
|
}
|
|
}
|
|
|
|
public class DownlodeResp : Request<DownlodeResp>
|
|
{
|
|
private Protocol protocol = Protocol.Downlode;
|
|
public string data { get; set; }
|
|
public string version { get; set; }
|
|
|
|
public void Request(Action<DownlodeResp> 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<LoginResp>
|
|
{
|
|
private Protocol protocol = Protocol.Login;
|
|
public string uuid { get; set; }
|
|
public string nickname { get; set; }
|
|
public List<DynamicData> dynamic_data { get; set; }
|
|
public List<DeckUnitInfo> deck_unit { get; set; }
|
|
public List<DeckInfo> deck_info { get; set; }
|
|
public List<Equipment> equipment { get; set; }
|
|
|
|
public void Request(LoginReq loginReq, Action<LoginResp> onRequestFinished, Action errorRequestFinished)
|
|
{
|
|
CreateRequest(protocol, onRequestFinished, loginReq, HTTPMethods.Post, errorRequestFinished);
|
|
}
|
|
}
|
|
|
|
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 user_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 unit_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 long user_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; }
|
|
|
|
}
|
|
#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 EquipChangeReq(long unit_id, long equipment_id)
|
|
{
|
|
this.uuid = Statics.uuid;
|
|
this.unit_id = unit_id;
|
|
this.equipment_id = equipment_id;
|
|
}
|
|
}
|
|
|
|
public class EquipChangeResp : Request<EquipChangeResp>
|
|
{
|
|
private Protocol protocol = Protocol.EquipChange;
|
|
public Equipment equipment { get; set; }
|
|
public DeckUnitInfo deck_unit_info { get; set; }
|
|
|
|
public void Request(Action<EquipChangeResp> onRequestFinished, long unit_id, long equipment_id)
|
|
{
|
|
CreateRequest(protocol, onRequestFinished, new EquipChangeReq(unit_id, equipment_id), HTTPMethods.Post, null);
|
|
}
|
|
}
|
|
#endregion |