Esempio n. 1
0
    // -------------------------------------------------------------------------------------------
    void winMenuChange(int id)
    {
        int nVirticlaCount = 0;

        if ((FXMakerLayout.m_bMinimizeAll || FXMakerLayout.m_bMinimizeTopMenu) == false)
        {
            // change button
            if (GUI.Button(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 3, 0, 1), FXMakerTooltip.GetHcToolMain("go " + (m_nToolIndex == 0 ? "PrefabTool" : "Background"))))
            {
                SetActiveTool(m_nToolIndex == 0 ? 1 : 0);
            }
            // Capture
            if (GUI.Button(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 3, 1, 1), FXMakerTooltip.GetHcToolMain("FullCapture", FXMakerCapture.GetCaptureScreenShotDir())))
            {
                if (Input.GetMouseButtonUp(1))
                {
                    //Debug.Log(FXMakerCapture.GetCaptureScreenShotDir());
                    EditorUtility.OpenWithDefaultApp(FXMakerCapture.GetCaptureScreenShotDir());
                }
                else
                {
                    FXMakerCapture.CaptureScreenShot();
                }
            }
            nVirticlaCount = 2;
        }
        else
        {
            nVirticlaCount = 0;
        }

        // Reload Project Data
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 1 + nVirticlaCount, nVirticlaCount, 1), 2, 0, 1), FXMakerTooltip.GetHcToolMain("LoadPrj")))
        {
            LoadTool("Loaded Project");
        }
        // Save Project Data
        FXMakerEffect fxMakerEffect = GetComponent <FXMakerEffect>();
        bool          bEnable       = (fxMakerEffect != null && GetComponent <FXMakerEffect>().IsReadOnlyFolder() == 0);

        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 1 + nVirticlaCount, nVirticlaCount, 1), 2, 1, 1), FXMakerTooltip.GetHcToolMain("SavePrj"), bEnable))
        {
            SaveTool("Saved Prjoect");
        }
        SaveTooltip();
    }
Esempio n. 2
0
 GUIContent GetHelpContentScript(string text)
 {
     return(FXMakerTooltip.GetHcPopup_EffectScript(text));
 }
Esempio n. 3
0
    // 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);
            }
        }
    }
Esempio n. 4
0
    // ==========================================================================================================
    void winResourceList(int id)
    {
        GUIStyle   labelStyle = GUI.skin.GetStyle("BackMain_NotSelected");
        int        nWinIndex  = id - FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.RESOURCE_START);
        int        nBackIndex = nWinIndex - m_CloneTypeCount;
        bool       bCloneType = nWinIndex < m_CloneTypeCount;
        GameObject settingObj = (m_CurrentBackgroundInfo != null) ? m_CurrentBackgroundInfo.GetChildObject(nWinIndex) : null;

        // 현재 선택된 prefab
        if (settingObj != null)
        {
            GUIContent econ = new GUIContent();
            econ.image   = FXMakerMain.inst.GetPrefabThumbTexture(m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex));
            econ.text    = settingObj.name;
            econ.tooltip = bCloneType ? FXMakerTooltip.GetHsToolBackground("RES_CLONE_HOVER", settingObj.name) : FXMakerTooltip.GetHsToolBackground("RES_REFERENCE_HOVER", settingObj.name);
            // Current Selected
            if (settingObj != null && GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, FXMakerLayout.m_fScrollButtonHeight), econ))
            {
                m_CurrentBackgroundInfo.SetPingObject(nWinIndex);
            }

            // Clear Selected
            if (GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25), FXMakerTooltip.GetHcToolBackground("Clear Selected", settingObj.name)))
            {
                settingObj = null;
                if (bCloneType)
                {
                    m_CurrentBackgroundInfo.SetCloneObject(nWinIndex, null);
                }
                else
                {
                    m_CurrentBackgroundInfo.SetReferenceObject(nBackIndex, null);
                }
//				SaveBackgroundPrefab();
            }
            // Thumb Selected
            if (bCloneType && m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex) != "" && GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 48 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25), FXMakerTooltip.GetHcToolBackground("Create Thumb", settingObj.name)))
            {
                FXMakerCapture.StartSaveBackThumb(m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex));
                return;
            }
        }
        else
        {
            if (bCloneType)
            {
                string strDir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDRESOURCES), m_ResourceSubDir[nWinIndex]);
                GUI.Box(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, FXMakerLayout.m_fScrollButtonHeight), FXMakerTooltip.GetHcToolBackground("[Not Selected]", strDir), labelStyle);

                // list ----------------------------
                int  nNodeCount = m_ClonePrefabs[nWinIndex].Length;
                Rect listRect   = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetResListRect(nWinIndex), 160, 1, 0, 1);
                Rect scrollRect = FXMakerLayout.GetScrollViewRect((int)listRect.width, nNodeCount, 1);
                Rect gridRect   = FXMakerLayout.GetScrollGridRect((int)listRect.width, nNodeCount, 1);
                m_CloneWindowScrollPos[nWinIndex] = GUI.BeginScrollView(listRect, m_CloneWindowScrollPos[nWinIndex], scrollRect);
