// ==========================================================================================================
    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);

        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);

        if (GUI.changed)
        {
            bChanged = true;
        }
//		FXMakerMain.inst.ToggleGlobalLangSkin(false);

        if (bChanged)
        {
            NgUtil.LogDevelop("changed MenuToolbar = " + nProjectIndex + " " + nGroupIndex);
            SaveProject();
            SelectToolbar(nProjectIndex, (m_nProjectIndex != nProjectIndex ? GetGroupIndex(nProjectIndex) : nGroupIndex), "");
        }

        FXMakerMain.inst.SaveTooltip();
    }
Beispiel #2
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);

            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);

            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);

        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();
    }
Beispiel #3
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();
    }
Beispiel #4
0
    // -------------------------------------------------------------------------------------------
    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();
    }