Esempio n. 1
0
 public ItemButton(InventoryComponent component, int slot)
     : base(Locator.getTextureManager().loadTexture("tile32"), Services.PostCategory.INV_SLOT)
 {
     component_ = component;
     slot_ = slot;
     count_ = new Text("", false);
     count_.parent_ = this;
 }
Esempio n. 2
0
 public ItemButton(GameEntity item)
     : base(Locator.getTextureManager().loadTexture("tile32"), Services.PostCategory.UNUSED)
 {
     item_ = item;
     count_ = new Text("" + item.item.number_, false);
     count_.parent_ = this;
     count_.pack();
     count_.loc_ = new Vector2(buttonSize) - count_.size;
 }
Esempio n. 3
0
        public StatusFrame(InfoComponent source)
            : base(1, 2)
        {
            source_ = source;
            padding_ = new Vector2(5);
            Text status = new Text("STATUS...", false);
            status.centerX = false;
            set(0, 0, status);
            statusText = new Text("", false);
            set(0, 1, statusText);

            refresh();
            source_.register(refresh);
        }
Esempio n. 4
0
        public InfoWindow(InfoComponent info)
            : base(2, 1)
        {
            padding_ = new Vector2(5);
            minimum_ = new Vector2(100, 50);
            Text name = new Text(info.name, true);
            name.centerX = false;
            set(0, 0, name);

            int subsections = 2;
            if (info.entity_.inventory != null)
            {
                ++subsections;
            }
            if (info.entity_.production != null)
            {
                ++subsections;
            }
            if (info.entity_.controller != null && info.entity_.controller.isDrawn)
            {
                ++subsections;
            }
            Text text = new Text(info.flavorText, false);
            text.padding_ = new Vector2(10);

            Window subFrames = new Window(subsections, 1);

            subFrames.color_ = new Color(0, 0, 0, 255);
            int subIndex = 0;

            subFrames.set(subIndex++, 0, text);

            subFrames.set(subIndex++, 0, new StatusFrame(info));

            if (info.entity_.controller != null && info.entity_.controller.isDrawn)
            {
                subFrames.set(subIndex++, 0, info.entity_.controller.getFrame());
            }
            if (info.entity_.production != null)
            {
                subFrames.set(subIndex++, 0, new ProductionFrame(info.entity_.production));
            }
            if (info.entity_.inventory != null)
            {
                subFrames.set(subIndex++, 0, new InventoryFrame(info.entity_.inventory));
            }

            set(1, 0, subFrames);
        }