//				m_nResourceSelIndex[nWinIndex]		= GUI.SelectionGrid(gNcLayout.GetChildVerticalRect(gNcLayout.GetResListRect(nWinIndex), 80, 1, 0, 1), m_nResourceSelIndex[nWinIndex], m_strResourceList[nWinIndex], 1);
//				m_nClonePrefabSelIndex[nWinIndex]	= GUI.SelectionGrid(gridRect, m_nClonePrefabSelIndex[nWinIndex], m_CloneContents[nWinIndex], 1);
                m_nClonePrefabSelIndex[nWinIndex] = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(FXMakerLayout.GetResListRect(nWinIndex), 0, -m_CloneWindowScrollPos[nWinIndex].y), listRect, gridRect, m_nClonePrefabSelIndex[nWinIndex], m_CloneContents[nWinIndex], 1);

                if (GUI.changed)
                {
                    NgUtil.LogDevelop("changed m_nResourceSelIndex - nWinIndex = " + nWinIndex + ", value = " + m_nClonePrefabSelIndex[nWinIndex]);

                    GameObject selPrefab = m_ClonePrefabs[nWinIndex][m_nClonePrefabSelIndex[nWinIndex]];
                    m_CurrentBackgroundInfo.SetCloneObject(nWinIndex, selPrefab);
//					SaveBackgroundPrefab();
                }
                GUI.EndScrollView();
            }
        }

        // select prefab
        if (bCloneType == false)
        {
            Rect subRect = new Rect(FXMakerLayout.m_rectInnerMargin.x, 48 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(subRect, 2, 0, 1), FXMakerTooltip.GetHcToolBackground("Select", "")))
            {
                FxmPopupManager.inst.ShowSelectPrefabPopup(m_CurrentBackgroundInfo, false, nBackIndex);
//				SaveBackgroundPrefab();
            }
            if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(subRect, 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Open", ""), m_CurrentBackgroundInfo.GetReferenceObject(nBackIndex) != null))
            {
                FXMakerEffect.inst.LoadProject(AssetDatabase.GetAssetPath(m_CurrentBackgroundInfo.GetReferenceObject(nBackIndex)));
                FXMakerMain.inst.SetActiveTool(1);
//				SaveBackgroundPrefab();
            }
        }

        FXMakerMain.inst.SaveTooltip();
    }
Esempio n. 5
0
    // Event Function -------------------------------------------------------------------

    // -------------------------------------------------------------------------------------------
    GUIContent GetHelpContent(string text)
    {
//		return FXMakertip.GetGUIContentNoTooltip(text);
        return(FXMakerTooltip.GetHcPopup_Sprite(text));
    }
    // -------------------------------------------------------------------------------------------
    void winActionToolbar(int id)
    {
        Rect popupRect = FXMakerLayout.GetMenuTestPanelRect();
        Rect baseRect;
        int  nRowCount = 2;
        int  nRowIndex = 0;

        // window desc -----------------------------------------------------------
        FXMakerTooltip.WindowDescription(popupRect, FXMakerLayout.WINDOWID.PANEL_TEST, null);

        // mini ----------------------------------------------------------------
        m_bMinimize = GUI.Toggle(new Rect(3, 1, popupRect.width, FXMakerLayout.m_fMinimizeClickHeight), m_bMinimize, "MiniQuickMenu");
        if (GUI.changed)
        {
            EditorPrefs.SetBool("FXMakerQuickMenu.m_bMinimize", m_bMinimize);
        }
        GUI.changed = false;
        if (FXMakerLayout.m_bMinimizeAll || m_bMinimize)
        {
            FXMakerLayout.m_fTestPanelHeight = FXMakerLayout.m_MinimizeHeight;

            nRowCount = 1;
            // mesh info -----------------------------------------------------------------
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1);

            //

            FXMakerMain.inst.SaveTooltip();
            return;
        }
        else
        {
            FXMakerLayout.m_fTestPanelHeight = FXMakerLayout.m_fOriTestPanelHeight;
        }

        // info -----------------------------------------------------------------
        nRowCount = 3;
