Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void Run(EventType.NumbericChange args)
        {
            Unit unit = args.Parent as Unit;

            if (unit == null)
            {
                Log.Error("监视hp数值变化,改变血条值 Unit 未找到 !");
                return;
            }

            InfoComponent ic = unit.GetComponent <InfoComponent>();

            ic?.RefreshUI();
        }
Exemplo 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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void SetModification(Modification newModificationValue)
        {
            if (this.modification != null)
            {
                this.enabledComponent.PropertyChanged   -= HandleComponentPropertyChanged;
                this.infoComponent.PropertyChanged      -= HandleComponentPropertyChanged;
                this.leagueComponent.PropertyChanged    -= HandleComponentPropertyChanged;
                this.thumbnailComponent.PropertyChanged -= HandleComponentPropertyChanged;
            }

            this.modification = newModificationValue;

            this.enabledComponent   = newModificationValue.GetComponent <EnabledComponent>();
            this.infoComponent      = newModificationValue.GetComponent <InfoComponent>();
            this.thumbnailComponent = newModificationValue.GetComponent <ThumbnailComponent>();
            this.leagueComponent    = newModificationValue.GetComponent <LeagueMetadataComponent>();

            enabledComponent.PropertyChanged   += HandleComponentPropertyChanged;
            infoComponent.PropertyChanged      += HandleComponentPropertyChanged;
            thumbnailComponent.PropertyChanged += HandleComponentPropertyChanged;
            leagueComponent.PropertyChanged    += HandleComponentPropertyChanged;

            OnPropertyChanged(nameof(Modification));
        }
Exemplo n.º 7
0
 private void add(InfoComponent info)
 {
     info_.Add(info);
 }
Exemplo n.º 8
0
 private void remove(InfoComponent info)
 {
     info_.Remove(info);
 }
Exemplo n.º 9
0
 private void remove(InfoComponent info)
 {
     info_.Remove(info);
 }
Exemplo n.º 10
0
 private void add(InfoComponent info)
 {
     info_.Add(info);
 }
Exemplo n.º 11
0
        private void initObjects()
        {
            int typeId = 0;
            gunInfo = new InfoComponent(typeId++);
            gunInfo.name = "Cannon";
            gunInfo.flavorText = "Dual purpose weaponry can defend or mine.\nRequires blue orb to function.";
            gunItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("gun64"));
            gunItemInfo.structureID_ = gunInfo.typeID_;
            entities.Add(createGun());

            debrisInfo = new InfoComponent(typeId++);
            debrisInfo.name = "Scrap";
            debrisInfo.type = ObjectType.LOOTABLE;
            entities.Add(createDebris());

            wreckInfo = new InfoComponent(typeId++);
            wreckInfo.name = "Wreck";
            wreckInfo.type = ObjectType.SHOOTABLE;
            entities.Add(createWreck());

            tractorInfo = new InfoComponent(typeId++);
            tractorInfo.name = "Tractor Beam";
            tractorInfo.flavorText = "Pulls objects into the ship.\nRequires blue orb to function.";
            tractorItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("mag128"));
            tractorItemInfo.structureID_ = tractorInfo.typeID_;
            entities.Add(createTractor());

            furnaceInfo = new InfoComponent(typeId++);
            furnaceInfo.name = "Furnace";
            furnaceInfo.flavorText = "Reforms scrap into usable steel.";
            furnaceItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("furnace"));
            furnaceItemInfo.structureID_ = furnaceInfo.typeID_;
            entities.Add(createFurnace());

            tankInfo = new InfoComponent(typeId++);
            tankInfo.name = "Storage Tank";
            tankInfo.flavorText = "Stores liquid or gaseous substances.";
            tankItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("tank"));
            tankItemInfo.structureID_ = tankInfo.typeID_;
            entities.Add(createTank());

            compressorInfo = new InfoComponent(typeId++);
            compressorInfo.name = "Compressor";
            compressorInfo.flavorText = "Pressurizes gas, moving it from one entity to another.";
            compressorItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("compressor"));
            compressorItemInfo.structureID_ = compressorInfo.typeID_;
            entities.Add(createCompressor());

            pumpInfo = new InfoComponent(typeId++);
            pumpInfo.name = "Pump";
            pumpInfo.flavorText = "Pumps liquids from one entity to another.\nRequires a motor and pinion to function.";
            pumpItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("pump"));
            pumpItemInfo.structureID_ = pumpInfo.typeID_;
            entities.Add(createPump());

            combustInfo = new InfoComponent(typeId++);
            combustInfo.name = "Combustion Chamber";
            combustInfo.flavorText = "Burns oxygen and hydrogen.";
            combustItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("cchamber"));
            combustItemInfo.structureID_ = combustInfo.typeID_;
            entities.Add(createCombChamb());

            thrustInfo = new InfoComponent(typeId++);
            thrustInfo.name = "Thruster";
            thrustInfo.flavorText = "Directs exploding materials to provide thrust.";
            thrustItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("thrust"));
            thrustItemInfo.structureID_ = thrustInfo.typeID_;
            entities.Add(createThruster());

            reactorInfo = new InfoComponent(typeId++);
            reactorInfo.name = "Reactor";
            reactorInfo.flavorText = "Provides power.";
            reactorItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("reactor"));
            reactorItemInfo.structureID_ = reactorInfo.typeID_;
            entities.Add(createReactor());

            machineshopInfo = new InfoComponent(typeId++);
            machineshopInfo.name = "Machine Shop";
            machineshopInfo.flavorText = "Creates various components from steel.";
            machineshopItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("machineshop"));
            machineshopItemInfo.structureID_ = machineshopInfo.typeID_;
            entities.Add(createMachineShop());

            grinderInfo = new InfoComponent(typeId++);
            grinderInfo.name = "Grinder";
            grinderInfo.flavorText = "Turns things into scrap.";
            grinderItemInfo = new ItemInfo(Locator.getTextureManager().loadTexture("grinder"));
            grinderItemInfo.structureID_ = grinderInfo.typeID_;
            entities.Add(createGrinder());
        }
