FightProxy.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using Newtonsoft.Json.Linq;
  5. using static global::LinqExt;
  6. /// <summary>
  7. /// 战斗模块
  8. /// </summary>
  9. public class FightProxy : ProxyBase<FightProxy>
  10. {
  11. #region 构造函数
  12. public FightProxy() => this.opeCode = OpeCode.ope_fight;
  13. #endregion
  14. #region ' 680x '
  15. /// <summary>
  16. /// 【6800】关卡挑战预先计算下奖励字符串
  17. /// </summary>
  18. /// <param name="domainId">区域Id</param>
  19. /// <param name="gateId"></param>
  20. /// <param name="difficulty"></param>
  21. /// <param name="callback">奖励字符串 id,num;id,num</param>
  22. public void ArenasPreFight(int domainId, int gateId, int difficulty, Action<string> callback = null)
  23. {
  24. Post(CmdCode.cmd_fight_ArenasPreFight, new object[] { gateId, difficulty }, resp =>
  25. {
  26. var rewardstr = resp.result["r"].ToString();
  27. DropManager.Instance.DropStr = rewardstr;
  28. callback?.Invoke(rewardstr);
  29. });
  30. }
  31. /// <summary>
  32. /// [6801] 挑战关卡
  33. /// </summary>
  34. /// <param name="uid">玩家Uid</param>
  35. /// <param name="domainId">区域id</param>
  36. /// <param name="gateId">关卡索引</param>
  37. /// <param name="difficulty">难度选择 0,1,2</param>
  38. /// <param name="stars">获得评星0,1,2,3, 如果战斗失败star=-1</param>
  39. /// <param name="TeamArray">队伍列表</param>
  40. /// <param name="callback">回调函数</param>
  41. public void ArenasFight(int domainId, int gateId, int difficulty, GateStar stars,
  42. List<string> TeamArray,
  43. Action<FightProxy_RetVo.ArenasFight_RetVo> callback = null)
  44. {
  45. UnityEngine.Debug.Assert(gateId > 0, "关卡id必须大于0(503001开始)");
  46. Post(CmdCode.cmd_fight_ArenasFight, new object[] { gateId, difficulty, stars.ToIntValue(), TeamArray },
  47. resp =>
  48. {
  49. var player = UserProxy.Instance.player;
  50. var nandu = difficulty + 1;
  51. FightProxy_RetVo.ArenasFight_RetVo vo = new FightProxy_RetVo.ArenasFight_RetVo(gateId, domainId);
  52. var smGate = sm_gate.GetMoById(gateId);
  53. vo.commander = new FightProxy_RetVo.CommanderChangeInfo();
  54. vo.commander.addExp = resp.result["exp"].ToObject<int>();
  55. vo.GateName = smGate.gateName;
  56. vo.WorldName = sm_gate_zone.GetMoById(domainId)?.zoneName ?? "本章之章";
  57. vo.teamChange = new List<FightProxy_RetVo.HeroChangedInfo>();
  58. foreach (var heroUid in TeamArray)
  59. {
  60. if (string.IsNullOrEmpty(heroUid))
  61. {
  62. continue;
  63. }
  64. var info = new FightProxy_RetVo.HeroChangedInfo();
  65. info.addExp = smGate.HeroExp(nandu);
  66. info.uid = int.Parse(heroUid);
  67. vo.teamChange.Add(info);
  68. }
  69. player.ChangeUserAccount(AccountType.exp, vo.commander.addExp); // 指挥官经验
  70. //player.ChangeUserAccount(AccountType.gold, vo.dropGold); // 掉落金币
  71. player.areansRecord.InitArenasGateData((JObject)resp.result["gates"]); // 同步关卡记录
  72. player.collectHero.InitData((JObject)resp.result["heros"],player); // 同步英雄数据
  73. //player.InitFromStore((JObject)resp.result["store"]); // 同步背包数据
  74. player.baseInfo.tili = resp.result["tili"].ToObject<int>(); // 同步体力
  75. player.baseInfo.gold = Convert.ToInt32(resp.result["gold"].ToString()); // 同步金币
  76. player.baseInfo.resPoint = Convert.ToInt32(resp.result["resPoint"].ToString()); // 同步资源点
  77. player.baseInfo.cash = Convert.ToInt32(resp.result["cash"].ToString()); // 同步钻石
  78. var priv = resp.result.TryGetValue("priv",out var prJ)?prJ.ToObject<Info_PrivateState>() : null; // 私有字段记录了挑战记录
  79. if (null != priv)
  80. {
  81. player.PrivateState = priv; // 同步挑战记录
  82. }
  83. TiliTime.Instance.SetTiliTime((long)resp.result["time"]); // 同步体力时间
  84. if (resp.result["isFirst"].ToObject<bool>())
  85. {
  86. if (smGate.First_Hero(nandu) > 0)
  87. {
  88. vo.UnlockHero = player.collectHero.GetHeroGameInfoByModelID(smGate.First_Hero(nandu).ToString());
  89. }
  90. }
  91. callback?.Invoke(vo);
  92. });
  93. }
  94. /// <summary>
  95. /// [6803] 拉取(挑战)对手的信息
  96. /// </summary>
  97. /// <param name="targetUID">对手UID</param>
  98. /// <param name="callback"></param>
  99. public void GetChallengeAdversaryInfo(string targetUID, Action<AdversaryInfo> callback = null)
  100. {
  101. Post(CmdCode.cmd_fight_GetChallengeAdversaryInfo, new object[] { targetUID },
  102. resp =>
  103. {
  104. if (null != resp.result)
  105. {
  106. var adversary = resp.result["adversaryInfo"].ToObject<AdversaryInfo>();
  107. foreach (var eqps in adversary.equipment.equipments.Values)
  108. { // 同步调整herouid的偏移
  109. if (eqps.herouid > 0)
  110. {
  111. eqps.herouid -= 10000;
  112. }
  113. }
  114. foreach (var yanls in adversary.yanling.items.Values)
  115. { // 同步进行herouid的偏移
  116. if (yanls.herouid > 0)
  117. {
  118. yanls.herouid -= 10000;
  119. }
  120. }
  121. foreach (var heroVo in adversary.heros.Values)
  122. {
  123. if (null == heroVo) continue;
  124. heroVo.uid = (int.Parse(heroVo.uid) - 10000).ToString();
  125. heroVo.EquipRef = adversary.equipment;
  126. heroVo.YanlingRef = adversary.yanling;
  127. }
  128. callback?.Invoke(adversary);
  129. }
  130. else
  131. {
  132. throw new Exception("故障, 未找到该玩家数据!");
  133. // 发生错误, 后台未找到此玩家数据...
  134. }
  135. });
  136. }
  137. /// <summary>
  138. /// [6804] 记录 挑战结果
  139. /// </summary>
  140. /// <param name="targetUID">对手UID</param>
  141. /// <param name="callback"></param>
  142. public void LogChallengeResult(string targetUID, string name, string headImg, bool win, string msg = "", Action callback = null)
  143. {
  144. Post(CmdCode.cmd_fight_LogChallengeResult, new object[] { targetUID, name, headImg, win, msg }, resp => callback?.Invoke());
  145. }
  146. /// <summary>
  147. /// [6805] 拉取(挑战)记录
  148. /// </summary>
  149. /// <param name="targetUID">对手UID</param>
  150. /// <param name="callback"></param>
  151. public void GetChallengeLog(Action<MyChallengeLog> callback = null)
  152. {
  153. Post(CmdCode.cmd_fight_GetChallengeLog, new object[] { },
  154. resp =>
  155. {
  156. if (null != resp.result)
  157. {
  158. var vo = resp.result.ToObject<MyChallengeLog>();
  159. callback?.Invoke(vo);
  160. }
  161. else
  162. {
  163. throw new Exception("故障, 未找到挑战记录数据!");
  164. }
  165. });
  166. }
  167. /// <summary>
  168. /// [6806] 领取(累计)星数奖励
  169. /// </summary>
  170. /// <param name="domainId"></param>
  171. /// <param name="diffculty"></param>
  172. /// <param name="stars"></param>
  173. /// <param name="callback"></param>
  174. public void GetStarRewards(int domainId, int diffculty, int stars, Action callback = null)
  175. {
  176. Post(CmdCode.cmd_fight_GetArenasActiveReward, new object[] { domainId, diffculty, stars },
  177. resp =>
  178. {
  179. var p = UserProxy.Instance.player;
  180. p.baseInfo.gold = resp.result["gold"].ToObject<int>();
  181. p.baseInfo.cash = resp.result["cash"].ToObject<int>();
  182. //p.InitFromStore((JObject)resp.result["store"]); // 同步背包
  183. // 同步领取奖励记录
  184. if (!p.areansRecord.chapterStarsRwd.ContainsKey(domainId))
  185. {
  186. p.areansRecord.chapterStarsRwd.Add(domainId, new Dictionary<int, List<int>>() { });
  187. }
  188. int hardLevel = 1 + diffculty;
  189. if (!p.areansRecord.chapterStarsRwd[domainId].ContainsKey(hardLevel))
  190. {
  191. p.areansRecord.chapterStarsRwd[domainId].Add(hardLevel, new List<int>());
  192. }
  193. p.areansRecord.chapterStarsRwd[domainId][hardLevel].Add(stars);
  194. callback?.Invoke();
  195. });
  196. }
  197. #endregion
  198. #region 闲置函数
  199. /// <summary>
  200. /// [6802] 扫荡关卡
  201. /// </summary>
  202. /// <param name="uid"></param>
  203. /// <param name="zoneid"></param>
  204. /// <param name="gateId">关卡索引</param>
  205. /// <param name="diff">难度</param>
  206. /// <param name="itemid">扫荡券id</param>
  207. /// <param name="callback"></param>
  208. [Obsolete("暂时不用2019年12月19日14:12:24")]
  209. public void ArenasSweep(int gateId, int difficulty, int sweepItemId, Action<JObject> callback = null)
  210. {
  211. Post(CmdCode.cmd_fight_ArenasSweep, new object[] { gateId, difficulty, sweepItemId },
  212. resp =>
  213. {
  214. if (callback != null)
  215. {
  216. callback.Invoke(resp.result);
  217. }
  218. });
  219. }
  220. #endregion
  221. #region ' 竞技场 681x '
  222. /// <summary>
  223. /// [6810] 竞技场 - 主界面信息
  224. /// </summary>
  225. /// <param name="callback"></param>
  226. public void PVP_MainInfo(Action<PVP_Main_UIVo> callback)
  227. {
  228. Post(CmdCode.cmd_pvp_maininfo, new object[] { },
  229. resp =>
  230. {
  231. if (callback != null)
  232. {
  233. var ret = resp.result.ToObject<PVP_Main_UIVo>();
  234. var pvp = UserProxy.Instance.player.pvpRecord;
  235. pvp.defTeam = ret.defTeam;
  236. pvp.pvpCoins = ret.pvpCoins;
  237. pvp.fightTicket = ret.fightTicket;
  238. FixArenasAdversaryInfo(ret.matches);
  239. callback.Invoke(ret);
  240. }
  241. });
  242. }
  243. private static void FixArenasAdversaryInfo(List<AdversaryInfo_Arenas> li)
  244. {
  245. li.ForEach(adversary =>
  246. {
  247. foreach (var eqps in adversary.equipment.equipments.Values)
  248. { // 同步调整herouid的偏移
  249. if (eqps.herouid > 0)
  250. {
  251. eqps.herouid -= 10000;
  252. }
  253. }
  254. foreach (var yanls in adversary.yanling.items.Values)
  255. { // 同步进行herouid的偏移
  256. if (yanls.herouid > 0)
  257. {
  258. yanls.herouid -= 10000;
  259. }
  260. }
  261. foreach (var heroVo in adversary.heros.Values)
  262. {
  263. if (null == heroVo) continue;
  264. heroVo.uid = (int.Parse(heroVo.uid) - 10000).ToString();
  265. heroVo.EquipRef = adversary.equipment;
  266. heroVo.YanlingRef = adversary.yanling;
  267. }
  268. });
  269. }
  270. /// <summary>
  271. /// [6811] 竞技场 - 刷新对手(建议客户端设置时间间隔)
  272. /// </summary>
  273. /// <param name="callback"></param>
  274. public void PVP_Refresh(Action<List<AdversaryInfo_Arenas>> callback)
  275. {
  276. Post(CmdCode.cmd_pvp_refresh, new object[] { },
  277. resp =>
  278. {
  279. var matches = resp.result["curMatches"].ToObject<List<AdversaryInfo_Arenas>>();
  280. callback?.Invoke(matches.ToList());
  281. });
  282. }
  283. /// <summary>
  284. /// [6812] 竞技场 - 挑战对手
  285. /// </summary>
  286. /// <param name="target_uid"></param>
  287. /// <param name="win"> 战斗结果0负, 1 胜</param>
  288. /// <param name="callback"></param>
  289. public void PVP_PK(string target_uid, bool win, string target_name, string target_headImg, Action<PVP_PK_Ret> callback)
  290. {
  291. Post(CmdCode.cmd_pvp_pk, new object[] { target_uid, win, target_name, target_headImg },
  292. resp => callback?.Invoke(resp.result.ToObject<PVP_PK_Ret>()));
  293. }
  294. /// <summary>
  295. /// [6813] 竞技场 - 设置防守队伍
  296. /// </summary>
  297. /// <param name="newTeam"></param>
  298. /// <param name="callback"></param>
  299. public void PVP_SetDefTeam(List<string> newTeam, Action<List<string>> callback)
  300. {
  301. Post(CmdCode.cmd_pvp_setteam, new object[] { newTeam },
  302. resp =>
  303. {
  304. var ret = resp.result.ToObject<Info_UserPVP>();
  305. //UnityEngine.Debug.Assert(newTeam == ret);
  306. UserProxy.Instance.player.pvpRecord = ret;
  307. callback?.Invoke(ret.defTeam);
  308. });
  309. }
  310. /// <summary>
  311. /// [6814] 竞技场 - 购买挑战票
  312. /// </summary>
  313. /// <param name="amt"> 补充几个</param>
  314. /// <param name="callback"></param>
  315. public void PVP_BuyTicket(int amt, Action<PVP_BuyTicket_Ret> callback)
  316. {
  317. Post(CmdCode.cmd_pvp_buyTicket, new object[] { amt },
  318. resp =>
  319. {
  320. if (callback != null)
  321. {
  322. var ret = resp.result.ToObject<PVP_BuyTicket_Ret>();
  323. UserProxy.Instance.player.pvpRecord.fightTicket = ret.fightTicket; // 同步挑战票
  324. UserProxy.Instance.player.baseInfo.cash = ret.userCash; // 同步玩家钻石
  325. callback.Invoke(ret);
  326. }
  327. });
  328. }
  329. /// <summary>
  330. /// 6815 竞技场 - 拉取排行榜信息
  331. /// </summary>
  332. /// <param name="start">排名起始索引 1,11,21,31,41,51,61,71,81,91</param>
  333. /// <param name="num">拉取数量,建议不超10, 排行榜最大500人</param>
  334. /// <param name="callback"></param>
  335. public void PVP_getRank(int start, int num, Action<PVP_RankInfo> callback)
  336. {
  337. Post(CmdCode.cmd_pvp_getRank, new object[] { start, num },
  338. resp => callback?.Invoke(resp.result.ToObject<PVP_RankInfo>()));
  339. }
  340. /// <summary>
  341. /// 6816 竞技场 - 查询战报
  342. /// </summary>
  343. /// <param name="callback"></param>
  344. public void PVP_getLog(Action<MyPVPLog> callback)
  345. {
  346. Post(CmdCode.cmd_pvp_getLog, new object[] { }, resp => callback?.Invoke(resp.result.ToObject<MyPVPLog>()));
  347. }
  348. #endregion
  349. #region ' 竞技 商店 '
  350. /// <summary>
  351. /// [6820] 竞技商店 - 主界面
  352. /// </summary>
  353. /// <param name="callback"></param>
  354. public void PVP_ShopMain(Action<Info_UserPVP> callback)
  355. {
  356. Post(CmdCode.cmd_fight_pvpShop_getMainInfo, new object[] { },
  357. resp =>
  358. {
  359. var ret = resp.result.ToObject<Info_UserPVP>();
  360. UserProxy.Instance.player.pvpRecord = ret;
  361. callback?.Invoke(ret);
  362. });
  363. }
  364. /// <summary>
  365. /// [6821] 竞技商店 - 购买道具
  366. /// </summary>
  367. /// <param name="callback"></param>
  368. public void PVP_ShopBuy(int itemId, Action<Info_UserPVP> callback)
  369. {
  370. Post(CmdCode.cmd_fight_pvpShop_buy, new object[] { itemId },
  371. resp =>
  372. {
  373. var p = UserProxy.Instance.player;
  374. var ret = resp.result["pvp"].ToObject<Info_UserPVP>();
  375. //p.InitFromStore(resp.result["store"] as JObject);
  376. p.pvpRecord = ret;
  377. callback?.Invoke(ret);
  378. });
  379. }
  380. /// <summary>
  381. /// [6822] 竞技商店 - 刷新道具
  382. /// </summary>
  383. /// <param name="callback"></param>
  384. public void PVP_ShopRefresh(Action<Info_UserPVP> callback)
  385. {
  386. Post(CmdCode.cmd_fight_pvpShop_refresh, new object[] { },
  387. resp =>
  388. {
  389. var ret = resp.result.ToObject<Info_UserPVP>();
  390. UserProxy.Instance.player.pvpRecord = ret;
  391. callback?.Invoke(ret);
  392. });
  393. }
  394. #endregion
  395. #region ' 世界boss '
  396. public void BossFight_Enter(int bossid) {
  397. Post(CmdCode.fight_worldBoss_enter, new object[] { BossFight.Instance.bossId },
  398. resp => {
  399. });
  400. }
  401. /// <summary>
  402. /// 6834 世界boss, 拉取排行榜
  403. /// </summary>
  404. /// <param name="callback"></param>
  405. public void BossFight_GetRank(Action<Dictionary<string, int>> callback)
  406. {
  407. Post(CmdCode.fight_worldBoss_refresh_rank, new object[] {BossFight.Instance.bossId },
  408. resp =>
  409. {
  410. var dic2 = new Dictionary<string, int>();
  411. if (resp.result["rank"].Count() > 0)
  412. {
  413. var dic = resp.result["rank"].ToObject<Dictionary<string, int>>();
  414. foreach (var kv in dic)
  415. {
  416. var arr = kv.Key.Explode("__");
  417. var name = (arr.Length > 1 ? arr[1] : arr[0]) ?? "-";
  418. dic2.Add(kv.Key.Substring(kv.Key.IndexOf("__") + 2), kv.Value);
  419. }
  420. }
  421. callback?.Invoke(dic2);
  422. });
  423. }
  424. #endregion
  425. #region ' 无尽塔 '
  426. /// <summary>
  427. /// 6841 无尽塔 - 查询当前进度
  428. /// </summary>
  429. /// <param name="callback"></param>
  430. public void EndlessTower_Get(Action<int> callback)
  431. {
  432. Post(CmdCode.fight_endlessTower_Get, new object[] { },
  433. resp => callback?.Invoke(resp.result["index"].ToObject<int>()));
  434. }
  435. /// <summary>
  436. /// 6842 无尽塔 - 前进
  437. /// </summary>
  438. /// <param name="passIndex">刚通关的索引</param>
  439. /// <param name="callback"></param>
  440. public void EndlessTower_Up(int passIndex, Action<int> callback)
  441. {
  442. Post(CmdCode.fight_endlessTower_Up, new object[] { passIndex },
  443. resp =>
  444. {
  445. var p = UserProxy.Instance.player;
  446. p.baseInfo = resp.result["baseInfo"].ToObject<Info_UserBase>();
  447. callback?.Invoke(resp.result["index"].ToObject<int>());
  448. });
  449. }
  450. /// <summary>
  451. /// 6843 无尽塔 - 领取特殊奖励
  452. /// </summary>
  453. /// <param name="index">遇到 5/10 会有特殊奖励可领取</param>
  454. /// <param name="callback">奖励字符串请自取</param>
  455. public void EndlessTower_Drawreward(int index, Action callback)
  456. {
  457. Post(CmdCode.fight_endlessTower_Drawreward, new object[] { index },
  458. resp =>
  459. {
  460. var p = UserProxy.Instance.player;
  461. p.baseInfo = resp.result["baseInfo"].ToObject<Info_UserBase>();
  462. callback?.Invoke();
  463. });
  464. }
  465. #endregion
  466. #region-------战斗复活
  467. /// <summary>
  468. /// 满血复活
  469. /// </summary>
  470. /// <param name="callback"></param>
  471. public void BackBloodRevive(Action<bool> callback)
  472. {
  473. Post(CmdCode.fight_fullBlood, new object[] { },
  474. resp =>
  475. {
  476. var p = UserProxy.Instance.player;
  477. p.baseInfo.cash = int.Parse(resp.result["cash"].ToString());
  478. callback?.Invoke(true);
  479. });
  480. }
  481. #endregion
  482. #region 内部类
  483. /// <summary>
  484. /// 任务/挑战目标达成记录(三星评价)
  485. /// </summary>
  486. /// <author>gwang</author>
  487. //[Obsolete("评星已经没什么意义了, 现在追求的是关卡内掉落.")] // ps. 2021.又给恢复了
  488. [Obsolete("后来又改成开放地图模式, 没有关卡了 -gwang 2022")]
  489. public class GateStar
  490. {
  491. /// <summary>
  492. /// 根据三个条件达成情况构造(战斗结果转给后台)
  493. /// </summary>
  494. /// <param name="p1"></param>
  495. /// <param name="p2"></param>
  496. /// <param name="p3"></param>
  497. public GateStar(bool p1, bool p2, bool p3)
  498. { this.S1 = p1; this.S2 = p2; this.S3 = p3; }
  499. /// <summary>
  500. /// 根据后台记录的数值构造(反向提供给前端显示层)
  501. /// </summary>
  502. /// <param name="i"></param>
  503. public GateStar(int i)
  504. {
  505. this.S1 = (i & 1) > 0;
  506. this.S2 = (i & 2) > 0;
  507. this.S3 = (i & 4) > 0;
  508. }
  509. /// <summary>
  510. /// 第一个目标达成
  511. /// </summary>
  512. public readonly bool S1;
  513. /// <summary>
  514. /// 第二个目标达成
  515. /// </summary>
  516. public readonly bool S2;
  517. /// <summary>
  518. /// 第三个目标达成
  519. /// </summary>
  520. public readonly bool S3;
  521. /// <summary>
  522. /// 取其压缩格式(三个变量压缩到一个int值中)
  523. /// </summary>
  524. /// <returns></returns>
  525. public int ToIntValue()
  526. {
  527. return ((S3 ? 1 : 0) << 2) | ((S2 ? 1 : 0) << 1) | (S1 ? 1 : 0);
  528. }
  529. /// <summary>
  530. /// 统计总星数
  531. /// </summary>
  532. public int Count => (S3 ? 1 : 0) + (S2 ? 1 : 0) + (S1 ? 1 : 0);
  533. }
  534. #region 普通挑战
  535. /// <summary>
  536. /// (挑战)对手信息
  537. /// </summary>
  538. /// <remarks >用该数据初始化对手战场信息的时候, 注意理清数据来源,不要引用到玩家的数据去(比如hero,equip和yanling)</remarks>
  539. public class AdversaryInfo
  540. {
  541. /// <summary>
  542. /// uid
  543. /// </summary>
  544. public string uid;
  545. /// <summary>
  546. /// 昵称
  547. /// </summary>
  548. public string name;
  549. /// <summary>
  550. /// 等级
  551. /// </summary>
  552. public int level;
  553. /// <summary>
  554. /// 头像
  555. /// </summary>
  556. public string headImg;
  557. /// <summary>
  558. /// 玩家装备数据
  559. /// </summary>
  560. public GameCollectEquips equipment;
  561. /// <summary>
  562. /// 玩家言灵数据
  563. /// </summary>
  564. public GameCollectYanling yanling;
  565. /// <summary>
  566. /// 玩家战队英雄数据集合
  567. /// </summary>
  568. public Dictionary<string, GameHeroVo> heros = new Dictionary<string, GameHeroVo>();
  569. }
  570. /// <summary>
  571. /// (挑战)日志
  572. /// </summary>
  573. public class MyChallengeLog
  574. {
  575. /// <summary>
  576. /// 主动挑战记录
  577. /// </summary>
  578. public List<AdversaryInfo> offLog;
  579. /// <summary>
  580. /// 被动防守记录
  581. /// </summary>
  582. public List<AdversaryInfo> defLog;
  583. /// <summary>
  584. /// 对手信息(简)
  585. /// </summary>
  586. public class AdversaryInfo
  587. {
  588. /// <summary>
  589. /// uid
  590. /// </summary>
  591. public string uid;
  592. /// <summary>
  593. /// 昵称
  594. /// </summary>
  595. public string name;
  596. /// <summary>
  597. /// 头像
  598. /// </summary>
  599. public string headImg;
  600. /// <summary>
  601. /// 战斗结果
  602. /// </summary>
  603. public bool win;
  604. /// <summary>
  605. /// 胜利者留言
  606. /// </summary>
  607. public string msg;
  608. /// <summary>
  609. /// 时间戳
  610. /// </summary>
  611. public int ts;
  612. // 其他信息再添加
  613. // . . . . . .
  614. }
  615. }
  616. #endregion
  617. #region 竞技场
  618. /// <summary>
  619. /// 竞技场 对手信息(比普通挑战对手增加了竞技场积分和总战力信息)
  620. /// </summary>
  621. public class AdversaryInfo_Arenas : AdversaryInfo
  622. {
  623. /// <summary>
  624. /// 竞技场积分
  625. /// </summary>
  626. public int score = 0;
  627. /// <summary>
  628. /// 总战力
  629. /// </summary>
  630. public int fpower = 0;
  631. }
  632. /// <summary>
  633. /// 竞技场主界面所需信息
  634. /// </summary>
  635. public class PVP_Main_UIVo
  636. {
  637. /// <summary>
  638. /// 竞技场积分
  639. /// </summary>
  640. public int score;
  641. /// <summary>
  642. /// 竞技场排名
  643. /// </summary>
  644. public int rank;
  645. /// <summary>
  646. /// 竞技币
  647. /// </summary>
  648. public int pvpCoins;
  649. /// <summary>
  650. /// 总战力
  651. /// </summary>
  652. public int fPower;
  653. /// <summary>
  654. /// 挑战票
  655. /// </summary>
  656. public int fightTicket;
  657. /// <summary>
  658. /// 玩家自己的防守战队(英雄的uid列表)
  659. /// </summary>
  660. public List<string> defTeam;
  661. /// <summary>
  662. /// 新挑战记录条数
  663. /// </summary>
  664. public int numNewLog;
  665. /// <summary>
  666. /// 匹配对手
  667. /// </summary>
  668. public List<AdversaryInfo_Arenas> matches;
  669. /// <summary>
  670. /// 当前奖励
  671. /// </summary>
  672. /// <returns></returns>
  673. public sm_pvp_rankreward currentReward()
  674. {
  675. return sm_pvp_rankreward.GetMoByRank(this.rank);
  676. }
  677. /// <summary>
  678. /// 产看所有奖励
  679. /// </summary>
  680. /// <returns></returns>
  681. public List<sm_pvp_rankreward> HaveALookOfAllRewards()
  682. {
  683. return GameConfigData.Ins.pvp_rankreward.Values.ToList();
  684. }
  685. }
  686. /// <summary>
  687. /// 竞技场挑战对手返回值
  688. /// </summary>
  689. public class PVP_PK_Ret
  690. {
  691. /// <summary>
  692. /// 自己剩余免费票
  693. /// </summary>
  694. public int freeFightTickets;
  695. /// <summary>
  696. /// 自己剩余挑战票
  697. /// </summary>
  698. public int fightTicket;
  699. /// <summary>
  700. /// 自己挑战之前积分
  701. /// </summary>
  702. public int RA;
  703. /// <summary>
  704. /// 对手挑战之前积分
  705. /// </summary>
  706. public int RB;
  707. /// <summary>
  708. /// 自己最新积分
  709. /// </summary>
  710. public int R_A;
  711. /// <summary>
  712. /// 对手最新积分
  713. /// </summary>
  714. public int R_B;
  715. /// <summary>
  716. /// 排名变化
  717. /// </summary>
  718. public int rank_diff;
  719. /// <summary>
  720. /// 最新排名
  721. /// </summary>
  722. public int rank_new;
  723. }
  724. /// <summary>
  725. /// 竞技场 购买挑战票返回值
  726. /// </summary>
  727. public class PVP_BuyTicket_Ret
  728. {
  729. /// <summary>
  730. /// 最新挑战票数量
  731. /// </summary>
  732. public int fightTicket;
  733. /// <summary>
  734. /// 花费钻石
  735. /// </summary>
  736. public int costCash;
  737. /// <summary>
  738. /// 玩家剩余钻石
  739. /// </summary>
  740. public int userCash;
  741. }
  742. /// <summary>
  743. /// (竞技场)战斗日志
  744. /// </summary>
  745. public class MyPVPLog
  746. {
  747. /// <summary>
  748. /// 主动挑战记录
  749. /// </summary>
  750. public List<AdversaryInfo> offLog;
  751. /// <summary>
  752. /// 被动防守记录
  753. /// </summary>
  754. public List<AdversaryInfo> defLog;
  755. /// <summary>
  756. /// 对手信息(简)
  757. /// </summary>
  758. public class AdversaryInfo
  759. {
  760. /// <summary>
  761. /// uid
  762. /// </summary>
  763. public string uid;
  764. /// <summary>
  765. /// 昵称
  766. /// </summary>
  767. public string name;
  768. /// <summary>
  769. /// 头像
  770. /// </summary>
  771. public string headImg;
  772. /// <summary>
  773. /// 战斗结果
  774. /// </summary>
  775. public bool win;
  776. /// <summary>
  777. /// 胜利者留言
  778. /// </summary>
  779. public string msg;
  780. /// <summary>
  781. /// 时间戳
  782. /// </summary>
  783. public int ts;
  784. /// <summary>
  785. /// 积分变更信息
  786. /// </summary>
  787. public int scoreInfo;
  788. // 其他信息再添加
  789. // . . . . . .
  790. }
  791. }
  792. /// <summary>
  793. /// 竞技场 排行榜信息
  794. /// </summary>
  795. public class PVP_RankInfo
  796. {
  797. /// <summary>
  798. /// 玩家列表
  799. /// </summary>
  800. public Dictionary<int, AdversaryInfo_Arenas> dic;
  801. /// <summary>
  802. /// 我的排名
  803. /// </summary>
  804. public int myRank;
  805. /// <summary>
  806. /// 我的积分
  807. /// </summary>
  808. public int myScore;
  809. }
  810. #endregion
  811. #endregion
  812. }