Exemple #1
0
    public bool IsGUIMousePosition()
    {
        Rect rect = new Rect();

        if (IsShowCurrentFolderPopup())
        {
            rect = FxmPopupManager.inst.GetCurrentFolderPopup().GetPopupRect();
        }
        if (IsShowHierarchyPopup())
        {
            rect = m_CurrentHierarchyPopup.GetPopupRect();
        }
        if (IsShowCurrentMenuPopup())
        {
            rect = m_CurrentMenuPopup.GetPopupRect();
        }
        if (IsShowSpritePopup())
        {
            rect = m_CurrentSpritePopup.GetPopupRect();
        }

        if (rect.Contains(FXMakerLayout.GetGUIMousePosition()))
        {
            return(true);
        }
        return(false);
    }
Exemple #2
0
	public bool IsGUIMousePosition()
	{
		if (FxmPopupManager.inst.IsShowPopup())
			return FxmPopupManager.inst.IsGUIMousePosition();
		if (FXMakerLayout.GetMenuGizmoRect().Contains(FXMakerLayout.GetGUIMousePosition()))
			return true;
		return (m_nLastFocusWindow != FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.TOP_RIGHT) && 0 < m_nLastFocusWindow);
	}
 protected bool UnscreenClose()
 {
     if ((new Rect(0, 0, Screen.width, Screen.height)).Contains(FXMakerLayout.GetGUIMousePosition()) == false)
     {
         ClosePopup(true);
         return(true);
     }
     return(false);
 }
Exemple #4
0
    // Property -------------------------------------------------------------------------
    public bool ShowPopupWindow()
    {
        m_PopupPosition      = FXMakerLayout.GetGUIMousePosition();
        m_SelectedPrefabName = FXMakerMain.inst.GetOriginalEffectPrefab().name;
        enabled = true;

        LoadPrefs();
        base.ShowPopupWindow(null);
        return(enabled);
    }
    public override bool ShowPopupWindow(Object selObj)
    {
        m_nButtonCount   = 20;
        m_PopupPosition  = FXMakerLayout.GetGUIMousePosition();
        m_SelectedObject = selObj;
        enabled          = true;

        base.ShowPopupWindow(null);
        return(enabled);
    }
    public bool ShowPopupWindow(string[] displayedMenu, bool[] eabledMenu)
    {
        m_DisplayedMenu  = displayedMenu;
        m_EnabledMenu    = eabledMenu;
        m_nSelectedIndex = -1;
        m_nLineCount     = GetLineCount();
        m_PopupPosition  = FXMakerLayout.GetGUIMousePosition();
        enabled          = true;

        base.ShowPopupWindow(null);
        return(enabled);
    }
    // ----------------------------------------------------------------------------------------------------------
    void ShowRightMenu(int nObjectIndex, bool bSelected)
    {
        Rect toolbarRect = FXMakerLayout.GetMenuToolbarRect();

        if (FxmPopupManager.inst.IsShowPopupExcludeMenu() || toolbarRect.Contains(FXMakerLayout.GetGUIMousePosition()) == false)
        {
            return;
        }

        m_bShowRightMenuPopup  = true;
        m_nIndexRightMenuPopup = nObjectIndex;
        bool bNotReadOnly = true;

        FxmPopupManager.inst.ShowMenuPopup("Prefab", new string[] { "PingPrefab", "-", "New", "Delete", "Clone", "Thumb" },
                                           new bool  [] { bSelected, false, bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly });
    }
    // Property -------------------------------------------------------------------------
    public override bool ShowPopupWindow(Object selObj)
    {
        if ((selObj is GameObject))
        {
            m_PopupPosition     = FXMakerLayout.GetGUIMousePosition();
            m_SelectedTransform = (selObj as GameObject).transform;
            enabled             = true;

            LoadScriptList();
        }
        else
        {
            enabled = false;
        }
        base.ShowPopupWindow(null);
        return(enabled);
    }
Exemple #9
0
    // =============================================================================================
    public Rect AutoFocusWindow(int id, Rect clientRect, GUI.WindowFunction func, string title)
    {
        Rect    rect = GUI.Window(id, clientRect, func, FXMakerTooltip.GetGUIContentNoTooltip(title));
        Vector2 pos  = FXMakerLayout.GetGUIMousePosition();

        // auto focus
        if (GUI.enabled && (m_bPrevPopupWindow == false && m_bLastPopupWindow == false))
        {
//			if ((GUI.GetNameOfFocusedControl() != "TextField"))
            if (rect.Contains(pos))
            {
                m_nLastFocusWindow = id;
                GUI.FocusWindow(id);
            }
        }
        return(rect);
    }
Exemple #10
0
    void ShowRightMenu(int nObjectIndex, bool bSelected)
    {
        Rect scrollRect = FXMakerLayout.GetEffectListRect();

        scrollRect.y      += m_nGuiTopHeight;
        scrollRect.height -= m_nGuiTopHeight;

        if (FxmPopupManager.inst.IsShowPopupExcludeMenu() || scrollRect.Contains(FXMakerLayout.GetGUIMousePosition()) == false)
        {
            return;
        }

        m_bShowRightMenuPopup  = true;
        m_nIndexRightMenuPopup = nObjectIndex;
        bool bNotReadOnly = (IsReadOnlyFolder() == 0);

        FxmPopupManager.inst.ShowMenuPopup("Prefab", new string[] { "PingPrefab", "Copy", "Cut", "Paste", "-", "New", "Delete", "Clone", "Thumb", "BuildSprite", "Export", "ExportAll" },
                                           new bool  [] { bSelected, bSelected, bSelected && bNotReadOnly, FXMakerClipboard.inst.IsPrefab() && bNotReadOnly, false, true && bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly, bSelected && bNotReadOnly, bSelected, (0 < m_nEffectCount) });
    }
Exemple #11
0
    // Property -------------------------------------------------------------------------
    public override bool ShowPopupWindow(Object selObj)
    {
        if ((selObj is Transform))
        {
            m_PopupPosition     = FXMakerLayout.GetGUIMousePosition();
            m_SelectedTransform = selObj as Transform;
            if (m_CopyTransform == null)
            {
                m_CopyTransform = new NcTransformTool();
            }
            SaveTransform();
            enabled = true;
        }
        else
        {
            enabled = false;
        }

        m_nWorldLocalSelIndex = EditorPrefs.GetInt("FxmPopup_Transform.m_nWorldLocalSelIndex", m_nWorldLocalSelIndex);
        InitFloatInput();

        return(enabled);
    }
Exemple #12
0
    void DrawBottomPaletteRect(Rect baseRect)
    {
        if (m_SelectedMaterial == null)
        {
            return;
        }

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

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

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

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

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

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

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

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

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

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

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

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

        GUI.color = oldColor;

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

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

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

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

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

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

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

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

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

        if (bReinstance)
        {
//          CreateNewShaderMaterials(m_SelectedMaterial);
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }
    }
 protected bool UnfocusClose(Rect rectPopup, int offsetLeft, int offsetTop, int offsetRight, int offsetBottom)
 {
     if (FXMakerLayout.GetOffsetRect(rectPopup, -m_nMarginUnfocus + offsetLeft, -m_nMarginUnfocus + offsetTop, m_nMarginUnfocus + offsetRight, m_nMarginUnfocus + offsetBottom).Contains(FXMakerLayout.GetGUIMousePosition()) == false)
     {
         ClosePopup(true);
         return(true);
     }
     return(false);
 }