Exemplo n.º 12
0
        private void initObjects()
        {
            int typeId = 0;

            gunInfo                  = new InfoComponent(typeId++);
            gunInfo.name             = "Cannon";
            gunInfo.flavorText       = "Dual purpose weaponry can defend or mine.\nRequires blue orb to function.";
            gunItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("gun64"));
            gunItemInfo.structureID_ = gunInfo.typeID_;
            entities.Add(createGun());

            debrisInfo      = new InfoComponent(typeId++);
            debrisInfo.name = "Scrap";
            debrisInfo.type = ObjectType.LOOTABLE;
            entities.Add(createDebris());

            wreckInfo      = new InfoComponent(typeId++);
            wreckInfo.name = "Wreck";
            wreckInfo.type = ObjectType.SHOOTABLE;
            entities.Add(createWreck());

            tractorInfo                  = new InfoComponent(typeId++);
            tractorInfo.name             = "Tractor Beam";
            tractorInfo.flavorText       = "Pulls objects into the ship.\nRequires blue orb to function.";
            tractorItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("mag128"));
            tractorItemInfo.structureID_ = tractorInfo.typeID_;
            entities.Add(createTractor());

            furnaceInfo                  = new InfoComponent(typeId++);
            furnaceInfo.name             = "Furnace";
            furnaceInfo.flavorText       = "Reforms scrap into usable steel.";
            furnaceItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("furnace"));
            furnaceItemInfo.structureID_ = furnaceInfo.typeID_;
            entities.Add(createFurnace());

            tankInfo                  = new InfoComponent(typeId++);
            tankInfo.name             = "Storage Tank";
            tankInfo.flavorText       = "Stores liquid or gaseous substances.";
            tankItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("tank"));
            tankItemInfo.structureID_ = tankInfo.typeID_;
            entities.Add(createTank());

            compressorInfo                  = new InfoComponent(typeId++);
            compressorInfo.name             = "Compressor";
            compressorInfo.flavorText       = "Pressurizes gas, moving it from one entity to another.";
            compressorItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("compressor"));
            compressorItemInfo.structureID_ = compressorInfo.typeID_;
            entities.Add(createCompressor());

            pumpInfo                  = new InfoComponent(typeId++);
            pumpInfo.name             = "Pump";
            pumpInfo.flavorText       = "Pumps liquids from one entity to another.\nRequires a motor and pinion to function.";
            pumpItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("pump"));
            pumpItemInfo.structureID_ = pumpInfo.typeID_;
            entities.Add(createPump());

            combustInfo                  = new InfoComponent(typeId++);
            combustInfo.name             = "Combustion Chamber";
            combustInfo.flavorText       = "Burns oxygen and hydrogen.";
            combustItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("cchamber"));
            combustItemInfo.structureID_ = combustInfo.typeID_;
            entities.Add(createCombChamb());

            thrustInfo                  = new InfoComponent(typeId++);
            thrustInfo.name             = "Thruster";
            thrustInfo.flavorText       = "Directs exploding materials to provide thrust.";
            thrustItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("thrust"));
            thrustItemInfo.structureID_ = thrustInfo.typeID_;
            entities.Add(createThruster());

            reactorInfo                  = new InfoComponent(typeId++);
            reactorInfo.name             = "Reactor";
            reactorInfo.flavorText       = "Provides power.";
            reactorItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("reactor"));
            reactorItemInfo.structureID_ = reactorInfo.typeID_;
            entities.Add(createReactor());

            machineshopInfo                  = new InfoComponent(typeId++);
            machineshopInfo.name             = "Machine Shop";
            machineshopInfo.flavorText       = "Creates various components from steel.";
            machineshopItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("machineshop"));
            machineshopItemInfo.structureID_ = machineshopInfo.typeID_;
            entities.Add(createMachineShop());

            grinderInfo                  = new InfoComponent(typeId++);
            grinderInfo.name             = "Grinder";
            grinderInfo.flavorText       = "Turns things into scrap.";
            grinderItemInfo              = new ItemInfo(Locator.getTextureManager().loadTexture("grinder"));
            grinderItemInfo.structureID_ = grinderInfo.typeID_;
            entities.Add(createGrinder());
        }