private static void AddChar(List <StringGridRow> list) { string assetName = s_TotalDataName[1]; CharDataTotal BData = ScriptableObject.CreateInstance <CharDataTotal>(); for (int i = 1; i < list.Count; i++) { string[] s_array = list[i].Strings; CharData Data = ScriptableObject.CreateInstance <CharData>(); Data.m_index = int.Parse(s_array[0]); Data.m_CharIcon = s_array[1]; Data.m_CharName = s_array[2]; Data.m_Content = s_array[3]; Data.m_Skill = s_array[4]; Data.m_Force = int.Parse(s_array[5]); Data.m_See = s_array[6]; //Data.atk = s_array[7]; Data.m_HP = int.Parse(s_array[8]); //Data.m_NowHP = int.Parse(s_array[9]); Data.m_Bow = s_array[10]; Data.m_Knight = s_array[11]; Data.m_Infantry = s_array[12]; Data.m_Pos = s_array[13]; AssetDatabase.DeleteAsset("Assets/G_ScriptableUnit/" + assetName + i + ".asset"); AssetDatabase.CreateAsset(Data, AssetDatabase.GenerateUniqueAssetPath("Assets/G_ScriptableUnit/" + assetName + i + ".asset")); BData.m_totalCastleData.Add(Data); } AssetDatabase.DeleteAsset("Assets/G_ScriptableObject/" + assetName + ".asset"); AssetDatabase.CreateAsset(BData, AssetDatabase.GenerateUniqueAssetPath("Assets/G_ScriptableObject/" + assetName + ".asset")); AssetDatabase.SaveAssets(); }
public static void BuildCharObject() { int index = 0; CharDataTotal BData = ScriptableObject.CreateInstance <CharDataTotal>(); //ScriptObject string pathCreate = Path.Combine(m_PathC, m_TotalName[index] + ".asset"); string pathLoad = Path.Combine(m_Path, m_TotalName[index] + ".txt"); string pathCreateUnit = Path.Combine(m_PathCU, m_TotalName[index]); string[] s = File.ReadAllLines(pathLoad); AddData(s, BData, pathCreateUnit); AssetDatabase.DeleteAsset(pathCreate); AssetDatabase.CreateAsset(BData, pathCreate); AssetDatabase.SaveAssets(); }
private static void AddData(string[] s, CharDataTotal BData, string pathCreateUnit) { for (int i = 1; i < s.Length; i++) { m_Index = 0; CharDataObject Data = ScriptableObject.CreateInstance <CharDataObject>(); string[] split = s[i].Split(','); Data.m_index = ReturnValue(split); Data.m_CharName = ReturnValues(split); Data.m_Hp = ReturnValue(split); Data.m_Atk = ReturnValue(split); Data.m_Temp1 = ReturnValue(split); Data.m_Temp2 = ReturnValue(split); Data.m_Temp3 = ReturnValue(split); AssetDatabase.DeleteAsset(pathCreateUnit + i + ".asset"); AssetDatabase.CreateAsset(Data, pathCreateUnit + i + ".asset"); BData.m_TotalData.Add(Data); } }
private void LoadCharData() { AssetBundle ab = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "char")); if (ab == null) { Debug.LogError("ab==null"); return; } string[] totalName = ab.GetAllAssetNames(); for (int i = 0; i < totalName.Length; i++) { CharDataTotal cdt = (CharDataTotal)ab.LoadAsset(totalName[i]); List <CharData> l = cdt.m_totalCastleData; for (int j = 0; j < l.Count; j++) { CharData data = l[j]; GameGlobalValue.m_DicCharData[data.m_index] = data; //Debug.Log(data.name); } } }