//      baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 2);
//      if (NcEffectBehaviour.GetRootInstanceEffect())
//      {
//          info		= string.Format("P = {0}\nM = {1}\nT = {2}", m_nParticleCount, m_nMeshCount, m_nTriangles);
//          infotooltip	= string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", m_nParticleCount, m_nMeshCount, m_nTriangles, m_nVertices);
//      }
//      GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 1), new GUIContent(info, FXMakerTooltip.Tooltip(infotooltip)));

        // control button ------------------------------------------------------------
        if (FXMakerMain.inst.IsCurrentEffectObject())
        {
            // Replay ---------------------------------------
            bool bCreatedReplay = (m_ReplayObject != null && m_ReplayObject == FXMakerMain.inst.GetInstanceEffectObject());
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, nRowIndex++, 1);
            if (FXMakerLayout.GUIButton(baseRect, "CreateReplayEffect", true))
            {
                CreateReplayEffect();
            }
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, nRowIndex++, 1);
            if (FXMakerLayout.GUIButton(baseRect, "Replay", bCreatedReplay))
            {
                RunReplayEffect(false);
            }
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, nRowIndex++, 1);
            if (FXMakerLayout.GUIButton(baseRect, "Replay(ClearParticle)", bCreatedReplay))
            {
                RunReplayEffect(true);
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
 // -------------------------------------------------------------------------------------------
 protected override GUIContent GetHelpContent(string text)
 {
     return(FXMakerTooltip.GetHcFolderPopup_Texture(text));
 }
Esempio n. 8
0
    void winTopRight(int id)
    {
        if ((FXMakerLayout.m_bMinimizeAll || FXMakerLayout.m_bMinimizeTopMenu) == false)
        {
            Rect gridRectx = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 2, 0, 1);
            Rect gridRecty = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 2, 1, 1);
            m_nCameraAngleXIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetMenuTopRightRect(), gridRectx, m_nCameraAngleXIndex, FXMakerTooltip.GetHcToolEffect_CameraX(), 4);
            m_nCameraAngleYIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetMenuTopRightRect(), gridRecty, m_nCameraAngleYIndex, FXMakerTooltip.GetHcToolEffect_CameraY(), 4);

            if (GUI.changed)
            {
                FXMakerMain.inst.GetFXMakerMouse().ChangeAngle(FXMakerOption.inst.m_nCameraAangleXValues[m_nCameraAngleXIndex], FXMakerOption.inst.m_nCameraAangleYValues[m_nCameraAngleYIndex]);

                // 付瘤阜 急琶沥焊 历厘
                UnityEditor.EditorPrefs.SetInt("FXMakerEffect.m_nCameraAngleXIndex", m_nCameraAngleXIndex);
                UnityEditor.EditorPrefs.SetInt("FXMakerEffect.m_nCameraAngleYIndex", m_nCameraAngleYIndex);
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
Esempio n. 9
0
    // ==========================================================================================================
    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();
    }
Esempio n. 10
0
    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);
        }
    }
Esempio n. 11
0
    // ==========================================================================================================
    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();
    }
