ActorParam.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. using UnityEngine;
  2. using System.Collections;
  3. public class ServerFighterParam
  4. {
  5. public long uid;
  6. public int hp;
  7. public int sp;
  8. public float hpPercent;
  9. public float spPercent;
  10. public ServerFighterParam(long uid,int hp,int sp,float hpPercent,float spPercent)
  11. {
  12. this.uid = uid;
  13. this.hp = hp;
  14. this.sp = sp;
  15. this.hpPercent = hpPercent;
  16. this.spPercent = spPercent;
  17. }
  18. }
  19. public class GvGMark
  20. {
  21. public int m_nMarkid;
  22. public int m_nMarkNum;
  23. public GvGMark(int nMarkid, int nMarkNum)
  24. {
  25. this.m_nMarkid = nMarkid;
  26. this.m_nMarkNum = nMarkNum;
  27. }
  28. public GvGMark(JSONObject json)
  29. {
  30. this.m_nMarkid = (int)json[0].n;
  31. this.m_nMarkNum = (int)json[1].n;
  32. }
  33. public JSONObject ToJson()
  34. {
  35. JSONObject json = new JSONObject();
  36. json.Add(this.m_nMarkid);
  37. json.Add(this.m_nMarkNum);
  38. return json;
  39. }
  40. }
  41. public struct SkillParam
  42. {
  43. public int skillId;
  44. public int skillLv;
  45. public int skillRate;
  46. public SkillParam(int id, int lv)
  47. {
  48. skillId = id;
  49. skillLv = lv;
  50. skillRate = 100;
  51. }
  52. public SkillParam(int id,int lv,int rate)
  53. {
  54. skillId = id;
  55. skillLv = lv;
  56. skillRate = rate;
  57. }
  58. public SkillParam(JSONObject json)
  59. {
  60. skillId = (int)json[0].n;
  61. skillLv = (int)json[1].n;
  62. skillRate = (int)json[2].n;
  63. }
  64. public JSONObject ToJson()
  65. {
  66. JSONObject json = new JSONObject();
  67. json.Add(skillId);
  68. json.Add(skillLv);
  69. json.Add(skillRate);
  70. return json;
  71. }
  72. }
  73. public struct BuffParam
  74. {
  75. public int buffId;
  76. public int ratio;
  77. public int cd;
  78. public int type;
  79. public int casterType;
  80. public int extendPara;
  81. public string funStr;
  82. public BuffParam(int id,int ratio,int cd,int type)
  83. {
  84. this.buffId = id;
  85. this.ratio = ratio;
  86. this.cd = cd;
  87. this.casterType = type / 100;
  88. this.type = type - this.casterType * 100;
  89. this.extendPara = 0;
  90. this.funStr = "";
  91. }
  92. public BuffParam(int id, int ratio, int cd, int type,string funStr)
  93. {
  94. this.buffId = id;
  95. this.ratio = ratio;
  96. this.cd = cd;
  97. this.casterType = type / 100;
  98. this.type = type - this.casterType * 100;
  99. this.extendPara = 0;
  100. this.funStr = funStr;
  101. }
  102. public BuffParam(int id, int ratio, int cd, int type,int extendPara, string funStr)
  103. {
  104. this.buffId = id;
  105. this.ratio = ratio;
  106. this.cd = cd;
  107. this.casterType = type / 100;
  108. this.type = type - this.casterType * 100;
  109. this.extendPara = extendPara;
  110. this.funStr = funStr;
  111. }
  112. public BuffParam(JSONObject json)
  113. {
  114. this.buffId = (int)json[0].n;
  115. this.ratio = (int)json[1].n;
  116. this.cd = (int)json[2].n;
  117. this.type = (int)json[3].n;
  118. this.casterType = (int)json[4].n;
  119. this.funStr = json[5].str;
  120. this.extendPara = (int)json[6].n;
  121. }
  122. public JSONObject ToJson()
  123. {
  124. JSONObject json = new JSONObject();
  125. json.Add(this.buffId);
  126. json.Add(this.ratio);
  127. json.Add(this.cd);
  128. json.Add(this.type);
  129. json.Add(this.casterType);
  130. json.Add(this.funStr);
  131. json.Add(this.extendPara);
  132. return json;
  133. }
  134. }
  135. public struct HairColorParam
  136. {
  137. public Color clr;
  138. public Vector2 uvOffset;
  139. public HairColorParam(Color clr,Vector2 uvOffset)
  140. {
  141. this.clr = clr;
  142. this.uvOffset = uvOffset;
  143. }
  144. public HairColorParam(JSONObject json)
  145. {
  146. this.clr = BattleRecorder.ColorFromJson(json[0]);
  147. this.uvOffset = BattleRecorder.Vector2FromJson(json[1]);
  148. }
  149. public JSONObject ToJson()
  150. {
  151. JSONObject json = new JSONObject();
  152. json.Add(BattleRecorder.ColorToJson(this.clr));
  153. json.Add(BattleRecorder.Vector2ToJson(this.uvOffset));
  154. return json;
  155. }
  156. }
  157. public struct BodyPartParam
  158. {
  159. public int part;
  160. public string modelPrefab;
  161. public string linkPoint;
  162. public Vector3 pos;
  163. public Vector3 rot;
  164. public Vector3 scale;
  165. public BodyPartParam(int part,string modelPrefab,string linkPoint,Vector3 pos,Vector3 rot,Vector3 scale)
  166. {
  167. this.part = part;
  168. this.modelPrefab = modelPrefab;
  169. this.linkPoint = linkPoint;
  170. this.pos = pos;
  171. this.rot = rot;
  172. this.scale = scale;
  173. }
  174. public BodyPartParam(JSONObject json)
  175. {
  176. this.part = (int)json[0].n;
  177. this.modelPrefab = json[1].str;
  178. this.linkPoint = json[2].str;
  179. this.pos = BattleRecorder.Vector3FromJson(json[3]);
  180. this.rot = BattleRecorder.Vector3FromJson(json[4]);
  181. this.scale = BattleRecorder.Vector3FromJson(json[5]);
  182. }
  183. public JSONObject ToJson()
  184. {
  185. JSONObject json = new JSONObject();
  186. json.Add(part);
  187. json.Add(modelPrefab);
  188. json.Add(linkPoint);
  189. json.Add(BattleRecorder.Vector3ToJson(pos));
  190. json.Add(BattleRecorder.Vector3ToJson(rot));
  191. json.Add(BattleRecorder.Vector3ToJson(scale));
  192. return json;
  193. }
  194. }
  195. public struct FashionParam
  196. {
  197. public HairColorParam hairClrParam;
  198. public BodyPartParam[] parts;
  199. public FashionParam(BodyPartParam[] parts, HairColorParam hairClrParam)
  200. {
  201. this.hairClrParam = hairClrParam;
  202. if(parts != null) {
  203. this.parts = new BodyPartParam[parts.Length];
  204. for (int idx = 0; idx < parts.Length; idx++)
  205. this.parts[idx] = parts[idx];
  206. }
  207. else
  208. {
  209. this.parts = null;
  210. }
  211. }
  212. public FashionParam(JSONObject json)
  213. {
  214. if(json.HasField("Parts"))
  215. {
  216. JSONObject partsJson = json.GetField("Parts");
  217. this.parts = new BodyPartParam[partsJson.Count];
  218. for(int idx =0; idx < partsJson.Count;idx++)
  219. {
  220. BodyPartParam part = new BodyPartParam(partsJson.list[idx]);
  221. this.parts[idx] = part;
  222. }
  223. }
  224. else
  225. {
  226. this.parts = null;
  227. }
  228. if(json.HasField("hairColor"))
  229. {
  230. JSONObject hairColorJson = json.GetField("hairColor");
  231. hairClrParam = new HairColorParam(hairColorJson);
  232. }
  233. else
  234. {
  235. hairClrParam = default(HairColorParam);
  236. }
  237. }
  238. public JSONObject ToJson()
  239. {
  240. JSONObject json = new JSONObject();
  241. if (parts != null)
  242. {
  243. JSONObject partsJson = new JSONObject();
  244. for (int idx = 0; idx < parts.Length; idx++)
  245. {
  246. partsJson.Add(parts[idx].ToJson());
  247. }
  248. json.AddField("Parts", partsJson);
  249. }
  250. json.AddField("hairColor", hairClrParam.ToJson());
  251. return json;
  252. }
  253. }
  254. public class ActorParam
  255. {
  256. public int uid;
  257. public int baseId;
  258. public int level;
  259. public int jobId;
  260. public int petId;
  261. public bool isMainRole;
  262. public bool isRole;
  263. public int headFrameId;
  264. public int strengthLevel;
  265. public SkillParam[] skills;
  266. public BuffParam[] buffs;
  267. public FashionParam fashion;
  268. }