Esempio n. 5
0
        public SystemsWindow()
            : base(2, 1, 5)
        {
            FrameComponent frame, frame1;
            ProgressBar bar;
            Text text;
            Window window;
            Text title = new Text("Ship Systems Overview", true);
            title.centerX = false;
            set(0, 0, title);

            FrameComponent subFrame = new FrameComponent(2, 2);
            set(1, 0, subFrame);

            #region LEFT
            FrameComponent left = new FrameComponent(5, 1, 5);
            left.centerY = false;
            subFrame.set(0, 0, left);
            {
                #region POWER
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                left.set(0, 0, frame);
                {
                    title = new Text("Power", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(2, 2, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("Demand/Supply:", false, 5);
                        text.centerX = false;
                        window.set(0, 0, text);

                        frame1 = new FrameComponent(1, 3, 5);
                        window.set(0, 1, frame1);
                        {
                            text = new Text("4.0 GW", false, 5);
                            frame1.set(0, 0, text);

                            bar = new ProgressBar();
                            bar.percent = 4f / 6.8f;
                            frame1.set(0, 1, bar);

                            text = new Text("6.8 GW", false, 5);
                            frame1.set(0, 2, text);
                        }

                        text = new Text("Reserves:", false, 5);
                        text.centerX = false;
                        window.set(1, 0, text);

                        frame1 = new FrameComponent(1, 3, 5);
                        window.set(1, 1, frame1);
                        {
                            text = new Text("0.0 J ", false, 5);
                            frame1.set(0, 0, text);

                            bar = new ProgressBar();
                            bar.percent = 0;
                            frame1.set(0, 1, bar);

                            text = new Text("0.0 J ", false, 5);
                            frame1.set(0, 2, text);
                        }
                    }
                }
                #endregion
                #region SHIELD
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                left.set(1, 0, frame);
                {
                    title = new Text("Shields", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(1, 3, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("0 P", false, 5);
                        window.set(0, 0, text);

                        bar = new ProgressBar();
                        bar.fg = Color.Red;
                        bar.percent = 1;
                        window.set(0, 1, bar);

                        text = new Text("0 P", false, 5);
                        window.set(0, 2, text);
                    }
                }
                #endregion
                #region ENGINES
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                left.set(2, 0, frame);
                {
                    title = new Text("Engines", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(2, 2, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("Engines Online:", false, 5);
                        text.centerX = false;
                        window.set(0, 0, text);

                        engineText = new Text("0 / 6", false, 5);
                        window.set(0, 1, engineText);

                        text = new Text("Thrust:", false, 5);
                        text.centerX = false;
                        window.set(1, 0, text);

                        frame1 = new FrameComponent(1, 3, 5);
                        window.set(1, 1, frame1);
                        {
                            thrustText = new Text("0.0 N ", false, 5);
                            frame1.set(0, 0, thrustText);

                            thrustbar = new ProgressBar();
                            frame1.set(0, 1, thrustbar);

                            thrustMaxText = new Text("47.3 MN", false, 5);
                            frame1.set(0, 2, thrustMaxText);
                        }
                    }
                }
                #endregion
                #region WEAPONS
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                left.set(3, 0, frame);
                {
                    title = new Text("Weapons", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(3, 2, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("Kinetic Turrets Online:", false, 5);
                        text.centerX = false;
                        window.set(0, 0, text);

                        text = new Text("0 / 0", false, 5);
                        window.set(0, 1, text);

                        text = new Text("Laser Turrets Online:", false, 5);
                        text.centerX = false;
                        window.set(1, 0, text);

                        text = new Text("1 / 2", false, 5);
                        window.set(1, 1, text);

                        text = new Text("Missile Turrets Online:", false, 5);
                        text.centerX = false;
                        window.set(2, 0, text);

                        text = new Text("0 / 0", false, 5);
                        window.set(2, 1, text);
                    }
                }
                #endregion
                #region LIFE SUPPORT
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                left.set(4, 0, frame);
                {
                    title = new Text("Life Support Systems", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(1, 2, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("Oxygen:", false, 5);
                        text.centerX = false;
                        window.set(0, 0, text);

                        text = new Text("100%", false, 5);
                        window.set(0, 1, text);
                    }
                }
                #endregion
            }
            #endregion
            #region RIGHT
            FrameComponent right = new FrameComponent(2, 1, 5);
            right.centerY = false;
            subFrame.set(0, 1, right);
            {
                #region SENSORS
                frame = new FrameComponent(2, 1, 5);
                frame.fill = true;
                right.set(0, 0, frame);
                {
                    title = new Text("Sensors", true);
                    title.centerX = false;
                    frame.set(0, 0, title);

                    window = new Window(1, 2, 5);
                    window.color_ = Color.Black;
                    window.fill = true;
                    frame.set(1, 0, window);
                    {
                        text = new Text("Effective Range:", false, 5);
                        text.centerX = false;
                        window.set(0, 0, text);

                        text = new Text("384.4 Mm", false, 5);
                        window.set(0, 1, text);
                    }
                }
                #endregion
                #region MAP
                Map map = new Map();
                map.padding_ = new Vector2(10);
                right.set(1, 0, map);
                #endregion
            }
            #endregion

            pack();
            Locator.getMessageBoard().register(onPost);
        }
Esempio n. 6
0
        public Window cheaterWindow()
        {
            Window window = new Window(2, 1);
            window.padding_ = new Vector2(5, 0);
            Text text = new Text("Inventory", true);
            text.centerY = false;
            window.set(0, 0, text);
            FrameComponent buttonframe = new FrameComponent(2, 10);
            window.set(1, 0, buttonframe);

            int num = 0;
            Button button;

            button = new Button(Locator.getTextureManager().loadTexture("gun64"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createGun;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("mag128"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createTractor;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("furnace"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createFurnace;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("tank"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createTank;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("cchamber"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createCombChamb;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("compressor"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createCompressor;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("pump"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createPump;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("thrust"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createThruster;
            button.slot_ = num;
            buttonframe.set(0, num++, button);

            button = new Button(Locator.getTextureManager().loadTexture("reactor"), PostCategory.PLACING_OBJECT);
            button.getTarget = Locator.getObjectFactory().createReactor;
            buttonframe.set(0, num++, button);

            for (int i = num; i < 10; ++i)
            {
                button = new Button(Locator.getTextureManager().loadTexture("tile32"), PostCategory.PLACED_ITEM);
                button.slot_ = num;
                buttonframe.set(0, i, button);
            }

            for (int i = 0; i < 10; ++i)
            {
                Text label = new Text("" + ((i + 1) % 10), false);
                buttonframe.set(1, i, label);
            }

            buttonframe.padding_ = new Vector2(5, 0);
            window.pack();
            window.loc_ = new Vector2((screen_.X - window.size.X) / 2f, screen_.Y - window.size.Y);
            return window;
        }