DataWriter.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. using Excel4Unity;
  2. using JamesGame;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Text;
  7. using UnityEngine;
  8. public class DataWriter
  9. {
  10. private const int StartRow = 4;
  11. private static string dirPath = "{0}tables/{1}.xlsx";
  12. private static void AddTypeSheet(Excel xls, string xlsName)
  13. {
  14. xls.AddTable("@Types");
  15. xls.Tables[1].SetValue(1, 1, string.Format("TableName: \"{0}\" Package: \"JamesGame\"", xlsName));
  16. }
  17. public static string ExchangeListInt(List<int> list, string sep)
  18. {
  19. StringBuilder sb = new StringBuilder();
  20. for (int i = 0; i < list.Count; ++i)
  21. {
  22. sb.Append(list[i]);
  23. if (i != list.Count - 1)
  24. {
  25. sb.Append(sep);
  26. }
  27. }
  28. return sb.ToString();
  29. }
  30. public static string ExchangeListString(List<string> list, string sep)
  31. {
  32. StringBuilder sb = new StringBuilder();
  33. for (int i = 0; i < list.Count; ++i)
  34. {
  35. sb.Append(list[i]);
  36. if (i != list.Count - 1)
  37. {
  38. sb.Append(sep);
  39. }
  40. }
  41. return sb.ToString();
  42. }
  43. public static string ExchangeListFloat(List<float> list, string sep)
  44. {
  45. StringBuilder sb = new StringBuilder();
  46. for (int i = 0; i < list.Count; ++i)
  47. {
  48. sb.Append(list[i]);
  49. if (i != list.Count - 1)
  50. {
  51. sb.Append(sep);
  52. }
  53. }
  54. return sb.ToString();
  55. }
  56. public static void SaveChallengeData(string xlsPath, string xlsName, Dictionary<int, ChallengeDataDefine> challengeDataCfgs)
  57. {
  58. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  59. Excel xls = new Excel();
  60. xls.AddTable(xlsName);
  61. xls.Tables[0].SetValue(1, 1, "ID");
  62. xls.Tables[0].SetValue(1, 2, "FieldID");
  63. xls.Tables[0].SetValue(1, 3, "DecStaminaCnt");
  64. xls.Tables[0].SetValue(1, 4, "ConstraintType");
  65. xls.Tables[0].SetValue(1, 5, "ConstraintValue");
  66. xls.Tables[0].SetValue(1, 6, "Condition");
  67. xls.Tables[0].SetValue(1, 7, "Reward_ID_1");
  68. xls.Tables[0].SetValue(2, 1, "int32");
  69. xls.Tables[0].SetValue(2, 2, "int32");
  70. xls.Tables[0].SetValue(2, 3, "int32");
  71. xls.Tables[0].SetValue(2, 4, "int32");
  72. xls.Tables[0].SetValue(2, 5, "int32");
  73. xls.Tables[0].SetValue(2, 6, "repeated int32");
  74. xls.Tables[0].SetValue(2, 7, "int32");
  75. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  76. xls.Tables[0].SetValue(3, 6, "ListSpliter:\"#\"");
  77. xls.Tables[0].SetValue(3, 7, "Default: 0");
  78. xls.Tables[0].SetValue(4, 1, "关卡ID");
  79. int i = StartRow;
  80. foreach (var data in challengeDataCfgs.Values)
  81. {
  82. ++i;
  83. xls.Tables[0].SetValue(i, 1, data.ID);
  84. xls.Tables[0].SetValue(i, 2, data.FieldID);
  85. xls.Tables[0].SetValue(i, 3, data.DecStaminaCnt);
  86. xls.Tables[0].SetValue(i, 4, data.ConstraintType);
  87. xls.Tables[0].SetValue(i, 5, data.ConstraintValue);
  88. xls.Tables[0].SetValue(i, 6, ExchangeListInt(data.Condition, "#"));
  89. xls.Tables[0].SetValue(i, 7, data.Reward_ID_1);
  90. }
  91. AddTypeSheet(xls, xlsName);
  92. ExcelHelper.SaveExcel(xls, outputPath);
  93. }
  94. public static void SaveFieldData(string xlsPath, string xlsName, Dictionary<int, FieldDataDefine> fieldDataCfgs)
  95. {
  96. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  97. Excel xls = new Excel();
  98. xls.AddTable(xlsName);
  99. xls.Tables[0].SetValue(1, 1, "ID");
  100. xls.Tables[0].SetValue(1, 2, "RoundFactorGroupID");
  101. xls.Tables[0].SetValue(1, 3, "FieldShapeID");
  102. xls.Tables[0].SetValue(1, 4, "DefaultPlayerPos");
  103. xls.Tables[0].SetValue(1, 5, "Mark");
  104. xls.Tables[0].SetValue(2, 1, "int32");
  105. xls.Tables[0].SetValue(2, 2, "int32");
  106. xls.Tables[0].SetValue(2, 3, "int32");
  107. xls.Tables[0].SetValue(2, 4, "repeated int32");
  108. xls.Tables[0].SetValue(2, 5, "string");
  109. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  110. xls.Tables[0].SetValue(3, 4, "ListSpliter:\"|\"");
  111. xls.Tables[0].SetValue(4, 1, "关卡ID");
  112. int i = StartRow;
  113. foreach (var data in fieldDataCfgs.Values)
  114. {
  115. ++i;
  116. xls.Tables[0].SetValue(i, 1, data.ID);
  117. xls.Tables[0].SetValue(i, 2, data.RoundFactorGroupID);
  118. xls.Tables[0].SetValue(i, 3, data.FieldShapeID);
  119. xls.Tables[0].SetValue(i, 4, ExchangeListInt(data.DefaultPlayerPos, "|"));
  120. xls.Tables[0].SetValue(i, 5, data.Mark);
  121. }
  122. AddTypeSheet(xls, xlsName);
  123. ExcelHelper.SaveExcel(xls, outputPath);
  124. }
  125. public static void SaveTargetData(string xlsPath, string xlsName, Dictionary<int, TargetDataDefine> targetDataCfgs)
  126. {
  127. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  128. Excel xls = new Excel();
  129. xls.AddTable(xlsName);
  130. xls.Tables[0].SetValue(1, 1, "ID");
  131. xls.Tables[0].SetValue(1, 2, "ResourceName");
  132. xls.Tables[0].SetValue(1, 3, "Life");
  133. xls.Tables[0].SetValue(1, 4, "CtrlAniFileName");
  134. xls.Tables[0].SetValue(1, 5, "Attrib");
  135. xls.Tables[0].SetValue(1, 6, "CtrlAniStartDelay");
  136. xls.Tables[0].SetValue(1, 7, "Child");
  137. xls.Tables[0].SetValue(1, 8, "cNode");
  138. xls.Tables[0].SetValue(1, 9, "Material");
  139. xls.Tables[0].SetValue(1, 10, "Hit");
  140. xls.Tables[0].SetValue(1, 11, "Death");
  141. xls.Tables[0].SetValue(1, 12, "CtrlAniSpeed");
  142. xls.Tables[0].SetValue(1, 13, "Scale");
  143. xls.Tables[0].SetValue(1, 14, "DieRule");
  144. xls.Tables[0].SetValue(1, 15, "ReID");
  145. xls.Tables[0].SetValue(1, 16, "TargetPos");
  146. xls.Tables[0].SetValue(1, 17, "TargetRot");
  147. xls.Tables[0].SetValue(2, 1, "int32");
  148. xls.Tables[0].SetValue(2, 2, "string");
  149. xls.Tables[0].SetValue(2, 3, "int32");
  150. xls.Tables[0].SetValue(2, 4, "string");
  151. xls.Tables[0].SetValue(2, 5, "int32");
  152. xls.Tables[0].SetValue(2, 6, "float");
  153. xls.Tables[0].SetValue(2, 7, "string");
  154. xls.Tables[0].SetValue(2, 8, "string");
  155. xls.Tables[0].SetValue(2, 9, "int32");
  156. xls.Tables[0].SetValue(2, 10, "string");
  157. xls.Tables[0].SetValue(2, 11, "string");
  158. xls.Tables[0].SetValue(2, 12, "float");
  159. xls.Tables[0].SetValue(2, 13, "float");
  160. xls.Tables[0].SetValue(2, 14, "int32");
  161. xls.Tables[0].SetValue(2, 15, "int32");
  162. xls.Tables[0].SetValue(2, 16, "repeated float");
  163. xls.Tables[0].SetValue(2, 17, "repeated float");
  164. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  165. xls.Tables[0].SetValue(3, 16, "ListSpliter:\"|\"");
  166. xls.Tables[0].SetValue(3, 17, "ListSpliter:\"|\"");
  167. xls.Tables[0].SetValue(4, 1, "关卡ID");
  168. int i = StartRow;
  169. foreach (var data in targetDataCfgs.Values)
  170. {
  171. ++i;
  172. xls.Tables[0].SetValue(i, 1, data.ID);
  173. xls.Tables[0].SetValue(i, 2, data.ResourceName);
  174. xls.Tables[0].SetValue(i, 3, data.Life);
  175. xls.Tables[0].SetValue(i, 4, data.CtrlAniFileName.Equals("none")?"": data.CtrlAniFileName);
  176. xls.Tables[0].SetValue(i, 5, data.Attrib);
  177. xls.Tables[0].SetValue(i, 6, data.CtrlAniStartDelay);
  178. xls.Tables[0].SetValue(i, 7, data.Child.Equals("none")?"": data.Child);
  179. xls.Tables[0].SetValue(i, 8, data.cNode.Equals("none")?"" : data.cNode);
  180. xls.Tables[0].SetValue(i, 9, data.Material);
  181. xls.Tables[0].SetValue(i, 10, data.Hit.Equals("none")?"": data.Hit);
  182. xls.Tables[0].SetValue(i, 11, data.Death.Equals("none")?"" : data.Death);
  183. xls.Tables[0].SetValue(i, 12, data.CtrlAniSpeed);
  184. xls.Tables[0].SetValue(i, 13, data.Scale);
  185. xls.Tables[0].SetValue(i, 14, data.DieRule);
  186. xls.Tables[0].SetValue(i, 15, data.ReID);
  187. xls.Tables[0].SetValue(i, 16, ExchangeListFloat(data.TargetPos, "|"));
  188. xls.Tables[0].SetValue(i, 17, ExchangeListFloat(data.TargetRot, "|"));
  189. }
  190. AddTypeSheet(xls, xlsName);
  191. ExcelHelper.SaveExcel(xls, outputPath);
  192. }
  193. public static void SaveTargetGroupData(string xlsPath, string xlsName, Dictionary<int, TargetGroupDefine> targetGroupCfgs)
  194. {
  195. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  196. Excel xls = new Excel();
  197. xls.AddTable(xlsName);
  198. xls.Tables[0].SetValue(1, 1, "ID");
  199. xls.Tables[0].SetValue(1, 2, "GroupID");
  200. xls.Tables[0].SetValue(1, 3, "TargetID");
  201. xls.Tables[0].SetValue(2, 1, "int32");
  202. xls.Tables[0].SetValue(2, 2, "int32");
  203. xls.Tables[0].SetValue(2, 3, "int32");
  204. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  205. xls.Tables[0].SetValue(4, 1, "关卡ID");
  206. int i = StartRow;
  207. foreach (var data in targetGroupCfgs.Values)
  208. {
  209. ++i;
  210. xls.Tables[0].SetValue(i, 1, data.ID);
  211. xls.Tables[0].SetValue(i, 2, data.GroupID);
  212. xls.Tables[0].SetValue(i, 3, data.TargetID);
  213. }
  214. AddTypeSheet(xls, xlsName);
  215. ExcelHelper.SaveExcel(xls, outputPath);
  216. }
  217. public static void SaveFieldShapeData(string xlsPath, string xlsName, Dictionary<int, FieldShapeDataDefine> fieldShapeCfgs)
  218. {
  219. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  220. Excel xls = new Excel();
  221. xls.AddTable(xlsName);
  222. xls.Tables[0].SetValue(1, 1, "ID");
  223. xls.Tables[0].SetValue(1, 2, "ResourceName");
  224. xls.Tables[0].SetValue(1, 3, "EnvSoundName");
  225. xls.Tables[0].SetValue(1, 4, "EnvParticleName");
  226. xls.Tables[0].SetValue(1, 5, "AttendAnim");
  227. xls.Tables[0].SetValue(1, 6, "LoadMethod");
  228. xls.Tables[0].SetValue(2, 1, "int32");
  229. xls.Tables[0].SetValue(2, 2, "string");
  230. xls.Tables[0].SetValue(2, 3, "string");
  231. xls.Tables[0].SetValue(2, 4, "string");
  232. xls.Tables[0].SetValue(2, 5, "repeated string");
  233. xls.Tables[0].SetValue(2, 6, "int32");
  234. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  235. xls.Tables[0].SetValue(3, 5, "ListSpliter:\"#\"");
  236. xls.Tables[0].SetValue(4, 1, "关卡ID");
  237. xls.Tables[0].SetValue(4, 5, "开场动画,多选一");
  238. int i = StartRow;
  239. foreach (var data in fieldShapeCfgs.Values)
  240. {
  241. ++i;
  242. xls.Tables[0].SetValue(i, 1, data.ID);
  243. xls.Tables[0].SetValue(i, 2, data.ResourceName);
  244. xls.Tables[0].SetValue(i, 3, data.EnvSoundName);
  245. xls.Tables[0].SetValue(i, 4, data.EnvParticleName);
  246. xls.Tables[0].SetValue(i, 5, ExchangeListString(data.AttendAnim, "#"));
  247. xls.Tables[0].SetValue(i, 6, data.LoadMethod);
  248. }
  249. AddTypeSheet(xls, xlsName);
  250. ExcelHelper.SaveExcel(xls, outputPath);
  251. }
  252. public static void SaveLevelData(string xlsPath, string xlsName, Dictionary<int, LevelDefine> levelCfgs)
  253. {
  254. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  255. Excel xls = new Excel();
  256. xls.AddTable(xlsName);
  257. xls.Tables[0].SetValue(1, 1, "ID");
  258. xls.Tables[0].SetValue(1, 2, "coinsStar1");
  259. xls.Tables[0].SetValue(1, 3, "coinsStar2");
  260. xls.Tables[0].SetValue(1, 4, "coinsStar3");
  261. xls.Tables[0].SetValue(1, 5, "coinsBullet");
  262. xls.Tables[0].SetValue(1, 6, "coinsCombo");
  263. xls.Tables[0].SetValue(1, 7, "fittedWeapon");
  264. xls.Tables[0].SetValue(1, 8, "roundTargetIds");
  265. xls.Tables[0].SetValue(1, 9, "timeTargetPrice");
  266. xls.Tables[0].SetValue(1, 10, "rewardedItems");
  267. xls.Tables[0].SetValue(1, 11, "crownPower");
  268. xls.Tables[0].SetValue(1, 12, "posX");
  269. xls.Tables[0].SetValue(1, 13, "posY");
  270. xls.Tables[0].SetValue(1, 14, "posZ");
  271. xls.Tables[0].SetValue(1, 15, "rotX");
  272. xls.Tables[0].SetValue(1, 16, "rotY");
  273. xls.Tables[0].SetValue(1, 17, "rotZ");
  274. xls.Tables[0].SetValue(1, 18, "gameType");
  275. xls.Tables[0].SetValue(1, 19, "realID");
  276. xls.Tables[0].SetValue(1, 20, "offsetX");
  277. xls.Tables[0].SetValue(1, 21, "offsetY");
  278. xls.Tables[0].SetValue(1, 22, "offsetZ");
  279. xls.Tables[0].SetValue(1, 23, "attendAnims");
  280. xls.Tables[0].SetValue(1, 24, "fov");
  281. xls.Tables[0].SetValue(1, 25, "shadowPlane");
  282. xls.Tables[0].SetValue(1, 26, "windMin");
  283. xls.Tables[0].SetValue(1, 27, "windMax");
  284. xls.Tables[0].SetValue(1, 28, "windChange");
  285. xls.Tables[0].SetValue(1, 29, "dungonCondition");
  286. xls.Tables[0].SetValue(1, 30, "dungonBattleRewards");
  287. xls.Tables[0].SetValue(1, 31, "rankTargetScore");
  288. xls.Tables[0].SetValue(1, 32, "openRigiBody");
  289. xls.Tables[0].SetValue(1, 33, "moveRigiBody");
  290. xls.Tables[0].SetValue(1, 34, "AttributeTypeData");
  291. xls.Tables[0].SetValue(1, 35, "AttributeValueData");
  292. xls.Tables[0].SetValue(2, 1, "int32");
  293. xls.Tables[0].SetValue(2, 2, "int32");
  294. xls.Tables[0].SetValue(2, 3, "int32");
  295. xls.Tables[0].SetValue(2, 4, "int32");
  296. xls.Tables[0].SetValue(2, 5, "int32");
  297. xls.Tables[0].SetValue(2, 6, "int32");
  298. xls.Tables[0].SetValue(2, 7, "int32");
  299. xls.Tables[0].SetValue(2, 8, "string");
  300. xls.Tables[0].SetValue(2, 9, "string");
  301. xls.Tables[0].SetValue(2, 10, "string");
  302. xls.Tables[0].SetValue(2, 11, "int32");
  303. xls.Tables[0].SetValue(2, 12, "float");
  304. xls.Tables[0].SetValue(2, 13, "float");
  305. xls.Tables[0].SetValue(2, 14, "float");
  306. xls.Tables[0].SetValue(2, 15, "float");
  307. xls.Tables[0].SetValue(2, 16, "float");
  308. xls.Tables[0].SetValue(2, 17, "float");
  309. xls.Tables[0].SetValue(2, 18, "int32");
  310. xls.Tables[0].SetValue(2, 19, "int32");
  311. xls.Tables[0].SetValue(2, 20, "float");
  312. xls.Tables[0].SetValue(2, 21, "float");
  313. xls.Tables[0].SetValue(2, 22, "float");
  314. xls.Tables[0].SetValue(2, 23, "repeated string");
  315. xls.Tables[0].SetValue(2, 24, "int32");
  316. xls.Tables[0].SetValue(2, 25, "float");
  317. xls.Tables[0].SetValue(2, 26, "float");
  318. xls.Tables[0].SetValue(2, 27, "float");
  319. xls.Tables[0].SetValue(2, 28, "int32");
  320. xls.Tables[0].SetValue(2, 29, "int32");
  321. xls.Tables[0].SetValue(2, 30, "repeated string");
  322. xls.Tables[0].SetValue(2, 31, "int32");
  323. xls.Tables[0].SetValue(2, 32, "repeated string");
  324. xls.Tables[0].SetValue(2, 33, "repeated string");
  325. xls.Tables[0].SetValue(2, 34, "repeated int32");
  326. xls.Tables[0].SetValue(2, 35, "repeated int32");
  327. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  328. xls.Tables[0].SetValue(3, 5, "Default: 0");
  329. xls.Tables[0].SetValue(3, 23, "ListSpliter:\"#\"");
  330. xls.Tables[0].SetValue(3, 30, "ListSpliter:\"|\"");
  331. xls.Tables[0].SetValue(3, 32, "ListSpliter:\"|\"");
  332. xls.Tables[0].SetValue(3, 33, "ListSpliter:\"|\"");
  333. xls.Tables[0].SetValue(3, 34, "ListSpliter:\"#\"");
  334. xls.Tables[0].SetValue(3, 35, "ListSpliter:\"#\"");
  335. xls.Tables[0].SetValue(4, 1, "关卡ID");
  336. xls.Tables[0].SetValue(4, 30, "格式 ID:Type:Count,(Type: 0:金币1:女助手碎片2:武器碎片3:天赋点)");
  337. xls.Tables[0].SetValue(4, 32, "打开刚体,用|分隔每组,用&分隔破碎id和一系列刚体,刚体之间用;分隔");
  338. xls.Tables[0].SetValue(4, 33, "打开刚体,用|分隔每组,用&分隔破碎id和一系列刚体,刚体之间用;分隔");
  339. xls.Tables[0].SetValue(4, 34, "推荐的属性类别");
  340. xls.Tables[0].SetValue(4, 35, "推荐的属性值");
  341. int i = StartRow;
  342. foreach (var data in levelCfgs.Values)
  343. {
  344. ++i;
  345. xls.Tables[0].SetValue(i, 1, data.ID);
  346. xls.Tables[0].SetValue(i, 2, data.coinsStar1);
  347. xls.Tables[0].SetValue(i, 3, data.coinsStar2);
  348. xls.Tables[0].SetValue(i, 4, data.coinsStar3);
  349. xls.Tables[0].SetValue(i, 5, data.coinsBullet);
  350. xls.Tables[0].SetValue(i, 6, data.coinsCombo);
  351. xls.Tables[0].SetValue(i, 7, data.fittedWeapon);
  352. xls.Tables[0].SetValue(i, 8, data.roundTargetIds);
  353. xls.Tables[0].SetValue(i, 9, data.timeTargetPrice);
  354. xls.Tables[0].SetValue(i, 10, data.rewardedItems);
  355. xls.Tables[0].SetValue(i, 11, data.crownPower);
  356. xls.Tables[0].SetValue(i, 12, data.posX);
  357. xls.Tables[0].SetValue(i, 13, data.posY);
  358. xls.Tables[0].SetValue(i, 14, data.posZ);
  359. xls.Tables[0].SetValue(i, 15, data.rotX);
  360. xls.Tables[0].SetValue(i, 16, data.rotY);
  361. xls.Tables[0].SetValue(i, 17, data.rotZ);
  362. xls.Tables[0].SetValue(i, 18, data.gameType);
  363. xls.Tables[0].SetValue(i, 19, data.realID);
  364. xls.Tables[0].SetValue(i, 20, data.offsetX);
  365. xls.Tables[0].SetValue(i, 21, data.offsetY);
  366. xls.Tables[0].SetValue(i, 22, data.offsetZ);
  367. xls.Tables[0].SetValue(i, 23, ExchangeListString(data.attendAnims, "#"));
  368. xls.Tables[0].SetValue(i, 24, data.fov);
  369. xls.Tables[0].SetValue(i, 25, data.shadowPlane);
  370. xls.Tables[0].SetValue(i, 26, data.windMin);
  371. xls.Tables[0].SetValue(i, 27, data.windMax);
  372. xls.Tables[0].SetValue(i, 28, data.windChange);
  373. xls.Tables[0].SetValue(i, 29, data.dungonCondition);
  374. xls.Tables[0].SetValue(i, 30, ExchangeListString(data.dungonBattleRewards, "|"));
  375. xls.Tables[0].SetValue(i, 31, data.rankTargetScore);
  376. xls.Tables[0].SetValue(i, 32, ExchangeListString(data.openRigiBody, "|"));
  377. xls.Tables[0].SetValue(i, 33, ExchangeListString(data.moveRigiBody, "|"));
  378. xls.Tables[0].SetValue(i, 34, ExchangeListInt(data.AttributeTypeData, "#"));
  379. xls.Tables[0].SetValue(i, 35, ExchangeListInt(data.AttributeValueData, "#"));
  380. }
  381. AddTypeSheet(xls, xlsName);
  382. ExcelHelper.SaveExcel(xls, outputPath);
  383. }
  384. //public static void SaveDungonInfoData(string xlsPath, string xlsName, List<DungonInfoDefine> dungonInfoCfgs)
  385. //{
  386. // string outputPath = string.Format(dirPath, xlsPath, xlsName);
  387. // Excel xls = new Excel();
  388. // xls.AddTable(xlsName);
  389. // xls.Tables[0].SetValue(1, 1, "ID");
  390. // xls.Tables[0].SetValue(1, 2, "openNumber");
  391. // xls.Tables[0].SetValue(1, 3, "brokenNumber");
  392. // xls.Tables[0].SetValue(1, 4, "seeNumber");
  393. // xls.Tables[0].SetValue(1, 5, "posX");
  394. // xls.Tables[0].SetValue(1, 6, "posY");
  395. // xls.Tables[0].SetValue(1, 7, "posZ");
  396. // xls.Tables[0].SetValue(1, 8, "rowNum");
  397. // xls.Tables[0].SetValue(2, 1, "int32");
  398. // xls.Tables[0].SetValue(2, 2, "repeated int32");
  399. // xls.Tables[0].SetValue(2, 3, "repeated int32");
  400. // xls.Tables[0].SetValue(2, 4, "repeated int32");
  401. // xls.Tables[0].SetValue(2, 5, "float");
  402. // xls.Tables[0].SetValue(2, 6, "float");
  403. // xls.Tables[0].SetValue(2, 7, "float");
  404. // xls.Tables[0].SetValue(2, 8, "int32");
  405. // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  406. // xls.Tables[0].SetValue(3, 2, "ListSpliter:\"|\"");
  407. // xls.Tables[0].SetValue(3, 3, "ListSpliter:\"|\"");
  408. // xls.Tables[0].SetValue(3, 4, "ListSpliter:\"|\"");
  409. // xls.Tables[0].SetValue(3, 8, "Default: 0");
  410. // xls.Tables[0].SetValue(4, 1, "编号");
  411. // xls.Tables[0].SetValue(4, 2, "可打开的编号");
  412. // xls.Tables[0].SetValue(4, 3, "可破碎的编号");
  413. // xls.Tables[0].SetValue(4, 4, "可看到的编号");
  414. // xls.Tables[0].SetValue(4, 8, "所属行号");
  415. // int i = StartRow;
  416. // foreach (var data in dungonInfoCfgs)
  417. // {
  418. // ++i;
  419. // xls.Tables[0].SetValue(i, 1, data.ID);
  420. // xls.Tables[0].SetValue(i, 2, ExchangeListInt(data.openNumber, "|"));
  421. // xls.Tables[0].SetValue(i, 3, ExchangeListInt(data.brokenNumber, "|"));
  422. // xls.Tables[0].SetValue(i, 4, ExchangeListInt(data.seeNumber, "|"));
  423. // xls.Tables[0].SetValue(i, 5, data.posX);
  424. // xls.Tables[0].SetValue(i, 6, data.posY);
  425. // xls.Tables[0].SetValue(i, 7, data.posZ);
  426. // xls.Tables[0].SetValue(i, 8, 0);
  427. // }
  428. // AddTypeSheet(xls, xlsName);
  429. // ExcelHelper.SaveExcel(xls, outputPath);
  430. //}
  431. //public static void SaveDungonMapData(string xlsPath, string xlsName, Dictionary<int, DungonMapEditor.DungonMapParam> dungonMapCfgs)
  432. //{
  433. // string outputPath = string.Format(dirPath, xlsPath, xlsName);
  434. // Excel xls = new Excel();
  435. // xls.AddTable(xlsName);
  436. // xls.Tables[0].SetValue(1, 1, "ID");
  437. // xls.Tables[0].SetValue(1, 2, "mapContent");
  438. // xls.Tables[0].SetValue(1, 3, "backgroundHeight");
  439. // xls.Tables[0].SetValue(2, 1, "int32");
  440. // xls.Tables[0].SetValue(2, 2, "repeated int32");
  441. // xls.Tables[0].SetValue(2, 3, "int32");
  442. // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  443. // xls.Tables[0].SetValue(3, 2, "ListSpliter:\"|\"");
  444. // xls.Tables[0].SetValue(4, 1, "阵型id");
  445. // xls.Tables[0].SetValue(4, 2, "阵型的内容用|分隔");
  446. // xls.Tables[0].SetValue(4, 3, "背景的高度");
  447. // int i = StartRow;
  448. // foreach (var data in dungonMapCfgs)
  449. // {
  450. // ++i;
  451. // xls.Tables[0].SetValue(i, 1, data.Key);
  452. // xls.Tables[0].SetValue(i, 2, data.Value.content);
  453. // xls.Tables[0].SetValue(i, 3, data.Value.height);
  454. // }
  455. // AddTypeSheet(xls, xlsName);
  456. // ExcelHelper.SaveExcel(xls, outputPath);
  457. //}
  458. //public static void SaveRankRobotData(string xlsPath, string xlsName, Dictionary<int, RankingDataEditor.RankRobotData> rankRobotDatas)
  459. //{
  460. // string outputPath = string.Format(dirPath, xlsPath, xlsName);
  461. // Excel xls = new Excel();
  462. // xls.AddTable(xlsName);
  463. // xls.Tables[0].SetValue(1, 1, "id");
  464. // xls.Tables[0].SetValue(1, 2, "robotName");
  465. // xls.Tables[0].SetValue(1, 3, "robotSerNum");
  466. // xls.Tables[0].SetValue(1, 4, "robotCountry");
  467. // xls.Tables[0].SetValue(1, 5, "robotstep");
  468. // xls.Tables[0].SetValue(1, 6, "stepCount");
  469. // xls.Tables[0].SetValue(1, 7, "periodNum");
  470. // xls.Tables[0].SetValue(1, 8, "baseTime");
  471. // xls.Tables[0].SetValue(2, 1, "int32");
  472. // xls.Tables[0].SetValue(2, 2, "string");
  473. // xls.Tables[0].SetValue(2, 3, "string");
  474. // xls.Tables[0].SetValue(2, 4, "string");
  475. // xls.Tables[0].SetValue(2, 5, "int32");
  476. // xls.Tables[0].SetValue(2, 6, "int32");
  477. // xls.Tables[0].SetValue(2, 7, "int32");
  478. // xls.Tables[0].SetValue(2, 8, "int32");
  479. // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  480. // xls.Tables[0].SetValue(4, 1, "ID");
  481. // xls.Tables[0].SetValue(4, 2, "机器人名称");
  482. // xls.Tables[0].SetValue(4, 3, "机器人的序列号");
  483. // xls.Tables[0].SetValue(4, 4, "机器人国家");
  484. // xls.Tables[0].SetValue(4, 5, "机器人步长");
  485. // xls.Tables[0].SetValue(4, 6, "步长次数");
  486. // xls.Tables[0].SetValue(4, 7, "所属号段");
  487. // xls.Tables[0].SetValue(4, 8, "基础时间");
  488. // int i = StartRow;
  489. // foreach (var data in rankRobotDatas)
  490. // {
  491. // ++i;
  492. // xls.Tables[0].SetValue(i, 1, data.Key);
  493. // xls.Tables[0].SetValue(i, 3, data.Value.robotSerNum);
  494. // xls.Tables[0].SetValue(i, 4, data.Value.robotCountry);
  495. // xls.Tables[0].SetValue(i, 7, data.Value.periodNum);
  496. // xls.Tables[0].SetValue(i, 8, data.Value.baseTime);
  497. // }
  498. // AddTypeSheet(xls, xlsName);
  499. // ExcelHelper.SaveExcel(xls, outputPath);
  500. //}
  501. public static void SaveTestPracticleData(string xlsPath, string xlsName, List<EffectReport> reports)
  502. {
  503. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  504. Excel xls = new Excel();
  505. xls.AddTable(xlsName);
  506. xls.Tables[0].SetValue(1, 1, "effectName");
  507. xls.Tables[0].SetValue(1, 2, "fpsNum");
  508. xls.Tables[0].SetValue(1, 3, "loadTime");
  509. xls.Tables[0].SetValue(1, 4, "createTime");
  510. xls.Tables[0].SetValue(1, 5, "minRenderTime");
  511. xls.Tables[0].SetValue(1, 6, "maxRenderTime");
  512. xls.Tables[0].SetValue(1, 7, "topFramesAvgRenderTime");
  513. xls.Tables[0].SetValue(1, 8, "maxRenderOccurTime");
  514. xls.Tables[0].SetValue(1, 9, "activeRenderCount");
  515. xls.Tables[0].SetValue(1, 10, "totalPsCount");
  516. xls.Tables[0].SetValue(1, 11, "materialCount");
  517. xls.Tables[0].SetValue(1, 12, "maxParticleCount");
  518. xls.Tables[0].SetValue(1, 13, "texMemBytes");
  519. xls.Tables[0].SetValue(1, 14, "texMemCount");
  520. xls.Tables[0].SetValue(2, 1, "特效名称");
  521. xls.Tables[0].SetValue(2, 2, "帧数");
  522. xls.Tables[0].SetValue(2, 3, "加载时间(毫秒)");
  523. xls.Tables[0].SetValue(2, 4, "实例化时间(毫秒)");
  524. xls.Tables[0].SetValue(2, 5, "最小渲染时间");
  525. xls.Tables[0].SetValue(2, 6, "最大渲染时间");
  526. xls.Tables[0].SetValue(2, 7, "duration内N帧的平均时间");
  527. xls.Tables[0].SetValue(2, 8, "最耗时的一帧发生在第几秒");
  528. xls.Tables[0].SetValue(2, 9, "激活的渲染器数量");
  529. xls.Tables[0].SetValue(2, 10, "粒子系统数量(只统计激活的)");
  530. xls.Tables[0].SetValue(2, 11, "材质数量");
  531. xls.Tables[0].SetValue(2, 12, "最大粒子数量");
  532. xls.Tables[0].SetValue(2, 13, "贴图大小(KB)");
  533. xls.Tables[0].SetValue(2, 14, "贴图数量");
  534. int i = StartRow;
  535. foreach (var data in reports)
  536. {
  537. ++i;
  538. xls.Tables[0].SetValue(i, 1, data.effectName);
  539. xls.Tables[0].SetValue(i, 2, data.fpsNum);
  540. xls.Tables[0].SetValue(i, 3, data.loadTime);
  541. xls.Tables[0].SetValue(i, 4, data.createTime);
  542. xls.Tables[0].SetValue(i, 5, data.minRenderTime);
  543. xls.Tables[0].SetValue(i, 6, data.maxRenderTime);
  544. xls.Tables[0].SetValue(i, 7, data.topFramesAvgRenderTime);
  545. xls.Tables[0].SetValue(i, 8, data.maxRenderOccurTime);
  546. xls.Tables[0].SetValue(i, 9, data.activeRenderCount);
  547. xls.Tables[0].SetValue(i, 10, data.totalPsCount);
  548. xls.Tables[0].SetValue(i, 11, data.materialCount);
  549. xls.Tables[0].SetValue(i, 12, data.maxParticleCount);
  550. xls.Tables[0].SetValue(i, 13, data.texMemBytes);
  551. xls.Tables[0].SetValue(i, 14, data.texMemCount);
  552. }
  553. ExcelHelper.SaveExcel(xls, outputPath);
  554. }
  555. }