using Excel4Unity; using JamesGame; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using UnityEngine; public class DataWriter { private const int StartRow = 4; private static string dirPath = "{0}tables/{1}.xlsx"; private static void AddTypeSheet(Excel xls, string xlsName) { xls.AddTable("@Types"); xls.Tables[1].SetValue(1, 1, string.Format("TableName: \"{0}\" Package: \"JamesGame\"", xlsName)); } public static string ExchangeListInt(List list, string sep) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.Count; ++i) { sb.Append(list[i]); if (i != list.Count - 1) { sb.Append(sep); } } return sb.ToString(); } public static string ExchangeListString(List list, string sep) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.Count; ++i) { sb.Append(list[i]); if (i != list.Count - 1) { sb.Append(sep); } } return sb.ToString(); } public static string ExchangeListFloat(List list, string sep) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.Count; ++i) { sb.Append(list[i]); if (i != list.Count - 1) { sb.Append(sep); } } return sb.ToString(); } public static void SaveChallengeData(string xlsPath, string xlsName, Dictionary challengeDataCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "FieldID"); xls.Tables[0].SetValue(1, 3, "DecStaminaCnt"); xls.Tables[0].SetValue(1, 4, "ConstraintType"); xls.Tables[0].SetValue(1, 5, "ConstraintValue"); xls.Tables[0].SetValue(1, 6, "Condition"); xls.Tables[0].SetValue(1, 7, "Reward_ID_1"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "int32"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(2, 4, "int32"); xls.Tables[0].SetValue(2, 5, "int32"); xls.Tables[0].SetValue(2, 6, "repeated int32"); xls.Tables[0].SetValue(2, 7, "int32"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(3, 6, "ListSpliter:\"#\""); xls.Tables[0].SetValue(3, 7, "Default: 0"); xls.Tables[0].SetValue(4, 1, "关卡ID"); int i = StartRow; foreach (var data in challengeDataCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.FieldID); xls.Tables[0].SetValue(i, 3, data.DecStaminaCnt); xls.Tables[0].SetValue(i, 4, data.ConstraintType); xls.Tables[0].SetValue(i, 5, data.ConstraintValue); xls.Tables[0].SetValue(i, 6, ExchangeListInt(data.Condition, "#")); xls.Tables[0].SetValue(i, 7, data.Reward_ID_1); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } public static void SaveFieldData(string xlsPath, string xlsName, Dictionary fieldDataCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "RoundFactorGroupID"); xls.Tables[0].SetValue(1, 3, "FieldShapeID"); xls.Tables[0].SetValue(1, 4, "DefaultPlayerPos"); xls.Tables[0].SetValue(1, 5, "Mark"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "int32"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(2, 4, "repeated int32"); xls.Tables[0].SetValue(2, 5, "string"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(3, 4, "ListSpliter:\"|\""); xls.Tables[0].SetValue(4, 1, "关卡ID"); int i = StartRow; foreach (var data in fieldDataCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.RoundFactorGroupID); xls.Tables[0].SetValue(i, 3, data.FieldShapeID); xls.Tables[0].SetValue(i, 4, ExchangeListInt(data.DefaultPlayerPos, "|")); xls.Tables[0].SetValue(i, 5, data.Mark); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } public static void SaveTargetData(string xlsPath, string xlsName, Dictionary targetDataCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "ResourceName"); xls.Tables[0].SetValue(1, 3, "Life"); xls.Tables[0].SetValue(1, 4, "CtrlAniFileName"); xls.Tables[0].SetValue(1, 5, "Attrib"); xls.Tables[0].SetValue(1, 6, "CtrlAniStartDelay"); xls.Tables[0].SetValue(1, 7, "Child"); xls.Tables[0].SetValue(1, 8, "cNode"); xls.Tables[0].SetValue(1, 9, "Material"); xls.Tables[0].SetValue(1, 10, "Hit"); xls.Tables[0].SetValue(1, 11, "Death"); xls.Tables[0].SetValue(1, 12, "CtrlAniSpeed"); xls.Tables[0].SetValue(1, 13, "Scale"); xls.Tables[0].SetValue(1, 14, "DieRule"); xls.Tables[0].SetValue(1, 15, "ReID"); xls.Tables[0].SetValue(1, 16, "TargetPos"); xls.Tables[0].SetValue(1, 17, "TargetRot"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "string"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(2, 4, "string"); xls.Tables[0].SetValue(2, 5, "int32"); xls.Tables[0].SetValue(2, 6, "float"); xls.Tables[0].SetValue(2, 7, "string"); xls.Tables[0].SetValue(2, 8, "string"); xls.Tables[0].SetValue(2, 9, "int32"); xls.Tables[0].SetValue(2, 10, "string"); xls.Tables[0].SetValue(2, 11, "string"); xls.Tables[0].SetValue(2, 12, "float"); xls.Tables[0].SetValue(2, 13, "float"); xls.Tables[0].SetValue(2, 14, "int32"); xls.Tables[0].SetValue(2, 15, "int32"); xls.Tables[0].SetValue(2, 16, "repeated float"); xls.Tables[0].SetValue(2, 17, "repeated float"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(3, 16, "ListSpliter:\"|\""); xls.Tables[0].SetValue(3, 17, "ListSpliter:\"|\""); xls.Tables[0].SetValue(4, 1, "关卡ID"); int i = StartRow; foreach (var data in targetDataCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.ResourceName); xls.Tables[0].SetValue(i, 3, data.Life); xls.Tables[0].SetValue(i, 4, data.CtrlAniFileName.Equals("none")?"": data.CtrlAniFileName); xls.Tables[0].SetValue(i, 5, data.Attrib); xls.Tables[0].SetValue(i, 6, data.CtrlAniStartDelay); xls.Tables[0].SetValue(i, 7, data.Child.Equals("none")?"": data.Child); xls.Tables[0].SetValue(i, 8, data.cNode.Equals("none")?"" : data.cNode); xls.Tables[0].SetValue(i, 9, data.Material); xls.Tables[0].SetValue(i, 10, data.Hit.Equals("none")?"": data.Hit); xls.Tables[0].SetValue(i, 11, data.Death.Equals("none")?"" : data.Death); xls.Tables[0].SetValue(i, 12, data.CtrlAniSpeed); xls.Tables[0].SetValue(i, 13, data.Scale); xls.Tables[0].SetValue(i, 14, data.DieRule); xls.Tables[0].SetValue(i, 15, data.ReID); xls.Tables[0].SetValue(i, 16, ExchangeListFloat(data.TargetPos, "|")); xls.Tables[0].SetValue(i, 17, ExchangeListFloat(data.TargetRot, "|")); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } public static void SaveTargetGroupData(string xlsPath, string xlsName, Dictionary targetGroupCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "GroupID"); xls.Tables[0].SetValue(1, 3, "TargetID"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "int32"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(4, 1, "关卡ID"); int i = StartRow; foreach (var data in targetGroupCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.GroupID); xls.Tables[0].SetValue(i, 3, data.TargetID); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } public static void SaveFieldShapeData(string xlsPath, string xlsName, Dictionary fieldShapeCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "ResourceName"); xls.Tables[0].SetValue(1, 3, "EnvSoundName"); xls.Tables[0].SetValue(1, 4, "EnvParticleName"); xls.Tables[0].SetValue(1, 5, "AttendAnim"); xls.Tables[0].SetValue(1, 6, "LoadMethod"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "string"); xls.Tables[0].SetValue(2, 3, "string"); xls.Tables[0].SetValue(2, 4, "string"); xls.Tables[0].SetValue(2, 5, "repeated string"); xls.Tables[0].SetValue(2, 6, "int32"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(3, 5, "ListSpliter:\"#\""); xls.Tables[0].SetValue(4, 1, "关卡ID"); xls.Tables[0].SetValue(4, 5, "开场动画,多选一"); int i = StartRow; foreach (var data in fieldShapeCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.ResourceName); xls.Tables[0].SetValue(i, 3, data.EnvSoundName); xls.Tables[0].SetValue(i, 4, data.EnvParticleName); xls.Tables[0].SetValue(i, 5, ExchangeListString(data.AttendAnim, "#")); xls.Tables[0].SetValue(i, 6, data.LoadMethod); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } public static void SaveLevelData(string xlsPath, string xlsName, Dictionary levelCfgs) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "coinsStar1"); xls.Tables[0].SetValue(1, 3, "coinsStar2"); xls.Tables[0].SetValue(1, 4, "coinsStar3"); xls.Tables[0].SetValue(1, 5, "coinsBullet"); xls.Tables[0].SetValue(1, 6, "coinsCombo"); xls.Tables[0].SetValue(1, 7, "fittedWeapon"); xls.Tables[0].SetValue(1, 8, "roundTargetIds"); xls.Tables[0].SetValue(1, 9, "timeTargetPrice"); xls.Tables[0].SetValue(1, 10, "rewardedItems"); xls.Tables[0].SetValue(1, 11, "crownPower"); xls.Tables[0].SetValue(1, 12, "posX"); xls.Tables[0].SetValue(1, 13, "posY"); xls.Tables[0].SetValue(1, 14, "posZ"); xls.Tables[0].SetValue(1, 15, "rotX"); xls.Tables[0].SetValue(1, 16, "rotY"); xls.Tables[0].SetValue(1, 17, "rotZ"); xls.Tables[0].SetValue(1, 18, "gameType"); xls.Tables[0].SetValue(1, 19, "realID"); xls.Tables[0].SetValue(1, 20, "offsetX"); xls.Tables[0].SetValue(1, 21, "offsetY"); xls.Tables[0].SetValue(1, 22, "offsetZ"); xls.Tables[0].SetValue(1, 23, "attendAnims"); xls.Tables[0].SetValue(1, 24, "fov"); xls.Tables[0].SetValue(1, 25, "shadowPlane"); xls.Tables[0].SetValue(1, 26, "windMin"); xls.Tables[0].SetValue(1, 27, "windMax"); xls.Tables[0].SetValue(1, 28, "windChange"); xls.Tables[0].SetValue(1, 29, "dungonCondition"); xls.Tables[0].SetValue(1, 30, "dungonBattleRewards"); xls.Tables[0].SetValue(1, 31, "rankTargetScore"); xls.Tables[0].SetValue(1, 32, "openRigiBody"); xls.Tables[0].SetValue(1, 33, "moveRigiBody"); xls.Tables[0].SetValue(1, 34, "AttributeTypeData"); xls.Tables[0].SetValue(1, 35, "AttributeValueData"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "int32"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(2, 4, "int32"); xls.Tables[0].SetValue(2, 5, "int32"); xls.Tables[0].SetValue(2, 6, "int32"); xls.Tables[0].SetValue(2, 7, "int32"); xls.Tables[0].SetValue(2, 8, "string"); xls.Tables[0].SetValue(2, 9, "string"); xls.Tables[0].SetValue(2, 10, "string"); xls.Tables[0].SetValue(2, 11, "int32"); xls.Tables[0].SetValue(2, 12, "float"); xls.Tables[0].SetValue(2, 13, "float"); xls.Tables[0].SetValue(2, 14, "float"); xls.Tables[0].SetValue(2, 15, "float"); xls.Tables[0].SetValue(2, 16, "float"); xls.Tables[0].SetValue(2, 17, "float"); xls.Tables[0].SetValue(2, 18, "int32"); xls.Tables[0].SetValue(2, 19, "int32"); xls.Tables[0].SetValue(2, 20, "float"); xls.Tables[0].SetValue(2, 21, "float"); xls.Tables[0].SetValue(2, 22, "float"); xls.Tables[0].SetValue(2, 23, "repeated string"); xls.Tables[0].SetValue(2, 24, "int32"); xls.Tables[0].SetValue(2, 25, "float"); xls.Tables[0].SetValue(2, 26, "float"); xls.Tables[0].SetValue(2, 27, "float"); xls.Tables[0].SetValue(2, 28, "int32"); xls.Tables[0].SetValue(2, 29, "int32"); xls.Tables[0].SetValue(2, 30, "repeated string"); xls.Tables[0].SetValue(2, 31, "int32"); xls.Tables[0].SetValue(2, 32, "repeated string"); xls.Tables[0].SetValue(2, 33, "repeated string"); xls.Tables[0].SetValue(2, 34, "repeated int32"); xls.Tables[0].SetValue(2, 35, "repeated int32"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(3, 5, "Default: 0"); xls.Tables[0].SetValue(3, 23, "ListSpliter:\"#\""); xls.Tables[0].SetValue(3, 30, "ListSpliter:\"|\""); xls.Tables[0].SetValue(3, 32, "ListSpliter:\"|\""); xls.Tables[0].SetValue(3, 33, "ListSpliter:\"|\""); xls.Tables[0].SetValue(3, 34, "ListSpliter:\"#\""); xls.Tables[0].SetValue(3, 35, "ListSpliter:\"#\""); xls.Tables[0].SetValue(4, 1, "关卡ID"); xls.Tables[0].SetValue(4, 30, "格式 ID:Type:Count,(Type: 0:金币1:女助手碎片2:武器碎片3:天赋点)"); xls.Tables[0].SetValue(4, 32, "打开刚体,用|分隔每组,用&分隔破碎id和一系列刚体,刚体之间用;分隔"); xls.Tables[0].SetValue(4, 33, "打开刚体,用|分隔每组,用&分隔破碎id和一系列刚体,刚体之间用;分隔"); xls.Tables[0].SetValue(4, 34, "推荐的属性类别"); xls.Tables[0].SetValue(4, 35, "推荐的属性值"); int i = StartRow; foreach (var data in levelCfgs.Values) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.coinsStar1); xls.Tables[0].SetValue(i, 3, data.coinsStar2); xls.Tables[0].SetValue(i, 4, data.coinsStar3); xls.Tables[0].SetValue(i, 5, data.coinsBullet); xls.Tables[0].SetValue(i, 6, data.coinsCombo); xls.Tables[0].SetValue(i, 7, data.fittedWeapon); xls.Tables[0].SetValue(i, 8, data.roundTargetIds); xls.Tables[0].SetValue(i, 9, data.timeTargetPrice); xls.Tables[0].SetValue(i, 10, data.rewardedItems); xls.Tables[0].SetValue(i, 11, data.crownPower); xls.Tables[0].SetValue(i, 12, data.posX); xls.Tables[0].SetValue(i, 13, data.posY); xls.Tables[0].SetValue(i, 14, data.posZ); xls.Tables[0].SetValue(i, 15, data.rotX); xls.Tables[0].SetValue(i, 16, data.rotY); xls.Tables[0].SetValue(i, 17, data.rotZ); xls.Tables[0].SetValue(i, 18, data.gameType); xls.Tables[0].SetValue(i, 19, data.realID); xls.Tables[0].SetValue(i, 20, data.offsetX); xls.Tables[0].SetValue(i, 21, data.offsetY); xls.Tables[0].SetValue(i, 22, data.offsetZ); xls.Tables[0].SetValue(i, 23, ExchangeListString(data.attendAnims, "#")); xls.Tables[0].SetValue(i, 24, data.fov); xls.Tables[0].SetValue(i, 25, data.shadowPlane); xls.Tables[0].SetValue(i, 26, data.windMin); xls.Tables[0].SetValue(i, 27, data.windMax); xls.Tables[0].SetValue(i, 28, data.windChange); xls.Tables[0].SetValue(i, 29, data.dungonCondition); xls.Tables[0].SetValue(i, 30, ExchangeListString(data.dungonBattleRewards, "|")); xls.Tables[0].SetValue(i, 31, data.rankTargetScore); xls.Tables[0].SetValue(i, 32, ExchangeListString(data.openRigiBody, "|")); xls.Tables[0].SetValue(i, 33, ExchangeListString(data.moveRigiBody, "|")); xls.Tables[0].SetValue(i, 34, ExchangeListInt(data.AttributeTypeData, "#")); xls.Tables[0].SetValue(i, 35, ExchangeListInt(data.AttributeValueData, "#")); } AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } //public static void SaveDungonInfoData(string xlsPath, string xlsName, List dungonInfoCfgs) //{ // string outputPath = string.Format(dirPath, xlsPath, xlsName); // Excel xls = new Excel(); // xls.AddTable(xlsName); // xls.Tables[0].SetValue(1, 1, "ID"); // xls.Tables[0].SetValue(1, 2, "openNumber"); // xls.Tables[0].SetValue(1, 3, "brokenNumber"); // xls.Tables[0].SetValue(1, 4, "seeNumber"); // xls.Tables[0].SetValue(1, 5, "posX"); // xls.Tables[0].SetValue(1, 6, "posY"); // xls.Tables[0].SetValue(1, 7, "posZ"); // xls.Tables[0].SetValue(1, 8, "rowNum"); // xls.Tables[0].SetValue(2, 1, "int32"); // xls.Tables[0].SetValue(2, 2, "repeated int32"); // xls.Tables[0].SetValue(2, 3, "repeated int32"); // xls.Tables[0].SetValue(2, 4, "repeated int32"); // xls.Tables[0].SetValue(2, 5, "float"); // xls.Tables[0].SetValue(2, 6, "float"); // xls.Tables[0].SetValue(2, 7, "float"); // xls.Tables[0].SetValue(2, 8, "int32"); // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); // xls.Tables[0].SetValue(3, 2, "ListSpliter:\"|\""); // xls.Tables[0].SetValue(3, 3, "ListSpliter:\"|\""); // xls.Tables[0].SetValue(3, 4, "ListSpliter:\"|\""); // xls.Tables[0].SetValue(3, 8, "Default: 0"); // xls.Tables[0].SetValue(4, 1, "编号"); // xls.Tables[0].SetValue(4, 2, "可打开的编号"); // xls.Tables[0].SetValue(4, 3, "可破碎的编号"); // xls.Tables[0].SetValue(4, 4, "可看到的编号"); // xls.Tables[0].SetValue(4, 8, "所属行号"); // int i = StartRow; // foreach (var data in dungonInfoCfgs) // { // ++i; // xls.Tables[0].SetValue(i, 1, data.ID); // xls.Tables[0].SetValue(i, 2, ExchangeListInt(data.openNumber, "|")); // xls.Tables[0].SetValue(i, 3, ExchangeListInt(data.brokenNumber, "|")); // xls.Tables[0].SetValue(i, 4, ExchangeListInt(data.seeNumber, "|")); // xls.Tables[0].SetValue(i, 5, data.posX); // xls.Tables[0].SetValue(i, 6, data.posY); // xls.Tables[0].SetValue(i, 7, data.posZ); // xls.Tables[0].SetValue(i, 8, 0); // } // AddTypeSheet(xls, xlsName); // ExcelHelper.SaveExcel(xls, outputPath); //} //public static void SaveDungonMapData(string xlsPath, string xlsName, Dictionary dungonMapCfgs) //{ // string outputPath = string.Format(dirPath, xlsPath, xlsName); // Excel xls = new Excel(); // xls.AddTable(xlsName); // xls.Tables[0].SetValue(1, 1, "ID"); // xls.Tables[0].SetValue(1, 2, "mapContent"); // xls.Tables[0].SetValue(1, 3, "backgroundHeight"); // xls.Tables[0].SetValue(2, 1, "int32"); // xls.Tables[0].SetValue(2, 2, "repeated int32"); // xls.Tables[0].SetValue(2, 3, "int32"); // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); // xls.Tables[0].SetValue(3, 2, "ListSpliter:\"|\""); // xls.Tables[0].SetValue(4, 1, "阵型id"); // xls.Tables[0].SetValue(4, 2, "阵型的内容用|分隔"); // xls.Tables[0].SetValue(4, 3, "背景的高度"); // int i = StartRow; // foreach (var data in dungonMapCfgs) // { // ++i; // xls.Tables[0].SetValue(i, 1, data.Key); // xls.Tables[0].SetValue(i, 2, data.Value.content); // xls.Tables[0].SetValue(i, 3, data.Value.height); // } // AddTypeSheet(xls, xlsName); // ExcelHelper.SaveExcel(xls, outputPath); //} //public static void SaveRankRobotData(string xlsPath, string xlsName, Dictionary rankRobotDatas) //{ // string outputPath = string.Format(dirPath, xlsPath, xlsName); // Excel xls = new Excel(); // xls.AddTable(xlsName); // xls.Tables[0].SetValue(1, 1, "id"); // xls.Tables[0].SetValue(1, 2, "robotName"); // xls.Tables[0].SetValue(1, 3, "robotSerNum"); // xls.Tables[0].SetValue(1, 4, "robotCountry"); // xls.Tables[0].SetValue(1, 5, "robotstep"); // xls.Tables[0].SetValue(1, 6, "stepCount"); // xls.Tables[0].SetValue(1, 7, "periodNum"); // xls.Tables[0].SetValue(1, 8, "baseTime"); // xls.Tables[0].SetValue(2, 1, "int32"); // xls.Tables[0].SetValue(2, 2, "string"); // xls.Tables[0].SetValue(2, 3, "string"); // xls.Tables[0].SetValue(2, 4, "string"); // xls.Tables[0].SetValue(2, 5, "int32"); // xls.Tables[0].SetValue(2, 6, "int32"); // xls.Tables[0].SetValue(2, 7, "int32"); // xls.Tables[0].SetValue(2, 8, "int32"); // xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); // xls.Tables[0].SetValue(4, 1, "ID"); // xls.Tables[0].SetValue(4, 2, "机器人名称"); // xls.Tables[0].SetValue(4, 3, "机器人的序列号"); // xls.Tables[0].SetValue(4, 4, "机器人国家"); // xls.Tables[0].SetValue(4, 5, "机器人步长"); // xls.Tables[0].SetValue(4, 6, "步长次数"); // xls.Tables[0].SetValue(4, 7, "所属号段"); // xls.Tables[0].SetValue(4, 8, "基础时间"); // int i = StartRow; // foreach (var data in rankRobotDatas) // { // ++i; // xls.Tables[0].SetValue(i, 1, data.Key); // xls.Tables[0].SetValue(i, 3, data.Value.robotSerNum); // xls.Tables[0].SetValue(i, 4, data.Value.robotCountry); // xls.Tables[0].SetValue(i, 7, data.Value.periodNum); // xls.Tables[0].SetValue(i, 8, data.Value.baseTime); // } // AddTypeSheet(xls, xlsName); // ExcelHelper.SaveExcel(xls, outputPath); //} public static void SaveTestPracticleData(string xlsPath, string xlsName, List reports) { string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "effectName"); xls.Tables[0].SetValue(1, 2, "fpsNum"); xls.Tables[0].SetValue(1, 3, "loadTime"); xls.Tables[0].SetValue(1, 4, "createTime"); xls.Tables[0].SetValue(1, 5, "minRenderTime"); xls.Tables[0].SetValue(1, 6, "maxRenderTime"); xls.Tables[0].SetValue(1, 7, "topFramesAvgRenderTime"); xls.Tables[0].SetValue(1, 8, "maxRenderOccurTime"); xls.Tables[0].SetValue(1, 9, "activeRenderCount"); xls.Tables[0].SetValue(1, 10, "totalPsCount"); xls.Tables[0].SetValue(1, 11, "materialCount"); xls.Tables[0].SetValue(1, 12, "maxParticleCount"); xls.Tables[0].SetValue(1, 13, "texMemBytes"); xls.Tables[0].SetValue(1, 14, "texMemCount"); xls.Tables[0].SetValue(2, 1, "特效名称"); xls.Tables[0].SetValue(2, 2, "帧数"); xls.Tables[0].SetValue(2, 3, "加载时间(毫秒)"); xls.Tables[0].SetValue(2, 4, "实例化时间(毫秒)"); xls.Tables[0].SetValue(2, 5, "最小渲染时间"); xls.Tables[0].SetValue(2, 6, "最大渲染时间"); xls.Tables[0].SetValue(2, 7, "duration内N帧的平均时间"); xls.Tables[0].SetValue(2, 8, "最耗时的一帧发生在第几秒"); xls.Tables[0].SetValue(2, 9, "激活的渲染器数量"); xls.Tables[0].SetValue(2, 10, "粒子系统数量(只统计激活的)"); xls.Tables[0].SetValue(2, 11, "材质数量"); xls.Tables[0].SetValue(2, 12, "最大粒子数量"); xls.Tables[0].SetValue(2, 13, "贴图大小(KB)"); xls.Tables[0].SetValue(2, 14, "贴图数量"); int i = StartRow; foreach (var data in reports) { ++i; xls.Tables[0].SetValue(i, 1, data.effectName); xls.Tables[0].SetValue(i, 2, data.fpsNum); xls.Tables[0].SetValue(i, 3, data.loadTime); xls.Tables[0].SetValue(i, 4, data.createTime); xls.Tables[0].SetValue(i, 5, data.minRenderTime); xls.Tables[0].SetValue(i, 6, data.maxRenderTime); xls.Tables[0].SetValue(i, 7, data.topFramesAvgRenderTime); xls.Tables[0].SetValue(i, 8, data.maxRenderOccurTime); xls.Tables[0].SetValue(i, 9, data.activeRenderCount); xls.Tables[0].SetValue(i, 10, data.totalPsCount); xls.Tables[0].SetValue(i, 11, data.materialCount); xls.Tables[0].SetValue(i, 12, data.maxParticleCount); xls.Tables[0].SetValue(i, 13, data.texMemBytes); xls.Tables[0].SetValue(i, 14, data.texMemCount); } ExcelHelper.SaveExcel(xls, outputPath); } }