// ==========================================================================================================
    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();
    }
Example #2
0
    void winModalMessage(int id)
    {
        Rect baseRect   = FXMakerLayout.GetModalMessageRect();
        Rect msgRect    = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 10, 1, 5);
        Rect buttonRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 10, 6, 3);

        switch (m_ModalType)
        {
        case FXMakerLayout.MODAL_TYPE.MODAL_NONE: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_MSG: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_OK: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_YESNO: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_OKCANCEL:
        {
            GUI.Label(FXMakerLayout.GetInnerHorizontalRect(msgRect, 10, 1, 9), m_ModalMessage);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 14, 2, 4), "OK"))
            {
                m_nModalMessageValue = FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK;
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 14, 8, 4), "CANCEL"))
            {
                m_nModalMessageValue = FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_CANCEL;
            }
            break;
        }
        }
    }
Example #3
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", true);
		SaveTooltip();
	}
Example #4
0
    protected void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();

//      if (UnscreenClose())
//          return;

        // --------------------------------------------------------------------------------
        int  nProjectRows = m_nProjectCount / m_nProjectColumn + (0 < (m_nProjectCount % m_nProjectColumn) ? 1 : 0);
        int  nGroupRows   = m_nGroupCount / m_nGroupColumn + (0 < (m_nGroupCount % m_nGroupColumn) ? 1 : 0);
        int  nTopHeight   = (nProjectRows + (m_bOptionRecursively ? 0 : nGroupRows) + 2) * m_nMenuButtonHeight + m_nMenuButtonHeight / 2;
        Rect topRect      = FXMakerLayout.GetChildTopRect(baseRect, 0, nTopHeight);
        Rect scrollRect   = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1);
        Rect bottomRect   = FXMakerLayout.GetChildBottomRect(baseRect, m_nBottomHeight);

        // left Align ----------------------------------------------------------------
        if (m_bShowLeftPopup)
        {
            m_bShowLeftPopup = GUI.Toggle(new Rect(baseRect.width - 50, 1, baseRect.width, 16), m_bShowLeftPopup, "Left");
            if (GUI.changed)
            {
                EditorPrefs.SetBool(m_PrefsName + ".m_bShowLeftPopup", m_bShowLeftPopup);
            }
        }
        else
        {
            m_bShowLeftPopup = !GUI.Toggle(new Rect(3, 1, baseRect.width, 16), !m_bShowLeftPopup, "Right");
            if (GUI.changed)
            {
                EditorPrefs.SetBool(m_PrefsName + ".m_bShowLeftPopup", m_bShowLeftPopup);
            }
        }
        GUI.changed = false;

        bottomRect.y      -= 3;
        scrollRect.height -= (m_nBottomHeight + 3);
        DrawFolderList(topRect);
        DrawObjectList(scrollRect);
        DrawBottomRect(bottomRect);

        FXMakerMain.inst.SaveTooltip();
    }
    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();
    }
    void winTopRight(int id)
    {
        if ((FXMakerLayout.m_bMinimizeAll || FXMakerLayout.m_bMinimizeTopMenu) == false)
        {
//          Rect	zoomRect	= NgLayout.GetChildVerticalRect(NgLayout.GetMenuTopRightRect(), 0, 3, 0, 1);
            Rect gridRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 0, 3);

//			if (GUI.Button(NgLayout.GetInnerHorizontalRect(zoomRect, 2, 0, 1), NgTooltip.GetHcToolEffect("Zoom/2")))
//              FXMakerMain.inst.GetFXMakerMouse().SetDistance(0.5f);
//          if (GUI.Button(NgLayout.GetInnerHorizontalRect(zoomRect, 2, 1, 1), NgTooltip.GetHcToolEffect("Zoom*2")))
//	            FXMakerMain.inst.GetFXMakerMouse().SetDistance(2.0f);

            m_nCameraAngleIndex = GUI.SelectionGrid(gridRect, m_nCameraAngleIndex, FXMakerTooltip.GetHcToolEffect_Camera(), 2);
            if (GUI.changed)
            {
                FXMakerMain.inst.GetFXMakerMouse().ChangeAngle(m_nCameraAangleValues[m_nCameraAngleIndex]);
                // 마지막 선택정보 저장
                UnityEditor.EditorPrefs.SetInt("FXMakerEffect.m_nCameraAngleIndex", m_nCameraAngleIndex);
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();
        Rect lineRect;

        if (UnfocusClose(baseRect, 5, 0, 0, 0))
        {
            return;
        }

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1);

        int nLineCount = m_nLineCount;
        int nDrawCount = 0;

        for (int n = 0; n < m_DisplayedMenu.Length; n++)
        {
            if (m_DisplayedMenu[n] == "-")
            {
                // Draw line
                lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nDrawCount, 1);
                NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
                nDrawCount += 1;
            }
            else
            {
                if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nDrawCount, 2), GetHelpContent(m_DisplayedMenu[n]), m_EnabledMenu[n]))
                {
                    m_nSelectedIndex = n;
                    ClosePopup(false);
                }
                nDrawCount += 2;
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
Example #8
0
    void winPopup(int id)
    {
        Rect   baseRect = GetPopupRect();
        Rect   lineRect;
        int    nMargin    = 2;
        int    nTopHeight = 1;
        int    nLineCount = 25;
        int    nIncLine   = 0;
        string str;

//      if (UnfocusClose(baseRect, 5, 0, 0, 0))
//          return;

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1);
        baseRect = FXMakerLayout.GetOffsetRect(baseRect, -nMargin);

        // Capture
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height - 1), (int)lineRect.width, Color.grey, 2, false);
        GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), "Capture");

        // m_CaptureType
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("CaptureType"), false);
        m_CaptureType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_CaptureType == CAPTURE_TYPE.ANIMATION, new GUIContent("Animation"), true) ? CAPTURE_TYPE.ANIMATION : m_CaptureType;
        m_CaptureType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), m_CaptureType == CAPTURE_TYPE.RANDOM, new GUIContent("Random"), true) ? CAPTURE_TYPE.RANDOM : m_CaptureType;

        // size 32, 64, 128, 256, 512
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Size"), false);
        m_nCaptureSizeIndex = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nCaptureSizeIndex, 1, 0, m_nCaptureSizeValues.Length - 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nCaptureSizeValues[m_nCaptureSizeIndex].ToString(), false);

        if (m_CaptureType == CAPTURE_TYPE.ANIMATION)
        {
            // frame
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Fps"), false);
            m_nFrameCountIndex = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nFrameCountIndex, 1, 0, m_nFrameCountValues.Length);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nFrameCountValues[m_nFrameCountIndex].ToString(), false);

            // Get Time
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 1, 0, 1), "Get Duration = " + FXMakerMain.inst.GetFXMakerControls().GetLastAutoRetTime().ToString("0.00"), true))
            {
                m_fCaptureTime = System.Convert.ToSingle(FXMakerMain.inst.GetFXMakerControls().GetLastAutoRetTime().ToString("0.00"));
            }

            // Rescale Time
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Time"), false);
            m_fCaptureTime = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fCaptureTime, GetFrameTime(), GetFrameTime(), m_fMaxCaptureTime);
            str            = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_fCaptureTime.ToString(), true).Trim();
            m_fCaptureTime = NgConvert.ToFloat(str, m_fCaptureTime);

            // SkipFrameCount
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("SkipFrame"), false);
            if (m_nTotalFrameCount <= m_nSkipFrameCount)
            {
                m_nSkipFrameCount = m_nTotalFrameCount - 1;
            }
            if (m_nTotalFrameCount <= 1)
            {
                m_nSkipFrameCount = 0;
            }
            else
            {
                m_nSkipFrameCount = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nSkipFrameCount, 1, 0, m_nTotalFrameCount);
            }
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nSkipFrameCount.ToString(), false);

            // total
            m_nTotalFrameCount = (int)(m_fCaptureTime / GetFrameTime()) + 1;
            m_nSaveFrameCount  = (m_nTotalFrameCount - m_nSkipFrameCount);
            m_nResultFps       = m_nFrameCountValues[m_nFrameCountIndex];
        }
        if (m_CaptureType == CAPTURE_TYPE.RANDOM)
        {
            // m_nRandomCaptureCount
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("CaptureCount"), false);
            m_nRandomCaptureCount = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nRandomCaptureCount, 1, 1, m_fMaxRandomCaptureCount);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nRandomCaptureCount.ToString(), false);

            // SkipTime
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("SkipTime"), false);
            m_fCaptureTime = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fCaptureTime, 0.01f, 0, m_fMaxCaptureTime);
            str            = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_fCaptureTime.ToString(), true).Trim();
            m_fCaptureTime = NgConvert.ToFloat(str, m_fCaptureTime);

            nIncLine += 2;

            // total
            m_nSkipFrameCount  = 0;
            m_nTotalFrameCount = m_nRandomCaptureCount;
            m_nSaveFrameCount  = m_nRandomCaptureCount;
            m_nResultFps       = m_nFrameCountValues[m_nFrameCountIndex];
        }

        // total frame
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TotalFrame"), false);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 7), (m_nTotalFrameCount - m_nSkipFrameCount).ToString(), false);

        // m_nResultTextureSize
        m_nResultCaptureSize = m_nCaptureSizeValues[(int)m_nCaptureSizeIndex];
        m_nResultTextureSize = NgAtlas.GetTextureSize(m_nSaveFrameCount, m_nResultCaptureSize);
        lineRect             = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TextureSize"), false);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 7), m_nResultTextureSize.ToString() + " x " + (m_nSaveFrameCount <= (m_nResultTextureSize / m_nResultCaptureSize) * (m_nResultTextureSize / m_nResultCaptureSize) / 2 ? m_nResultTextureSize / 2 : m_nResultTextureSize).ToString(), false);

        // -------------------------------------------------------------------------------------------------------------------------
        // Output
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height - 1), (int)lineRect.width, Color.grey, 2, false);
        GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), "Output");

        // bCreatePrefab
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Create"), false);
        m_bCreatePrefab = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_bCreatePrefab, new GUIContent("Prefab"), true);
        m_bCreatePrefab = !FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), !m_bCreatePrefab, new GUIContent("Texture"), true);

        // PlayMode
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("PlayMode"), false);
        if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.DEFAULT), new GUIContent("Default"), m_bCreatePrefab))
        {
            m_PlayMode = NcSpriteAnimation.PLAYMODE.DEFAULT;
        }
        if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.INVERSE), new GUIContent("Inverse"), m_bCreatePrefab))
        {
            m_PlayMode = NcSpriteAnimation.PLAYMODE.INVERSE;
        }
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.PINGPONG), new GUIContent("PingPong"), m_bCreatePrefab))
        {
            m_PlayMode = NcSpriteAnimation.PLAYMODE.PINGPONG;
        }
        if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.RANDOM), new GUIContent("Random"), m_bCreatePrefab))
        {
            m_PlayMode = NcSpriteAnimation.PLAYMODE.RANDOM;
        }

        // Loop
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Loop"), false);
        if (m_bCreatePrefab)
        {
            m_bLoop = !FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && !m_bLoop), new GUIContent("Once"), m_bCreatePrefab);
            m_bLoop = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_bLoop), new GUIContent("Loop"), m_bCreatePrefab);
        }
        else
        {
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_bLoop), new GUIContent("Once"), m_bCreatePrefab);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && !m_bLoop), new GUIContent("Loop"), m_bCreatePrefab);
        }

        // Shader
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Shader"), false);
        if (m_bCreatePrefab)
        {
            m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE), new GUIContent("Additive"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE : m_ShaderType;
            m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_MOBILE), new GUIContent("AdditiveMobile"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE_MOBILE : m_ShaderType;
            lineRect     = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_SOFT), new GUIContent("AdditiveSoft"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE_SOFT : m_ShaderType;
            m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED), new GUIContent("AlphaBlended"), m_bCreatePrefab) ? SHADER_TYPE.ALPHA_BLENDED : m_ShaderType;
            lineRect     = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 13), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE), new GUIContent("AlphaBlendedMobile"), m_bCreatePrefab) ? SHADER_TYPE.ALPHA_BLENDED_MOBILE : m_ShaderType;
        }
        else
        {
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 5), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE), new GUIContent("Additive"), m_bCreatePrefab);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 12, 4), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_MOBILE), new GUIContent("Mobile"), m_bCreatePrefab);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 17, 3), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_SOFT), new GUIContent("Soft"), m_bCreatePrefab);
            lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED), new GUIContent("AlphaBlended"), m_bCreatePrefab);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 14, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE), new GUIContent("AlphaBlendedMobile"), m_bCreatePrefab);
        }

        // Fade
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        bool bFade = (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE || m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED);

        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Fade"), false);
        if (bFade)
        {
            m_bFadeIn  = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_bFadeIn, new GUIContent("FadeIn"), bFade);
            m_bFadeOut = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), m_bFadeOut, new GUIContent("FadeOut"), bFade);
        }
        else
        {
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), false, new GUIContent("FadeIn"), bFade);
            FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), false, new GUIContent("FadeOut"), bFade);
        }

        // Texture Format ---------------------------------------------------------------------------------------
        // TextureType
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TextureType"), false);
        m_bGUITexture = FXMakerLayout.GUIToggle(GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6)), m_bGUITexture, new GUIContent("GUI"), true);
        m_bGUITexture = !FXMakerLayout.GUIToggle(GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6)), !m_bGUITexture, new GUIContent("Texture"), true);

        // AnisoLevel
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("AnisoLevel"), false);
        if (!m_bGUITexture)
        {
            m_anisoLevel = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_anisoLevel, 1, 0, 9 + 1);
            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_anisoLevel.ToString(), false);
        }

        // m_nSpriteTextureSizes
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("MaxSize"), false);
        m_fSpriteTextureIndex = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fSpriteTextureIndex, 1, 0, m_nSpriteTextureSizes.Length - 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nSpriteTextureSizes[(int)m_fSpriteTextureIndex].ToString(), false);

        // m_nSpriteTextureFormat
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Format"), false);
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        for (int n = 0; n < m_SpriteTextureFormatName.Length; n++)
        {
            Rect toggleRect = GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, n, 1));
            if (n == 2)
            {
                toggleRect.x     -= 15;
                toggleRect.width += 15;
            }
            bool bCheck = (GUI.Toggle(toggleRect, (m_fSpriteTextureFormatIdx == n), m_SpriteTextureFormatName[n]));
            if (bCheck && m_fSpriteTextureFormatIdx != n)
            {
                m_fSpriteTextureFormatIdx = n;
//              EditorPrefs.SetInt("FxmSpritePopup.m_nShowGameObjectOptionIndex", m_nShowGameObjectOptionIndex);
            }
        }


        nIncLine++;
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1);
        lineRect = FXMakerLayout.GetOffsetRect(lineRect, 0, -12, 0, 0);

        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 2, 0, 1), "Build Sprite", (m_nResultTextureSize <= 2048)))
        {
            FXMakerCapture.StartSpriteCapture(m_CaptureType, m_nTotalFrameCount, (m_CaptureType == CAPTURE_TYPE.ANIMATION ? GetFrameTime() : m_fCaptureTime), GetSpriteCaptureRect());
            ClosePopup();
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 2, 1, 1), "Close", true))
        {
            ClosePopup();
        }

        FXMakerMain.inst.SaveTooltip();
    }
