コード例 #1
0
    // ==========================================================================================================
    protected override void DrawBottomRect(Rect baseRect)
    {
        GUI.Box(baseRect, "");

        GUIContent guiCon;
        Rect       imageRect = baseRect;

        imageRect.width = FXMakerLayout.GetFixedWindowWidth();
        Rect rightRect = baseRect;

        rightRect.x     += imageRect.width;
        rightRect.width -= imageRect.width;
        rightRect        = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3);

        Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5);

        if (m_bSaveDialog)
        {
            Rect labelRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 2, 3);
            GUI.Label(FXMakerLayout.GetLeftRect(labelRect, 100), "Filename:");
            Rect   editRect     = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 5, 5);
            string saveFilename = GUI.TextField(editRect, m_SaveFilename, 50);
            if (saveFilename != m_SaveFilename)
            {
                if (saveFilename.Trim() != "")
                {
                    m_SaveFilename = saveFilename;
                }
            }
        }
        else
        {
            bool bPreviewEnable = false;
            // image
            if (m_SelObjectContent == null)
            {
                guiCon = new GUIContent("[Not Selected]");
                // original mesh preview
                if (m_bDialogType == DIALOG_TYPE.SELECT && m_bSelectMeshDialog && m_OldSelectMesh != null)
                {
                    Texture2D preview = NgAsset.GetAssetPreview(m_OldSelectMesh);
                    guiCon         = new GUIContent(m_OldSelectMesh.name, preview, GetMeshInfo(m_OldSelectMesh));
                    bPreviewEnable = true;
                }
            }
            else
            {
                guiCon         = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip);
                bPreviewEnable = (m_SelObjectContent != null);
            }

            if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), bPreviewEnable))
            {
                if (m_bDialogType == DIALOG_TYPE.SELECT)
                {
                    if (m_bSelectMeshDialog)
                    {
                        Object pingObj;
                        Object pingMesh;
                        if (m_AddPrefabObject != null)
                        {
                            pingObj  = m_AddPrefabObject;
                            pingMesh = m_AddPrefabObject.GetComponent <MeshFilter>().sharedMesh;
                        }
                        else
                        {
                            pingObj  = m_OldSelectMesh;
                            pingMesh = m_OldSelectMesh;
                        }

                        if (Input.GetMouseButtonUp(0))
                        {
                            FXMakerAsset.SetPingObject(pingObj);
                            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                        }
                        if (Input.GetMouseButtonUp(1))
                        {
                            FXMakerAsset.SetPingObject(pingMesh);
                        }
                    }
                    else
                    {
                        FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                    }
                }
                else
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        FXMakerAsset.SetPingObject(m_AddGameObject);
                        FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                    }
                    if (Input.GetMouseButtonUp(1))
                    {
                        FXMakerAsset.SetPingObject(GetObjectNodePrefab(m_nObjectIndex));
                    }
                }
            }

            // text
            GUI.Label(FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text));
        }

        if (m_bSaveDialog)
        {
            bool bSaveEnable    = (0 <= m_nGroupIndex && 0 < m_nGroupCount);
            bool bReadOnyFolder = false;

            if (bSaveEnable)
            {
                bReadOnyFolder = 0 < IsReadOnlyFolder();
                bSaveEnable    = !bReadOnyFolder;
            }

            // Cancel
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true))
            {
                ClosePopup(false);
                return;
            }
            // save
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable))
            {
                SaveCurrentObjectToPrefabFile();
                ClosePopup(true);
//              FXMakerEffect.inst.LoadProject();
            }
            if (m_bDrawRedBottomButtom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
            if (m_bDrawRedBottom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(baseRect, 2), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
        }
        else
        {
            // Undo
            int nButtonWidht = 70;
            buttonRect.width = nButtonWidht / 2;
            if (FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Undo"), (m_AddGameObject != null)))
            {
                UndoObject();
            }

            // close
            buttonRect.x    += buttonRect.width + 5;
            buttonRect.width = baseRect.width - buttonRect.x;
            if (GUI.Button(buttonRect, GetHelpContent("Close")))
            {
                ClosePopup(true);
            }
        }
    }
コード例 #2
0
    // ==========================================================================================================
    protected override void DrawBottomRect(Rect baseRect)
    {
        GUI.Box(baseRect, "");

        GUIContent guiCon;
        Rect       imageRect = baseRect;

        imageRect.width = FXMakerLayout.GetFixedWindowWidth();
        Rect rightRect = baseRect;

        rightRect.x     += imageRect.width;
        rightRect.width -= imageRect.width;
        rightRect        = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3);

        Rect buttonRect  = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5);
        Rect buttonRect2 = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 5);

        // image
        if (m_SelObjectContent == null)
        {
            guiCon = new GUIContent("[Not Selected]");
        }
        else
        {
            guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip);
        }
        if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null)))
        {
            if (Input.GetMouseButtonUp(0))
            {
                FXMakerMain.inst.CreateCurrentInstanceEffect(true);
            }
        }
        int nImageMargin = 3;

        imageRect = FXMakerLayout.GetOffsetRect(imageRect, -nImageMargin);
        EditorGUIUtility.DrawCurveSwatch(imageRect, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).m_AniCurve, null, Color.green, Color.black, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).GetFixedDrawRange());

        // text