Esempio n. 12
0
    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);

            if (projectPath.Contains("Assets/Resources") && projectName == "Resources" && projectPath.Contains("Res.."))
            {
                projectName = "2 Background";
            }

            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);
        }
    }
    public override bool ShowPopupWindow(Object selObj, bool bSaveDialog)
    {
        Material currentObj = selObj as Material;

        // No Shader Selected
        if (currentObj != null && (currentObj.shader == null || currentObj.shader.name == ""))
        {
            currentObj = null;
        }

        // init
        m_OriMaterial                  = currentObj;
        m_OriObjectContent             = (currentObj == null ? new GUIContent() : new GUIContent(currentObj.name, currentObj.mainTexture, FXMakerTooltip.Tooltip(GetTextureInfo(currentObj.mainTexture, false))));
        m_SelectedMaterial             = currentObj;
        m_CurrentTextureMaterials      = null;
        m_nCurrentTextureMaterialIndex = -1;
        m_NewShaderMaterials           = null;
        m_nNewShaderMaterialIndex      = -1;
        m_nBottomHeight                = m_nOriginalBottomHeight + m_nMaterialBottomHeight + m_nPaletteBottomHeight;
        m_bUniqueSave                  = false;
        m_PrefsName            = "Texture";
        m_BaseDefaultGroupName = m_DefaultGroupName;
        bool baseRet = base.ShowPopupWindow(m_SelectedTransform, bSaveDialog);

        // arg select
        m_SelObjectContent = m_OriObjectContent;
        if (currentObj != null)
        {
            SetActiveObject(currentObj.mainTexture, false);
        }

        return(baseRet);
    }
    void DrawBottomPaletteRect(Rect baseRect)
    {
        if (m_SelectedMaterial == null)
        {
            return;
        }

        GUIStyle styleBox = GUI.skin.GetStyle("MaterialList_Box");
        Color    oldColor = GUI.color;
        Color    oldMatColor;
        bool     bReinstance = false;

        if (NgMaterial.IsMaterialColor(m_SelectedMaterial) == false)
        {
            return;
        }

        // Color Palette Image
        baseRect = FXMakerLayout.GetOffsetRect(baseRect, 0, -2, 0, -3);
        GUI.Box(baseRect, FXMakerTooltip.GetGUIContentNoTooltip(), styleBox);
        baseRect = FXMakerLayout.GetOffsetRect(baseRect, 2, 2, -2, -2);
        Rect popupRect = GetPopupRect();
        Rect leftRect  = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 0, 1);
        Rect rightRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 1, 1);

        // Pickup Color
        GUI.color = Color.white;
        Color   pickColor   = oldMatColor = NgMaterial.GetMaterialColor(m_SelectedMaterial);
        Color32 oldMatCol32 = oldMatColor;

        // Color Progress
        Rect barRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(leftRect, 5, 0, 1), -1, 1, 1, -1);

        GUI.DrawTexture(FXMakerLayout.GetOffsetRect(barRect, 5, 0, -5, 0), m_PaletteBarColorImage);
        float fPaletteBarValue = GUI.HorizontalSlider(barRect, m_fPaletteBarColorValue, 0, 1.0f);

        if (m_fPaletteBarColorValue != fPaletteBarValue)
        {
            m_fPaletteBarColorValue = fPaletteBarValue;
            pickColor = m_PaletteBarColorImage.GetPixelBilinear(m_fPaletteBarColorValue, 0.5f);
        }

        // Color Palette
        Rect    palRect  = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(leftRect, 5, 1, 4), 4, 0, -4, -1);
        Rect    lockRect = new Rect(palRect.x + popupRect.x, palRect.y + popupRect.y, palRect.width, palRect.height + 1);
        Vector2 mousePos = FXMakerLayout.GetGUIMousePosition();

        GUI.DrawTexture(palRect, m_PalettePanelImage);
        if (Input.GetMouseButtonDown(0) && lockRect.Contains(mousePos))
        {
            m_bEnterPalette = true;
        }
        if (Input.GetMouseButtonUp(0) && m_bEnterPalette)
        {
            m_bEnterPalette = false;
            bReinstance     = true;
        }

        if (Input.GetMouseButton(0) && m_bEnterPalette)
        {
            int xpos = (int)(mousePos.x - lockRect.x);
            int ypos = (int)(mousePos.y - lockRect.y);
            if (xpos < 0)
            {
                xpos = 0;
            }
            if (ypos < 0)
            {
                ypos = 0;
            }
            if (lockRect.width <= xpos)
            {
                xpos = (int)(lockRect.width);
            }
            if (lockRect.height <= ypos)
            {
                ypos = (int)(lockRect.height);
            }

            pickColor = m_PalettePanelImage.GetPixelBilinear(xpos / palRect.width, (palRect.height - ypos) / palRect.height);
        }

        // Gray Progress
        GUI.changed = false;
        barRect     = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(rightRect, 5, 0, 1), -1, 1, 1, -1);
        GUI.DrawTexture(FXMakerLayout.GetOffsetRect(barRect, 5, 0, -5, 0), m_PaletteBarGrayImage);
        fPaletteBarValue = GUI.HorizontalSlider(barRect, m_fPaletteBarGrayValue, 0, 1.0f);
        if (GUI.changed)                // m_fPaletteBarGrayValue != fPaletteBarValue
        {
            m_fPaletteBarGrayValue = fPaletteBarValue;
            pickColor = m_PaletteBarGrayImage.GetPixelBilinear(m_fPaletteBarGrayValue, 0.5f);
            if (Input.GetMouseButtonDown(1))
            {
                m_fPaletteBarGrayValue = 0.5f;
                pickColor = new Color(0.5f, 0.5f, 0.5f);
            }
            GUI.changed = false;
        }

        GUI.color = oldColor;

        // Color RGB Scroll
        rightRect = FXMakerLayout.GetOffsetRect(rightRect, 0, 3, -5, -3);
        Color32 selColor32 = new Color(pickColor.r, pickColor.g, pickColor.b, oldMatColor.a);
        int     nTextWidth = 15;
        int     nEditWidth = 38;

        string[] rgbName  = { "R", "G", "B", "A" };
        Color[]  rgbColor = { Color.red, Color.green, Color.blue, Color.white };
        byte[]   RGBA     = new byte[4];

        RGBA[0] = selColor32.r;
        RGBA[1] = selColor32.g;
        RGBA[2] = selColor32.b;
        RGBA[3] = selColor32.a;

        // RGB Progress
        for (int n = 0; n < 4; n++)
        {
            string str;
            oldColor = GUI.color;
            Rect line = FXMakerLayout.GetInnerVerticalRect(rightRect, 5, n + 1, 1);
            line.width = nTextWidth;
            GUI.color  = rgbColor[n];
            GUI.Label(line, rgbName[n]);

            GUI.color = oldColor;
            line      = FXMakerLayout.GetInnerVerticalRect(rightRect, 5, n + 1, 1);
            RGBA[n]   = (byte)GUI.HorizontalSlider(FXMakerLayout.GetOffsetRect(line, nTextWidth, 0, -nEditWidth - 8, 0), RGBA[n], 0, 255);
            if (GUI.changed)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    RGBA[n] = 127;
                }
                GUI.changed = false;
            }
            line.x     = line.x + line.width - nEditWidth;
            line.width = nEditWidth;
            str        = GUI.TextField(FXMakerLayout.GetOffsetRect(line, 0, -2, 0, 2), RGBA[n].ToString());
            RGBA[n]    = (byte)(255 < NgConvert.ToUint(str, RGBA[n]) ? 255 : NgConvert.ToUint(str, RGBA[n]));
        }

        selColor32.r = RGBA[0];
        selColor32.g = RGBA[1];
        selColor32.b = RGBA[2];
        selColor32.a = RGBA[3];

        if (selColor32.r != oldMatCol32.r || selColor32.g != oldMatCol32.g || selColor32.b != oldMatCol32.b || selColor32.a != oldMatCol32.a)
        {
            SetActiveMaterialColor(selColor32);
        }

        // mouse up - reinstance
        Rect chkRect = new Rect(baseRect.x + popupRect.x, baseRect.y + popupRect.y, baseRect.width, baseRect.height);

        if (Input.GetMouseButtonUp(0) && chkRect.Contains(mousePos))
        {
            bReinstance = true;
        }

        if (bReinstance)
        {
//          CreateNewShaderMaterials(m_SelectedMaterial);
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }
    }
