Пример #1
0
 public void ConfirmClick(UIElement element)
 {
     Resources.Menus.Title.MenuSelect.Play();
     introTime = 12;
     findingNetwork = true;
     Network.Username = usernameBar.TrueContents;
     Network.Password = passwordBar.TrueContents;
 }
Пример #2
0
        public override void Initialize()
        {
            Viewport viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;
            Texture2D tex = Resources.Menus.Title.LoginButton;
            Rectangle rect = new Rectangle(0, 290, tex.Width, tex.Height);
            loginButton = new UIElement(this, tex, rect);
            loginButton.Clicked += LoginClick;
            loginButton.MouseOver += MouseOver;
            loginButton.MouseOff += MouseOff;
            loginButton.color = Color.Black;
            Manager.Elements.Add(loginButton);

            tex = Resources.Menus.Title.OptionsButton;
            rect = new Rectangle(0, 370, tex.Width, tex.Height);
            optionsButton = new UIElement(this, tex, rect);
            optionsButton.Clicked += OptionsClick;
            optionsButton.MouseOver += MouseOver;
            optionsButton.MouseOff += MouseOff;
            optionsButton.color = Color.Black;
            Manager.Elements.Add(optionsButton);

            tex = Resources.Menus.Title.ExitButton;
            rect = new Rectangle(0, 450, tex.Width, tex.Height);
            exitButton = new UIElement(this, tex, rect);
            exitButton.Clicked += ExitClick;
            exitButton.MouseOver += MouseOver;
            exitButton.MouseOff += MouseOff;
            exitButton.color = Color.Black;
            Manager.Elements.Add(exitButton);

            pointerTex = Resources.Menus.Title.Pointer;
            pointerDimensions = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);

            loginMenu = Resources.Menus.Title.LoginMenu;
            loginDimensions = new Rectangle(viewport.Width / 2 - loginMenu.Width / 2, viewport.Height, loginMenu.Width, loginMenu.Height);

            tex = Resources.Menus.Title.LoginConfirmButton;
            rect = new Rectangle(25, 9, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);

            loginConfirmButton = new UIElement(this, tex, rect);
            loginConfirmButton.Clicked += ConfirmClick;

            Manager.Elements.Add(loginConfirmButton);

            tex = Resources.Menus.Title.TextBox;
            rect = new Rectangle(186, 6, tex.Width,tex.Height);
            rect.Offset(loginDimensions.Location);
            usernameBar = new UITextBox(this, tex, rect, false);
            rect = new Rectangle(186, 42, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);
            passwordBar = new UITextBox(this, tex, rect, true);
            Manager.Elements.Add(usernameBar);
            Manager.Elements.Add(passwordBar);

            loginBackButton = new UIStandardButton(this, new Point(128, 128), "Back");
            loginBackButton.dimensions.Offset(loginDimensions.Location);
            loginBackButton.hasButton = true;
            loginBackButton.customFont = Resources.Menus.BaroqueScript16;
            loginBackButton.Clicked += LoginCancel;
            Manager.Elements.Add(loginBackButton);
        }
Пример #3
0
 public void ExitClick(UIElement element)
 {
     Resources.Menus.Title.MenuCancel.Play();
     introTime = -1 - (float)Resources.Menus.Title.MenuCancel.Duration.TotalSeconds;
 }
