Exemplo n.º 1
0
 public static void HideAll()
 {
     MenuPlayer.SetActive(false);
     MenuGold.SetActive(false);
     MenuServers.SetActive(false);
     MenuShop.SetActive(false);
     MenuOptions.SetActive(false);
     MenuInventory.SetActive(false);
     MenuPreview.SetActive(false);
 }
Exemplo n.º 2
0
    public static void DrawButton(int state, string text, Rect r, Texture2D normal, Texture2D hover, Texture2D line)
    {
        TopBar.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
        Rect position = new Rect(r.x + (r.width - GUIM.YRES(50f)) / 2f, r.y - GUIM.YRES(8f), GUIM.YRES(50f), GUIM.YRES(50f));

        if (TopBar.clicktime[state] + 0.05f > Time.time)
        {
            GUI.DrawTexture(r, line);
            GUI.color = Color.black;
            GUI.DrawTexture(position, normal);
            GUI.color = Color.white;
            GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), line);
            GUIM.DrawText(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true);
        }
        else if (r.Contains(TopBar.mpos))
        {
            TopBar.buttontime[state] = Time.time;
            GUI.DrawTexture(position, hover);
            GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), line);
            GUIM.DrawText(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true);
            if (Input.GetMouseButton(0))
            {
                TopBar.clicktime[state] = Time.time;
            }
        }
        else
        {
            float num  = Time.time - TopBar.buttontime[state];
            float num2 = 16f - num * 100f;
            if (num2 < 2f)
            {
                num2 = 2f;
            }
            GUI.DrawTexture(position, normal);
            GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(num2)), line);
        }
        if (GUIM.HideButton(r))
        {
            Main.HideAll();
            if (state == 0)
            {
                MenuServers.SetActive(true);
            }
            if (state == 1)
            {
                MenuShop.SetActive(true);
            }
            if (state == 2)
            {
                MenuOptions.SetActive(true);
            }
        }
    }