Esempio n. 1
0
        public static SettingData GetInstance()
        {
            if (instance == null)
            {
// Create File in Editor
#if UNITY_EDITOR
                // File Exists(true) : Load file
                if (File.Exists(PathEF.settingDataFilePath))
                {
                    //instance = Resources.Load<SettingData>("SettingData");
                    instance = (SettingData)Resources.Load("SettingData", typeof(SettingData));
                }
                // File Exists(false) : Create file
                else
                {
                    // Directory Exists(false) : Create Directory
                    if (Directory.Exists(PathEF.directoryPath) == false)
                    {
                        Directory.CreateDirectory(PathEF.directoryPath);
                    }

                    // Create SettingData
                    instance = ScriptableObject.CreateInstance <SettingData>();
                    UnityEditor.AssetDatabase.CreateAsset(instance, PathEF.settingDataAssetPath);
                    UnityEditor.AssetDatabase.SaveAssets();
                    UnityEditor.AssetDatabase.Refresh();
                }

// Load File in Other Version
#else
                instance = (SettingData)Resources.Load("PathEF.settingDataName", typeof(SettingData));
#endif
            }
            return(instance);
        }
Esempio n. 2
0
        private void CreateSaveData(COVER_MODE coverMode, EasyFlow easyflow)
        {
            // Create SaveData instance
            easyflow.saveData            = ScriptableObject.CreateInstance <SaveData>();
            easyflow.saveData.coverMode  = coverMode;
            easyflow.saveData.coverCount = SettingData.GetInstance().defaultCoverCount;

            // Load Sample Textures ("Assets/EasyFlow/Resources/TextureSample")
            UnityEngine.Object[] objList = Resources.LoadAll("TextureSample", typeof(Texture));
            if (objList != null)
            {
                easyflow.saveData.textureList = new List <Texture>(objList.Length);
                foreach (Texture texture in objList)
                {
                    easyflow.saveData.textureList.Add(texture);
                }
            }

            string directoryPath = string.Format("{0}/SaveData", PathEF.assetPath);

            // Directory Exists(false) : Create Directory
            if (Directory.Exists(directoryPath) == false)
            {
                Directory.CreateDirectory(directoryPath);
            }

            // Save SaveData file
            UnityEditor.AssetDatabase.CreateAsset(easyflow.saveData, string.Format("{0}/SaveData_{1}.asset", directoryPath, easyflow.GetInstanceID()));
            UnityEditor.AssetDatabase.SaveAssets();
            UnityEditor.AssetDatabase.Refresh();
        }
Esempio n. 3
0
        public static void OpenWindow()
        {
            SettingTool window = (SettingTool)EditorWindow.GetWindow(typeof(SettingTool), false, "EF:SettingTool", true);

            window.autoRepaintOnSceneChange = true;
            window.minSize     = new Vector2(440.0f, 145.0f);
            window.settingData = SettingData.GetInstance();
        }
Esempio n. 4
0
        private void OnEnable()
        {
            switch (SettingData.GetInstance().linkMode)
            {
            case LINK_MODE.Link:
                if (Selection.activeGameObject != null)
                {
                    EasyFlow easyflow = Selection.activeGameObject.GetComponent <EasyFlow>();
                    OptionTool.SetEasyflow(easyflow);
                    PresetTool.SetEasyflow(easyflow);
                }
                else
                {
                    OptionTool.SetEasyflow(null);
                    PresetTool.SetEasyflow(null);
                }
                break;

            case LINK_MODE.OpenPresetTool:
                if (Selection.activeGameObject != null)
                {
                    EasyFlow easyflow = Selection.activeGameObject.GetComponent <EasyFlow>();
                    if (easyflow != null)
                    {
                        PresetTool.OpenWindow(easyflow);
                    }
                }
                break;

            case LINK_MODE.OpenOptionTool:
                if (Selection.activeGameObject != null)
                {
                    EasyFlow easyflow = Selection.activeGameObject.GetComponent <EasyFlow>();
                    if (easyflow != null)
                    {
                        OptionTool.OpenWindow(easyflow);
                    }
                }
                break;
            }
        }
Esempio n. 5
0
 private void CreateCover(COVER_MODE coverMode, EasyFlow easyflow, GameObject panel)
 {
     easyflow.saveData.coverMode = coverMode;
     easyflow.ChangeCoverCount(SettingData.GetInstance().defaultCoverCount);
 }
Esempio n. 6
0
 private void OnSelectionChange()
 {
     settingData = SettingData.GetInstance();
 }
Esempio n. 7
0
 private void OnEnable()
 {
     settingData = SettingData.GetInstance();
 }