Example #1
0
        public CapacitorUI(Item[] slot, CapacitorEntity capacitorEntity)
        {
            chargingSlot = new ChargingSlot[4];
            for (int i = 0; i < chargingSlot.Length; i++)
            {
                chargingSlot[i] = new ChargingSlot(new Ref <Item>(slot, i), TUA.instance.GetTexture("API/TerraEnergy/Texture/ChargingSlotUI"), capacitorEntity, capacitorEntity.maxTransferRate);
            }

            this.capacitorEntity = capacitorEntity;
        }
Example #2
0
        public override void OnInitialize()
        {
            panel = new UIPanel();
            panel.Width.Set(400, 0);
            panel.Height.Set(200, 0);
            panel.Top.Set(Main.screenHeight / 2 - 100, 0);
            panel.Left.Set(Main.screenWidth / 2 - 200, 0);

            int space = 40;

            for (int i = 0; i < chargingSlot.Length; i++)
            {
                ChargingSlot slot = chargingSlot[i];
                slot.Top.Set(25, 0);
                slot.Left.Set(space, 0);
                slot.Width.Set(64, 0);
                slot.Height.Set(64, 0);
                space += 75;
                panel.Append(slot);
            }

            Texture2D     buttonDeleteTexture = ModContent.GetTexture("Terraria/UI/ButtonDelete");
            UIImageButton closeButton         = new UIImageButton(buttonDeleteTexture);

            closeButton.Left.Set(400 - 45, 0f);
            closeButton.Width.Set(22, 0f);
            closeButton.Height.Set(22, 0f);
            closeButton.OnClick += new MouseEvent(CloseButtonClicked);
            panel.Append(closeButton);

            energybar = new UIEnergyBar(capacitorEntity.energy);
            energybar.Top.Set(170f, 0);
            energybar.Height.Set(14f, 0);
            energybar.Width.Set(386f, 0);
            panel.Append(energybar);
            Append(panel);
        }