//      GUI.Label(NgLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text));

        if (m_bSaveDialog)
        {
            bool bSaveEnable    = (0 <= m_nProjectIndex);
            bool bReadOnyFolder = false;

            if (bSaveEnable)
            {
                bReadOnyFolder = IsReadOnlyFolder(m_ProjectFolerContents[m_nProjectIndex].text);
                bSaveEnable    = !bReadOnyFolder;
            }

            // Cancel
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true))
            {
                ClosePopup(false);
                return;
            }
            // save
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable))
            {
                SaveAddCurvePrefab(false);
                ClosePopup(true);
            }
            // overwrite
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect2, 2, 0, 2), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Overwrite", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Overwrite")), (bSaveEnable && 0 <= m_nObjectIndex)))
            {
                SaveAddCurvePrefab(true);
                ClosePopup(true);
            }
            buttonRect.height *= 2;
            if (m_bDrawRedBottomButtom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
        }
        else
        {
            // Undo
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Undo"), (m_SelCurveInfo != null)))
            {
                UndoCurveAni();
            }
            // close
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), GetHelpContent("Close")))
            {
                ClosePopup(true);
            }
        }
    }
コード例 #3
0
    // ==========================================================================================================
    protected override void DrawBottomRect(Rect baseRect)
    {
        GUI.Box(baseRect, "");

        GUIContent guiCon;
        Rect       imageRect = baseRect;

        imageRect.width = FXMakerLayout.GetFixedWindowWidth();
        Rect rightRect = baseRect;

        rightRect.x     += imageRect.width;
        rightRect.width -= imageRect.width;
        rightRect        = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3);

        Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5);

        if (m_bSaveDialog)
        {
            Rect labelRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 2, 3);
            GUI.Label(FXMakerLayout.GetLeftRect(labelRect, 100), "Filename:");
            Rect   editRect     = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 5, 5);
            string saveFilename = GUI.TextField(editRect, m_SaveFilename, 50);
            if (saveFilename != m_SaveFilename)
            {
                if (saveFilename.Trim() != "")
                {
                    m_SaveFilename = saveFilename;
                }
            }
        }
        else
        {
            // image
            if (m_SelObjectContent == null)
            {
                guiCon = new GUIContent("[Not Selected]");
            }
            else
            {
                guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip);
            }
            if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null)))
            {
                if (Input.GetMouseButtonUp(0))
                {
                    FXMakerAsset.SetPingObject(m_CurrentCurveAnimation);
                    FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                }
                if (Input.GetMouseButtonUp(1))
                {
                    FXMakerAsset.SetPingObject(m_CurveAniObjects[m_nObjectIndex]);
                }
            }

            // text
            GUI.Label(FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text));
        }

        if (m_bSaveDialog)
        {
            bool bSaveEnable    = (0 <= m_nGroupIndex && 0 < m_nGroupCount);
            bool bReadOnyFolder = false;

            if (bSaveEnable)
            {
                bReadOnyFolder = 0 < IsReadOnlyFolder();
                bSaveEnable    = !bReadOnyFolder;
            }

            // Cancel
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true))
            {
                ClosePopup(false);
                return;
            }
            // save
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable))
            {
                SaveCurveAniToPrefabFile();
                ClosePopup(true);
//              FXMakerEffect.inst.LoadProject();
            }
            if (m_bDrawRedBottomButtom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
            if (m_bDrawRedBottom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(baseRect, 2), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
        }
        else
        {
            // Undo
            int nButtonWidht = 70;
            buttonRect.width = nButtonWidht / 2;
            if (FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Undo"), (m_SelCurveAniObject != null)))
            {
                UndoCurveAni();
                m_nObjectIndex           = -1;
                m_nSelObjectGroupIndex   = -1;
                m_nSelObjectProjectIndex = -1;
                m_SelObjectContent       = null;
                m_SelCurveAniObject      = null;

                FXMakerMain.inst.CreateCurrentInstanceEffect(true);
            }

            // close
            buttonRect.x    += buttonRect.width + 5;
            buttonRect.width = baseRect.width - buttonRect.x;
            if (GUI.Button(buttonRect, GetHelpContent("Close")))
            {
                ClosePopup(true);
            }
        }
    }