Example #9
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();
    }
Example #10
0
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect     baseRect  = GetPopupRect();
        GUIStyle styleList = GUI.skin.GetStyle("List_Box");

        if (UnfocusClose(baseRect, 0, 0, 0, 0))
        {
            return;
        }

        // --------------------------------------------------------------------------------
        int  nMargin    = 5;
        int  nTopHeight = 25;
        Rect topRect    = FXMakerLayout.GetChildTopRect(baseRect, -nMargin, nTopHeight);
        Rect bottomRect = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1);
        Rect leftRect   = FXMakerLayout.GetInnerHorizontalRect(bottomRect, 6, 0, 6);

        // top - Name ----------------------------------------------------------------------------
        topRect = FXMakerLayout.GetOffsetRect(topRect, -nMargin / 2);
        GUI.Box(FXMakerLayout.GetOffsetRect(topRect, 0, -2, 0, 2), "");
        Rect nameRect = FXMakerLayout.GetInnerVerticalRect(topRect, 2, 0, 2);

        GUI.Label(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 0, 1), "Name");
        GUI.SetNextControlName("TextField");
//      FXMakerMain.inst.ToggleGlobalLangSkin(true);
        string newName = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 1, 4), m_SelectedTransform.name, m_SelectedTransform.gameObject != FXMakerMain.inst.GetOriginalEffectObject());

