void OnEnergyAnimStop(UIEnergyBar bar) { mInputLockCounter--; if (mInputLockCounter <= 0) { fillSfx.Stop(); } }
public override void OnInitialize() { panelMain.Width.Pixels = Main.screenWidth / 7f; panelMain.Height.Precent = 0.25f; panelMain.Center(); panelMain.SetPadding(0); panelMain.OnMouseDown += DragStart; panelMain.OnMouseUp += DragEnd; Append(panelMain); textLabel.Top.Pixels = 8; textLabel.HAlign = 0.5f; panelMain.Append(textLabel); barEnergy = new UIEnergyBar(panel); barEnergy.Width.Pixels = 32; barEnergy.Height.Set(-16, 1); barEnergy.Left.Set(-barEnergy.Width.Pixels - 8, 1); barEnergy.Top.Pixels = 8; panelMain.Append(barEnergy); panelInfo.Width.Set(-56, 1); panelInfo.Height.Set(-44, 1); panelInfo.Left.Pixels = 8; panelInfo.Top.Pixels = 36; panelInfo.SetPadding(0); panelMain.Append(panelInfo); textGeneration = new UIText(() => $"Generating: {barEnergy.delta.AsPower(true)}"); textGeneration.Left.Pixels = 8; textGeneration.Top.Pixels = 8; panelInfo.Append(textGeneration); textEfficiency = new UIText(() => $"Efficiency: {panel.efficiency:F2}%"); textEfficiency.Left.Pixels = 8; textEfficiency.Top.Pixels = 36; panelInfo.Append(textEfficiency); button.Left.Pixels = 8; button.Top.Pixels = 64; button.Height.Pixels = 40; button.Width.Set(-16, 1); button.OnClick += (a, b) => panel.energy.SetValue("energy", 0); panelInfo.Append(button); }
void Awake() { mWeapons = weaponsHolder.GetComponentsInChildren <UIEnergyBar>(true); System.Array.Sort(mWeapons, delegate(UIEnergyBar bar1, UIEnergyBar bar2) { return(bar1.name.CompareTo(bar2.name)); }); for (int i = 0, max = mWeapons.Length; i < max; i++) { UIEnergyBar wpnUI = mWeapons[i]; wpnUI.current = 0; wpnUI.RefreshBars(); wpnUI.animateEndCallback += OnEnergyAnimStop; } hpBar.animateEndCallback += OnEnergyAnimStop; mEnergySubTankBarFillW = energySubTankBar1Fill.width; mWeaponSubTankBarFillW = weaponSubTankBar1Fill.width; }
void OnEnergyAnimStop(UIEnergyBar bar) { mInputLockCounter--; }
void InitWeapons() { Player player = Player.instance; UIButtonKeys firstWeaponButtonKeys = null; UIButtonKeys lastWeaponButtonKeys = null; UIButtonKeys rightButtonKeys = null; if (PlayerStats.isSubTankEnergy1Acquired || PlayerStats.isSubTankEnergy2Acquired) { rightButtonKeys = energySubTank.GetComponent <UIButtonKeys>(); } else if (PlayerStats.isSubTankWeapon1Acquired || PlayerStats.isSubTankWeapon2Acquired) { rightButtonKeys = weaponSubTank.GetComponent <UIButtonKeys>(); } else { rightButtonKeys = exit.GetComponent <UIButtonKeys>(); } for (int i = 0, max = mWeapons.Length; i < max; i++) { UIEnergyBar wpnUI = mWeapons[i]; Weapon wpn = i < player.weapons.Length ? player.weapons[i] : null; UIEventListener eventListener = wpnUI.GetComponent <UIEventListener>(); if (Weapon.IsAvailable(i) && wpn) { wpnUI.gameObject.SetActive(true); wpnUI.label.text = wpn.labelText; wpnUI.SetIconSprite(wpn.iconSpriteRef); wpnUI.max = Mathf.CeilToInt(Weapon.weaponEnergyDefaultMax); wpnUI.current = wpn.energyType == Weapon.EnergyType.Unlimited ? wpnUI.max : Mathf.CeilToInt(wpn.currentEnergy); eventListener.onClick = OnWeaponClick; eventListener.onSelect = OnWeaponSelect; UIButtonKeys buttonKeys = wpnUI.GetComponent <UIButtonKeys>(); buttonKeys.selectOnUp = lastWeaponButtonKeys; buttonKeys.selectOnRight = rightButtonKeys; if (firstWeaponButtonKeys == null) { firstWeaponButtonKeys = buttonKeys; } if (lastWeaponButtonKeys) { lastWeaponButtonKeys.selectOnDown = buttonKeys; } lastWeaponButtonKeys = buttonKeys; } else { wpnUI.gameObject.SetActive(false); eventListener.onClick = null; UIButtonKeys buttonKeys = wpnUI.GetComponent <UIButtonKeys>(); buttonKeys.selectOnUp = null; buttonKeys.selectOnDown = null; } } if (firstWeaponButtonKeys) { firstWeaponButtonKeys.selectOnUp = lastWeaponButtonKeys; } if (lastWeaponButtonKeys) { lastWeaponButtonKeys.selectOnDown = firstWeaponButtonKeys; } }
void OnEnergyAnimStop(UIEnergyBar bar) { Pause(false); }
void OnHPBarFilled(UIEnergyBar bar) { Player.instance.Pause(false); HUD.instance.barBoss.animateEndCallback -= OnHPBarFilled; }
void OnEnergyAnimStop(UIEnergyBar bar) { Pause(false); }
void OnHPBarFilled(UIEnergyBar bar) { Player.instance.Pause(false); HUD.instance.barBoss.animateEndCallback -= OnHPBarFilled; }
void OnEnergyAnimStop(UIEnergyBar bar) { mInputLockCounter--; }