public ReqVersusStart(VERSUS_TYPE type) { this.name = "vs/start"; this.body = string.Empty; this.body = this.body + "\"type\":\"" + type.ToString().ToLower() + "\""; this.body = WebAPI.GetRequestString(this.body); }
public ReqVersusMake(VERSUS_TYPE type, string comment, string iname, bool isLine = false) { this.name = "vs/" + type.ToString().ToLower() + "match/make"; this.body = string.Empty; this.body = this.body + "\"comment\":\"" + JsonEscape.Escape(comment) + "\","; this.body = this.body + "\"iname\":\"" + JsonEscape.Escape(iname) + "\","; this.body = this.body + "\"Line\":" + ((!isLine) ? 0 : 1); this.body = WebAPI.GetRequestString(this.body); }
public ReqVersusStart(VERSUS_TYPE type, Network.ResponseCallback response) { this.name = "vs/start"; this.body = string.Empty; ReqVersusStart reqVersusStart = this; reqVersusStart.body = reqVersusStart.body + "\"type\":\"" + type.ToString().ToLower() + "\""; this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public ReqVersusMake(VERSUS_TYPE type, string comment, string iname, bool isLine = false, Network.ResponseCallback response = null) { this.name = "vs/" + type.ToString().ToLower() + "match/make"; this.body = string.Empty; ReqVersusMake reqVersusMake1 = this; reqVersusMake1.body = reqVersusMake1.body + "\"comment\":\"" + JsonEscape.Escape(comment) + "\","; ReqVersusMake reqVersusMake2 = this; reqVersusMake2.body = reqVersusMake2.body + "\"iname\":\"" + JsonEscape.Escape(iname) + "\","; ReqVersusMake reqVersusMake3 = this; reqVersusMake3.body = reqVersusMake3.body + "\"Line\":" + (object)(!isLine ? 0 : 1); this.body = WebAPI.GetRequestString(this.body); this.callback = response; }
public ReqVersus(string iname, int plid, int seat, string uid, VERSUS_TYPE type) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "vs/" + type.ToString().ToLower() + "match/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append("QE_VS_TEST_00"); stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\""); this.body = WebAPI.GetRequestString(stringBuilder.ToString()); }
public bool Deserialize(JSON_VersusEnableTimeParam json) { if (json == null) { return(false); } this.mScheduleId = json.id; this.mVersusType = (VERSUS_TYPE)json.mode; try { if (!string.IsNullOrEmpty(json.begin_at)) { this.mBeginAt = DateTime.Parse(json.begin_at); } if (!string.IsNullOrEmpty(json.end_at)) { this.mEndAt = DateTime.Parse(json.end_at); } } catch (Exception ex) { DebugUtility.LogError(ex.Message); return(false); } this.mSchedule = new List <VersusEnableTimeScheduleParam>(); for (int index = 0; index < json.schedule.Length; ++index) { VersusEnableTimeScheduleParam timeScheduleParam = new VersusEnableTimeScheduleParam(); if (timeScheduleParam.Deserialize(json.schedule[index])) { this.mSchedule.Add(timeScheduleParam); } } this.mDraftType = (VersusDraftType)json.draft_type; return(true); }
public ReqVersusEnd(long btlid, BtlResultTypes result, string uid, string fuid, uint turn, int[] myhp, int[] enhp, int atk, int dmg, int heal, int beat, Network.ResponseCallback response, VERSUS_TYPE type, string trophyprog = null, string bingoprog = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("vs/"); stringBuilder.Append(type.ToString().ToLower()); stringBuilder.Append("match/end"); this.name = stringBuilder.ToString(); stringBuilder.Length = 0; stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; case BtlResultTypes.Draw: stringBuilder.Append("draw"); break; } stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"turn\":\""); stringBuilder.Append(turn); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"atk\":\""); stringBuilder.Append(atk); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"dmg\":\""); stringBuilder.Append(dmg); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"heal\":\""); stringBuilder.Append(heal); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"beatcnt\":"); stringBuilder.Append(beat); if (myhp != null) { stringBuilder.Append(','); stringBuilder.Append("\"myhp\":["); for (int index = 0; index < myhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(myhp[index].ToString()); } stringBuilder.Append("]"); } if (enhp != null) { stringBuilder.Append(','); stringBuilder.Append("\"enhp\":["); for (int index = 0; index < enhp.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(enhp[index].ToString()); } stringBuilder.Append("]"); } if ((int)stringBuilder[stringBuilder.Length - 1] == 44) { --stringBuilder.Length; } stringBuilder.Append("},"); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\","); stringBuilder.Append("\"fuid\":\""); stringBuilder.Append(fuid); stringBuilder.Append("\""); if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqVersusEnd(long btlid, int time, BtlResultTypes result, int[] beats, string uid, string fuid, Network.ResponseCallback response, VERSUS_TYPE type, string trophyprog = null, string bingoprog = null, string maxdata = null) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); stringBuilder.Append("vs/"); stringBuilder.Append(type.ToString().ToLower()); stringBuilder.Append("match/end"); this.name = stringBuilder.ToString(); stringBuilder.Length = 0; stringBuilder.Append("\"btlid\":"); stringBuilder.Append(btlid); stringBuilder.Append(','); stringBuilder.Append("\"btlendparam\":{"); stringBuilder.Append("\"time\":"); stringBuilder.Append(time); stringBuilder.Append(','); stringBuilder.Append("\"result\":\""); switch (result) { case BtlResultTypes.Win: stringBuilder.Append("win"); break; case BtlResultTypes.Lose: stringBuilder.Append("lose"); break; case BtlResultTypes.Retire: stringBuilder.Append("retire"); break; case BtlResultTypes.Cancel: stringBuilder.Append("cancel"); break; case BtlResultTypes.Draw: stringBuilder.Append("draw"); break; } if (result == BtlResultTypes.Win && beats == null) { beats = new int[0]; } stringBuilder.Append("\","); if (beats != null) { stringBuilder.Append("\"beats\":["); for (int index = 0; index < beats.Length; ++index) { if (index > 0) { stringBuilder.Append(','); } stringBuilder.Append(beats[index].ToString()); } stringBuilder.Append("],"); } stringBuilder.Append("\"steals\":["); stringBuilder.Append("],"); stringBuilder.Append("\"missions\":["); stringBuilder.Append("],"); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); if ((int)stringBuilder[stringBuilder.Length - 1] == 44) { --stringBuilder.Length; } stringBuilder.Append("},"); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\","); stringBuilder.Append("\"fuid\":\""); stringBuilder.Append(fuid); stringBuilder.Append("\""); if (!string.IsNullOrEmpty(trophyprog)) { stringBuilder.Append(","); stringBuilder.Append(trophyprog); } if (!string.IsNullOrEmpty(bingoprog)) { stringBuilder.Append(","); stringBuilder.Append(bingoprog); } if (!string.IsNullOrEmpty(maxdata)) { stringBuilder.Append(","); stringBuilder.Append(maxdata); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }
public ReqVersus(string iname, int plid, int seat, string uid, VersusStatusData param, int num, Network.ResponseCallback response, VERSUS_TYPE type, int draft_id = 0, int enemy_draft_id = 0) { StringBuilder stringBuilder = WebAPI.GetStringBuilder(); this.name = "vs/" + type.ToString().ToLower() + "match/req"; stringBuilder.Append("\"iname\":\""); stringBuilder.Append(JsonEscape.Escape(iname)); stringBuilder.Append("\","); stringBuilder.Append("\"token\":\""); stringBuilder.Append(JsonEscape.Escape(GlobalVars.SelectedMultiPlayRoomName)); stringBuilder.Append("\","); stringBuilder.Append("\"plid\":\""); stringBuilder.Append(plid); stringBuilder.Append("\","); stringBuilder.Append("\"seat\":\""); stringBuilder.Append(seat); stringBuilder.Append("\","); stringBuilder.Append("\"uid\":\""); stringBuilder.Append(uid); stringBuilder.Append("\""); stringBuilder.Append(","); stringBuilder.Append("\"status\":{"); stringBuilder.Append("\"hp\":" + (object)param.Hp + ","); stringBuilder.Append("\"atk\":" + (object)param.Atk + ","); stringBuilder.Append("\"def\":" + (object)param.Def + ","); stringBuilder.Append("\"matk\":" + (object)param.Matk + ","); stringBuilder.Append("\"mdef\":" + (object)param.Mdef + ","); stringBuilder.Append("\"dex\":" + (object)param.Dex + ","); stringBuilder.Append("\"spd\":" + (object)param.Spd + ","); stringBuilder.Append("\"cri\":" + (object)param.Cri + ","); stringBuilder.Append("\"luck\":" + (object)param.Luck + ","); stringBuilder.Append("\"cmb\":" + (object)param.Cmb + ","); stringBuilder.Append("\"move\":" + (object)param.Move + ","); stringBuilder.Append("\"jmp\":" + (object)param.Jmp); stringBuilder.Append("}"); stringBuilder.Append(",\"member_count\":" + (object)num); if (draft_id > 0) { stringBuilder.Append(",\"draft_id\":" + (object)draft_id); stringBuilder.Append(",\"enemy_draft_id\":" + (object)enemy_draft_id); } this.body = WebAPI.GetRequestString(stringBuilder.ToString()); this.callback = response; }