Esempio n. 15
0
    // ==========================================================================================================
    public void OnGUIGizmo()
    {
        Rect     baseRect = FXMakerLayout.GetMenuGizmoRect();
        Rect     boxRect;
        Rect     subRect;
        GUIStyle toolStyle = GUI.skin.GetStyle("GizmoToolbar");
        int      nColCount = 15;

        // -----------------------------------------------------------------------------------------------------------------------------------
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 7), new GUIContent(" ", " "));
//		m_nGizmoTypeIndex	= GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 5), m_nGizmoTypeIndex, GetGizmoContents(), 5, toolStyle);
        m_nGizmoTypeIndex = FXMakerLayout.TooltipSelectionGrid(baseRect, FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 5), m_nGizmoTypeIndex, GetGizmoContents(), 5, toolStyle);

        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect       = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 5, 2);
        subRect       = FXMakerLayout.GetOffsetRect(boxRect, 4, 0, -2, 0);
        m_bWorldSpace = GUI.Toggle(new Rect(subRect.x, subRect.y - 3, subRect.width, subRect.height - 5), m_bWorldSpace, FXMakerTooltip.GetHcEffectGizmo("World"));
        m_bFixedSide  = GUI.Toggle(new Rect(subRect.x, subRect.y + 10, subRect.width, subRect.height - 6), m_bFixedSide, FXMakerTooltip.GetHcEffectGizmo("Fixed-Z"));

        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 4);
        boxRect = FXMakerLayout.GetOffsetRect(boxRect, 2, 0, -2, 0);
        GUI.Box(boxRect, new GUIContent(" ", " "));
        subRect   = FXMakerLayout.GetOffsetRect(boxRect, 1, -3, -4, -8);
        m_bGridXY = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bGridXY, FXMakerTooltip.GetHcEffectGizmo("XY"));
        m_bGridXZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bGridXZ, FXMakerTooltip.GetHcEffectGizmo("XZ"));
        m_bGridYZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bGridYZ, FXMakerTooltip.GetHcEffectGizmo("YZ"));

        subRect       = FXMakerLayout.GetOffsetRect(boxRect, 1, 10, -4, 3);
        m_bBackground = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 1, 0, 1), m_bBackground, FXMakerTooltip.GetHcEffectGizmo("Background"));


        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 11, 4);
        GUI.Box(boxRect, new GUIContent(" ", " "));
        subRect = FXMakerLayout.GetOffsetRect(boxRect, 0, 2, 0, -2);
        // Grayscale
        bool bGray = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bShowGameObjectOptionGray, FXMakerTooltip.GetHcEffectGizmo("Gray")));

        if (m_bShowGameObjectOptionGray != bGray)
        {
            m_bShowGameObjectOptionGray = bGray;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionGray", m_bShowGameObjectOptionGray);
            FXMakerMain.inst.ResetCamera();
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }
        // BoundsBox
        bool bBounds = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bShowGameObjectOptionBounds, FXMakerTooltip.GetHcEffectGizmo("Box")));

        if (m_bShowGameObjectOptionBounds != bBounds)
        {
            m_bShowGameObjectOptionBounds = bBounds;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionBounds", m_bShowGameObjectOptionBounds);
            FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true);
        }
        // wireframe
        bool bWireframe = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bShowGameObjectOptionWireframe, FXMakerTooltip.GetHcEffectGizmo("Wire")));

        if (m_bShowGameObjectOptionWireframe != bWireframe)
        {
            m_bShowGameObjectOptionWireframe = bWireframe;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionWireframe", m_bShowGameObjectOptionWireframe);
            FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true);
        }

        // -----------------------------------------------------------------------------------------------------------------------------------
        if (GUI.changed)
        {
            SetGizmoType(m_nGizmoTypeIndex);

            EditorPrefs.SetBool("FXMakerGizmo.m_bWorldSpace", m_bWorldSpace);
//			EditorPrefs.SetBool("FXMakerGizmo.m_bFixedSide", m_bFixedSide);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridXY", m_bGridXY);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridXZ", m_bGridXZ);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridYZ", m_bGridYZ);
            EditorPrefs.SetBool("FXMakerGizmo.m_bBackground", m_bBackground);

            UpdateGrid(true);
            FXMakerBackground.inst.UpdateBackground();
        }

