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); }
// ========================================================================================================== protected override void DrawBottomRect(Rect baseRect) { GUI.Box(baseRect, ""); GUIContent guiCon; Rect imageRect = baseRect; imageRect.width = FXMakerLayout.GetFixedWindowWidth(); Rect rightRect = baseRect; rightRect.x += imageRect.width; rightRect.width -= imageRect.width; rightRect = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3); Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5); Rect buttonRect2 = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 5); // image if (m_SelObjectContent == null) { guiCon = new GUIContent("[Not Selected]"); } else { guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip); } if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null))) { if (Input.GetMouseButtonUp(0)) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } } int nImageMargin = 3; imageRect = FXMakerLayout.GetOffsetRect(imageRect, -nImageMargin); EditorGUIUtility.DrawCurveSwatch(imageRect, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).m_AniCurve, null, Color.green, Color.black, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).GetFixedDrawRange()); // text // GUI.Label(NgLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text)); if (m_bSaveDialog) { bool bSaveEnable = (0 <= m_nProjectIndex); bool bReadOnyFolder = false; if (bSaveEnable) { bReadOnyFolder = IsReadOnlyFolder(m_ProjectFolerContents[m_nProjectIndex].text); bSaveEnable = !bReadOnyFolder; } // Cancel if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true)) { ClosePopup(false); return; } // save if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable)) { SaveAddCurvePrefab(false); ClosePopup(true); } // overwrite if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect2, 2, 0, 2), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Overwrite", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Overwrite")), (bSaveEnable && 0 <= m_nObjectIndex))) { SaveAddCurvePrefab(true); ClosePopup(true); } buttonRect.height *= 2; if (m_bDrawRedBottomButtom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } } else { // Undo if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Undo"), (m_SelCurveInfo != null))) { UndoCurveAni(); } // close if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), GetHelpContent("Close"))) { ClosePopup(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(); }
bool LoadGroup(int nProjectIndex, int nGroupIndex, string groupName) { if (m_nProjectCount <= nProjectIndex) { nProjectIndex = m_nProjectCount - 1; } m_nProjectIndex = nProjectIndex; // load Group if (0 <= m_nProjectIndex && m_nProjectIndex < m_nProjectCount) { string[] groupFolderStrings = NgAsset.GetFolderList(NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text), null, null, FXMakerOption.inst.m_nMinBottomToolbarCount, out m_nGroupCount); m_GroupFolderContents = NgConvert.StringsToContents(groupFolderStrings); if (m_GroupFolderContents != null) { for (int n = 0; n < m_GroupFolderContents.Length; n++) { if (groupName != "" && m_GroupFolderContents[n].text == groupName) { nGroupIndex = n; } if (m_GroupFolderContents[n].text == null) { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("EMPTYGROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text)); } else { if (IsReadOnlyFolder(m_ProjectFolerContents[m_nProjectIndex].text) || IsReadOnlyFolder(m_GroupFolderContents[n].text)) { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("GROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text, m_GroupFolderContents[n].text) + "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY", "")); } else { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("GROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text, m_GroupFolderContents[n].text)); } } } } SetGroupIndex(nGroupIndex); LoadEffectFolder(""); return(true); } else { m_nGroupCount = 0; SetGroupIndex(-1); return(false); } }
public void LoadProject(string defaultEffectPath) { // Debug.Log(defaultEffectPath); NgUtil.LogDevelop("LoadProject - FXMakerMain"); // clear current FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); // load Project string[] projectFolerStrings = NgAsset.GetFolderList(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), null, null, FXMakerOption.inst.m_nMinTopToolbarCount, out m_nProjectCount); m_ProjectFolerContents = NgConvert.StringsToContents(projectFolerStrings); for (int n = 0; n < m_ProjectFolerContents.Length; n++) { if (m_ProjectFolerContents[n].text == null) { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("EMPTYPROJECT_HOVER", FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS)); } else { if (IsReadOnlyFolder(m_ProjectFolerContents[n].text)) { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("PROJECT_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[n].text) + "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY", "")); } else { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("PROJECT_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[n].text)); } } } int nProjectIndex = -1; int nGroupIndex = 0; int nEffectIndex = 0; // 捞傈 急琶沥焊 贸府 if (FXMakerLayout.m_bDevelopPrefs == false) { nProjectIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nProjectIndex", nProjectIndex); nGroupIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nGroupIndex", nGroupIndex); nEffectIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nEffectIndex", nEffectIndex); m_nScrollColumn = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nScrollColumn", m_nScrollColumn); } // defaultEffectPath if (defaultEffectPath != null && defaultEffectPath != "") { string projectPath = defaultEffectPath.Replace(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), ""); string projectName = NgFile.GetSplit(projectPath, 1); string groupName = NgFile.GetSplit(projectPath, 2); for (nProjectIndex = 0; nProjectIndex < m_ProjectFolerContents.Length; nProjectIndex++) { if (m_ProjectFolerContents[nProjectIndex].text == projectName) { break; } } SelectToolbar(nProjectIndex, groupName, defaultEffectPath); } else { // Search DefaultDir if (nProjectIndex < 0) { for (nProjectIndex = 0; nProjectIndex < m_ProjectFolerContents.Length; nProjectIndex++) { if (m_ProjectFolerContents[nProjectIndex].text == m_DefaultProjectName) { break; } } } SelectToolbar(nProjectIndex, nGroupIndex, nEffectIndex); } }
void winMenuEdit(int id) { if (m_nGroupCount <= 0) { return; } // Change Group name if (0 <= m_nGroupIndex && m_nGroupIndex < m_nGroupCount) { // string newName = GUI.TextField(gNcLayout.GetChildVerticalRect(gNcLayout.GetMenuTopRightRect(), 0, 2, 0), m_GroupFolerStrings[m_nGroupIndex], 50); // newName = newName.Trim(); // if (newName != "" && m_GroupFolerStrings[m_nGroupIndex] != newName) // { // FileUtil.ReplaceDirectory(NgFile.CombinePath(m_RootBackgroundDir, m_GroupFolerStrings[m_nGroupIndex]), NgFile.CombinePath(m_RootBackgroundDir, newName)); // m_GroupFolerStrings[m_nGroupIndex] = newName; // FXMakerMain.inst.AssetDatabaseRefresh(); // } } // Add button if (m_nBackgroundCount < FXMakerOption.inst.m_nMinBottomToolbarCount) { if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 0, 1), 2, 0, 1), FXMakerTooltip.GetHcToolBackground("New", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), m_GroupFolerContents[m_nGroupIndex].text)))) { RenameCurrentPrefab(m_EditingName); NewPrefab(); return; } } // Selected state if (m_CurrentBackgroundInfo != null) { // Delete button if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 0, 1), 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Del", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); m_bProcessDelete = true; } if (m_bProcessDelete) { m_bProcessDelete = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_BackgroundContents[m_nBackgroundIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETEPREFAB", "")); if (m_bProcessDelete == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { if (m_CurrentBackgroundInfo != null) { DestroyImmediate(m_CurrentBackgroundInfo.gameObject); } FXMakerAsset.DeleteEffectPrefab(m_BackgroundPrefabs[m_nBackgroundIndex]); SelectToolbar(m_nGroupIndex, m_nBackgroundIndex - 1); return; } } } // Clone button if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 1, 1), 2, 0, 1), FXMakerTooltip.GetHcToolBackground("Clone", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); ClonePrefab(); return; } // Thumb Selected if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 1, 1), 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Thumb", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); ThumbPrefab(); return; } // ChangeName if (m_CurrentBackgroundInfo != null && 0 <= m_nBackgroundIndex && m_nBackgroundIndex < m_nBackgroundCount) { GUI.SetNextControlName("TextField"); m_EditingName = GUI.TextField(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 2, 1), m_EditingName, 50); if (FXMakerMain.GetPrevWindowFocus() == (int)FXMakerLayout.WINDOWID.TOP_RIGHT && FXMakerMain.GetWindowFocus() != (int)FXMakerLayout.WINDOWID.TOP_RIGHT) { RenameCurrentPrefab(m_EditingName); } } } FXMakerMain.inst.SaveTooltip(); }
// ========================================================================================================== protected override void DrawBottomRect(Rect baseRect) { GUI.Box(baseRect, ""); GUIContent guiCon; Rect imageRect = baseRect; imageRect.width = FXMakerLayout.GetFixedWindowWidth(); Rect rightRect = baseRect; rightRect.x += imageRect.width; rightRect.width -= imageRect.width; rightRect = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3); Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5); if (m_bSaveDialog) { Rect labelRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 2, 3); GUI.Label(FXMakerLayout.GetLeftRect(labelRect, 100), "Filename:"); Rect editRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 5, 5); string saveFilename = GUI.TextField(editRect, m_SaveFilename, 50); if (saveFilename != m_SaveFilename) { if (saveFilename.Trim() != "") { m_SaveFilename = saveFilename; } } } else { bool bPreviewEnable = false; // image if (m_SelObjectContent == null) { guiCon = new GUIContent("[Not Selected]"); // original mesh preview if (m_bDialogType == DIALOG_TYPE.SELECT && m_bSelectMeshDialog && m_OldSelectMesh != null) { Texture2D preview = NgAsset.GetAssetPreview(m_OldSelectMesh); guiCon = new GUIContent(m_OldSelectMesh.name, preview, GetMeshInfo(m_OldSelectMesh)); bPreviewEnable = true; } } else { guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip); bPreviewEnable = (m_SelObjectContent != null); } if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), bPreviewEnable)) { if (m_bDialogType == DIALOG_TYPE.SELECT) { if (m_bSelectMeshDialog) { Object pingObj; Object pingMesh; if (m_AddPrefabObject != null) { pingObj = m_AddPrefabObject; pingMesh = m_AddPrefabObject.GetComponent <MeshFilter>().sharedMesh; } else { pingObj = m_OldSelectMesh; pingMesh = m_OldSelectMesh; } if (Input.GetMouseButtonUp(0)) { FXMakerAsset.SetPingObject(pingObj); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(pingMesh); } } else { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } } else { if (Input.GetMouseButtonUp(0)) { FXMakerAsset.SetPingObject(m_AddGameObject); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(GetObjectNodePrefab(m_nObjectIndex)); } } } // text GUI.Label(FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text)); } if (m_bSaveDialog) { bool bSaveEnable = (0 <= m_nGroupIndex && 0 < m_nGroupCount); bool bReadOnyFolder = false; if (bSaveEnable) { bReadOnyFolder = 0 < IsReadOnlyFolder(); bSaveEnable = !bReadOnyFolder; } // Cancel if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true)) { ClosePopup(false); return; } // save if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable)) { SaveCurrentObjectToPrefabFile(); ClosePopup(true); // FXMakerEffect.inst.LoadProject(); } if (m_bDrawRedBottomButtom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } if (m_bDrawRedBottom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(baseRect, 2), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } } else { // Undo int nButtonWidht = 70; buttonRect.width = nButtonWidht / 2; if (FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Undo"), (m_AddGameObject != null))) { UndoObject(); } // close buttonRect.x += buttonRect.width + 5; buttonRect.width = baseRect.width - buttonRect.x; if (GUI.Button(buttonRect, GetHelpContent("Close"))) { ClosePopup(true); } } }
// tooltip ------------------------------------------------------------- void ProcessTooltip() { if (FxmPopupManager.inst.IsShowModalMessage() == false) { if (m_PriorityTooltip != "") { m_Tooltip = m_PriorityTooltip; } if (m_Tooltip != "") { if (0 < m_Tooltip.Trim().Length) { string tooltip = ""; // HintRect tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HintRect, m_Tooltip); if (tooltip != "") { if (FXMakerOption.inst.m_bHintRedBox) { FxmPopupManager.inst.ShowHintRect(FXMakerTooltip.GetHintRect(tooltip)); } } // HoverCommand_Button tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HoverCommand_Button, m_Tooltip); if (tooltip != "") { OnHoverCommand_Button(tooltip); } // HoverCommand_Popup Object tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HoverCommand_Popup, m_Tooltip); if (tooltip != "") { OnHoverCommand_Popup(System.Convert.ToInt32(tooltip)); } else { OnHoverCommand_Popup(0); } // Cursor Shot Tooltip tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.CursorTooltip, m_Tooltip); if (tooltip != "") { FxmPopupManager.inst.ShowCursorTooltip(tooltip); } // Bottom Long Tooltip tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.Tooltip, m_Tooltip); if (tooltip != "") { FxmPopupManager.inst.ShowBottomTooltip(tooltip); } FxmPopupManager.inst.UpdateBringWindow(); } if (m_nOnGUICallCount == 2) { m_Tooltip = ""; m_PriorityTooltip = ""; } } else { // OnHoverCommand_Hierarchy(0); string msg = m_EmptyTooltip; FXMakerEffect fxMakerEffect = GetComponent <FXMakerEffect>(); if (fxMakerEffect != null && 0 < GetComponent <FXMakerEffect>().IsReadOnlyFolder()) { msg += "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY_BOTTOM", ""); } GUI.Label(FXMakerLayout.GetTooltipRect(), msg); } } }
void SaveMaterial(Material addMat) { string path = ""; string newPath = ""; string uniquePath; Object existsObj; int nUniqueCount = 0; // Find Same Material if (m_bUniqueSave == false && m_SelectedTextureMaterials != null) { foreach (Material mat in m_SelectedTextureMaterials) { if (NgMaterial.IsSameMaterial(mat, addMat, false)) { NgUtil.LogMessage(FXMakerTooltip.GetHsToolMessage("MATERIAL_EXISTSAVED", "")); SetSelectedTransformMaterial(mat); return; } } } // Create Path bool bUseDefaultFolder = false; string devMatDir = "_MaterialsTool"; string userMatDir = "_MaterialsUser"; string matDir; if (FXMakerLayout.m_bDevelopState) { matDir = devMatDir; } else { matDir = userMatDir; } if ((addMat.mainTexture != null)) { path = AssetDatabase.GetAssetPath(addMat.mainTexture); if (path == "") { bUseDefaultFolder = true; } else { newPath = NgFile.CombinePath(NgFile.TrimFilenameExt(path), matDir); // Default SubDirectory if (NgAsset.ExistsDirectory(newPath) == false) { AssetDatabase.CreateFolder(NgFile.TrimFilenameExt(path), matDir); } } } else { newPath = NgFile.TrimFilenameExt(AssetDatabase.GetAssetPath(m_OriMaterial)); if (newPath == "") { bUseDefaultFolder = true; } else { string tmpPath = NgFile.TrimLastFolder(newPath); string tmpLast = NgFile.GetLastFolder(newPath); if (FXMakerLayout.m_bDevelopState) { if (tmpLast != devMatDir) { newPath = NgFile.CombinePath(tmpPath, devMatDir); if (NgAsset.ExistsDirectory(newPath) == false) { AssetDatabase.CreateFolder(tmpPath, matDir); } } } else { if (tmpLast != userMatDir) { newPath = NgFile.CombinePath(tmpPath, userMatDir); if (NgAsset.ExistsDirectory(newPath) == false) { AssetDatabase.CreateFolder(tmpPath, matDir); } } } } } if (bUseDefaultFolder) { path = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDRESOURCES); newPath = NgFile.CombinePath(path, matDir); // Default SubDirectory if (NgAsset.ExistsDirectory(newPath) == false) { AssetDatabase.CreateFolder(path, matDir); } } // Unique Name string texname = addMat.name; if (addMat.mainTexture != null) { texname = addMat.mainTexture.name; } int nLoopCount = 0; while (true) { string matName = texname + (0 < nUniqueCount ? "_" + nUniqueCount.ToString() : "") + ".mat"; uniquePath = NgFile.CombinePath(newPath, matName); existsObj = AssetDatabase.LoadAssetAtPath(uniquePath, typeof(Material)); if (existsObj == null) { break; } nLoopCount++; nUniqueCount++; if (999 < nUniqueCount) { nUniqueCount = 1; } if (999 < nLoopCount) { Debug.LogError("Over Loop ----------------------"); return; } } AssetDatabase.CreateAsset(addMat, uniquePath); NgUtil.LogMessage(FXMakerTooltip.GetHsToolMessage("MATERIAL_NEWSAVED", "") + "\n" + uniquePath); FXMakerAsset.AssetDatabaseRefresh(); FXMakerAsset.AssetDatabaseSaveAssets(); }
// ========================================================================================================== protected override void DrawBottomRect(Rect baseRect) { GUI.Box(baseRect, ""); GUIContent guiCon; Rect imageRect = baseRect; imageRect.width = FXMakerLayout.GetFixedWindowWidth(); Rect rightRect = baseRect; rightRect.x += imageRect.width; rightRect.width -= imageRect.width; rightRect = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3); Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5); if (m_bSaveDialog) { Rect labelRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 2, 3); GUI.Label(FXMakerLayout.GetLeftRect(labelRect, 100), "Filename:"); Rect editRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 5, 5); string saveFilename = GUI.TextField(editRect, m_SaveFilename, 50); if (saveFilename != m_SaveFilename) { if (saveFilename.Trim() != "") { m_SaveFilename = saveFilename; } } } else { // image if (m_SelObjectContent == null) { guiCon = new GUIContent("[Not Selected]"); } else { guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip); } if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null))) { if (Input.GetMouseButtonUp(0)) { FXMakerAsset.SetPingObject(m_CurrentCurveAnimation); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(m_CurveAniObjects[m_nObjectIndex]); } } // text GUI.Label(FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text)); } if (m_bSaveDialog) { bool bSaveEnable = (0 <= m_nGroupIndex && 0 < m_nGroupCount); bool bReadOnyFolder = false; if (bSaveEnable) { bReadOnyFolder = 0 < IsReadOnlyFolder(); bSaveEnable = !bReadOnyFolder; } // Cancel if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true)) { ClosePopup(false); return; } // save if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable)) { SaveCurveAniToPrefabFile(); ClosePopup(true); // FXMakerEffect.inst.LoadProject(); } if (m_bDrawRedBottomButtom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } if (m_bDrawRedBottom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(baseRect, 2), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } } else { // Undo int nButtonWidht = 70; buttonRect.width = nButtonWidht / 2; if (FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Undo"), (m_SelCurveAniObject != null))) { UndoCurveAni(); m_nObjectIndex = -1; m_nSelObjectGroupIndex = -1; m_nSelObjectProjectIndex = -1; m_SelObjectContent = null; m_SelCurveAniObject = null; FXMakerMain.inst.CreateCurrentInstanceEffect(true); } // close buttonRect.x += buttonRect.width + 5; buttonRect.width = baseRect.width - buttonRect.x; if (GUI.Button(buttonRect, GetHelpContent("Close"))) { ClosePopup(true); } } }