//      FXMakerMain.inst.ToggleGlobalLangSkin(false);
        if (m_SelectedTransform.name != newName)
        {
            m_SelectedTransform.name = newName;
            if (newName.Trim() != "" && m_SelectedTransform.gameObject == FXMakerMain.inst.GetOriginalEffectObject())
            {
                FXMakerEffect.inst.RenameCurrentPrefab(newName);
            }
        }
        if (Event.current.type == EventType.KeyDown && Event.current.character == '\n')
        {
            ClosePopup(true);
        }

        // left ----------------------------------------------------------------------------
        leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin / 2);
        GUI.Box(leftRect, "");
        leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin);
        Rect scrollRect     = FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 2, 15);
        int  scrollBarWidth = 13;
        int  nCellHeight    = 18;

        scrollRect.width -= scrollBarWidth;
        GUI.Box(scrollRect, "");

        // folder list
//		m_nGroupIndex		= GUI.SelectionGrid(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length);
        m_nGroupIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length);

        if (GUI.changed)
        {
            LoadScriptList();
        }

        // script list
        Rect listRect = new Rect(0, 0, scrollRect.width - 1, nCellHeight * m_ScriptScrings.Length);

        m_PopupScrollPos = GUI.BeginScrollView(scrollRect, m_PopupScrollPos, listRect);
        GUI.changed      = false;
