Beispiel #1
0
        void InitDifficultyButtons()
        {
            ImageToggleButton btnNormal = null;
            ImageToggleButton btnEasy   = null;

            easymode              = false;
            btnEasy               = new ImageToggleButton();
            btnEasy.Image         = Root.Singleton.Material("img/customizeUI/button_easy_on.png");
            btnEasy.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_easy_select2.png");
            btnEasy.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_easy_select2.png");
            btnEasy.DisabledImage = Root.Singleton.Material("img/customizeUI/button_easy_off.png");
            btnEasy.Enabled       = true;
            btnEasy.Toggled       = true;
            btnEasy.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnEasy.OnClick      += sender =>
            {
                btnEasy.Toggled = true;
                btnEasy.UpdateImage();
                btnNormal.Toggled = false;
                btnNormal.UpdateImage();
                easymode = true;
            };
            Util.LayoutControl(btnEasy, 977, 16, btnEasy.Image.Size, rctScreen);
            btnEasy.Parent = Root.Singleton.Canvas;
            btnEasy.Init();


            btnNormal               = new ImageToggleButton();
            btnNormal.Image         = Root.Singleton.Material("img/customizeUI/button_normal_on.png");
            btnNormal.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_normal_select2.png");
            btnNormal.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_normal_select2.png");
            btnNormal.DisabledImage = Root.Singleton.Material("img/customizeUI/button_normal_off.png");
            btnNormal.Enabled       = true;
            btnNormal.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnNormal.OnClick      += sender =>
            {
                btnEasy.Toggled = false;
                btnEasy.UpdateImage();
                btnNormal.Toggled = true;
                btnNormal.UpdateImage();
                easymode = false;
            };
            Util.LayoutControl(btnNormal, 977, 41, btnNormal.Image.Size, rctScreen);
            btnNormal.Parent = Root.Singleton.Canvas;
            btnNormal.Init();
        }
Beispiel #2
0
        public void SetShipGenerator(Library.ShipGenerator gen, int layout = 0)
        {
            if (lstSystems != null)
            {
                foreach (var system in lstSystems)
                {
                    system.Remove();
                }
                lstSystems.Clear();
                lstSystems = null;
            }

            // Set current ship
            currentShipGen = gen;
            currentShip    = gen.Generate(layout);

            // Update ship renderer
            shipRenderer.Ship = currentShip;

            // Update layout buttons
            btnLayoutA.Enabled = (currentShipGen.NumberOfLayouts >= 1);
            btnLayoutA.Toggled = (layout == 0);
            btnLayoutA.UpdateImage();
            btnLayoutB.Enabled = (currentShipGen.NumberOfLayouts >= 2);
            btnLayoutB.Toggled = (layout == 1);
            btnLayoutB.UpdateImage();

            // Create new UI
            tbShipName.Text = currentShip.Name;

            lstSystems = new List <ImageButton>();
            var systems = currentShip.Systems;

            for (int i = 0; i < systems.Count; i++)
            {
                var system    = systems[i];
                var btnSystem = new ImageButton();
                btnSystem.Image         = Root.Singleton.Material("img/customizeUI/box_system_on.png");
                btnSystem.HoveredImage  = Root.Singleton.Material("img/customizeUI/box_system_select2.png");
                btnSystem.DisabledImage = Root.Singleton.Material("img/customizeUI/box_system_off.png");
                btnSystem.Enabled       = true;
                //btnSystem.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
                Util.LayoutControl(btnSystem, 370 + (i * 38), 380, 38, 96, rctScreen);
                btnSystem.Parent = Root.Singleton.Canvas;
                btnSystem.Init();

                var systembox = new SystemBox();
                systembox.SystemIcon = Root.Singleton.Material(system.IconGraphics["green"]);
                systembox.PowerLevel = system.MinPower;
                systembox.Width      = btnSystem.Width - 2;
                systembox.Height     = btnSystem.Height - 2;
                systembox.Parent     = btnSystem;
                systembox.Init();

                lstSystems.Add(btnSystem);
            }
        }
Beispiel #3
0
        void InitLayoutButtons()
        {
            btnLayoutA = null;
            btnLayoutB = null;

            btnLayoutA               = new ImageToggleButton();
            btnLayoutA.Image         = Root.Singleton.Material("img/customizeUI/button_typea_on.png");
            btnLayoutA.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_typea_select2.png");
            btnLayoutA.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_typea_select2.png");
            btnLayoutA.DisabledImage = Root.Singleton.Material("img/customizeUI/button_typea_off.png");
            btnLayoutA.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnLayoutA.OnClick      += sender =>
            {
                btnLayoutA.Toggled = true;
                btnLayoutA.UpdateImage();
                btnLayoutB.Toggled = false;
                btnLayoutB.UpdateImage();
                SetShipGenerator(currentShipGen, 0);
            };
            Util.LayoutControl(btnLayoutA, 18, 260, btnLayoutA.Image.Size, rctScreen);
            btnLayoutA.Parent = Root.Singleton.Canvas;
            btnLayoutA.Init();

            btnLayoutB               = new ImageToggleButton();
            btnLayoutB.Image         = Root.Singleton.Material("img/customizeUI/button_typeb_on.png");
            btnLayoutB.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_typeb_select2.png");
            btnLayoutB.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_typeb_select2.png");
            btnLayoutB.DisabledImage = Root.Singleton.Material("img/customizeUI/button_typeb_off.png");
            btnLayoutB.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnLayoutB.OnClick      += sender =>
            {
                btnLayoutA.Toggled = false;
                btnLayoutA.UpdateImage();
                btnLayoutB.Toggled = true;
                btnLayoutB.UpdateImage();
                SetShipGenerator(currentShipGen, 1);
            };
            Util.LayoutControl(btnLayoutB, 100, 260, btnLayoutB.Image.Size, rctScreen);
            btnLayoutB.Parent = Root.Singleton.Canvas;
            btnLayoutB.Init();
        }
