private static void AddCastleConnection(List <StringGridRow> list)
    {
        string assetName            = s_TotalDataName[2];
        CastleConnectionTotal BData = ScriptableObject.CreateInstance <CastleConnectionTotal>();

        for (int i = 1; i < list.Count; i++)
        {
            string[]             s_array = list[i].Strings;
            CastleConnectionData Data    = ScriptableObject.CreateInstance <CastleConnectionData>();
            int index = 0;
            if (int.TryParse(s_array[0], out index) == false)
            {
                continue;
            }
            Data.m_index = index;
            Data.m_Connection.Add(ReturnValue(s_array[1]));
            Data.m_Connection.Add(ReturnValue(s_array[2]));
            Data.m_Connection.Add(ReturnValue(s_array[3]));
            Data.m_Connection.Add(ReturnValue(s_array[4]));


            AssetDatabase.DeleteAsset("Assets/G_ScriptableUnit/" + assetName + i + ".asset");
            AssetDatabase.CreateAsset(Data, AssetDatabase.GenerateUniqueAssetPath("Assets/G_ScriptableUnit/" + assetName + i + ".asset"));

            BData.m_TotalData.Add(Data);
        }
        AssetDatabase.DeleteAsset("Assets/G_ScriptableObject/" + assetName + ".asset");
        AssetDatabase.CreateAsset(BData, AssetDatabase.GenerateUniqueAssetPath("Assets/G_ScriptableObject/" + assetName + ".asset"));
        AssetDatabase.SaveAssets();
    }
Exemple #2
0
    private void LoadCastleConnection()
    {
        AssetBundle ab = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "castle_connect"));

        if (ab == null)
        {
            Debug.LogError("ab==null");
            return;
        }

        string[] totalName         = ab.GetAllAssetNames();
        CastleConnectionTotal data = (CastleConnectionTotal)ab.LoadAsset(totalName[0]);

        m_CM.m_TotalCastleConnect = data;
        SetDataToStatic(data.m_TotalData);
    }