Ejemplo n.º 1
0
        public CrewMember(Library.Race race, Ships.Ship ship, string name)
        {
            // Store details
            Race = race;
            Name = name;
            this.ship = ship;

            // Load spritesheets
            tsRed = Root.Singleton.Material(race.TilesheetRed, true);
            tsYellow = Root.Singleton.Material(race.TilesheetYellow, true);
            tsGreen = Root.Singleton.Material(race.TilesheetGreen, true);
            tsSelected = Root.Singleton.Material(race.TilesheetSelected, true);

            // Calculate tile size
            tileW = (int)(tsGreen.Size.X / race.TilesX);
            tileH = (int)(tsGreen.Size.Y / race.TilesY);

            // Create sprite
            sprGraphic = new Sprite();
            sprGraphic.Scale = new Vector2f(1.0f, 1.0f);

            // Default drawmode
            Mode = DrawMode.Yellow;
        }
Ejemplo n.º 2
0
        public void SetShipGenerator(Library.ShipGenerator gen)
        {
            if (lstSystems != null)
            {
                foreach (var system in lstSystems)
                    system.Remove();
                lstSystems.Clear();
                lstSystems = null;
            }

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

            // Update ship renderer
            shipRenderer.Ship = currentShip;

            // 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);
            }
        }
Ejemplo n.º 3
0
            public ShipButton(Library.ShipGenerator gen)
            {
                Image = Root.Singleton.Material("img/customizeUI/ship_list_button_on.png");
                HoveredImage = Root.Singleton.Material("img/customizeUI/ship_list_button_select2.png");
                DisabledImage = Root.Singleton.Material("img/customizeUI/ship_list_button_off.png");
                LockImage = Root.Singleton.Material("img/customizeUI/box_lock_on.png");
                HoveredLockImage = Root.Singleton.Material("img/customizeUI/box_lock_selected.png");
                DisabledLockImage = Root.Singleton.Material("img/customizeUI/box_lock_off.png");

                this.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");

                GeneratorName = gen.Name;
                ShipImage = Root.Singleton.Material(gen.MiniGraphic);
                Locked = !gen.Unlocked;
                Enabled = true;
            }