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(); }
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); } } }
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); }
public void Init(string name, EasyFlow parent, Vector3 position) { gameObject.name = name; this.saveData = parent.saveData; this.position = position; transform.localPosition = position; //isClickEnabled = false; }
public static void SetEasyflow(EasyFlow easyflow) { selectedEasyflow = easyflow; if (window != null) { window.Repaint(); } }
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); }
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; }
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 }
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); }
public static void SetEasyflow(EasyFlow easyflow) { if (isLock) { return; } selectedEasyflow = easyflow; if (selectedEasyflow != null) { saveData = selectedEasyflow.saveData; ResetTextureList(); } if (window != null) { window.Repaint(); } }
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; } }
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>(); }
public override void OnAfterCreated(EasyFlow easyflow, Cover cover) { base.OnAfterCreated(easyflow, cover); gameObject.AddComponent <GraphicRaycaster>(); }
private void CreateCover(COVER_MODE coverMode, EasyFlow easyflow, GameObject panel) { easyflow.saveData.coverMode = coverMode; easyflow.ChangeCoverCount(SettingData.GetInstance().defaultCoverCount); }
public virtual void OnAfterCreated(EasyFlow easyflow, Cover cover) { this.easyflow = easyflow; this.cover = cover; }