Esempio n. 1
0
        public void UpdateInventoryMenu()
        {
            UI_Inv_Items.RemoveAllChildren();
            string     pref1 = "^0^e^7";
            string     pref2 = "^7^e^0";
            UITextLink prev  = new UITextLink(Textures.Clear, "Air", pref1 + "Air", pref2 + "Air", FontSets.Standard, () => InventorySelectItem(0), UIAnchor.TOP_LEFT, () => 0, () => 0);

            UI_Inv_Items.AddChild(prev);
            string filter = UI_Inv_Filter.Text;

            for (int i = 0; i < Items.Count; i++)
            {
                if (filter.Length == 0 || Items[i].ToString().ToLowerFast().Contains(filter.ToLowerFast()))
                {
                    string     name = Items[i].DisplayName;
                    UITextLink p    = prev;
                    int        x    = i;
                    UITextLink neo  = new UITextLink(Items[i].Tex, name, pref1 + name, pref2 + name, FontSets.Standard, () => InventorySelectItem(x + 1), UIAnchor.TOP_LEFT, p.GetX, () => (int)(p.GetY() + p.GetHeight()))
                    {
                        IconColor = Items[i].DrawColor
                    };
                    UI_Inv_Items.AddChild(neo);
                    prev = neo;
                }
            }
        }
Esempio n. 2
0
        public void InitChatSystem()
        {
            FontSet font = FontSets.Standard;
            int     minY = 10 + (int)font.font_default.Height;

            ChatMenu     = new UIGroup(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_CENTER).GetterWidthHeight(() => Window.Width, () => Window.Height - minY - UIBottomHeight).ConstantXY(0, 0));
            ChatScroller = new UIScrollBox(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_CENTER).GetterWidthHeight(() => ChatMenu.Position.Width - (30 * 2), () => ChatMenu.Position.Height - minY).ConstantXY(0, minY))
            {
                Color = new Color4F(0f, 0.5f, 0.5f, 0.6f)
            };
            ChatBox = new UIInputBox("", "Enter a /command or a chat message...", font, new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_CENTER).GetterWidth(() => ChatScroller.Position.Width).ConstantX(0).GetterY(() => (int)ChatScroller.Position.Height + minY))
            {
                EnterPressed = EnterChatMessage
            };
            ChatMenu.AddChild(ChatBox);
            ChatMenu.AddChild(ChatScroller);
            Channels = new bool[(int)TextChannelHelpers.COUNT];
            Func <int> xer = () => 30;

            Channels[0] = true;
            for (int i = 1; i < Channels.Length; i++)
            {
                Channels[i] = true;
                string     n    = ((TextChannel)i).ToString();
                int        len  = (int)FontSets.Standard.MeasureFancyText(n);
                UITextLink link = null;
                Func <int> fxer = xer;
                int        chan = i;
                link = new UITextLink(null, "^r^t^0^h^o^2" + n, "^!^e^t^0^h^o^2" + n, "^2^e^t^0^h^o^0" + n, FontSets.Standard, () => ToggleLink(link, n, chan), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterX(fxer).ConstantY(10));
                xer  = () => fxer() + len + 10;
                ChatMenu.AddChild(link);
            }
            ClearChat();
            ChatScrollToBottom();
        }
Esempio n. 3
0
        public void UpdateInventoryMenu()
        {
            UI_Inv_Items.RemoveAllChildren();
            string     pref1 = "^0^e^7";
            string     pref2 = "^7^e^0";
            UITextLink prev  = new UITextLink(Textures.Clear, "Air", pref1 + "Air", pref2 + "Air", FontSets.Standard, () => InventorySelectItem(0), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).ConstantXY(0, 0));

            UI_Inv_Items.AddChild(prev);
            string filter = UI_Inv_Filter.Text;

            for (int i = 0; i < Items.Count; i++)
            {
                if (filter.Length == 0 || Items[i].ToString().ToLowerFast().Contains(filter.ToLowerFast()))
                {
                    string     name = Items[i].DisplayName;
                    UITextLink p    = prev;
                    int        x    = i;
                    UITextLink neo  = new UITextLink(Items[i].Tex, name, pref1 + name, pref2 + name, FontSets.Standard, () => InventorySelectItem(x + 1), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterX(() => p.Position.X).GetterY(() => (int)(p.Position.Y + p.Position.Height)))
                    {
                        IconColor = Items[i].DrawColor
                    };
                    UI_Inv_Items.AddChild(neo);
                    prev = neo;
                }
            }
        }