//		m_nPopupListIndex	= GUI.SelectionGrid(listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList);
        m_nPopupListIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_PopupScrollPos.y), scrollRect, listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList);

        if (GUI.changed && Input.GetMouseButtonUp(1))
        {
            AddScript(m_ScriptScrings[m_nPopupListIndex]);
        }

        GUI.EndScrollView();

        // Add script button
        if (0 <= m_nPopupListIndex && m_nPopupListIndex < m_ScriptContents.Length)
        {
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 17, 3), GetHelpContent("Add Component "), (m_ScriptScrings[m_nPopupListIndex] != "")))
            {
                AddScript(m_ScriptScrings[m_nPopupListIndex]);
                if (Input.GetMouseButtonUp(0))
                {
                    ClosePopup(true);
                }
            }
        }

        FXMakerMain.inst.SaveTooltip();
    }
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();
        Rect buttonRect;
        Rect lineRect;

        if (UnfocusClose(baseRect, -10, 0, 0, 0))
        {
            return;
        }

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1);

        Transform transOriginalRoot = FXMakerMain.inst.GetOriginalEffectObject().transform;
        int       nButtonCount      = m_nButtonCount * 2;
        int       nDrawCount        = 0;
        bool      bEnable           = false;

        // Copy
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy"), true))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Cut
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Cut"), bEnable))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Paste
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsObject();     break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste", FXMakerClipboard.inst.GetName()), bEnable))
        {
            Object tarObj = FXMakerClipboard.inst.PasteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            if (tarObj is GameObject)
            {
                SetAddObject((tarObj as GameObject), tarObj);
            }
            else
            {
                SetAddObject(null, tarObj);
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Overwrite
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:            bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = FXMakerClipboard.inst.IsTransform() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsComponent() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = FXMakerClipboard.inst.IsMaterial() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();              break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = FXMakerClipboard.inst.IsAnimationClip() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType(); break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Overwrite", FXMakerClipboard.inst.GetName()), bEnable))
        {
            FXMakerClipboard.inst.OverwriteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // Duplicate
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);   break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Duplicate"), bEnable))
        {
            switch (m_SelObjectType)
            {
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    SetAddObject(FXMakerHierarchy.inst.AddGameObject(m_SelectedTransform.transform.parent.gameObject, m_SelectedTransform.gameObject), null);               break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 m_AddComObject = NgSerialized.CloneComponent(m_SelectedObject as Component, (m_SelectedObject as Component).gameObject, false); break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               break;

            default: Debug.LogWarning("not declare"); break;
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Disable
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            bool bObjEnable = (m_SelectedTransform.gameObject.GetComponent <NcDontActive>() == null);
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), (bObjEnable ? GetHelpContent("Disable") : GetHelpContent("Enable")), (m_SelectedTransform != transOriginalRoot)))
            {
                FXMakerHierarchy.inst.SetEnableGameObject(m_SelectedTransform.gameObject, !bObjEnable);
                ClosePopup(true);
                return;
            }
        }
        else
        {
            buttonRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2);
            if (m_SelectedObject is Component)
            {
                int nObjEnable = EditorUtility.GetObjectEnabled(m_SelectedObject);
                if (0 <= nObjEnable)
                {
                    if (0 < nObjEnable)
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Disable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, false);
                            ClosePopup(true);
                            return;
                        }
                    }
                    else
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Enable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, true);
                            ClosePopup(true);
                            return;
                        }
                    }
                }
                else
                {
                    FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
                }
            }
            else
            {
                FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
            }
        }
        nDrawCount += 2;


        // Delete
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = true;         break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Delete"), bEnable))
        {
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // -------------------------------------------------------------------------------------
        if (m_SelectedObject is NcCurveAnimation)
        {
            // NcCurveAnimation
            NcCurveAnimation curveCom = m_SelectedObject as NcCurveAnimation;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("SaveCurves"), 0 < curveCom.GetCurveInfoCount()))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, true);
                return;
            }
            nDrawCount += 2;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("LoadCurves"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, false);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            // Add Child
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Child"), true))
            {
//              GameObject	newChild	= new GameObject("GameObject");
//              newChild.transform.parent = m_SelectedTransform;
//              FXMakerHierarchy.inst.OnAddGameObject(newChild);
//              SetAddObject(newChild, null);
//              ClosePopup(true);

                FXMakerHierarchy.inst.ShowAddObjectRightPopup();
                ClosePopup(false);

                return;
            }
            nDrawCount += 2;

            // Add Parent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Parent"), true))
            {
                GameObject newParent = new GameObject("GameObject");
                newParent.transform.parent = m_SelectedTransform.parent;
                m_SelectedTransform.parent = newParent.transform;
                m_SelectedTransform.name   = m_SelectedTransform.name.Replace("(Original)", "");
                if (m_SelectedTransform == transOriginalRoot)
                {
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(newParent);
                }
                FXMakerHierarchy.inst.OnAddGameObject(newParent);
                SetAddObject(newParent, null);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // MoveToParent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("MoveToParent"), (m_SelectedTransform != transOriginalRoot && (m_SelectedTransform.parent != transOriginalRoot) || (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1))))
            {
                if (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1)
                {
                    FXMakerMain.inst.SaveTool("");
                    m_SelectedTransform = FXMakerMain.inst.GetOriginalEffectObject().transform;
                    // root swap
                    Transform toolRoot  = m_SelectedTransform.parent;
                    Transform newParent = m_SelectedTransform.GetChild(0);
                    Transform newChild  = m_SelectedTransform;
                    newChild.parent     = null;
                    newParent.parent    = null;
                    newChild.parent     = newParent;
                    newParent.parent    = toolRoot;
                    m_SelectedTransform = newParent;
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(m_SelectedTransform.gameObject);
                    SetAddObject(null, null);
                }
                else
                {
                    m_SelectedTransform.parent = m_SelectedTransform.parent.parent;
                }
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Add Component
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Component"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowHierarchyObjectPopup("FxmPopup_GameObject", m_SelectedTransform.gameObject);
                return;
            }
            nDrawCount += 2;

            // Add Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Prefab"), true))
            {
                FxmPopupManager.inst.ShowAddPrefabPopup(m_SelectedTransform);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Save Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Save Prefab"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowSavePrefabPopup(m_SelectedTransform);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL)
        {
            bEnable = NgMaterial.IsMaterialColor(m_SelectedObject as Material);

            // Copy Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy Color"), bEnable))
            {
                FXMakerClipboard.inst.SetClipboardColor(NgMaterial.GetMaterialColor(m_SelectedObject as Material));
                ClosePopup(true);
                return;
            }
            if (bEnable)
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, NgMaterial.GetMaterialColor(m_SelectedObject as Material));
            }
            nDrawCount += 2;

            // Paste Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste Color"), bEnable))
            {
                FXMakerClipboard.inst.PasteClipboardColor(m_SelectedTransform, m_nSelectedIndex, m_SelectedObject as Material);
                ClosePopup(true);
                return;
            }
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, FXMakerClipboard.inst.m_CopyColor);
            }
            nDrawCount += 2;
        }

        m_nButtonCount = nDrawCount / 2;
        FXMakerMain.inst.SaveTooltip();
    }
