Esempio n. 1
0
    public static void DrawProfile()
    {
        GUIM.DrawText(new Rect(Profile.rBackProfile.x, Profile.rBackProfile.y - GUIM.YRES(18f), Profile.rBackProfile.width, GUIM.YRES(18f)), Lang.Get("_PROFILE"), TextAnchor.MiddleLeft, BaseColor.White, 1, 12, false);
        Profile.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
        BaseColor fontcolor = BaseColor.White;

        GUIM.DrawBox(Profile.rBackProfile, Profile.tBlack);
        if (Main.avatar == null)
        {
            GUI.DrawTexture(Profile.rAvatar, Profile.tBlack);
        }
        else
        {
            GUI.DrawTexture(Profile.rAvatar, Main.avatar);
        }
        if (GUIM.HideButton(Profile.rBackName) && !GameData.gSteam)
        {
            Profile.inEdit  = true;
            Profile.newname = BaseData.Name;
        }
        if (Profile.inEdit)
        {
            GUI.DrawTexture(Profile.rBackName, Profile.tGray);
            GUIM.DrawEdit(Profile.rBackName, ref Profile.newname, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true);
        }
        else
        {
            if (Profile.rBackName.Contains(Profile.mpos) && !GameData.gSteam)
            {
                GUI.DrawTexture(Profile.rBackName, Profile.tOrange);
            }
            else
            {
                GUI.DrawTexture(Profile.rBackName, Profile.tBlue);
            }
            GUIM.DrawText(Profile.rBackName, BaseData.Name, TextAnchor.MiddleCenter, fontcolor, 1, 14, true);
        }
        GUIM.DrawText(new Rect(Profile.rBackName.x, Profile.rBackProfile.y + GUIM.YRES(8f), Profile.rBackName.width, Profile.rBackName.height), Lang.Get("_NICKNAME"), TextAnchor.MiddleLeft, BaseColor.White, 1, 14, false);
        GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(8f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(48f), GUIM.YRES(24f)), Profile.tWhite);
        GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(8f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(48f), GUIM.YRES(24f)), BaseData.Level, TextAnchor.MiddleCenter, BaseColor.Blue, 1, 14, false);
        GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(94f), GUIM.YRES(190f), GUIM.YRES(10f)), Profile.tGray);
        GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(94f), (float)BaseData.iProgress * 0.01f * GUIM.YRES(190f), GUIM.YRES(10f)), Profile.tOrange);
        GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(190f), GUIM.YRES(12f)), BaseData.Progress, TextAnchor.MiddleRight, BaseColor.Gray, 1, 14, false);
        GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(190f), GUIM.YRES(12f)), BaseData.EXPData, TextAnchor.MiddleLeft, BaseColor.Gray, 1, 14, false);
        if (GameData.gSteam)
        {
            return;
        }
        GUIM.DrawBox(Profile.rBackGold, Profile.tBlack);
        GUI.DrawTexture(new Rect(Profile.rBackGold.x + GUIM.YRES(14f), Profile.rBackGold.y + GUIM.YRES(6f), GUIM.YRES(30f), GUIM.YRES(30f)), Profile.tGold);
        GUIM.DrawText(new Rect(Profile.rBackGold.x + GUIM.YRES(50f), Profile.rBackGold.y + GUIM.YRES(1f), GUIM.YRES(110f), Profile.rBackGold.height - GUIM.YRES(4f)), BaseData.Gold, TextAnchor.MiddleLeft, BaseColor.White, 1, 20, false);
        Profile.DrawMenuButton(2, new Rect(Profile.rBackGold.x + GUIM.YRES(120f), Profile.rBackGold.y + GUIM.YRES(6f), GUIM.YRES(126f), GUIM.YRES(30f)), Profile.tGreen, Profile.tOrange);
        GUIM.DrawText(new Rect(Profile.rBackGold.x + GUIM.YRES(120f), Profile.rBackGold.y + GUIM.YRES(5f), GUIM.YRES(126f), GUIM.YRES(30f)), Lang.Get("_ADD_GOLD"), TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true);
    }
Esempio n. 2
0
    private void OnGUI()
    {
        if (!this.show)
        {
            return;
        }
        GUI.depth = -1;
        GUI.color = new Color(1f, 1f, 1f, 0.8f);
        if (this.tBlack)
        {
            GUI.DrawTexture(this.rBlack, this.tBlack);
        }
        GUI.color = Color.white;
        float num = (float)Screen.height / 2f - 46f;

        for (int i = MainMenuConsole.log.Count - 1; i >= 0; i--)
        {
            GUIM.DrawText(new Rect(4f, num, (float)(Screen.width - 8), 24f), MainMenuConsole.log[i], TextAnchor.MiddleLeft, BaseColor.Gray, 0, 12, false);
            num -= 14f;
        }
        GUIM.DrawText(new Rect(0f, 0f, (float)(Screen.width - 4), 24f), "[MENU CONSOLE]", TextAnchor.MiddleRight, BaseColor.White, 0, 16, true);
        GUIM.DrawEdit(new Rect(4f, (float)Screen.height / 2f - 28f, (float)(Screen.width - 8), 24f), ref MainMenuConsole.command, TextAnchor.MiddleLeft, BaseColor.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_1FB;

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

            case KeyCode.UpArrow:
            {
                MainMenuConsole.command = MainMenuConsole.inputstore;
                TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
                textEditor.selectIndex = MainMenuConsole.command.Length + 1;
                textEditor.cursorIndex = MainMenuConsole.command.Length + 1;
                return;
            }
            }
            goto IL_1B8;
IL_1FB:
            MainMenuConsole.ParsingCommand(MainMenuConsole.command);
            MainMenuConsole.command = string.Empty;
            Event.current.Use();
        }
    }