Esempio n. 4
0
        public void InitChatSystem()
        {
            FontSet font = FontSets.Standard;
            int     minY = 10 + (int)font.font_default.Height;

            ChatMenu     = new UIGroup(UIAnchor.TOP_CENTER, () => Window.Width, () => Window.Height - minY - UIBottomHeight, () => 0, () => 0);
            ChatScroller = new UIScrollBox(UIAnchor.TOP_CENTER, () => ChatMenu.GetWidth() - (30 * 2), () => ChatMenu.GetHeight() - minY, () => 0, () => minY)
            {
                Color = new Vector4(0f, 0.5f, 0.5f, 0.6f)
            };
            ChatBox = new UIInputBox("", "Enter a /command or a chat message...", font, UIAnchor.TOP_CENTER, ChatScroller.GetWidth, () => 0, () => (int)ChatScroller.GetHeight() + minY)
            {
                EnterPressed = EnterChatMessage
            };
            ChatMenu.AddChild(ChatBox);
            ChatMenu.AddChild(ChatScroller);
            Channels = new bool[(int)TextChannel.COUNT];
            Func <int> xer = () => 30;

            Channels[0] = true;
            for (int i = 1; i < Channels.Length; i++)
            {
                Channels[i] = true;
                string     n    = ((TextChannel)i).ToString();
                int        len  = (int)FontSets.Standard.MeasureFancyText(n);
                UITextLink link = null;
                Func <int> fxer = xer;
                int        chan = i;
                link = new UITextLink(null, "^r^t^0^h^o^2" + n, "^!^e^t^0^h^o^2" + n, "^2^e^t^0^h^o^0" + n, FontSets.Standard, () => ToggleLink(link, n, chan), UIAnchor.TOP_LEFT, fxer, () => 10);
                xer  = () => fxer() + len + 10;
                ChatMenu.AddChild(link);
            }
            ClearChat();
            ChatScrollToBottom();
        }