Пример #4
0
        void SelectPart(UIElement element)
        {
            if (element == Nose.NameBar)
            {
                selectedPart = SelectedPart.Nose;
                Nose.NameBar.color = Color.Lime;
                Core.NameBar.color = Color.White;
                Engine.NameBar.color = Color.White;
                selectedWeaponSlot = 0;

                ResetWeapons();

                if (Ship.Nose.WeaponSlots != null)
                {
                    Weapon1.Weapon = Ship.Weapons[Ship.Nose.WeaponSlots[0]];
                    if(Ship.Nose.WeaponSlots.Length > 1)
                    {
                        Weapon2.Weapon = Ship.Weapons[Ship.Nose.WeaponSlots[1]];
                        if (Ship.Nose.WeaponSlots.Length > 2)
                        {
                            Weapon3.Weapon = Ship.Weapons[Ship.Nose.WeaponSlots[2]];
                            if (Ship.Nose.WeaponSlots.Length > 3)
                            {
                                Weapon4.Weapon = Ship.Weapons[Ship.Nose.WeaponSlots[4]];
                            }
                        }
                    }
                }
                Resources.Menus.Title.MenuSelect.Play();
            }
            else if (element == Core.NameBar)
            {
                selectedPart = SelectedPart.Core;
                Nose.NameBar.color = Color.White;
                Core.NameBar.color = Color.Lime;
                Engine.NameBar.color = Color.White;
                selectedWeaponSlot = 0;
                ResetWeapons();
                if (Ship.Core.WeaponSlots != null)
                {
                    Weapon1.Weapon = Ship.Weapons[Ship.Core.WeaponSlots[0]];
                    if (Ship.Core.WeaponSlots.Length > 1)
                    {
                        Weapon2.Weapon = Ship.Weapons[Ship.Core.WeaponSlots[1]];
                        if (Ship.Core.WeaponSlots.Length > 2)
                        {
                            Weapon3.Weapon = Ship.Weapons[Ship.Core.WeaponSlots[2]];
                            if (Ship.Core.WeaponSlots.Length > 3)
                            {
                                Weapon4.Weapon = Ship.Weapons[Ship.Core.WeaponSlots[3]];
                            }
                        }
                    }
                }
                Resources.Menus.Title.MenuSelect.Play();
            }
            else if(element == Engine.NameBar)
            {
                selectedPart = SelectedPart.Tail;
                Nose.NameBar.color = Color.White;
                Core.NameBar.color = Color.White;
                Engine.NameBar.color = Color.Lime;
                selectedWeaponSlot = 0;
                ResetWeapons();
                if (Ship.Engine.WeaponSlots != null)
                {
                    Weapon1.Weapon = Ship.Weapons[Ship.Engine.WeaponSlots[0]];
                    if (Ship.Engine.WeaponSlots.Length > 1)
                    {
                        Weapon2.Weapon = Ship.Weapons[Ship.Engine.WeaponSlots[1]];
                        if (Ship.Engine.WeaponSlots.Length > 2)
                        {
                            Weapon3.Weapon = Ship.Weapons[Ship.Engine.WeaponSlots[2]];
                            if (Ship.Engine.WeaponSlots.Length > 3)
                            {
                                Weapon4.Weapon = Ship.Weapons[Ship.Engine.WeaponSlots[4]];
                            }
                        }
                    }
                }
                Resources.Menus.Title.MenuSelect.Play();
            }
            else if (element == Weapon1.NameBar)
            {
                if (selectedPart != SelectedPart.None)
                    switch(selectedPart)
                    {
                        case SelectedPart.Nose:
                            if (Ship.Nose.WeaponSlots != null)
                            {
                                selectedWeaponSlot = 1;
                                ResetWeaponColors();
                                Weapon1.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Core:
                            if (Ship.Core.WeaponSlots != null)
                            {
                                selectedWeaponSlot = 1;
                                ResetWeaponColors();
                                Weapon1.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Tail:
                            if (Ship.Engine.WeaponSlots != null)
                            {
                                selectedWeaponSlot = 1;
                                ResetWeaponColors();
                                Weapon1.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                    }
            }
            else if (element == Weapon2.NameBar)
            {
                if (selectedPart != SelectedPart.None)
                    switch (selectedPart)
                    {
                        case SelectedPart.Nose:
                            if (Ship.Nose.WeaponSlots != null && Ship.Nose.WeaponSlots.Length >= 2)
                            {
                                selectedWeaponSlot = 2;
                                ResetWeaponColors();
                                Weapon2.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Core:
                            if (Ship.Core.WeaponSlots != null && Ship.Core.WeaponSlots.Length >= 2)
                            {
                                selectedWeaponSlot = 2;
                                ResetWeaponColors();
                                Weapon2.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Tail:
                            if (Ship.Engine.WeaponSlots != null && Ship.Engine.WeaponSlots.Length >= 2)
                            {
                                selectedWeaponSlot = 2;
                                ResetWeaponColors();
                                Weapon2.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                    }
            }
            else if (element == Weapon3.NameBar)
            {
                if (selectedPart != SelectedPart.None)
                    switch (selectedPart)
                    {
                        case SelectedPart.Nose:
                            if (Ship.Nose.WeaponSlots != null && Ship.Nose.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 3;
                                ResetWeaponColors();
                                Weapon3.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Core:
                            if (Ship.Core.WeaponSlots != null && Ship.Core.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 3;
                                ResetWeaponColors();
                                Weapon3.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Tail:
                            if (Ship.Engine.WeaponSlots != null && Ship.Engine.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 3;
                                ResetWeaponColors();
                                Weapon3.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                    }
            }
            else if (element == Weapon4.NameBar)
            {
                if (selectedPart != SelectedPart.None)
                    switch (selectedPart)
                    {
                        case SelectedPart.Nose:
                            if (Ship.Nose.WeaponSlots != null && Ship.Nose.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 4;
                                ResetWeaponColors();
                                Weapon4.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Core:
                            if (Ship.Core.WeaponSlots != null && Ship.Core.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 4;
                                ResetWeaponColors();
                                Weapon4.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                        case SelectedPart.Tail:
                            if (Ship.Engine.WeaponSlots != null && Ship.Engine.WeaponSlots.Length >= 3)
                            {
                                selectedWeaponSlot = 4;
                                ResetWeaponColors();
                                Weapon4.NameBar.color = Color.Lime;
                                Resources.Menus.Title.MenuSelect.Play();
                            }
                            break;
                    }
            }
        }
Пример #5
0
 void PreviousWeapon(UIElement element)
 {
     int selectedIndex = 1;
     if (element == Weapon2.UpArrow) selectedIndex = 2;
     if (element == Weapon3.UpArrow) selectedIndex = 3;
     if (element == Weapon4.UpArrow) selectedIndex = 4;
     PartData part = null;
     WeaponData weapon = null;
     Vector3 slot = Vector3.Zero;
     switch (selectedPart)
     {
         case SelectedPart.Nose:
             part = Ship.Nose;
             break;
         case SelectedPart.Core:
             part = Ship.Core;
             break;
         case SelectedPart.Tail:
             part = Ship.Engine;
             break;
         default:
             break;
     }
     if (part != null && part.WeaponSlots != null && part.WeaponSlots.Length >= selectedWeaponSlot)
     {
         slot = part.WeaponSlots[selectedIndex - 1];
         weapon = Ship.Weapons[slot];
         int nextWeapon = 0;
         bool noWeapon = true;
         if (weapon != null)
         {
             nextWeapon = weapon.Index - 1;
             if (nextWeapon < 0)
                 noWeapon = true;
             else
                 noWeapon = false;
         }
         else
         {
             nextWeapon = WeaponData.WeaponTypes.Length - 1;
             noWeapon = false;
         }
         WeaponData newWeapon;
         if (!noWeapon)
         {
             newWeapon = WeaponData.WeaponTypes[nextWeapon].Copy();
             Ship.SetWeapon(slot,newWeapon);
         }
         else
         {
             Ship.SetWeapon(slot,null);
             newWeapon = null;
         }
         if (noWeapon)
         {
             if (selectedIndex <= 1)
                 Weapon1.Weapon = null;
             else if (selectedIndex <= 2)
                 Weapon2.Weapon = null;
             else if (selectedIndex <= 3)
                 Weapon3.Weapon = null;
             else
                 Weapon4.Weapon = null;
         }
         else
         {
             if (selectedIndex <= 1)
                 Weapon1.Weapon = newWeapon;
             else if (selectedIndex <= 2)
                 Weapon2.Weapon = newWeapon;
             else if (selectedIndex <= 3)
                 Weapon3.Weapon = newWeapon;
             else
                 Weapon4.Weapon = newWeapon;
         }
         Resources.Sounds.Latch.Play();
     }
 }
Пример #6
0
        public override void Initialize()
        {
            Viewport viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;

            Weapon1 = new UIWeaponSelector(this, new Point(12, viewport.Height- 256 - 48));
            Weapon2 = new UIWeaponSelector(this, new Point(12, viewport.Height - 192 - 36));
            Weapon3 = new UIWeaponSelector(this, new Point(12, viewport.Height - 128 - 24));
            Weapon4 = new UIWeaponSelector(this, new Point(12, viewport.Height - 64 - 12));
            Weapon1.NameBar.Clicked += SelectPart;
            Weapon2.NameBar.Clicked += SelectPart;
            Weapon3.NameBar.Clicked += SelectPart;
            Weapon4.NameBar.Clicked += SelectPart;
            Weapon1.graphicBox.Clicked += IncrementWeaponGroup;
            Weapon2.graphicBox.Clicked += IncrementWeaponGroup;
            Weapon3.graphicBox.Clicked += IncrementWeaponGroup;
            Weapon4.graphicBox.Clicked += IncrementWeaponGroup;
            Weapon1.UpArrow.Clicked += PreviousWeapon;
            Weapon1.DownArrow.Clicked += NextWeapon;
            Weapon2.UpArrow.Clicked += PreviousWeapon;
            Weapon2.DownArrow.Clicked += NextWeapon;
            Weapon3.UpArrow.Clicked += PreviousWeapon;
            Weapon3.DownArrow.Clicked += NextWeapon;
            Weapon4.UpArrow.Clicked += PreviousWeapon;
            Weapon4.DownArrow.Clicked += NextWeapon;

            Ship = new ShipData(1, 1, 1);

            Nose = new UIPartSelector(this, new Point(375 + 12, viewport.Height - 192 - 36 + 8));
            Nose.Part = Ship.Nose;
            Nose.UpArrow.Clicked += PreviousNose;
            Nose.DownArrow.Clicked += NextNose;
            Nose.NameBar.Clicked += SelectPart;
            Core = new UIPartSelector(this, new Point(375 + 12, viewport.Height - 128 - 24 + 8));
            Core.PartType = "Core";
            Core.Part = Ship.Core;
            Core.UpArrow.Clicked += PreviousCore;
            Core.DownArrow.Clicked += NextCore;
            Core.NameBar.Clicked += SelectPart;
            Engine = new UIPartSelector(this, new Point(375 + 12, viewport.Height - 64 - 12 + 8));
            Engine.PartType = "Engine";
            Engine.Part = Ship.Engine;
            Engine.UpArrow.Clicked += PreviousEngine;
            Engine.DownArrow.Clicked += NextEngine;
            Engine.NameBar.Clicked += SelectPart;

            ConfirmButton = new UIStandardButton(this, new Point(viewport.Width - 198 - 16, 8), "Launch");
            ConfirmButton.hasButton = true;
            ConfirmButton.Clicked += Confirm;
            Manager.Elements.Add(ConfirmButton);

            Texture2D tex = Resources.Menus.Customization.DescriptionScreen;
            DescriptionBox = new UIElement(this, tex,
                new Rectangle(5, 5, tex.Width, tex.Height));

            Manager.ClickAway += SelectPart;

            pointerTex = Resources.Menus.Title.Pointer;
            pointerDimensions = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);

            Camera.CustomizationSetup(MobileFortressClient.Game,new Vector3(0,1.5f,6));
        }
Пример #7
0
 public void OptionsClick(UIElement element)
 {
     Resources.Menus.Title.MenuConfirm.Play();
     MenuManager.Menu = new OptionsMenu();
 }
Пример #8
0
 public void MouseOff(UIElement element)
 {
     element.color = Color.LightGray;
 }
Пример #9
0
 void NextNose(UIElement element)
 {
     int id = (Ship.NoseID + 1);
     if (id > PartData.Noses.Length - 1) id = 0;
     Ship.SetNose(id);
     Nose.Part = Ship.Nose;
     ResetAvailableWeapons(Ship.Nose);
 }
Пример #10
0
 void NextEngine(UIElement element)
 {
     int id = (Ship.EngineID + 1);
     if (id > PartData.Engines.Length - 1) id = 0;
     Ship.SetEngine(id);
     Engine.Part = Ship.Engine;
     ResetAvailableWeapons(Ship.Engine);
 }
Пример #11
0
 void NextCore(UIElement element)
 {
     int id = (Ship.CoreID + 1);
     if (id > PartData.Cores.Length - 1) id = 0;
     Ship.SetCore(id);
     Core.Part = Ship.Core;
     ResetAvailableWeapons(Ship.Core);
 }
Пример #12
0
 void IncrementWeaponGroup(UIElement element)
 {
     if (element == Weapon1.graphicBox)
     {
         if(Weapon1.Weapon != null) Weapon1.Weapon.fireGroup = (byte)((Weapon1.Weapon.fireGroup+1)%(fireGroups));
     }
     else if (element == Weapon2.graphicBox)
     {
         if (Weapon2.Weapon != null) Weapon2.Weapon.fireGroup = (byte)((Weapon2.Weapon.fireGroup + 1) % (fireGroups));
     }
     else if (element == Weapon3.graphicBox)
     {
         if (Weapon3.Weapon != null) Weapon3.Weapon.fireGroup = (byte)((Weapon3.Weapon.fireGroup + 1) % (fireGroups));
     }
     else
     {
         if (Weapon4.Weapon != null) Weapon4.Weapon.fireGroup = (byte)((Weapon4.Weapon.fireGroup + 1) % (fireGroups));
     }
 }
Пример #13
0
 void Confirm(UIElement element)
 {
     SendOutputMessage();
 }
Пример #14
0
 public void MouseOver(UIElement element)
 {
     Resources.Menus.Title.MenuSelect.Play();
 }
Пример #15
0
 public void LoginCancel(UIElement element)
 {
     Resources.Menus.Title.MenuCancel.Play();
     loginMenuScroll = false;
 }
Пример #16
0
 public void LoginClick(UIElement element)
 {
     Resources.Menus.Title.MenuConfirm.Play();
     loginMenuScroll = true;
 }
Пример #17
0
 void PreviousCore(UIElement element)
 {
     int id = (Ship.CoreID - 1);
     if (id < 0) id = PartData.Cores.Length - 1;
     Ship.SetCore(id);
     Core.Part = Ship.Core;
     ResetAvailableWeapons(Ship.Core);
 }
Пример #18
0
 public void MouseOver(UIElement element)
 {
     Resources.Menus.Title.MenuSelect.Play();
     element.color = Color.White;
 }
Пример #19
0
 void PreviousEngine(UIElement element)
 {
     int id = (Ship.EngineID - 1);
     if (id < 0) id = PartData.Engines.Length - 1;
     Ship.SetEngine(id);
     Engine.Part = Ship.Engine;
     ResetAvailableWeapons(Ship.Engine);
 }
Пример #20
0
 void PreviousNose(UIElement element)
 {
     int id = (Ship.NoseID - 1);
     if (id < 0) id = PartData.Noses.Length - 1;
     Ship.SetNose(id);
     Nose.Part = Ship.Nose;
     ResetAvailableWeapons(Ship.Nose);
 }
Пример #21
0
 void UITextBox_Clicked(UIElement element)
 {
     Controls.Instance.SetActiveTextBox(this);
 }