//          DrawGuiGizmo();

        FXMakerMain.inst.SaveTooltip();
    }
Esempio n. 16
0
    // -------------------------------------------------------------------------------------------
    void winActionToolbar(int id)
    {
        Rect       popupRect = FXMakerLayout.GetActionToolbarRect();
        Rect       baseRect;
        Rect       rect;
        string     info        = "";
        string     infotooltip = "";
        int        nColCount   = 10;
        int        nRowCount   = 5;
        GUIContent content;

        // window desc -----------------------------------------------------------
        FXMakerTooltip.WindowDescription(popupRect, FXMakerLayout.WINDOWID.EFFECT_CONTROLS, null);

        // mini ----------------------------------------------------------------
        m_bMinimize = GUI.Toggle(new Rect(3, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), m_bMinimize, "Mini");
        if (GUI.changed)
        {
            EditorPrefs.SetBool("FXMakerControls.m_bMinimize", m_bMinimize);
        }
        GUI.changed = false;
        if (FXMakerLayout.m_bMinimizeAll || m_bMinimize)
        {
            FXMakerLayout.m_fActionToolbarHeight = FXMakerLayout.m_MinimizeHeight;

            nRowCount = 1;
            // mesh info -----------------------------------------------------------------
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1);
            if (FXMakerMain.inst.IsCurrentEffectObject())
            {
                info        = string.Format("P={0} M={1} T={2}", m_nParticleCount, m_nMeshCount, m_nTriangles);
                infotooltip = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", m_nParticleCount, m_nMeshCount, m_nTriangles, m_nVertices);
            }
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), new GUIContent(info, FXMakerTooltip.Tooltip(infotooltip)));

            // CurrentTime Horizontal Slider ----------------------------------------------
            if (FXMakerMain.inst.IsCurrentEffectObject())
            {
                float fMaxTime = (m_nRepeatIndex <= m_nPlayIndex) ? m_fPlayToolbarTimes[m_nPlayIndex] : 10.0f;
                baseRect      = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1);
                content       = FXMakerTooltip.GetHcEffectControls("ElapsedTime", "");
                content.text += " " + (Time.time - m_fPlayStartTime).ToString("0.000");
                GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 2), content);
                rect    = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 4, 4);
                rect.y += 5;
                GUI.HorizontalSlider(rect, Time.time - m_fPlayStartTime, 0.0f, fMaxTime);

                // restart
                baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1);
                if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 2), FXMakerTooltip.GetHcEffectControls("Restart", "")))
                {
                    CreateInstanceEffect();
                }
            }

            FXMakerMain.inst.SaveTooltip();
            return;
        }
        else
        {
            FXMakerLayout.m_fActionToolbarHeight = FXMakerLayout.m_fOriActionToolbarHeight;
        }

        // mesh info -----------------------------------------------------------------
        baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 2);
        if (NcEffectBehaviour.GetRootInstanceEffect())
        {
            info        = string.Format("P = {0}\nM = {1}\nT = {2}", m_nParticleCount, m_nMeshCount, m_nTriangles);
            infotooltip = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", m_nParticleCount, m_nMeshCount, m_nTriangles, m_nVertices);
        }
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 1), new GUIContent(info, FXMakerTooltip.Tooltip(infotooltip)));

        // control button ------------------------------------------------------------
        if (FXMakerMain.inst.IsCurrentEffectObject())
        {
            bool bClick = false;

            // Play ---------------------------------------
            GUIContent[] playToolbarContents = FXMakerTooltip.GetHcEffectControls_Play(0, m_fTimeScale, m_fPlayToolbarTimes[1], m_fPlayToolbarTimes[m_nRepeatIndex], m_fPlayToolbarTimes[m_nRepeatIndex + 1], m_fPlayToolbarTimes[m_nRepeatIndex + 2], m_fPlayToolbarTimes[m_nRepeatIndex + 3], m_fPlayToolbarTimes[m_nRepeatIndex + 4]);
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1);
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 1, 1), FXMakerTooltip.GetHcEffectControls("Play", ""));
//			int nPlayIndex	= GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nPlayIndex, playToolbarContents, playToolbarContents.Length);
            int nPlayIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nPlayIndex, playToolbarContents, playToolbarContents.Length);

            if (GUI.changed)
            {
                bClick = true;
            }

            // Trans ---------------------------------------
            GUIContent[] TransToolbarContents = FXMakerTooltip.GetHcEffectControls_Trans(m_nTransAxis);
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 1, 1);
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 1, 1), FXMakerTooltip.GetHcEffectControls("Trans", ""));
//			int nTransIndex	= GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nTransIndex, TransToolbarContents, TransToolbarContents.Length);
            int nTransIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nTransIndex, TransToolbarContents, TransToolbarContents.Length);

            if (GUI.changed)
            {
                bClick       = true;
                m_fTransRate = 1.0f;
                if ((nTransIndex == 1 || nTransIndex == 2) && Input.GetMouseButtonUp(1))                        // m_nTransIndex scale
                {
                    if (m_nTransAxis == NgEnum.AXIS.Z)
                    {
                        m_nTransAxis = 0;
                    }
                    else
                    {
                        m_nTransAxis++;
                    }
                    UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nTransAxis", (int)m_nTransAxis);
                }
            }

            if (bClick)
            {
                FXMakerMain.inst.CreateCurrentInstanceEffect(false);
                RunActionControl(nPlayIndex, nTransIndex);
                UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nPlayIndex", m_nPlayIndex);
                UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nTransIndex", m_nTransIndex);
            }
        }

        // TransSpeed Horizontal Slider -----------------------------------------------
        float TransSpeed = m_fDistPerTime;

        baseRect      = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 2, 1);
        content       = FXMakerTooltip.GetHcEffectControls("DistPerTime", "");
        content.text += " " + m_fDistPerTime.ToString("00.00");
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content);
        rect       = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5);
        rect.y    += 5;
        TransSpeed = GUI.HorizontalSlider(rect, TransSpeed, 0.1f, 40.0f);
        // TransSpeed Trans ----------------------------------------------
