Exemple #1
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();
    }
Exemple #2
0
 // -------------------------------------------------------------------------------------------
 public void OnGUIControl()
 {
     // Selected Info Window -----------------------------------------------
     FXMakerMain.inst.AutoFocusWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.EFFECT_CONTROLS), FXMakerLayout.GetActionToolbarRect(), winActionToolbar, "PrefabSimulate - " + (FXMakerMain.inst.IsCurrentEffectObject() ? FXMakerMain.inst.GetOriginalEffectPrefab().name : "Not Selected"));
 }