Esempio n. 5
0
        public void InitInventory()
        {
            FixInvRender();
            CInvMenu = null;
            // Inventory Menu
            InventoryMenu = new UIGroup(UIAnchor.TOP_LEFT, TheGameScreen.GetWidth, TheGameScreen.GetHeight, () => 0, () => 0);
            UILabel    inv_inventory = new UILabel("^(Inventory", FontSets.SlightlyBigger, UIAnchor.TOP_LEFT, () => 20, () => 20);
            UITextLink inv_equipment = new UITextLink(null, "Equipment", "^0^e^7Equipment", "^7^e^0Equipment", FontSets.SlightlyBigger,
                                                      () => SetCurrent(EquipmentMenu), UIAnchor.TOP_LEFT, () => (int)(inv_inventory.GetX() + inv_inventory.GetWidth()) + 20, () => inv_inventory.GetY());
            UITextLink inv_builderitems = new UITextLink(null, "Builder-Items", "^0^e^&Builder-Items", "^7^e^0Builder-Items", FontSets.SlightlyBigger,
                                                         () => SetCurrent(BuilderItemsMenu), UIAnchor.TOP_LEFT, () => (int)(inv_equipment.GetX() + inv_equipment.GetWidth()) + 20, () => inv_equipment.GetY());

            InventoryMenu.AddChild(InventoryBackground());
            InventoryMenu.AddChild(inv_inventory);
            InventoryMenu.AddChild(inv_equipment);
            InventoryMenu.AddChild(inv_builderitems);
            InventoryMenu.AddChild(InventoryExitButton());
            Func <int> height = () => inv_inventory.GetY() + (int)inv_inventory.GetHeight() + 20 + (int)FontSets.Standard.font_default.Height + 20;

            UI_Inv_Items  = new UIScrollBox(UIAnchor.TOP_LEFT, () => ItemsListSize, () => Window.Height - (height() + 20), () => 20, height);
            UI_Inv_Filter = new UIInputBox("", "Item Filter", FontSets.Standard, UIAnchor.TOP_LEFT, () => ItemsListSize, () => 20, () => (int)(inv_inventory.GetY() + inv_inventory.GetHeight() + 20));
            UI_Inv_Filter.TextModified += (o, e) => UpdateInventoryMenu();
            InventoryMenu.AddChild(UI_Inv_Items);
            InventoryMenu.AddChild(UI_Inv_Filter);
            GenerateItemDescriptors();
            UpdateInventoryMenu();
            // Equipment Menu
            EquipmentMenu = new UIGroup(UIAnchor.TOP_LEFT, TheGameScreen.GetWidth, TheGameScreen.GetHeight, () => 0, () => 0);
            UITextLink equ_inventory    = new UITextLink(null, "Inventory", "^0^e^7Inventory", "^7^e^0Inventory", FontSets.SlightlyBigger, () => SetCurrent(InventoryMenu), UIAnchor.TOP_LEFT, () => 20, () => 20);
            UILabel    equ_equipment    = new UILabel("^(Equipment", FontSets.SlightlyBigger, UIAnchor.TOP_LEFT, () => (int)(equ_inventory.GetX() + equ_inventory.GetWidth()) + 20, () => equ_inventory.GetY());
            UITextLink equ_builderitems = new UITextLink(null, "Builder-Items", "^0^e^7Builder-Items", "^7^e^0Builder-Items", FontSets.SlightlyBigger,
                                                         () => SetCurrent(BuilderItemsMenu), UIAnchor.TOP_LEFT, () => (int)(equ_equipment.GetX() + equ_equipment.GetWidth()) + 20, () => equ_equipment.GetY());

            EquipmentMenu.AddChild(InventoryBackground());
            EquipmentMenu.AddChild(equ_inventory);
            EquipmentMenu.AddChild(equ_equipment);
            EquipmentMenu.AddChild(equ_builderitems);
            EquipmentMenu.AddChild(InventoryExitButton());
            // Builder-Items Menu
            BuilderItemsMenu = new UIGroup(UIAnchor.TOP_LEFT, TheGameScreen.GetWidth, TheGameScreen.GetHeight, () => 0, () => 0);
            UITextLink bui_inventory = new UITextLink(null, "Inventory", "^0^e^7Inventory", "^7^e^0Inventory", FontSets.SlightlyBigger, () => SetCurrent(InventoryMenu), UIAnchor.TOP_LEFT, () => 20, () => 20);
            UITextLink bui_equipment = new UITextLink(null, "Equipment", "^0^e^7Equipment", "^7^e^0Equipment", FontSets.SlightlyBigger,
                                                      () => SetCurrent(EquipmentMenu), UIAnchor.TOP_LEFT, () => (int)(bui_inventory.GetX() + bui_inventory.GetWidth()) + 20, () => bui_inventory.GetY());
            UILabel bui_builderitems = new UILabel("^(Builder Items", FontSets.SlightlyBigger, UIAnchor.TOP_LEFT, () => (int)(bui_equipment.GetX() + bui_equipment.GetWidth()) + 20, () => bui_equipment.GetY());

            BuilderItemsMenu.AddChild(InventoryBackground());
            BuilderItemsMenu.AddChild(bui_inventory);
            BuilderItemsMenu.AddChild(bui_equipment);
            BuilderItemsMenu.AddChild(bui_builderitems);
            BuilderItemsMenu.AddChild(InventoryExitButton());
        }