Beispiel #4
0
        public void OnActivate()
        {
            StoreWindow();
            LoadSprites();
            LoadUI();

            InitShipNamePanel();
            InitShipRenameButton();
            InitShipNameText();
            InitListShipsButton();
            InitShipsLeftButton();
            InitShipsRightButton();

            ImageToggleButton btnNormal = null, btnEasy = null;

            easymode = false;
            #region InitEasyButton
            btnEasy               = new ImageToggleButton();
            btnEasy.Image         = Root.Singleton.Material("img/customizeUI/button_easy_on.png");
            btnEasy.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_easy_select2.png");
            btnEasy.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_easy_select2.png");
            btnEasy.DisabledImage = Root.Singleton.Material("img/customizeUI/button_easy_off.png");
            btnEasy.Enabled       = true;
            btnEasy.Toggled       = true;
            btnEasy.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnEasy.OnClick      += sender => {
                btnEasy.Toggled = true;
                btnEasy.UpdateImage();
                btnNormal.Toggled = false;
                btnNormal.UpdateImage();
                easymode = true;
            };
            Util.LayoutControl(btnEasy, 977, 16, 95, 24, rctScreen);
            btnEasy.Parent = Root.Singleton.Canvas;
            btnEasy.Init();
            #endregion
            #region InitNormalButton
            btnNormal               = new ImageToggleButton();
            btnNormal.Image         = Root.Singleton.Material("img/customizeUI/button_normal_on.png");
            btnNormal.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_normal_select2.png");
            btnNormal.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_normal_select2.png");
            btnNormal.DisabledImage = Root.Singleton.Material("img/customizeUI/button_normal_off.png");
            btnNormal.Enabled       = true;
            btnNormal.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnNormal.OnClick      += sender => {
                btnEasy.Toggled = false;
                btnEasy.UpdateImage();
                btnNormal.Toggled = true;
                btnNormal.UpdateImage();
                easymode = false;
            };
            Util.LayoutControl(btnNormal, 977, 41, 95, 24, rctScreen);
            btnNormal.Parent = Root.Singleton.Canvas;
            btnNormal.Init();
            #endregion
            InitStartButton();

            ImageToggleButton btnTypeA = null, btnTypeB = null;

            #region Init Button Type A
            btnTypeA               = new ImageToggleButton();
            btnTypeA.Image         = Root.Singleton.Material("img/customizeUI/button_typea_on.png");
            btnTypeA.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_typea_select2.png");
            btnTypeA.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_typea_select2.png");
            btnTypeA.DisabledImage = Root.Singleton.Material("img/customizeUI/button_typea_off.png");
            btnTypeA.Enabled       = true;
            btnTypeA.Toggled       = true;
            btnTypeA.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnTypeA.OnClick      += sender => {
                btnTypeA.Toggled = true;
                btnTypeA.UpdateImage();
                btnTypeB.Toggled = false;
                btnTypeB.UpdateImage();
            };
            Util.LayoutControl(btnTypeA, 18, 260, 80, 22, rctScreen);
            btnTypeA.Parent = Root.Singleton.Canvas;
            btnTypeA.Init();
            #endregion
            #region Init Button Type B
            btnTypeB               = new ImageToggleButton();
            btnTypeB.Image         = Root.Singleton.Material("img/customizeUI/button_typeb_on.png");
            btnTypeB.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_typeb_select2.png");
            btnTypeB.ToggledImage  = Root.Singleton.Material("img/customizeUI/button_typeb_select2.png");
            btnTypeB.DisabledImage = Root.Singleton.Material("img/customizeUI/button_typeb_off.png");
            btnTypeB.Enabled       = false;
            btnTypeB.HoverSound    = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            btnTypeB.OnClick      += sender => {
                btnTypeA.Toggled = false;
                btnTypeA.UpdateImage();
                btnTypeB.Toggled = true;
                btnTypeB.UpdateImage();
            };
            Util.LayoutControl(btnTypeB, 100, 260, 80, 22, rctScreen);
            btnTypeB.Parent = Root.Singleton.Canvas;
            btnTypeB.Init();
            #endregion
            InitShowRoomsButton();

            if (currentShipGen == null)
            {
                // Locate the default ship
                SetShipGenerator(GetDefaultShipGenerator());
            }
            else
            {
                SetShipGenerator(currentShipGen);
            }
        }