Example #12
0
    public static Rect GetRect_Group()
    {
        Rect groupRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 4, 6);

        return(FXMakerLayout.GetOffsetRect(groupRect, FXMakerLayout.GetMenuToolbarRect().x, FXMakerLayout.GetMenuToolbarRect().y));
    }
Example #13
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();
    }
Example #14
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();
    }
Example #15
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();
    }
Example #16
0
    // ==========================================================================================================
    void winMenuToolbar(int id)
    {
        if (m_nGroupCount <= 0)
        {
            return;
        }

        // Group List
        int nGroupIndex = 0;

        if (m_bGroupFoler)
        {
//			nGroupIndex		= GUI.Toolbar(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 0, 3), m_nGroupIndex, m_GroupFolerContents);
            nGroupIndex = FXMakerLayout.TooltipToolbar(FXMakerLayout.GetMenuToolbarRect(), FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 0, 3), m_nGroupIndex, m_GroupFolerContents);
            if (GUI.changed)
            {
                SelectToolbar(nGroupIndex, "");
            }

            // Draw line
            Rect lineRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 3, 1);
            NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y), (int)lineRect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false);
        }

        // Background List
        Rect gridRect;

        if (m_bGroupFoler)
        {
            gridRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 4, 6);
        }
        else
        {
            gridRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuToolbarRect(), 0, 10, 0, 10);
        }
//      int nSetIndex	= GUI.SelectionGrid(gridRect, Mathf.Min(m_nBackgroundIndex, m_nBackgroundCount-1), m_BackgroundContents, m_BackgroundContents.Length);
        int nSetIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetMenuToolbarRect(), gridRect, Mathf.Min(m_nBackgroundIndex, m_nBackgroundCount - 1), m_BackgroundContents, m_BackgroundContents.Length);

        // select
        if (GUI.changed)
        {
            if (nSetIndex < m_nBackgroundCount)
            {
                NgUtil.LogDevelop("changed MenuToolbar = " + nGroupIndex + " " + nSetIndex);
                // Change Background Prefab
                if (0 <= nSetIndex)
                {
                    // right button
                    if (Input.GetMouseButtonUp(1))
                    {
                        ShowRightMenu(nSetIndex, true);
                    }
                    // active
                    SelectToolbar(nGroupIndex, nSetIndex);
                }
                else
                {
                }
            }
            else
            {
                // right button
                if (Input.GetMouseButtonUp(1))
                {
                    ShowRightMenu(-1, false);
                }
            }
        }
        FXMakerMain.inst.SaveTooltip();
    }
