Example #1
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();
        }
Example #2
0
        public void SetClickMode(EasyFlow easyflow, CLICK_MODE clickMode)
        {
            if (this.clickMode != clickMode)
            {
                this.clickMode = clickMode;

                // Remove previous ClickCover
                ClickCover cc = GetComponent <ClickCover>();
                if (cc != null)
                {
                    cc.OnBeforeDestroy();
                    DestroyImmediate(cc);
                }

                if (clickMode != CLICK_MODE.None)
                {
                    // Add new ClickCover
                    if (this is Cover_NGUI)
                    {
                        cc = gameObject.AddComponent <ClickCover_NGUI>();
                    }
                    if (this is Cover_Quad)
                    {
                        cc = gameObject.AddComponent <ClickCover_Quad>();
                    }
                    if (this is Cover_UGUI)
                    {
                        cc = gameObject.AddComponent <ClickCover_UGUI>();
                    }

                    // Initalize
                    cc.OnAfterCreated(easyflow, this);
                }
            }
        }
Example #3
0
 public static void OpenWindow(EasyFlow easyflow)
 {
     window = (PresetTool)EditorWindow.GetWindow(typeof(PresetTool), false, "EF:PresetTool", true);
     window.autoRepaintOnSceneChange = true;
     window.minSize = new Vector2(440.0f, 145.0f);
     PresetTool.SetEasyflow(easyflow);
 }
Example #4
0
 public void Init(string name, EasyFlow parent, Vector3 position)
 {
     gameObject.name         = name;
     this.saveData           = parent.saveData;
     this.position           = position;
     transform.localPosition = position;
     //isClickEnabled = false;
 }
Example #5
0
        public static void SetEasyflow(EasyFlow easyflow)
        {
            selectedEasyflow = easyflow;

            if (window != null)
            {
                window.Repaint();
            }
        }
Example #6
0
        private void OnCreateBtn(COVER_MODE coverMode)
        {
            GameObject root     = CreateRoot(coverMode);
            GameObject camera   = CreateCamera(coverMode, root);
            GameObject panel    = CreatePanel(coverMode, root, camera);
            EasyFlow   easyflow = CreateEasyFlow(coverMode, root, panel);

            CreateCover(coverMode, easyflow, panel);
            OptionTool.OpenWindow(easyflow);
        }
Example #7
0
        public override void OnAfterCreated(EasyFlow easyflow, Cover cover)
        {
            base.OnAfterCreated(easyflow, cover);

            var v = gameObject.GetComponent <Collider>();

            if (v == null)
            {
                v = gameObject.AddComponent <BoxCollider>();
            }
            v.isTrigger = true;
        }
Example #8
0
        public override void OnAfterCreated(EasyFlow easyflow, Cover cover)
        {
            base.OnAfterCreated(easyflow, cover);
#if NGUI_USED
            UIEventTrigger eventTrigger = gameObject.AddComponent <UIEventTrigger>();
            eventTrigger.onClick.Add(new EventDelegate(_OnClick));

            UITexture texture = GetComponent <UITexture>();

            BoxCollider collider = gameObject.AddComponent <BoxCollider>();
            collider.size = texture.localSize;
#endif
        }
Example #9
0
        private EasyFlow CreateEasyFlow(COVER_MODE coverMode, GameObject root, GameObject panel)
        {
            EasyFlow easyflow = null;

            switch (coverMode)
            {
            case COVER_MODE.NGUI: easyflow = root.AddComponent <EasyFlow_NGUI>(); break;

            case COVER_MODE.UGUI: easyflow = root.AddComponent <EasyFlow_UGUI>(); break;

            case COVER_MODE.Quad: easyflow = root.AddComponent <EasyFlow_Quad>(); break;
            }

            easyflow.panel          = panel.transform;
            easyflow.easyflowCamera = root.GetComponentInChildren <Camera>();
            CreateSaveData(coverMode, easyflow);
            return(easyflow);
        }
Example #10
0
        public static void SetEasyflow(EasyFlow easyflow)
        {
            if (isLock)
            {
                return;
            }

            selectedEasyflow = easyflow;
            if (selectedEasyflow != null)
            {
                saveData = selectedEasyflow.saveData;
                ResetTextureList();
            }

            if (window != null)
            {
                window.Repaint();
            }
        }
Example #11
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;
            }
        }
Example #12
0
    public void OnButton(int num)
    {
        if (list == null || list.Count <= num)
        {
            return;
        }

        GameObject obj = list[num];

        if (prevSelectObj != null)
        {
            if (obj == prevSelectObj)
            {
                return;
            }
            prevSelectObj.SetActive(false);
        }

        obj.SetActive(true);
        prevSelectObj = obj;

        currentEasyflow = obj.GetComponent <NAsoft_EasyFlow.EasyFlow>();
    }
Example #13
0
        public override void OnAfterCreated(EasyFlow easyflow, Cover cover)
        {
            base.OnAfterCreated(easyflow, cover);

            gameObject.AddComponent <GraphicRaycaster>();
        }
Example #14
0
 private void CreateCover(COVER_MODE coverMode, EasyFlow easyflow, GameObject panel)
 {
     easyflow.saveData.coverMode = coverMode;
     easyflow.ChangeCoverCount(SettingData.GetInstance().defaultCoverCount);
 }
Example #15
0
 public virtual void OnAfterCreated(EasyFlow easyflow, Cover cover)
 {
     this.easyflow = easyflow;
     this.cover    = cover;
 }