Beispiel #1
0
        void createNewSupplyDB()
        {
            viewIndex = 1;
            supplyDB  = CreateInstance <SupplyDatabase>();
            string destintation = dir + "SupplyDB.asset";

            AssetDatabase.CreateAsset(supplyDB, destintation);
            AssetDatabase.SaveAssets();
            if (supplyDB)
            {
                supplyDB.supplies = new List <SupplyData>();
                string relPath = AssetDatabase.GetAssetPath(supplyDB);
                EditorPrefs.SetString("SupplyPath", relPath);
                EditorUtility.FocusProjectWindow();
                Selection.activeObject = supplyDB;
            }
        }
Beispiel #2
0
        void OnEnable()
        {
            dir       = "Assets/Data/";
            toShow    = SHOW.NOTHING;
            viewIndex = 1;
            EditorPrefs.SetString("ObjectPath", dir);

            if (EditorPrefs.HasKey("SettingsPath"))
            {
                string path = EditorPrefs.GetString("SettingsPath");
                settingsDB = AssetDatabase.LoadAssetAtPath <SettingsDatabase>(path);
            }
            else
            {
                settingsDB = AssetDatabase.LoadAssetAtPath <SettingsDatabase>("Assets/Data/SettingsDB.asset");
            }

            if (EditorPrefs.HasKey("ItemsPath"))
            {
                string path = EditorPrefs.GetString("ItemsPath");
                itemDB = AssetDatabase.LoadAssetAtPath <ItemDatabase>(path);
            }
            else
            {
                itemDB = AssetDatabase.LoadAssetAtPath <ItemDatabase>("Assets/Data/ItemDB.asset");
            }

            if (EditorPrefs.HasKey("WeaponsPath"))
            {
                string path = EditorPrefs.GetString("WeaponsPath");
                weaponDB = AssetDatabase.LoadAssetAtPath <WeaponDatabase>(path);
            }
            else
            {
                weaponDB = AssetDatabase.LoadAssetAtPath <WeaponDatabase>("Assets/Data/WeaponDB.asset");
            }

            if (EditorPrefs.HasKey("EnvPath"))
            {
                string path = EditorPrefs.GetString("EnvPath");
                envDB = AssetDatabase.LoadAssetAtPath <EnvironmentDatabase>(path);
            }
            else
            {
                envDB = AssetDatabase.LoadAssetAtPath <EnvironmentDatabase>("Assets/Data/EnvDB.asset");
            }

            if (EditorPrefs.HasKey("SupplyPath"))
            {
                string path = EditorPrefs.GetString("SupplyPath");
                supplyDB = AssetDatabase.LoadAssetAtPath <SupplyDatabase>(path);
            }
            else
            {
                supplyDB = AssetDatabase.LoadAssetAtPath <SupplyDatabase>("Assets/Data/SupplyDB.asset");
            }

            if (EditorPrefs.HasKey("CharPath"))
            {
                string path = EditorPrefs.GetString("CharPath");
                charDB = AssetDatabase.LoadAssetAtPath <CharacterDatabase>(path);
            }
            else
            {
                charDB = AssetDatabase.LoadAssetAtPath <CharacterDatabase>("Assets/Data/CharDB.asset");
            }
        }