//      if (GUI.Button(NgLayout.GetInnerHorizontalRect(baseRect, nColCount*2, 23, 1), NgTooltip.GetHcEffectControls("1", "")))
//          TransSpeed = 1;
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 14, 1), FXMakerTooltip.GetHcEffectControls("<", "")))
        {
            TransSpeed = (int)(TransSpeed - 1);
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 15, 1), FXMakerTooltip.GetHcEffectControls(">", "")))
        {
            TransSpeed = (int)(TransSpeed + 1);
        }
        if (TransSpeed != m_fDistPerTime)
        {
            m_fDistPerTime = (TransSpeed == 0 ? 0.1f : TransSpeed);
            UnityEditor.EditorPrefs.SetFloat("FXMakerControls.m_fDistPerTime", m_fDistPerTime);
            // Trans 상태면.. 바로 적용
            if (0 < m_nTransIndex)
            {
                CreateInstanceEffect();
            }
        }

        if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 9, 1), FXMakerTooltip.GetHcEffectControls("Multi", m_nMultiShotCount.ToString()), true))
        {
            if (Input.GetMouseButtonUp(0))
            {
                m_nMultiShotCount++;
                if (4 < m_nMultiShotCount)
                {
                    m_nMultiShotCount = 1;
                }
            }
            else
            {
                m_nMultiShotCount = 1;
            }
            CreateInstanceEffect();
        }

        // front Rotation ----------------------------------------------
        GUIContent[] rotateToolbarContents = FXMakerTooltip.GetHcEffectControls_Rotate();
        baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 2, 1);