Example #17
0
    private void winActionToolbar(int id)
    {
        Rect   actionToolbarRect = this.GetActionToolbarRect();
        string text  = string.Empty;
        string str   = string.Empty;
        int    num   = 10;
        int    count = 5;

        this.m_bMinimize = GUI.Toggle(new Rect(3f, 1f, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), this.m_bMinimize, "Mini");
        if (GUI.changed)
        {
            PlayerPrefs.SetInt("FxmTestControls.m_bMinimize", (!this.m_bMinimize) ? 0 : 1);
        }
        GUI.changed = false;
        Rect childVerticalRect;
        Rect innerHorizontalRect;

        if (FXMakerLayout.m_bMinimizeAll || this.m_bMinimize)
        {
            count             = 1;
            childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1);
            if (FxmTestMain.inst.IsCurrentEffectObject())
            {
                text = string.Format("P={0} M={1} T={2}", this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles);
                str  = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", new object[]
                {
                    this.m_nParticleCount,
                    this.m_nMeshCount,
                    this.m_nTriangles,
                    this.m_nVertices
                });
            }
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), text);
            if (FxmTestMain.inst.IsCurrentEffectObject())
            {
                float rightValue = (3 > this.m_nPlayIndex) ? 10f : this.m_fPlayToolbarTimes[this.m_nPlayIndex];
                childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1);
                GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 2), "ElapsedTime " + (Time.time - this.m_fPlayStartTime).ToString("0.000"));
                innerHorizontalRect    = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 4, 4);
                innerHorizontalRect.y += 5f;
                GUI.HorizontalSlider(innerHorizontalRect, Time.time - this.m_fPlayStartTime, 0f, rightValue);
                childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1);
                if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 2), "Restart"))
                {
                    this.CreateInstanceEffect();
                }
            }
            return;
        }
        childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 2);
        if (NcEffectBehaviour.GetRootInstanceEffect())
        {
            text = string.Format("P = {0}\nM = {1}\nT = {2}", this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles);
            str  = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", new object[]
            {
                this.m_nParticleCount,
                this.m_nMeshCount,
                this.m_nTriangles,
                this.m_nVertices
            });
        }
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 1), new GUIContent(text, this.NgTooltipTooltip(str)));
        if (FxmTestMain.inst.IsCurrentEffectObject())
        {
            bool         flag = false;
            GUIContent[] hcEffectControls_Play = FxmTestControls.GetHcEffectControls_Play(0f, this.m_fTimeScale, this.m_fPlayToolbarTimes[1], this.m_fPlayToolbarTimes[3], this.m_fPlayToolbarTimes[4], this.m_fPlayToolbarTimes[5], this.m_fPlayToolbarTimes[6], this.m_fPlayToolbarTimes[7]);
            childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1);
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 1, 1), new GUIContent("Play", string.Empty));
            int nPlayIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 8), this.m_nPlayIndex, hcEffectControls_Play, hcEffectControls_Play.Length);
            if (GUI.changed)
            {
                flag = true;
            }
            GUIContent[] hcEffectControls_Trans = FxmTestControls.GetHcEffectControls_Trans(this.m_nTransAxis);
            childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 1, 1);
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 1, 1), new GUIContent("Trans", string.Empty));
            int num2 = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 8), this.m_nTransIndex, hcEffectControls_Trans, hcEffectControls_Trans.Length);
            if (GUI.changed)
            {
                flag = true;
                if ((num2 == 1 || num2 == 2) && Input.GetMouseButtonUp(1))
                {
                    if (this.m_nTransAxis == FxmTestControls.AXIS.Z)
                    {
                        this.m_nTransAxis = FxmTestControls.AXIS.X;
                    }
                    else
                    {
                        this.m_nTransAxis++;
                    }
                    PlayerPrefs.SetInt("FxmTestControls.m_nTransAxis", (int)this.m_nTransAxis);
                }
            }
            if (flag)
            {
                FxmTestMain.inst.CreateCurrentInstanceEffect(false);
                this.RunActionControl(nPlayIndex, num2);
                PlayerPrefs.SetInt("FxmTestControls.m_nPlayIndex", this.m_nPlayIndex);
                PlayerPrefs.SetInt("FxmTestControls.m_nTransIndex", this.m_nTransIndex);
            }
        }
        float num3 = this.m_fDistPerTime;

        childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 2, 1);
        GUIContent gUIContent = new GUIContent("DistPerTime", string.Empty);
        GUIContent expr_471   = gUIContent;

        expr_471.text = expr_471.text + " " + this.m_fDistPerTime.ToString("00.00");
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent);
        innerHorizontalRect    = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5);
        innerHorizontalRect.y += 5f;
        num3 = GUI.HorizontalSlider(innerHorizontalRect, num3, 0.1f, 40f);
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 14, 1), new GUIContent("<", string.Empty)))
        {
            num3 = (float)((int)(num3 - 1f));
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 15, 1), new GUIContent(">", string.Empty)))
        {
            num3 = (float)((int)(num3 + 1f));
        }
        if (num3 != this.m_fDistPerTime)
        {
            this.m_fDistPerTime = ((num3 != 0f) ? num3 : 0.1f);
            PlayerPrefs.SetFloat("FxmTestControls.m_fDistPerTime", this.m_fDistPerTime);
            if (0 < this.m_nTransIndex)
            {
                this.CreateInstanceEffect();
            }
        }
        if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 9, 1), new GUIContent("Multi", this.m_nMultiShotCount.ToString()), true))
        {
            if (Input.GetMouseButtonUp(0))
            {
                this.m_nMultiShotCount++;
                if (4 < this.m_nMultiShotCount)
                {
                    this.m_nMultiShotCount = 1;
                }
            }
            else
            {
                this.m_nMultiShotCount = 1;
            }
            this.CreateInstanceEffect();
        }
        GUIContent[] hcEffectControls_Rotate = FxmTestControls.GetHcEffectControls_Rotate();
        childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 2, 1);
        int num4 = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 1), this.m_nRotateIndex, hcEffectControls_Rotate, hcEffectControls_Rotate.Length);

        if (num4 != this.m_nRotateIndex)
        {
            this.m_nRotateIndex = num4;
            PlayerPrefs.SetInt("FxmTestControls.m_nRotateIndex", this.m_nRotateIndex);
            if (0 < this.m_nTransIndex)
            {
                this.CreateInstanceEffect();
            }
        }
        float num5 = this.m_fTimeScale;

        childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 3, 1);
        gUIContent        = new GUIContent("TimeScale", string.Empty);
        GUIContent expr_681 = gUIContent;

        expr_681.text = expr_681.text + " " + this.m_fTimeScale.ToString("0.00");
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent);
        innerHorizontalRect    = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5);
        innerHorizontalRect.y += 5f;
        num5 = GUI.HorizontalSlider(innerHorizontalRect, num5, 0f, 3f);
        if (num5 == 0f)
        {
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 7, 1), new GUIContent("Resume", string.Empty)))
            {
                num5 = this.m_fOldTimeScale;
            }
        }
        else if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 7, 1), new GUIContent("Pause", string.Empty)))
        {
            num5 = 0f;
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 1), new GUIContent("Reset", string.Empty)))
        {
            num5 = 1f;
        }
        this.SetTimeScale(num5);
        if (FxmTestMain.inst.IsCurrentEffectObject())
        {
            float rightValue2 = (3 > this.m_nPlayIndex) ? 10f : this.m_fPlayToolbarTimes[this.m_nPlayIndex];
            childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 4, 1);
            gUIContent        = new GUIContent("ElapsedTime", string.Empty);
            GUIContent expr_7D4 = gUIContent;
            expr_7D4.text = expr_7D4.text + " " + (Time.time - this.m_fPlayStartTime).ToString("0.000");
            GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent);
            innerHorizontalRect    = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5);
            innerHorizontalRect.y += 5f;
            GUI.HorizontalSlider(innerHorizontalRect, Time.time - this.m_fPlayStartTime, 0f, rightValue2);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 14, 1), new GUIContent("+.5", string.Empty)))
            {
                this.SetTimeScale(1f);
                base.Invoke("invokeStopTimer", 0.5f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 15, 1), new GUIContent("+.1", string.Empty)))
            {
                this.SetTimeScale(0.4f);
                base.Invoke("invokeStopTimer", 0.1f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 16, 1), new GUIContent("+.05", string.Empty)))
            {
                this.SetTimeScale(0.2f);
                base.Invoke("invokeStopTimer", 0.05f);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 17, 1), new GUIContent("+.01", string.Empty)))
            {
                this.SetTimeScale(0.04f);
                base.Invoke("invokeStopTimer", 0.01f);
            }
            childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 3, 2);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 9, 1), new GUIContent("Restart", string.Empty)))
            {
                this.CreateInstanceEffect();
            }
        }
    }
