public static List <Buff> SelectBuffTable() { string sheetName = "Buff"; DataRowCollection collect = ExcelAccess.ReadExcel(excelName, 2); List <Buff> BuffArray = new List <Buff>(); for (int i = 1; i < collect.Count; i++) { if (collect[i][1].ToString() == "") { continue; } Buff buff = new Buff() { Objindex = new ObjectIndex() { Id = Convert.ToInt32(collect[i][0].ToString()), Name = collect[i][1].ToString(), Comments = collect[i][2].ToString(), }, Buffshow = Resources.Load <Sprite>("Item/" + Convert.ToInt32(collect[i][0].ToString())), IsRecover = (bool)collect[i][4], IsInterruptible = (bool)collect[i][5], EffectRecoverP = new StatsIntime() { HpI = Convert.ToSingle(collect[i][6].ToString()), MpI = Convert.ToSingle(collect[i][7].ToString()), MgI = Convert.ToSingle(collect[i][8].ToString()), }, EffectStats = new StatsBase() { HpM = Convert.ToSingle(collect[i][9].ToString()), HpR = Convert.ToSingle(collect[i][10].ToString()), Atk = Convert.ToSingle(collect[i][11].ToString()), NAtk = Convert.ToSingle(collect[i][12].ToString()), FAtk = Convert.ToSingle(collect[i][13].ToString()), Def = Convert.ToSingle(collect[i][14].ToString()), SpdM = Convert.ToSingle(collect[i][15].ToString()), SpdA = Convert.ToSingle(collect[i][16].ToString()), MpM = Convert.ToInt32(collect[i][17].ToString()), MpR = Convert.ToInt32(collect[i][18].ToString()), CritP = Convert.ToSingle(collect[i][19].ToString()), CritM = Convert.ToSingle(collect[i][20].ToString()), MgM = Convert.ToSingle(collect[i][21].ToString()), }, EffectTime = Convert.ToInt32(collect[i][22].ToString()), }; BuffArray.Add(buff); } return(BuffArray); }
//查询PropEnternal表 public static List <PropEnternal> SelectPropEnternalTable() { string sheetName = "PropEnternal"; DataRowCollection collect = ExcelAccess.ReadExcel(excelName, 0); List <PropEnternal> propEArray = new List <PropEnternal>(); for (int i = 1; i < collect.Count; i++) { if (collect[i][1].ToString() == "") { continue; } PropEnternal PropE = new PropEnternal { Objindex = new ObjectIndex() { Id = Convert.ToInt32(collect[i][0].ToString()), Name = collect[i][1].ToString(), Comments = collect[i][2].ToString(), }, Itemtype = ItemType.Properties, Price = Convert.ToInt32(collect[i][3].ToString()), IsMarketable = Convert.ToBoolean(collect[i][4].ToString()), Bagshow = Resources.Load <Sprite>("Item/" + Convert.ToInt32(collect[i][0].ToString())), PProperties = new StatsBase() { HpM = Convert.ToSingle(collect[i][6].ToString()), HpR = Convert.ToSingle(collect[i][7].ToString()), Atk = Convert.ToSingle(collect[i][8].ToString()), NAtk = Convert.ToSingle(collect[i][9].ToString()), FAtk = Convert.ToSingle(collect[i][10].ToString()), Def = Convert.ToSingle(collect[i][11].ToString()), SpdM = Convert.ToSingle(collect[i][12].ToString()), SpdA = Convert.ToSingle(collect[i][13].ToString()), MpM = Convert.ToInt32(collect[i][14].ToString()), MpR = Convert.ToInt32(collect[i][15].ToString()), CritP = Convert.ToSingle(collect[i][16].ToString()), CritM = Convert.ToSingle(collect[i][17].ToString()), MgM = Convert.ToSingle(collect[i][18].ToString()), } /*m_Id = collect[i][0].ToString(), * m_level = collect[i][1].ToString(), * m_parentId = collect[i][2].ToString(), * m_name = collect[i][3].ToString()*/ }; propEArray.Add(PropE); } return(propEArray); }
public static List <PropRecover> SelectPropRecoverTable() { string sheetName = "PropRecover"; DataRowCollection collect = ExcelAccess.ReadExcel(excelName, 1); List <PropRecover> PropRArray = new List <PropRecover>(); for (int i = 1; i < collect.Count; i++) { if (collect[i][1].ToString() == "") { continue; } PropRecover PropR = new PropRecover { Objindex = new ObjectIndex() { Id = Convert.ToInt32(collect[i][0].ToString()), Name = collect[i][1].ToString(), Comments = collect[i][2].ToString(), }, Itemtype = ItemType.Properties, Price = Convert.ToInt32(collect[i][3].ToString()), IsMarketable = Convert.ToBoolean(collect[i][4].ToString()), Bagshow = Resources.Load <Sprite>("Item/" + Convert.ToInt32(collect[i][0].ToString())), PIntimeProperties = new StatsIntime() { HpI = Convert.ToSingle(collect[i][6].ToString()), MpI = Convert.ToSingle(collect[i][7].ToString()), MgI = Convert.ToSingle(collect[i][8].ToString()), }, Buffs = new List <int>() }; for (int j = 9; j < 16; j++) { if (collect[i][j] != null) { PropR.Buffs.Add(Convert.ToInt32(collect[i][j].ToString())); } else { break; } } PropRArray.Add(PropR); } return(PropRArray); }
public static void ExcuteBuild() { PropEnternalHolder PEholder = ScriptableObject.CreateInstance <PropEnternalHolder>(); PropRecoverHolder PRholder = ScriptableObject.CreateInstance <PropRecoverHolder>(); BuffHolder Bholder = ScriptableObject.CreateInstance <BuffHolder>(); //查询excel表中数据,赋值给asset文件 PEholder.EnternalPropList = ExcelAccess.SelectPropEnternalTable(); PRholder.RecoverPropList = ExcelAccess.SelectPropRecoverTable(); Bholder.BuffList = ExcelAccess.SelectBuffTable(); string PEpath = "Assets/Resources/PropEnternals.asset"; string PRpath = "Assets/Resources/PropRecovers.asset"; string Bpath = "Assets/Resources/Buffs.asset"; AssetDatabase.CreateAsset(PEholder, PEpath); AssetDatabase.CreateAsset(PRholder, PRpath); AssetDatabase.CreateAsset(Bholder, Bpath); AssetDatabase.Refresh(); Debug.Log("BuildAsset Success!"); }