示例#1
0
        public InventoryFrame(InventoryComponent source) : base(1, 1)
        {
            padding_  = new Vector2(5);
            source_   = source;
            capacity_ = source_.capacity;
            buttons_  = new ItemButton[capacity_];
            int rows = 1;
            int cols = capacity_;

            if (capacity_ > maxPerLine)
            {
                rows = capacity_ / maxPerLine;
                cols = maxPerLine;
            }
            inner_ = new FrameComponent(rows, cols);
            set(0, 0, inner_);
            int row = 0;
            int col = 0;

            for (int index = 0; index < capacity_; ++index)
            {
                buttons_[index]              = new ItemButton(source_, index);
                buttons_[index].slot_        = index;
                buttons_[index].getSource    = getSource;
                buttons_[index].getComponent = getComponent;
                buttons_[index].getTarget    = source_.getItem;
                inner_.set(row, col++, buttons_[index]);
                if (col >= maxPerLine)
                {
                    ++row;
                    col = 0;
                }
            }

            refresh();
            source_.register(refresh);
        }
示例#2
0
        public InventoryFrame(InventoryComponent source)
            : base(1, 1)
        {
            padding_ = new Vector2(5);
            source_ = source;
            capacity_ = source_.capacity;
            buttons_ = new ItemButton[capacity_];
            int rows = 1;
            int cols = capacity_;
            if (capacity_ > maxPerLine)
            {
                rows = capacity_ / maxPerLine;
                cols = maxPerLine;
            }
            inner_ = new FrameComponent(rows, cols);
            set(0, 0, inner_);
            int row = 0;
            int col = 0;
            for (int index = 0; index < capacity_; ++index)
            {
                buttons_[index] = new ItemButton(source_, index);
                buttons_[index].slot_ = index;
                buttons_[index].getSource = getSource;
                buttons_[index].getComponent = getComponent;
                buttons_[index].getTarget = source_.getItem;
                inner_.set(row, col++, buttons_[index]);
                if (col >= maxPerLine)
                {
                    ++row;
                    col = 0;
                }
            }

            refresh();
            source_.register(refresh);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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;
        }