Example #18
0
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect     baseRect = GetPopupRect();
        GUIStyle styleBox = GUI.skin.GetStyle("Transform_Box");

        if (UnfocusClose(baseRect, 0, 0, 0, 20))
        {
            return;
        }

        Rect   lineRect;
        Rect   groupRect;
        Rect   leftRect;
        Rect   rightRect;
        int    nGroup = 3;
        int    nLine  = 2;
        string format = "";

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1);
        baseRect = FXMakerLayout.GetOffsetRect(baseRect, -2);
        GUI.Box(baseRect, " ");
        // --------------------------------------------------------------------------------

//      // World Position
//      groupRect	= gNcLayout.GetInnerVerticalRect(baseRect, 15, 0, 5);
//      groupRect	= gNcLayout.GetOffsetRect(groupRect, -5);
//      leftRect	= gNcLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2);
//      rightRect	= gNcLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4);
//      GUI.Label(gNcLayout.GetInnerHorizontalRect(leftRect, 1, 0, 1), "World Position");
//      GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), trans.position.x.ToString(format), styleBox);
//      GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), trans.position.y.ToString(format), styleBox);
//      GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), trans.position.z.ToString(format), styleBox);
//      NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.yMax+5), (int)groupRect.width, Color.black, 2, false);

        // Clipboard
        groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 0, 8);
        groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5);
        leftRect  = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2);
        rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4);
        for (int n = 0; n < nGroup; n++)
        {
            Vector3    vecValue = Vector3.zero;
            TRANS_TYPE nTrans   = (TRANS_TYPE)n;

            switch (nTrans)
            {
            case TRANS_TYPE.POSITION:       vecValue = m_CopyTransform.m_vecPos;                            break;

            case TRANS_TYPE.ROTATION:       vecValue = m_CopyTransform.m_vecRotHint;                        break;

            case TRANS_TYPE.SCALE:          vecValue = m_CopyTransform.m_vecScale;                          break;
            }

            GUI.Label(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(leftRect, 1, 0, 1), 3, n, 1), "Clipboard " + m_TransStrings[n]);
            GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), 3, n, 1), vecValue.x.ToString(format), styleBox);
            GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), 3, n, 1), vecValue.y.ToString(format), styleBox);
            GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), 3, n, 1), vecValue.z.ToString(format), styleBox);
        }
        groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 8, 1);
        groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5);
        NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.y - 5), (int)groupRect.width, Color.grey, 2, false);

        // --------------------------------------------------------------------------------
        groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 9, 3);
        groupRect = FXMakerLayout.GetOffsetRect(groupRect, 5, 0, -5, 0);
        GUIContent[] worldlocalCon = new GUIContent[2] {
            GetHelpContent("World"), GetHelpContent("Local")
        };
        int nWorldLocalIndex = GUI.SelectionGrid(groupRect, m_nWorldLocalSelIndex, worldlocalCon, 2);

        if (m_nWorldLocalSelIndex != nWorldLocalIndex)
        {
            m_nWorldLocalSelIndex = nWorldLocalIndex;
            EditorPrefs.SetInt("FxmPopup_Transform.m_nWorldLocalSelIndex", m_nWorldLocalSelIndex);
            InitFloatInput();
            SaveTransform();
        }

        // --------------------------------------------------------------------------------
        Rect editRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 12, 18);

        for (int n = 0; n < nGroup; n++)
        {
            Vector3    vecValue = Vector3.zero;
            TRANS_TYPE nTrans   = (TRANS_TYPE)n;

            switch (nTrans)
            {
            case TRANS_TYPE.POSITION:       vecValue = m_SaveTrans.m_vecPos;                break;

            case TRANS_TYPE.ROTATION:       vecValue = m_SaveTrans.m_vecRotHint;    break;

            case TRANS_TYPE.SCALE:          vecValue = m_SaveTrans.m_vecScale;              break;
            }
            Vector3 oldValue = vecValue;

            for (int nn = 0; nn < 3; nn++)
            {
                if (m_strFloatInput[n, nn] == null)
                {
                    m_strFloatInput[n, nn] = vecValue[nn].ToString();
                }
            }

            groupRect = FXMakerLayout.GetInnerVerticalRect(editRect, nGroup, n, 1);
            groupRect = FXMakerLayout.GetOffsetRect(groupRect, -3);
            leftRect  = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2);
            rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4);

            // left
            // line 1
            lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 0, 1);
            GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 1, 0, 1), (m_nWorldLocalSelIndex == 0 ? "World " : "Local ") + m_TransStrings[n]);
            // line 2
            lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 1, 1);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Reset")))
            {
                ResetTransform(nTrans);
                RecreateInstance();
                InitFloatInput();
                return;
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("Copy")))
            {
                CopyTransform(nTrans);
                InitFloatInput();
                return;
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), GetHelpContent("Paste")))
            {
                PasteTransform(nTrans);
                InitFloatInput();
                return;
            }

            // left, All Scale
            if (nTrans == TRANS_TYPE.SCALE)
            {
                lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 0, 1);
                if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 5, 3, 1), GetHelpContent(GetPrevName(nTrans).ToString())))
                {
                    SetTransform(TRANS_TYPE.SCALE, GetPrevValue(nTrans, vecValue));
                    RecreateInstance();
                    InitFloatInput();
                    return;
                }
                if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 5, 4, 1), GetHelpContent(GetNextName(nTrans).ToString())))
                {
                    SetTransform(TRANS_TYPE.SCALE, GetNextValue(nTrans, vecValue));
                    RecreateInstance();
                    InitFloatInput();
                    return;
                }
            }

            // right
            // line 1
            lineRect = FXMakerLayout.GetInnerVerticalRect(rightRect, nLine, 0, 1);
            GUI.SetNextControlName("TextField");
            m_strFloatInput[n, 0] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), m_strFloatInput[n, 0]);
            m_strFloatInput[n, 0] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 0], ref vecValue.x);
            GUI.SetNextControlName("TextField");
            m_strFloatInput[n, 1] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), m_strFloatInput[n, 1]);
            m_strFloatInput[n, 1] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 1], ref vecValue.y);
            GUI.SetNextControlName("TextField");
            m_strFloatInput[n, 2] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), m_strFloatInput[n, 2]);
            m_strFloatInput[n, 2] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 2], ref vecValue.z);

