// ========================================================================================================== // Project의 특정폴더 밑에 있는 모든 폴더명을 가져온다. public static string[] GetFolderList(string strDir, string inclusiveName, string exclusiveName, int nMinArrayCount, out int nFindFolder) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); nFindFolder = 0; return(null); #else if (strDir[strDir.Length - 1] != '/' && strDir[strDir.Length - 1] != '\\') { strDir = strDir + "/"; } int nCount = 0; DirectoryInfo dir = new DirectoryInfo(strDir); // CheckDir if (dir.Exists == false) { Debug.LogError("Directory not found - " + strDir); } DirectoryInfo[] info = dir.GetDirectories(); List <string> strList = new List <string>(); NgUtil.LogDevelop("GetFolderList() - " + strDir); // 프로젝트 폴더명 로드 foreach (DirectoryInfo dirInfo in info) { // gUtil.LogDevelop("GetFolderList() - FindFolder - " + dirInfo.Name); if (exclusiveName != null && dirInfo.Name.Contains(exclusiveName) == true) { continue; } if (inclusiveName != null && dirInfo.Name.Contains(inclusiveName) == false) { continue; } strList.Add(dirInfo.Name); nCount++; } string[] folderStrings = new string[Mathf.Max(nMinArrayCount, strList.Count)]; folderStrings = strList.ToArray(); if (strList.Count < nMinArrayCount) { folderStrings = NgConvert.ResizeArray <string>(folderStrings, nMinArrayCount); } nFindFolder = nCount; return(folderStrings); #endif }
void Awake() { NgUtil.LogDevelop("Awake - FXMakerMain"); if (FXMakerLayout.m_bDevelopPrefs == false) { m_nToolIndex = EditorPrefs.GetInt("FXMakerMain.m_nToolIndex", m_nToolIndex); } m_bFocusUnityWindows[(int)(UNITYWINDOW.GameView)] = true; m_bStartTooMain = true; GetFXMakerControls().enabled = true; GetFXMakerHierarchy().enabled = true; }
public static string CloneEffectPrefab(GameObject srcPrefab) { string createPath = NgAsset.ClonePrefab(srcPrefab); NgUtil.LogMessage("CloneEffectPrefab() - " + createPath); // copy preview image if (createPath != "") { string srcFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(srcPrefab)); string tarFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(createPath)); AssetDatabase.CopyAsset(srcFile, tarFile); AssetDatabaseRefresh(); } return(createPath); }
public static GameObject LoadPrefab(GameObject srcPrefab, GameObject targetObject) { string path = AssetDatabase.GetAssetPath(srcPrefab); NgUtil.LogDevelop("LoadPrefab() - strPrefabPath - " + path); // 선택된 asset 로드 (project to Hierarchy) // GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)); // GameObject obj = NgObject.CreateGameObject(targetObject, prefab); GameObject obj = PrefabUtility.InstantiatePrefab(srcPrefab) as GameObject; obj.transform.parent = targetObject.transform; NgObject.SetActiveRecursively(obj, false); return(obj); }
public void CreateCurrentInstanceEffect(bool bRunAction) { FxmTestSetting component = this.m_PrefabList.GetComponent <FxmTestSetting>(); if (this.m_bAutoSetting && component != null) { this.m_FXMakerControls.AutoSetting(component.m_nPlayIndex, component.m_nTransIndex, component.m_nTransAxis, component.m_fDistPerTime, component.m_nRotateIndex, component.m_nMultiShotCount, component.m_fTransRate, component.m_fStartPosition); } NgUtil.LogDevelop("CreateCurrentInstanceEffect() - bRunAction - " + bRunAction); bool flag = this.CreateCurrentInstanceEffect(this.m_OriginalEffectObject); if (flag && bRunAction) { this.m_FXMakerControls.RunActionControl(); } }
public static void DeleteEffectPrefab(GameObject tarPrefab) { // delete preview image string filename = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(tarPrefab)); NgUtil.LogMessage("DeleteEffectPrefab() - delete preview - " + filename); AssetDatabase.MoveAssetToTrash(filename); // AssetDatabase.DeleteAsset(filename); // check clipboard FXMakerClipboard.inst.CheckDeletePrefab(tarPrefab); // delete prefab NgAsset.DeletePrefab(tarPrefab); AssetDatabaseRefresh(); AssetDatabaseSaveAssets(); }
public void LoadProject() { NgUtil.LogDevelop("LoadProject - FxmBackMain"); // group 弃歹甸 捞抚 阂矾坷扁 if (m_bGroupFoler) { string[] groupFolerStrings = NgAsset.GetFolderList(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), null, null, FXMakerOption.inst.m_nMinTopToolbarCount, out m_nGroupCount); m_GroupFolerContents = NgConvert.StringsToContents(groupFolerStrings); for (int n = 0; n < m_GroupFolerContents.Length; n++) { if (m_GroupFolerContents[n].text == null) { m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("EMPTYGROUP_HOVER", FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS)); } else { m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("GROUP_HOVER", m_GroupFolerContents[n].text); } } } else { m_GroupFolerContents = new GUIContent[1]; m_GroupFolerContents[0] = new GUIContent("", ""); m_nGroupCount = 1; } // 固府 沥狼等 府家胶 肺靛 LoadResourceFolder(); // 捞傈 急琶沥焊 贸府 int nGroupIndex = 0; int nBackgroundIndex = 0; if (FXMakerLayout.m_bDevelopPrefs == false) { nGroupIndex = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nGroupIndex", 0); nBackgroundIndex = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nBackgroundIndex", 0); } SelectToolbar(nGroupIndex, nBackgroundIndex); // default Background if (m_CurrentBackgroundInfo == null) { SelectToolbar(0, 0); } }
// 특정 prefab의 clone를 prjoect에 생성한다. public static string ClonePrefab(GameObject srcPrefab) { NgUtil.LogMessage("ClonePrefab() - srcPrefab - " + srcPrefab); string srcPath = AssetDatabase.GetAssetPath(srcPrefab); string UnqPath = AssetDatabase.GenerateUniqueAssetPath(srcPath); if (AssetDatabase.CopyAsset(srcPath, UnqPath)) { AssetDatabase.Refresh(); return(UnqPath); } else { Debug.LogWarning("Copy Error !!!"); return(""); } }
public void LoadTool(string toolMsg) { m_bLoadingProject = true; NgUtil.LogDevelop("LoadTool"); FxmPopupManager.inst.HideModalMessage(); if (toolMsg != "") FxmPopupManager.inst.ShowToolMessage(toolMsg); GetComponent<FXMakerBackground>().LoadProject(); GetComponent<FXMakerEffect>().LoadProject(); if (m_nToolIndex == 1) ResetCamera(); m_bLoadingProject = false; }
// Prefab --------------------------------------------------------------------------------------------------------------- public static string CopyEffectPrefab(GameObject srcPrefab, string tarPath, bool bCutCopy) { NgUtil.LogMessage("CopyPrefab() - tarPath : " + tarPath); bool bCopy = false; string errstr = "err"; string srcPath = AssetDatabase.GetAssetPath(srcPrefab); tarPath = NgFile.CombinePath(tarPath, NgFile.GetFilenameExt(srcPath)); tarPath = AssetDatabase.GenerateUniqueAssetPath(tarPath); NgUtil.LogDevelop("CopyEffectPrefab() - tarPath : " + tarPath); // tarPath = AssetDatabase.ValidateMoveAsset(srcPath, tarPath); NgUtil.LogDevelop("CopyEffectPrefab() - src : " + srcPath); NgUtil.LogDevelop("CopyEffectPrefab() - tar : " + tarPath); if (bCutCopy) { errstr = AssetDatabase.MoveAsset(srcPath, tarPath); } else { bCopy = AssetDatabase.CopyAsset(srcPath, tarPath); } // copy preview image if (errstr == "" || bCopy == true) { string srcFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(srcPrefab)); string tarFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(tarPath)); if (bCutCopy) { AssetDatabase.MoveAsset(srcFile, tarFile); } else { AssetDatabase.CopyAsset(srcFile, tarFile); } } else { Debug.LogWarning("CopyEffectPrefab() - CopyPreview : Faild"); } AssetDatabaseRefresh(); AssetDatabaseSaveAssets(); return(tarPath); }
// Project의 특정폴더안에서 특정path가 몇번째에 있는지 리턴한다. 0인덱스 public static int FindPathIndex(string strDir, string findPath, string ext) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); return(-1); #else if (strDir[strDir.Length - 1] != '/' && strDir[strDir.Length - 1] != '\\') { strDir = strDir + "/"; } findPath = NgFile.PathSeparatorNormalize(findPath); NgUtil.LogDevelop("FindPathIndex() - findPath - " + findPath); DirectoryInfo dir = new DirectoryInfo(strDir); // CheckDir if (dir.Exists == false) { Debug.LogError("Directory not found - " + strDir); } FileInfo[] info = dir.GetFiles(); int nIndex = 0; // string filename = NgUtil.GetFileFullName(findPath); // // Debug.Log(info[0].FullName); // Debug.Log(findPath); ext = ("." + ext).ToLower(); foreach (FileInfo fileInfo in info) { if (fileInfo.Extension.ToLower() == ext) { if (NgFile.PathSeparatorNormalize(fileInfo.FullName).Contains(findPath)) { return(nIndex); } nIndex++; } } return(-1); #endif }
// ------------------------------------------------------------------------------------------- public void CreateCurrentInstanceEffect(bool bRunAction) { // auto test setting FxmTestSetting setting = m_PrefabList.GetComponent <FxmTestSetting>(); if (m_bAutoSetting && setting != null) { m_FXMakerControls.AutoSetting(setting.m_nPlayIndex, setting.m_nTransIndex, setting.m_nTransAxis, setting.m_fDistPerTime, setting.m_nRotateIndex, setting.m_nMultiShotCount, setting.m_fTransRate, setting.m_fStartPosition); } NgUtil.LogDevelop("CreateCurrentInstanceEffect() - bRunAction - " + bRunAction); bool bTrue = CreateCurrentInstanceEffect(m_OriginalEffectObject); if (bTrue && bRunAction) { m_FXMakerControls.RunActionControl(); } }
public static void SetPropertyValue(SerializedObject serObj, string propertyName, object value, bool bUpdate) { SerializedProperty sp = serObj.FindProperty(propertyName); if (sp == null) { Debug.LogError("SetPropertyValue error - " + propertyName); return; } SetPropertyValue(sp, value); if (bUpdate) { if (serObj.ApplyModifiedProperties() == false) { NgUtil.LogDevelop("Failed - ApplyModifiedProperties"); // dup } } }
// DefaultPrefab을 이용해서 새로운 prefab 생성 public static string CreateDefaultUniquePrefab(GameObject srcPrefab, string dstPath) { NgUtil.LogMessage("CreateDefaultUniquePrefab() - dstPath - " + dstPath); string srcPath = AssetDatabase.GetAssetPath(srcPrefab); string UnqPath = AssetDatabase.GenerateUniqueAssetPath(dstPath); if (AssetDatabase.CopyAsset(srcPath, UnqPath)) { AssetDatabase.Refresh(); return(UnqPath); } else { Debug.LogWarning("Copy Error !!!"); return(""); } // EditorUtility.CreateEmptyPrefab(defaultPrefab); }
private bool CreateCurrentInstanceEffect(GameObject gameObj) { NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj); GameObject instanceRoot = this.GetInstanceRoot(); NgObject.RemoveAllChildObject(instanceRoot, true); if (gameObj != null) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(gameObj); NcEffectBehaviour.PreloadTexture(gameObject); gameObject.transform.parent = instanceRoot.transform; this.m_InstanceEffectObject = gameObject; NgObject.SetActiveRecursively(gameObject, true); this.m_FXMakerControls.SetStartTime(); return(true); } this.m_InstanceEffectObject = null; return(false); }
// BackgroundFolder郴狼 prefab list客 捞抚备己窍扁, selectPrefabPath甫 瘤沥且 版快 BackgroundIndex 府畔 int LoadBackgroundFolder(string selectPrefabPath) { // Debug.Log(selectPrefabPath); NgUtil.ClearObjects(m_BackgroundPrefabs); m_nBackgroundCount = 0; // load Group if (0 < m_nGroupCount) { // load Background Folder string loaddir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), m_GroupFolerContents[m_nGroupIndex].text); // Debug.Log(loaddir); m_BackgroundPrefabs = NgAsset.GetPrefabList(loaddir, false, true, 0, out m_nBackgroundCount); m_BackgroundContents = new GUIContent[Mathf.Max(m_nBackgroundCount, FXMakerOption.inst.m_nMinBottomToolbarCount)]; for (int n = 0; n < m_BackgroundPrefabs.Length; n++) { GUIContent econ = new GUIContent(); econ.image = FXMakerMain.inst.GetPrefabThumbTexture(m_BackgroundPrefabs[n]); econ.text = m_BackgroundPrefabs[n].name; econ.tooltip = FXMakerTooltip.GetHsToolBackground("BACKGROUND_HOVER", m_BackgroundPrefabs[n].name); m_BackgroundContents[n] = econ; } for (int n = m_BackgroundPrefabs.Length; n < FXMakerOption.inst.m_nMinBottomToolbarCount; n++) { GUIContent econ = new GUIContent(); econ.image = null; econ.text = ""; econ.tooltip = FXMakerTooltip.GetHsToolBackground("EMPTYBACKGROUND_HOVER", ""); m_BackgroundContents[n] = econ; } // select prefab if (selectPrefabPath != "") { return(NgAsset.FindPathIndex(loaddir, selectPrefabPath, "prefab")); } } else { } return(-1); }
// Project의 특정폴더안에 있는 파일 리스트를 가져온다. public static string[] GetFileList(string strDir, int nMaxFile, out int nFindFile) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); nFindFile = 0; return(null); #else if (strDir[strDir.Length - 1] != '/' && strDir[strDir.Length - 1] != '\\') { strDir = strDir + "/"; } NgUtil.LogDevelop("GetFileList() - LoadDir - " + strDir); DirectoryInfo dir = new DirectoryInfo(strDir); // CheckDir if (dir.Exists == false) { Debug.LogError("Directory not found - " + strDir); } FileInfo[] info = dir.GetFiles(); string[] fileStrings = new string[(0 < nMaxFile ? Mathf.Min(info.Length, nMaxFile) : info.Length)]; int nCount = 0; foreach (FileInfo fileInfo in info) { if (0 < nMaxFile && nMaxFile <= nCount) { Debug.LogWarning("GetFileList - Over MaxCount!!!"); break; } NgUtil.LogDevelop("GetFileList() - FindFile - " + fileInfo.Name); fileStrings[nCount++] = fileInfo.Name; } nFindFile = nCount; return(fileStrings); #endif }
// 특정폴더의 prefab을 로드해서 target 밑으로 생성한다. public static void LoadPrefabList(string strPrefabDir, GameObject targetObject) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); return; #else if (strPrefabDir[strPrefabDir.Length - 1] != '/' && strPrefabDir[strPrefabDir.Length - 1] != '\\') { strPrefabDir = strPrefabDir + "/"; } // load Current Group DirectoryInfo dir = new DirectoryInfo(strPrefabDir); // CheckDir if (dir.Exists == false) { Debug.LogError("Directory not found - " + strPrefabDir); } FileInfo[] info = dir.GetFiles(); NgUtil.LogDevelop("BuildPrefabList() - LoadDir - " + strPrefabDir); // Object[] objs = AssetDatabase.LoadAllAssetsAtPath(loaddir); // 기존것 모두 삭제 NgObject.RemoveAllChildObject(targetObject, true); // 선택된 그룹폴더 asset 로드 (project to Hierarchy) foreach (FileInfo fileInfo in info) { NgUtil.LogDevelop("BuildPrefabList() - FindFile - " + fileInfo.Name); GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(strPrefabDir + fileInfo.Name, typeof(GameObject)); NgUtil.LogDevelop("BuildPrefabList() - " + prefab.name); GameObject obj = NgObject.CreateGameObject(targetObject, prefab); NgObject.SetActiveRecursively(obj, false); } #endif }
public void SaveTool(string toolMsg, bool bClickSaveButton) { NgUtil.LogDevelop("SaveTool"); FxmPopupManager.inst.HideModalMessage(); if (toolMsg != "") FxmPopupManager.inst.ShowToolMessage(toolMsg); switch (m_nToolIndex) { case 0: { GetComponent<FXMakerBackground>().SaveProject(); break; } case 1: { GetComponent<FXMakerEffect>().SaveProject(bClickSaveButton); break; } } }
public bool SaveProject(bool bClickSaveButton) { if (bClickSaveButton == false && m_bChangePrefab == false) { return(false); } if (FXMakerMain.inst.GetOriginalEffectObject() == null || FXMakerMain.inst.GetOriginalEffectPrefab() == null) { return(false); } if (0 < IsReadOnlyFolder()) { NgUtil.LogMessage(FXMakerTooltip.GetHsToolMessage("READONLY_NOTSAVE", "")); m_bChangePrefab = false; } else { if (0 <= m_nEffectIndex && m_nEffectIndex < m_nEffectCount) { NgUtil.LogDevelop("SaveProject - FXMaker prefab"); FXMakerMain.inst.GetOriginalEffectObject().transform.parent = null; ChangeActiveState(FXMakerMain.inst.GetOriginalEffectObject()); FXMakerMain.inst.GetOriginalEffectObject().transform.parent = m_CurrentEffectRoot.transform; m_EffectPrefabs[m_nEffectIndex] = FXMakerAsset.SaveEffectPrefab(FXMakerMain.inst.GetOriginalEffectObject(), FXMakerMain.inst.GetOriginalEffectPrefab()); // clear current FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); SetCurrentEffectPrefab(m_EffectPrefabs[m_nEffectIndex]); // Baground Reload FXMakerBackground.inst.UpdateBackground(); m_bChangePrefab = false; return(true); } } return(false); }
bool CreateCurrentInstanceEffect(GameObject gameObj) { NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj); GameObject parentObj = GetInstanceRoot(); m_bFrameCreateInstance = true; // 이전거 삭제 NgObject.RemoveAllChildObject(parentObj, true); // 순환 참조 prefab 검사 NcEffectBehaviour.PreloadTexture(gameObj); // 새로 생성 if (gameObj != null) { GameObject createObj = (GameObject)Instantiate(gameObj); createObj.transform.parent = parentObj.transform; FxmInfoIndexing.CreateInstanceIndexing(gameObj.transform, createObj.transform, false, false); m_InstanceEffectObject = createObj; RemoveInvaildComponent(createObj); // Grayscale GetFXMakerHierarchy().OnCreateInstanceEffect(m_InstanceEffectObject, true, null); #if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) NgObject.SetActiveRecursively(createObj, true); #endif m_FXMakerControls.SetStartTime(); return(true); } m_InstanceEffectObject = null; return(false); }
bool CreateCurrentInstanceEffect(GameObject gameObj) { NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj); GameObject parentObj = GetInstanceRoot(); // 이전거 삭제 NgObject.RemoveAllChildObject(parentObj, true); // 새로 생성 if (gameObj != null) { GameObject createObj = (GameObject)Instantiate(gameObj); NcEffectBehaviour.PreloadTexture(createObj); createObj.transform.parent = parentObj.transform; m_InstanceEffectObject = createObj; m_FXMakerControls.SetStartTime(); return(true); } m_InstanceEffectObject = null; return(false); }
// ========================================================================================================== void winMenuToolbar(int id) { if (m_nProjectCount <= 0) { return; } bool bChanged = false; Rect popupRect = FXMakerLayout.GetMenuToolbarRect(); // window desc ----------------------------------------------------------- FXMakerTooltip.WindowDescription(popupRect, FXMakerLayout.WINDOWID.TOP_CENTER, null); // mini ---------------------------------------------------------------- FXMakerLayout.m_bMinimizeTopMenu = GUI.Toggle(new Rect(3, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), FXMakerLayout.m_bMinimizeTopMenu, "Mini"); // if (GUI.changed) // EditorPrefs.SetBool("FXMakerEffect.m_bMinimize", FXMakerLayout.m_bMinimizeTopMenu); FXMakerLayout.m_bMinimizeAll = GUI.Toggle(new Rect(popupRect.width - 60, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), FXMakerLayout.m_bMinimizeAll, "MiniAll"); GUI.changed = false; if (FXMakerLayout.m_bMinimizeAll || FXMakerLayout.m_bMinimizeTopMenu) { FXMakerMain.inst.SaveTooltip(); return; } // FXMakerMain.inst.ToggleGlobalLangSkin(true); // Group Project // int nProjectIndex = GUI.Toolbar(FXMakerLayout.GetChildVerticalRect(popupRect, 0, 10, 0, 3), m_nProjectIndex, m_ProjectFolerContents); int nProjectIndex = FXMakerLayout.TooltipToolbar(popupRect, FXMakerLayout.GetChildVerticalRect(popupRect, 0, 10, 0, 3), m_nProjectIndex, m_ProjectFolerContents); if (GUI.changed) { bChanged = true; } // Draw line Rect lineRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, 10, 3, 1); NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + 2), (int)lineRect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); // Group List Rect groupRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, 10, 4, 6); // int nGroupIndex = GUI.Toolbar(gNcLayout.GetChildVerticalRect(gNcLayout.GetMenuToolbarRect(), 0, 10, 4, 6), GetGroupIndex(), m_GroupFolderStrings); // int nGroupIndex = GUI.SelectionGrid(groupRect, GetGroupIndex(), m_GroupFolderContents, m_GroupFolderContents.Length/2+m_GroupFolderContents.Length%2); int nGroupIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, groupRect, GetGroupIndex(), m_GroupFolderContents, m_GroupFolderContents.Length / 2 + m_GroupFolderContents.Length % 2); if (GUI.changed) { bChanged = true; } // FXMakerMain.inst.ToggleGlobalLangSkin(false); if (bChanged) { NgUtil.LogDevelop("changed MenuToolbar = " + nProjectIndex + " " + nGroupIndex); SaveProject(); if (m_nProjectCount <= nProjectIndex) { nProjectIndex = m_nProjectCount - 1; m_nProjectIndex = nProjectIndex; } SelectToolbar(nProjectIndex, (m_nProjectIndex != nProjectIndex ? GetGroupIndex(nProjectIndex) : nGroupIndex), ""); } FXMakerMain.inst.SaveTooltip(); }
void Awake() { NgUtil.LogDevelop("Awake - FXMakerMain"); GetFXMakerControls().enabled = true; }
// ========================================================================================================== void winEffectList(int id) { if (GetGroupIndex() < 0) { return; } Rect effectRect = FXMakerLayout.GetEffectListRect(); // window desc ----------------------------------------------------------- FXMakerTooltip.WindowDescription(effectRect, FXMakerLayout.WINDOWID.EFFECT_LIST, null); // mini ---------------------------------------------------------------- m_bMinimize = GUI.Toggle(new Rect(3, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), m_bMinimize, "Mini"); GUI.changed = false; if (FXMakerLayout.m_bMinimizeAll || m_bMinimize) { RenameCurrentPrefab(m_EditingName); FXMakerMain.inst.SaveTooltip(); return; } // 扁瓷 滚瓢 ----------------------------------------------------------- Rect rect1Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 25); Rect rect2Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 50, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 20); Rect rect3Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 75, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 12); // Add button if (m_nEffectCount < FXMakerLayout.m_nMaxPrefabListCount) { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 0, 1), FXMakerTooltip.GetHcToolEffect("New"), IsReadOnlyFolder() == 0)) { RenameCurrentPrefab(m_EditingName); ShowNewMenu(); return; } } if (m_nEffectCount <= 0) { // right button if (Input.GetMouseButtonUp(1)) { ShowRightMenu(-1, false); } return; } // Selected state bool bEnable = (FXMakerMain.inst.IsCurrentEffectObject() && IsReadOnlyFolder() == 0); // Delete button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 1, 1), FXMakerTooltip.GetHcToolEffect("Del"), bEnable)) { RenameCurrentPrefab(m_EditingName); m_bProcessDelete = true; } if (m_bProcessDelete) { m_bProcessDelete = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_EffectContents[m_nEffectIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETEPREFAB", "")); if (m_bProcessDelete == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { NcSpriteAnimation spriteCom = FXMakerMain.inst.GetOriginalEffectPrefab().GetComponent <NcSpriteAnimation>(); if (spriteCom != null && spriteCom.m_bBuildSpriteObj && spriteCom.GetComponent <Renderer>().sharedMaterial != null) { m_bProcessDelSprite = true; } else { GameObject deletePrefab = FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); FXMakerAsset.DeleteEffectPrefab(deletePrefab); SelectToolbar(m_nProjectIndex, GetGroupIndex(), m_nEffectIndex); return; } } } } if (m_bProcessDelSprite) { m_bProcessDelSprite = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_EffectContents[m_nEffectIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETESPRITE", "")); if (m_bProcessDelSprite == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { // delete material, texture NcSpriteAnimation spriteCom = FXMakerMain.inst.GetOriginalEffectPrefab().GetComponent <NcSpriteAnimation>(); if (spriteCom.GetComponent <Renderer>().sharedMaterial.mainTexture != null) { string path = AssetDatabase.GetAssetPath(spriteCom.GetComponent <Renderer>().sharedMaterial.mainTexture); AssetDatabase.MoveAssetToTrash(path); // AssetDatabase.DeleteAsset(path); } string matpath = AssetDatabase.GetAssetPath(spriteCom.GetComponent <Renderer>().sharedMaterial); AssetDatabase.MoveAssetToTrash(matpath); // AssetDatabase.DeleteAsset(matpath); } // delete prefab GameObject deletePrefab = FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); FXMakerAsset.DeleteEffectPrefab(deletePrefab); SelectToolbar(m_nProjectIndex, GetGroupIndex(), m_nEffectIndex); return; } } // Clone button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 2, 1), FXMakerTooltip.GetHcToolEffect("Clone"), bEnable)) { RenameCurrentPrefab(m_EditingName); ClonePrefab(); return; } // Capture Thumb button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 3, 1), FXMakerTooltip.GetHcToolEffect("Thumb"), bEnable)) { RenameCurrentPrefab(m_EditingName); ThumbPrefab(); return; } // // History button // if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 4, 1), FXMakertip.GetHcToolEffect("History"), bEnable)) // { // SetActiveEffect(m_nEffectIndex); // return; // } // Sprite button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 4, 1), FXMakerTooltip.GetHcToolEffect("Sprite"), bEnable)) { RenameCurrentPrefab(m_EditingName); SpritePrefab(); return; } // Selected state if (FXMakerMain.inst.IsCurrentEffectObject()) { // ChangeName if (FXMakerMain.inst.IsCurrentEffectObject() && 0 <= m_nEffectIndex && m_nEffectIndex < m_nEffectCount) { GUI.SetNextControlName("TextField"); FXMakerLayout.GUIEnableBackup(IsReadOnlyFolder() == 0); // FXMakerMain.inst.ToggleGlobalLangSkin(true); m_EditingName = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(rect2Row, 4, 0, 4), m_EditingName, 50); // FXMakerMain.inst.ToggleGlobalLangSkin(false); FXMakerLayout.GUIEnableRestore(); bool bEnterKey = (Event.current.isKey && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)); if (bEnterKey || (FXMakerMain.GetPrevWindowFocus() == (int)FXMakerLayout.WINDOWID.EFFECT_LIST && FXMakerMain.GetWindowFocus() != (int)FXMakerLayout.WINDOWID.EFFECT_LIST)) { RenameCurrentPrefab(m_EditingName); } } } // Resize -------------------------------------------------------------- bool bChangeScrollColumn = false; m_nScrollColumn = (int)GUI.HorizontalScrollbar(rect3Row, m_nScrollColumn, 1, 1, m_nMaxObjectColumn + 1); if (GUI.changed) { UnityEditor.EditorPrefs.SetInt("FXMakerEffect.Effect_nScrollColumn", m_nScrollColumn); bChangeScrollColumn = true; Rect rect = FXMakerLayout.GetAspectScrollViewRect((int)rect3Row.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); m_EffectListScrollPos.y = rect.height * (m_nEffectIndex - m_nScrollColumn) / (float)m_nEffectCount; } // Draw line Rect lineRect = rect3Row; lineRect.y = rect3Row.yMax + 5; lineRect.height = 3; NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y), (int)lineRect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); // Effect List ------------------------------------------------------ Rect listRect = FXMakerLayout.GetChildVerticalRect(effectRect, m_nGuiTopHeight, 1, 0, 1); Rect scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); Rect gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); m_EffectListScrollPos = GUI.BeginScrollView(listRect, m_EffectListScrollPos, scrollRect); // FXMakerMain.inst.ToggleGlobalLangSkin(true); // int nEffectIndex = GUI.SelectionGrid(listRect, m_nEffectIndex, m_EffectNameStrings, m_nScrollColumn); // int nEffectIndex = GUI.SelectionGrid(gridRect, m_nEffectIndex, m_EffectContents, m_nScrollColumn); int nEffectIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(effectRect, 0, -m_EffectListScrollPos.y), listRect, gridRect, m_nEffectIndex, m_EffectContents, m_nScrollColumn); // FXMakerMain.inst.ToggleGlobalLangSkin(false); // move key if (FXMakerMain.inst.GetFocusInputKey(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.EFFECT_LIST)) != 0) { switch (FXMakerMain.inst.GetFocusInputKey(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.EFFECT_LIST))) { case KeyCode.LeftArrow: nEffectIndex--; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.RightArrow: nEffectIndex++; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.UpArrow: nEffectIndex -= m_nScrollColumn; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.DownArrow: nEffectIndex += m_nScrollColumn; FXMakerMain.inst.SetFocusInputKey(0); break; } if (nEffectIndex < 0) { nEffectIndex = 0; } if (m_nEffectCount <= nEffectIndex) { nEffectIndex = m_nEffectCount - 1; } } // select if ((bChangeScrollColumn == false && GUI.changed) || m_nEffectIndex != nEffectIndex) { RenameCurrentPrefab(m_EditingName); // right button if (Input.GetMouseButtonUp(1)) { ShowRightMenu(nEffectIndex, true); } // active NgUtil.LogDevelop("changed m_nEffectIndex - id = " + id + ", value = " + m_EffectContents[nEffectIndex].text); if (nEffectIndex == m_nEffectIndex && FXMakerMain.inst.IsCurrentEffectObject()) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } else { SetActiveEffect(nEffectIndex); } } else { // right button if (Input.GetMouseButtonUp(1)) { RenameCurrentPrefab(m_EditingName); ShowRightMenu(-1, false); } } GUI.EndScrollView(); FXMakerMain.inst.SaveTooltip(); }
protected void RunActionControl(int nPlayIndex, int nTransIndex) { NgUtil.LogDevelop("RunActionControl() - nPlayIndex " + nPlayIndex); CancelInvoke("CreateInstanceEffect"); m_bCalledDelayCreate = false; // 정지된 시계일 경우 움직이도록 해두자... ResumeTimeScale(); // Play --------------------------------------- m_bStartAliveAnimation = false; switch (nPlayIndex) { /*AutoRet*/ case 0: break; case 1: break; /*OneShot*/ case 2: SetTimeScale(m_fPlayToolbarTimes[nPlayIndex]); break; /*Repeat*/ case m_nRepeatIndex: case m_nRepeatIndex + 1: case m_nRepeatIndex + 2: case m_nRepeatIndex + 3: case m_nRepeatIndex + 4: { // repeat선택이면.. 이동관련 옵션을 끈다. if (nPlayIndex != m_nPlayIndex) { nTransIndex = 0; } break; } } // Trans --------------------------------------- if (0 < nTransIndex) { // init multishot // if (m_nTransIndex != nTransIndex && (m_nTransIndex != 0 && nTransIndex != 0)) // m_nMultiShotCount = 1; float fTransHalfDist = (Camera.mainCamera != null ? (Vector3.Magnitude(Camera.mainCamera.transform.position) * 0.65f) : 1) * m_fTransRate; GameObject instEffectObject = FXMakerMain.inst.GetInstanceEffectObject(); GameObject simRoot = NgObject.CreateGameObject(instEffectObject.transform.parent.gameObject, "simulate"); FXMakerSimulate simComponent = simRoot.AddComponent <FXMakerSimulate>(); instEffectObject.transform.parent = simRoot.transform; FXMakerMain.inst.ChangeRoot_InstanceEffectObject(simRoot); simComponent.Init(this, m_nMultiShotCount); switch (nTransIndex) { case 1: // Move { simComponent.SimulateMove(m_nTransAxis, fTransHalfDist, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 2: // scale { simComponent.SimulateScale(m_nTransAxis, fTransHalfDist * 0.3f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 3: // Arc { simComponent.SimulateArc(fTransHalfDist * 0.7f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 4: // fall { simComponent.SimulateFall(fTransHalfDist * 0.7f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 5: // raise { simComponent.SimulateRaise(fTransHalfDist * 0.7f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 6: // circle { simComponent.SimulateCircle(fTransHalfDist * 0.5f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 7: // tornado { simComponent.SimulateTornado(fTransHalfDist * 0.3f, fTransHalfDist * 0.7f, FXMakerOption.inst.m_fScaleTransSpeed * m_fDistPerTime, (m_nRotateIndex == 0)); break; } } } // 이동처리중이면... 자동반복되므로 기존repeat옵션은 끈다. if (0 < nTransIndex) { if (m_nRepeatIndex <= nPlayIndex) { nPlayIndex = 0; } } // 최족 결정값 저장 m_nPlayIndex = nPlayIndex; m_nTransIndex = nTransIndex; if (IsRepeat()) { m_fCreateTime = Time.time; } }
void OnEnable() { NgUtil.LogDevelop("OnEnable - m_FXMakerControls"); LoadPrefs(); }
// ------------------------------------------------------------------------------------------- void Awake() { NgUtil.LogDevelop("Awake - m_FXMakerControls"); LoadPrefs(); }
protected void RunActionControl(int nPlayIndex, int nTransIndex) { NgUtil.LogDevelop("RunActionControl() - nPlayIndex " + nPlayIndex); CancelInvoke(); m_bCalledDelayCreate = false; // ������ �ð��� ��� �����̵��� �ص���... ResumeTimeScale(); // Play --------------------------------------- m_bStartAliveAnimation = false; switch (nPlayIndex) { /*AutoRet*/ case 0: break; case 1: break; /*OneShot*/ case 2: SetTimeScale(m_fPlayToolbarTimes[nPlayIndex]); break; /*Repeat*/ case m_nRepeatIndex: case m_nRepeatIndex + 1: case m_nRepeatIndex + 2: case m_nRepeatIndex + 3: case m_nRepeatIndex + 4: { // repeat�����̸�.. �̵����� �ɼ��� ����. if (nPlayIndex != m_nPlayIndex) { nTransIndex = 0; } break; } } // Trans --------------------------------------- if (0 < nTransIndex) { // init multishot // if (m_nTransIndex != nTransIndex && (m_nTransIndex != 0 && nTransIndex != 0)) // m_nMultiShotCount = 1; float fTransHalfDist = (Camera.main != null ? (Vector3.Magnitude(Camera.main.transform.position) * 0.8f) : 1) * m_fTransRate; GameObject instEffectObject = FxmTestMain.inst.GetInstanceEffectObject(); GameObject simRoot = NgObject.CreateGameObject(instEffectObject.transform.parent.gameObject, "simulate"); FxmTestSimulate simComponent = simRoot.AddComponent <FxmTestSimulate>(); instEffectObject.transform.parent = simRoot.transform; FxmTestMain.inst.ChangeRoot_InstanceEffectObject(simRoot); simComponent.Init(this, m_nMultiShotCount); switch (nTransIndex) { case 1: // Move { simComponent.SimulateMove(m_nTransAxis, fTransHalfDist, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 2: // scale { simComponent.SimulateScale(m_nTransAxis, fTransHalfDist * 0.3f, m_fStartPosition, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 3: // Arc { simComponent.SimulateArc(fTransHalfDist * 0.7f, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 4: // fall { simComponent.SimulateFall(fTransHalfDist * 0.7f, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 5: // raise { simComponent.SimulateRaise(fTransHalfDist * 0.7f, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 6: // circle { simComponent.SimulateCircle(fTransHalfDist * 0.5f, m_fDistPerTime, (m_nRotateIndex == 0)); break; } case 7: // tornado { simComponent.SimulateTornado(fTransHalfDist * 0.3f, fTransHalfDist * 0.7f, m_fDistPerTime, (m_nRotateIndex == 0)); break; } } } // �̵�ó�����̸�... �ڵ��ݺ��ǹǷ� ����repeat�ɼ��� ����. if (0 < nTransIndex) { if (m_nRepeatIndex <= nPlayIndex) { nPlayIndex = 0; } } // ���� ������ ���� m_nPlayIndex = nPlayIndex; m_nTransIndex = nTransIndex; if (IsRepeat()) { m_fCreateTime = Time.time; } }
void OnEnable() { NgUtil.LogDevelop("OnEnable - FXMakerMain"); }