Esempio n. 6
0
        public void InitInventory()
        {
            FixInvRender();
            CInvMenu = null;
            // Inventory Menu
            InventoryMenu = new UIGroup(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterWidthHeight(() => TheGameScreen.Position.Width, () => TheGameScreen.Position.Height).ConstantXY(0, 0));
            UILabel    inv_inventory = new UILabel("^(Inventory", FontSets.SlightlyBigger, new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).ConstantXY(20, 20));
            UITextLink inv_equipment = new UITextLink(null, "Equipment", "^0^e^7Equipment", "^7^e^0Equipment", FontSets.SlightlyBigger,
                                                      () => SetCurrent(EquipmentMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(inv_inventory.Position.X + inv_inventory.Position.Width) + 20, () => inv_inventory.Position.Y));
            UITextLink inv_builderitems = new UITextLink(null, "Builder-Items", "^0^e^&Builder-Items", "^7^e^0Builder-Items", FontSets.SlightlyBigger,
                                                         () => SetCurrent(BuilderItemsMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(inv_equipment.Position.X + inv_equipment.Position.Width) + 20, () => inv_equipment.Position.Y));

            InventoryMenu.AddChild(InventoryBackground());
            InventoryMenu.AddChild(inv_inventory);
            InventoryMenu.AddChild(inv_equipment);
            InventoryMenu.AddChild(inv_builderitems);
            InventoryMenu.AddChild(InventoryExitButton());
            Func <int> height = () => inv_inventory.Position.Y + (int)inv_inventory.Position.Height + 20 + (int)FontSets.Standard.font_default.Height + 20;

            UI_Inv_Items  = new UIScrollBox(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterWidth(() => ItemsListSize).GetterHeight(() => Window.Height - (height() + 20)).ConstantX(20).GetterY(height));
            UI_Inv_Filter = new UIInputBox("", "Item Filter", FontSets.Standard, new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterWidth(() => ItemsListSize).ConstantX(20).GetterY(() => (int)(inv_inventory.Position.Y + inv_inventory.Position.Height + 20)));
            UI_Inv_Filter.TextModified += (o, e) => UpdateInventoryMenu();
            InventoryMenu.AddChild(UI_Inv_Items);
            InventoryMenu.AddChild(UI_Inv_Filter);
            GenerateItemDescriptors();
            UpdateInventoryMenu();
            // Equipment Menu
            EquipmentMenu = new UIGroup(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterWidthHeight(() => TheGameScreen.Position.Width, () => TheGameScreen.Position.Height).ConstantXY(0, 0));
            UITextLink equ_inventory    = new UITextLink(null, "Inventory", "^0^e^7Inventory", "^7^e^0Inventory", FontSets.SlightlyBigger, () => SetCurrent(InventoryMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).ConstantXY(20, 20));
            UILabel    equ_equipment    = new UILabel("^(Equipment", FontSets.SlightlyBigger, new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(equ_inventory.Position.X + equ_inventory.Position.Width) + 20, () => equ_inventory.Position.Y));
            UITextLink equ_builderitems = new UITextLink(null, "Builder-Items", "^0^e^7Builder-Items", "^7^e^0Builder-Items", FontSets.SlightlyBigger,
                                                         () => SetCurrent(BuilderItemsMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(equ_equipment.Position.X + equ_equipment.Position.Width) + 20, () => equ_equipment.Position.Y));

            EquipmentMenu.AddChild(InventoryBackground());
            EquipmentMenu.AddChild(equ_inventory);
            EquipmentMenu.AddChild(equ_equipment);
            EquipmentMenu.AddChild(equ_builderitems);
            EquipmentMenu.AddChild(InventoryExitButton());
            // Builder-Items Menu
            BuilderItemsMenu = new UIGroup(new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterWidthHeight(() => TheGameScreen.Position.Width, () => TheGameScreen.Position.Height).ConstantXY(0, 0));
            UITextLink bui_inventory = new UITextLink(null, "Inventory", "^0^e^7Inventory", "^7^e^0Inventory", FontSets.SlightlyBigger, () => SetCurrent(InventoryMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).ConstantXY(20, 20));
            UITextLink bui_equipment = new UITextLink(null, "Equipment", "^0^e^7Equipment", "^7^e^0Equipment", FontSets.SlightlyBigger,
                                                      () => SetCurrent(EquipmentMenu), new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(bui_inventory.Position.X + bui_inventory.Position.Width) + 20, () => bui_inventory.Position.Y));
            UILabel bui_builderitems = new UILabel("^(Builder Items", FontSets.SlightlyBigger, new UIPositionHelper(CWindow.MainUI).Anchor(UIAnchor.TOP_LEFT).GetterXY(() => (int)(bui_equipment.Position.X + bui_equipment.Position.Width) + 20, () => bui_equipment.Position.Y));

            BuilderItemsMenu.AddChild(InventoryBackground());
            BuilderItemsMenu.AddChild(bui_inventory);
            BuilderItemsMenu.AddChild(bui_equipment);
            BuilderItemsMenu.AddChild(bui_builderitems);
            BuilderItemsMenu.AddChild(InventoryExitButton());
        }
Esempio n. 7
0
        void ToggleLink(UITextLink link, string n, int chan)
        {
            char c = '2';

            Channels[chan] = !Channels[chan];
            if (!Channels[chan])
            {
                c = '&';
            }
            link.Text      = "^r^t^0^h^o^" + c + n;
            link.TextHover = "^!^e^t^0^h^o^" + c + n;
            link.TextClick = "^" + c + "^e^t^0^h^o^0" + n;
            UpdateChats();
        }