//          if (nTrans == TRANS_TYPE.ROTATION)
//              vecValue = Vector3.zero;

            // line 2
            lineRect = FXMakerLayout.GetInnerVerticalRect(rightRect, nLine, 1, 1);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 0, 1), GetHelpContent(GetPrevName(nTrans).ToString())))
            {
                vecValue.x = GetPrevValue(nTrans, vecValue.x);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 1, 1), GetHelpContent(GetNextName(nTrans).ToString())))
            {
                vecValue.x = GetNextValue(nTrans, vecValue.x);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 2, 1), GetHelpContent(GetPrevName(nTrans).ToString())))
            {
                vecValue.y = GetPrevValue(nTrans, vecValue.y);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 3, 1), GetHelpContent(GetNextName(nTrans).ToString())))
            {
                vecValue.y = GetNextValue(nTrans, vecValue.y);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 4, 1), GetHelpContent(GetPrevName(nTrans).ToString())))
            {
                vecValue.z = GetPrevValue(nTrans, vecValue.z);
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 5, 1), GetHelpContent(GetNextName(nTrans).ToString())))
            {
                vecValue.z = GetNextValue(nTrans, vecValue.z);
            }

            // Set
            if (vecValue != oldValue)
            {
                SetTransform(nTrans, vecValue);
                RecreateInstance();
                InitFloatInput();
                return;
            }
        }

        // --------------------------------------------------------------------------------
        // World, Local
        groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 30, 1);
        groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5);
        NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.y - 6), (int)groupRect.width, Color.grey, 1, false);
        groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 30, 5);
        groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5);
        leftRect  = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2);
        rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4);

        GUI.Label(leftRect, m_nWorldLocalSelIndex == 0 ? "World " : "Local ");
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), GetHelpContent("Reset")))
        {
            ResetTransform(TRANS_TYPE.POSITION);
            ResetTransform(TRANS_TYPE.ROTATION);
            ResetTransform(TRANS_TYPE.SCALE);
            RecreateInstance();
            InitFloatInput();
            return;
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), GetHelpContent("Copy")))
        {
            CopyTransform(TRANS_TYPE.POSITION);
            CopyTransform(TRANS_TYPE.ROTATION);
            CopyTransform(TRANS_TYPE.SCALE);
            return;
        }
        if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), GetHelpContent("Paste")))
        {
            PasteTransform(TRANS_TYPE.POSITION);
            PasteTransform(TRANS_TYPE.ROTATION);
            PasteTransform(TRANS_TYPE.SCALE);
            RecreateInstance();
            InitFloatInput();
            return;
        }
        FXMakerMain.inst.SaveTooltip();
    }
Example #19
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();
    }