コード例 #1
0
    public static void DrawTextRes(Rect r, string text, TextAnchor pos, _Color fontcolor, int fontpos, int fontsize, bool fontshadow)
    {
        int fontsize2 = (int)GUI2.YRES((float)fontsize);

        GUI2.DrawText(r, text, pos, fontcolor, fontpos, fontsize2, fontshadow);
    }
コード例 #2
0
ファイル: Console.cs プロジェクト: UnforeseenOcean/Warmode
    private void OnGUI()
    {
        if (global::Console.showfps)
        {
            this.DrawFPS();
        }
        if (!this.show)
        {
            return;
        }
        GUI.color = new Color(1f, 1f, 1f, 0.75f);
        if (this.tblack)
        {
            GUI.DrawTexture(this.rblack, this.tblack);
        }
        GUI.color = Color.white;
        float num = (float)Screen.height / 2f - 46f;

        for (int i = global::Console.log.Count - 1; i >= 0; i--)
        {
            GUI2.DrawText(new Rect(4f, num, (float)(Screen.width - 8), 24f), global::Console.log[i], TextAnchor.MiddleLeft, _Color.Gray, 0, 12, false);
            num -= 14f;
        }
        GUI2.DrawText(new Rect(0f, 0f, (float)(Screen.width - 4), 24f), "0.01a", TextAnchor.MiddleRight, _Color.White, 0, 16, true);
        GUI2.DrawEdit(new Rect(4f, (float)Screen.height / 2f - 28f, (float)(Screen.width - 8), 24f), ref this.command, TextAnchor.MiddleLeft, _Color.White, 0, 16, true);
        char character = Event.current.character;

        if ((character < 'a' || character > 'z') && (character < 'A' || character > 'Z') && (character < '0' || character > '9') && character != ' ' && character != '_' && character != '.')
        {
            Event.current.character = '\0';
        }
        if (Event.current.isKey)
        {
            KeyCode keyCode = Event.current.keyCode;
            switch (keyCode)
            {
            case KeyCode.KeypadEnter:
                goto IL_207;

            case KeyCode.KeypadEquals:
IL_1C3:
                if (keyCode == KeyCode.Return)
                {
                    goto IL_207;
                }
                if (keyCode != KeyCode.BackQuote && keyCode != KeyCode.F10)
                {
                    return;
                }
                this.command = string.Empty;
                this.SetActive(false);
                Event.current.Use();
                return;

            case KeyCode.UpArrow:
            {
                this.command = this.inputstore;
                TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
                textEditor.selectIndex = this.command.Length + 1;
                textEditor.cursorIndex = this.command.Length + 1;
                return;
            }
            }
            goto IL_1C3;
IL_207:
            this.ParsingCommand(this.command);
            this.command = string.Empty;
            Event.current.Use();
        }
    }
コード例 #3
0
ファイル: Vote.cs プロジェクト: UnforeseenOcean/Warmode
    private void OnGUI()
    {
        if (Vote.voteprocess)
        {
            if (Time.time > Vote.voteendtime)
            {
                Vote.voteprocess = false;
            }
            GUI2.DrawText(new Rect((float)Screen.width / 2f - GUI2.YRES(200f) / 2f, GUI2.YRES(40f), GUI2.YRES(200f), GUI2.YRES(40f)), Vote.votetext, TextAnchor.MiddleCenter, _Color.Green, 0, 20, true);
        }
        if (!Vote.show)
        {
            return;
        }
        GUI.DrawTexture(Vote.rBack, this.tBlack);
        float num  = (float)((int)GUI2.YRES(2f));
        float num2 = (float)((int)GUI2.YRES(20f));

        GUI2.DrawTextRes(new Rect(Vote.rBack.x, Vote.rBack.y - num2, Vote.rBack.width, num2), Lang.Get("_VOTE_KICK"), TextAnchor.MiddleCenter, _Color.White, 0, 12, true);
        for (int i = 0; i < 16; i++)
        {
            if (i == Client.ID)
            {
                GUI.DrawTexture(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), this.tGray0);
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), (i + 1).ToString(), TextAnchor.MiddleLeft, _Color.Black, 0, 12, false);
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num2, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), BaseData.Name, TextAnchor.MiddleLeft, _Color.White, 0, 12, false);
            }
            else if (PlayerControll.Player[i] == null)
            {
                GUI.DrawTexture(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), this.tGray2);
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), (i + 1).ToString(), TextAnchor.MiddleLeft, _Color.Black, 0, 12, false);
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num2, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), "-/-", TextAnchor.MiddleLeft, _Color.Black, 0, 12, false);
            }
            else
            {
                if (Vote.sid == i)
                {
                    GUI.DrawTexture(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), this.tRed);
                }
                else
                {
                    GUI.DrawTexture(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), this.tWhite);
                }
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), (i + 1).ToString(), TextAnchor.MiddleLeft, _Color.Black, 0, 12, false);
                GUI2.DrawTextRes(new Rect(Vote.rBack.x + num2, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2), PlayerControll.Player[i].Name, TextAnchor.MiddleLeft, _Color.Black, 0, 12, false);
                if (GUI2.HideButton(new Rect(Vote.rBack.x + num2, Vote.rBack.y + num + (num2 + num) * (float)i, Vote.rBack.width - num * 2f, num2)))
                {
                    Vote.sid = i;
                }
            }
        }
        GUI.DrawTexture(new Rect(Vote.rBack.x + Vote.rBack.width + GUI2.YRES(8f), Vote.rBack.y + Vote.rBack.height - num2 - num * 2f, GUI2.YRES(100f), num2 + num * 2f), this.tBlack);
        Rect rect = new Rect(Vote.rBack.x + Vote.rBack.width + GUI2.YRES(8f) + num, Vote.rBack.y + Vote.rBack.height - num2 - num, GUI2.YRES(100f) - num * 2f, num2);

        GUI.DrawTexture(rect, this.tBlue);
        GUI2.DrawTextRes(rect, Lang.Get("_SELECT"), TextAnchor.MiddleCenter, _Color.White, 0, 12, false);
        if (GUI2.HideButton(rect))
        {
            Vote_Dialog.cs.SendVoteStart((byte)Vote.sid);
            Vote.SetActive(false);
        }
        GUI.DrawTexture(new Rect(Vote.rBack.x - GUI2.YRES(8f) - num * 2f - GUI2.YRES(100f), Vote.rBack.y + Vote.rBack.height - num2 - num * 2f, GUI2.YRES(100f), num2 + num * 2f), this.tBlack);
        Rect rect2 = new Rect(Vote.rBack.x - GUI2.YRES(8f) - num - GUI2.YRES(100f), Vote.rBack.y + Vote.rBack.height - num2 - num, GUI2.YRES(100f) - num * 2f, num2);

        GUI.DrawTexture(rect2, this.tGray0);
        GUI2.DrawTextRes(rect2, Lang.Get("_CANCEL"), TextAnchor.MiddleCenter, _Color.White, 0, 12, false);
        if (GUI2.HideButton(rect2))
        {
            Vote.SetActive(false);
        }
    }