Esempio n. 8
0
        public MainMenuScreen(Client tclient) : base(tclient)
        {
            Background = new UIImage(TheClient.Textures.GetTexture("ui/menus/menuback"), UIAnchor.TOP_LEFT, GetWidth, GetHeight, () => 0, () => 0);
            AddChild(Background);
            FontSet    font = TheClient.FontSets.SlightlyBigger;
            UITextLink quit = new UITextLink(null, "^%Q^7uit", "^%Q^e^7uit", "^7^e^%Q^0uit", font, () => TheClient.Window.Close(), UIAnchor.BOTTOM_RIGHT, () => - 100, () => - 100);

            AddChild(quit);
            UITextLink sp = new UITextLink(null, "^%S^7ingleplayer", "^%S^e^7ingleplayer", "^7^e^%S^0ingleplayer", font, () => TheClient.ShowSingleplayer(), UIAnchor.BOTTOM_RIGHT, () => - 100, () => - 100 - (int)quit.GetHeight());

            AddChild(sp);
            UITextLink mp = new UITextLink(null, "^%M^7ultiplayer", "^%M^e^7ultiplayer", "^7^e^%M^0ultiplayer", font, () => UIConsole.WriteLine("Multiplayer menu coming soon!"), UIAnchor.BOTTOM_RIGHT, () => - 100, () => - 100 - (int)(sp.GetHeight() + quit.GetHeight()));

            AddChild(mp);
            List <string> hints = TheClient.Languages.GetTextList(TheClient.Files, "voxalia", "hints.common");
            UILabel       label = new UILabel("^0^e^7" + hints[Utilities.UtilRandom.Next(hints.Count)], TheClient.FontSets.Standard, UIAnchor.BOTTOM_LEFT, () => 0, () => - (int)TheClient.Fonts.Standard.Height * 3, () => TheClient.Window.Width);

            AddChild(label);
        }
Esempio n. 9
0
        public MainMenuScreen(Client tclient) : base(tclient)
        {
            ResetOnRender = false;
            //Background = new UIImage(TheClient.Textures.GetTexture("ui/menus/menuback"), UIAnchor.TOP_LEFT, GetWidth, GetHeight, Zero, Zero);
            //AddChild(Background);
            FontSet    font = TheClient.FontSets.SlightlyBigger;
            UITextLink quit = new UITextLink(null, "^%Q^7uit", "^%Q^e^7uit", "^7^e^%Q^0uit", font, () => TheClient.Window.Close(), new UIPositionHelper(Client.MainUI).Anchor(UIAnchor.BOTTOM_RIGHT).ConstantXY(-100, -100));

            AddChild(quit);
            UITextLink sp = new UITextLink(null, "^%S^7ingleplayer", "^%S^e^7ingleplayer", "^7^e^%S^0ingleplayer", font, () => TheClient.ShowSingleplayer(), new UIPositionHelper(Client.MainUI).Anchor(UIAnchor.BOTTOM_RIGHT).ConstantX(-100).GetterY(() => - 100 - quit.Position.Height));

            AddChild(sp);
            UITextLink mp = new UITextLink(null, "^%M^7ultiplayer", "^%M^e^7ultiplayer", "^7^e^%M^0ultiplayer", font, () => UIConsole.WriteLine("Multiplayer menu coming soon!"), new UIPositionHelper(Client.MainUI).Anchor(UIAnchor.BOTTOM_RIGHT).ConstantX(-100).GetterY(() => - 100 - (int)(sp.Position.Height + quit.Position.Height)));

            AddChild(mp);
            List <string> hints = TheClient.Languages.GetTextList(TheClient.Files, "voxalia", "hints.common");
            UILabel       label = new UILabel("^0^e^7" + hints[Utilities.UtilRandom.Next(hints.Count)], TheClient.FontSets.Standard, new UIPositionHelper(Client.MainUI).Anchor(UIAnchor.BOTTOM_LEFT).ConstantX(0).GetterY(() => - (int)TheClient.Fonts.Standard.Height * 3).GetterWidth(() => TheClient.Window.Width));

            AddChild(label);
        }