//		int nRotateIndex	= GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 1), m_nRotateIndex, rotateToolbarContents, rotateToolbarContents.Length);
        int nRotateIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 1), m_nRotateIndex, rotateToolbarContents, rotateToolbarContents.Length);

        if (nRotateIndex != m_nRotateIndex)
        {
            m_nRotateIndex = nRotateIndex;
            UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nRotateIndex", m_nRotateIndex);
            // Trans 상태면.. 바로 적용
            if (0 < m_nTransIndex)
            {
                CreateInstanceEffect();
            }
        }

        // timeScale Horizontal Slider -----------------------------------------------
        float timeScale = m_fTimeScale;

        baseRect      = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 3, 1);
        content       = FXMakerTooltip.GetHcEffectControls("TimeScale", "");
        content.text += " " + m_fTimeScale.ToString("0.00");
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content);
        rect      = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5);
        rect.y   += 5;
        timeScale = GUI.HorizontalSlider(rect, timeScale, 0.0f, 2.0f);
        if (timeScale == 0)
        {
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 1), FXMakerTooltip.GetHcEffectControls("Resume", "")))
            {
                timeScale = m_fOldTimeScale;
            }
        }
        else
        {
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 1), FXMakerTooltip.GetHcEffectControls("Pause", "")))
            {
                timeScale = 0;
            }
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 1), FXMakerTooltip.GetHcEffectControls("Reset", "")))
        {
            timeScale = 1;
        }
        SetTimeScale(timeScale);

        // CurrentTime Horizontal Slider ----------------------------------------------
        if (FXMakerMain.inst.IsCurrentEffectObject())
        {
            float fMaxTime = (m_nRepeatIndex <= m_nPlayIndex) ? m_fPlayToolbarTimes[m_nPlayIndex] : 10.0f;
            baseRect      = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 4, 1);
            content       = FXMakerTooltip.GetHcEffectControls("ElapsedTime", "");
            content.text += " " + (Time.time - m_fPlayStartTime).ToString("0.000");
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content);
            rect    = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5);
            rect.y += 5;
            GUI.HorizontalSlider(rect, Time.time - m_fPlayStartTime, 0.0f, fMaxTime);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 14, 1), FXMakerTooltip.GetHcEffectControls("+.5", "")))
            {
                SetTimeScale(1.0f);
                Invoke("invokeStopTimer", 0.5f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 15, 1), FXMakerTooltip.GetHcEffectControls("+.1", "")))
            {
                SetTimeScale(0.4f);
                Invoke("invokeStopTimer", 0.1f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 16, 1), FXMakerTooltip.GetHcEffectControls("+.05", "")))
            {
                SetTimeScale(0.2f);
                Invoke("invokeStopTimer", 0.05f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 17, 1), FXMakerTooltip.GetHcEffectControls("+.01", "")))
            {
                SetTimeScale(0.04f);
                Invoke("invokeStopTimer", 0.01f);
            }

            // restart
            baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 3, 2);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 9, 1), FXMakerTooltip.GetHcEffectControls("Restart", "")))
            {
                CreateInstanceEffect();
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
 GUIContent GetHelpContent(string text, string arg)
 {
     return(FXMakerTooltip.GetHcPopup_GameObject(text, arg));
 }
Esempio n. 18
0
    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();
    }
Esempio n. 19
0
    // Event Function -------------------------------------------------------------------


    // -------------------------------------------------------------------------------------------
    protected virtual GUIContent GetHelpContent(string text)
    {
        return(FXMakerTooltip.GetHcFolderPopup_Common(text));
    }
    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();
    }