103 lines
2.4 KiB
C#
103 lines
2.4 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,//유저 로그인
|
|
}
|
|
|
|
#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<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 DeckUnitInfo
|
|
{
|
|
public int id { get; set; }
|
|
public int unit_id { get; set; }
|
|
public int user_id { get; set; }
|
|
}
|
|
|
|
public class Equipment
|
|
{
|
|
public int id { get; set; }
|
|
public int unit_id { get; set; }
|
|
public int equip_unit { get; set; }
|
|
public int rand_stats { get; set; }
|
|
}
|
|
|
|
public class DeckInfo
|
|
{
|
|
public int id { get; set; }
|
|
public int user_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; }
|
|
|
|
}
|
|
#endregion |