Beispiel #1
0
//  public void ModalFocusWindow(Rect clientRect, GUI.WindowFunction func, string title)
//  {
//      GUISkin	oldSkin	= GUI.skin;
//
//      GUI.skin = m_GuiPopupSkin;
//      m_bLastPopupWindow = true;
//      gNcLayout.ModalWindow(clientRect, func, title);
//      GUI.skin = oldSkin;
//  }

    public void ModalMsgWindow(int id, Rect clientRect, GUI.WindowFunction func, string title)
    {
//		gNcLayout.ModalWindow(clientRect, func, title);
        GUI.Window(id, clientRect, func, FXMakerTooltip.GetGUIContentNoTooltip(title));
        m_bLastPopupWindow = true;
        if (GUI.enabled)
        {
            m_nLastFocusWindow = id;
            GUI.FocusWindow(id);
            GUI.BringWindowToFront(id);
        }
    }
Beispiel #2
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);
    }
Beispiel #3
0
	public Rect PopupFocusWindow(int id, Rect clientRect, GUI.WindowFunction func, string title)
	{
		GUISkin	oldSkin	= GUI.skin;

		GUI.skin = m_GuiPopupSkin;

		Rect rect = GUI.Window(id, clientRect, func, FXMakerTooltip.GetGUIContentNoTooltip(title));
 		m_bLastPopupWindow = true;
		if (GUI.enabled)
		{
			m_nLastFocusWindow	= id;
			GUI.FocusWindow(id);
			GUI.BringWindowToFront(id);
			SaveTooltip();
		}

		GUI.skin = oldSkin;
		return rect;
	}
Beispiel #4
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);
        }
    }
    GUIContent GetHelpContent(string text, string arg)
    {
        return(FXMakerTooltip.GetGUIContentNoTooltip(text));
//      return NgTooltip.GetHcPopup_GameObject(text, arg);
    }