private void ShowBossButtons() { foreach (var bossButtonPair in _bossButtons) { var bossButton = bossButtonPair.Value; bossButton.SubstituteEntity.EnableSynchronization(true); var hasRelation = _bossRelations.ContainsKey(bossButton.Name); var available = !hasRelation || (Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item1)) > 0 && Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item2)) > 0); var hidden = Game.PlayerData.BossAttempts(BossFactory.StringToBossType(bossButton.Name)) == 0; if (!hasRelation || (available && !hidden)) { var beaten = Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(bossButton.Name)) > 0; bossButton.Animator().AddTextureSwap( "Graphics/GUI/BossSelection/unknown-boss-button", Assets.GetTexture2D("Graphics/GUI/BossSelection/xmas-" + bossButton.Name + "-" + ((beaten) ? "beaten" : "available") + "-button") ); } else { bossButton.Name = "Unknown"; } Game.GuiManager.AddButton(bossButton); } EnableBossButtons(); }
private void OnBossButtonAction(object button, Point position) { var spriterGuiButton = button as SpriterGuiButton; var bossType = BossFactory.StringToBossType(spriterGuiButton.Name); if (bossType != BossType.Unknown) { OpenBossPanel(bossType); } }
private void OnBossButtonAction(object button, Point position) { var spriterGuiButton = button as SpriterGuiButton; // Make sure the ball is entirely visible spriterGuiButton.SubstituteEntity.SubstituteAnimator.Color = new Color(spriterGuiButton.SubstituteEntity.SubstituteAnimator.Color, 1f); var bossType = BossFactory.StringToBossType(spriterGuiButton.Name); if (bossType != BossType.Unknown) { OpenBossPanel(bossType); } }
protected override void InitializeSpriterGui() { Animators["BossSelection"].AnimationFinished += BossSelectionScreen_AnimationFinished; Animators["BossPanel"].AnimationFinished += BossPanel_AnimationFinished; Animators["Ball"].zIndex(9); Animators["Garland"].zIndex(5); Animators["BossPanel"].zIndex(10); // Christmas tree's balls foreach (var bossName in _bossNames) { var ballAnimator = Animators["Ball"].Clone(); ballAnimator.Play("Balance"); ballAnimator.Progress = (float)Game.GameManager.Random.NextDouble(); ballAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble(); var hasRelation = _bossRelations.ContainsKey(bossName); if (hasRelation) { _bossGarlands.Add(new SpriterSubstituteEntity( "xmas-" + _bossRelations[bossName].Item1 + "-" + bossName + "-garland.png", Animators["BossSelection"], Animators["Garland"].Clone() )); _bossGarlands.Add(new SpriterSubstituteEntity( "xmas-" + _bossRelations[bossName].Item2 + "-" + bossName + "-garland.png", Animators["BossSelection"], Animators["Garland"].Clone() )); } var bossButton = new SpriterGuiButton( Game.ViewportAdapter, bossName, "Graphics/GUI/BossSelection/xmas-" + bossName + "-available-button.png", ballAnimator, Animators["BossSelection"] ); bossButton.Action += OnBossButtonAction; _bossButtons.Add(BossFactory.StringToBossType(bossName), bossButton); } // Boss panel buttons _closeBossPanelButton = new SpriterGuiButton( Game.ViewportAdapter, "CloseBossPanel", "Graphics/GUI/BossSelection/boss-panel-close-button.png", Animators["CloseButton"], Animators["BossPanel"] ); _startBattleBossPanelButton = new SpriterGuiButton( Game.ViewportAdapter, "StartBattleBossPanel", "Graphics/GUI/BossSelection/boss-panel-battle-button.png", Animators["BattleButton"], Animators["BossPanel"] ); _closeBossPanelButton.Action += BossPanelCloseButtonAction; _startBattleBossPanelButton.Action += BossPanelStartBattleButtonAction; _closeBossPanelButton.Animator().zIndex(11); _startBattleBossPanelButton.Animator().zIndex(11); _bossPanelButtons.Add(_closeBossPanelButton); _bossPanelButtons.Add(_startBattleBossPanelButton); // Labels _bossNameLabel = new SpriterGuiLabel("Unknown", Assets.GetFont("Graphics/Fonts/ui-title"), "boss-panel-title-label.png", Animators["BossPanel"], true); _bestTimeLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-best-time-label.png", Animators["BossPanel"]); _playTimeLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-play-time-label.png", Animators["BossPanel"]); _playerDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-player-deaths-label.png", Animators["BossPanel"]); _bossDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-boss-deaths-label.png", Animators["BossPanel"]); _bossPanelLabels.Add(_bossNameLabel); _bossPanelLabels.Add(_bestTimeLabel); _bossPanelLabels.Add(_playTimeLabel); _bossPanelLabels.Add(_playerDeathLabel); _bossPanelLabels.Add(_bossDeathLabel); base.InitializeSpriterGui(); ResetUI(); }
private void InitializeSpriterGui() { SpriterFile["Main"].AnimationFinished += BossSelectionScreen_AnimationFinished; SpriterFile["BossPanel"].AnimationFinished += BossPanel_AnimationFinished; SpriterFile["Garland"].ZIndex(5); SpriterFile["BallHook"].ZIndex(6); SpriterFile["Ball"].ZIndex(9); SpriterFile["BossPanel"].ZIndex(10); // Christmas tree's balls foreach (var bossName in _bossNames) { var ballAnimator = SpriterFile["Ball"].Clone(); var hasRelation = _bossRelations.ContainsKey(bossName); for (int i = 0; i < 10; i++) { _ballHooks.Add(new SpriterSubstituteEntity("garland-forbidden-ball.png", SpriterFile["Main"], SpriterFile["BallHook"].Clone(), "garland-forbidden-ball_00" + i)); } if (hasRelation) { var garlandAnimator1 = SpriterFile["Garland"].Clone(); var garlandAnimator2 = SpriterFile["Garland"].Clone(); garlandAnimator1.Play("FlashForbidden"); garlandAnimator2.Play("FlashForbidden"); garlandAnimator1.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f; garlandAnimator2.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f; garlandAnimator1.Progress = (float)Game.GameManager.Random.NextDouble(); garlandAnimator2.Progress = (float)Game.GameManager.Random.NextDouble(); _bossGarlands.Add( _bossRelations[bossName].Item1 + "-" + bossName, new SpriterSubstituteEntity( "xmas-" + _bossRelations[bossName].Item1 + "-" + bossName + "-garland.png", SpriterFile["Main"], garlandAnimator1 ) ); _bossGarlands.Add( _bossRelations[bossName].Item2 + "-" + bossName, new SpriterSubstituteEntity( "xmas-" + _bossRelations[bossName].Item2 + "-" + bossName + "-garland.png", SpriterFile["Main"], garlandAnimator2 ) ); } var bossButton = new SpriterGuiButton( Game.ViewportAdapter, bossName, "Graphics/GUI/BossSelection/xmas-" + bossName + "-available-button.png", ballAnimator, SpriterFile["Main"], "Balance", null, "Audio/SE/select1" ); bossButton.SubstituteEntity.SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble(); bossButton.SubstituteEntity.SubstituteAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble(); bossButton.Action += OnBossButtonAction; _bossButtons.Add(BossFactory.StringToBossType(bossName), bossButton); } // Boss panel buttons var closeBossPanelButton = new SpriterGuiButton( Game.ViewportAdapter, "CloseBossPanel", "Graphics/GUI/BossSelection/boss-panel-close-button.png", SpriterFile["CloseButton"], SpriterFile["BossPanel"], "Idle", null, "Audio/SE/select4" ); var startBattleBossPanelButton = new SpriterGuiButton( Game.ViewportAdapter, "StartBattleBossPanel", "Graphics/GUI/BossSelection/boss-panel-battle-button.png", SpriterFile["BattleButton"], SpriterFile["BossPanel"], "Idle", null, "Audio/SE/select2" ); closeBossPanelButton.Action += BossPanelCloseButtonAction; startBattleBossPanelButton.Action += BossPanelStartBattleButtonAction; closeBossPanelButton.Animator().ZIndex(11); startBattleBossPanelButton.Animator().ZIndex(11); _bossPanelButtons.Add(closeBossPanelButton); _bossPanelButtons.Add(startBattleBossPanelButton); // Labels _bossNameLabel = new SpriterGuiLabel("Unknown", Assets.GetFont("Graphics/Fonts/ui-title"), "boss-panel-title-label.png", SpriterFile["BossPanel"], Vector2.Zero, true); _bestTimeLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-best-time-label.png", SpriterFile["BossPanel"], Vector2.Zero); _playTimeLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-play-time-label.png", SpriterFile["BossPanel"], Vector2.Zero); _playerDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-player-deaths-label.png", SpriterFile["BossPanel"], Vector2.Zero); _bossDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-boss-deaths-label.png", SpriterFile["BossPanel"], Vector2.Zero); _bossPanelLabels.Add(_bossNameLabel); _bossPanelLabels.Add(_bestTimeLabel); _bossPanelLabels.Add(_playTimeLabel); _bossPanelLabels.Add(_playerDeathLabel); _bossPanelLabels.Add(_bossDeathLabel); ResetUI(); }
private void ShowBossButtons() { foreach (var bossButtonPair in _bossButtons) { var bossButton = bossButtonPair.Value; var bossType = BossFactory.StringToBossType(bossButton.Name); bossButton.SubstituteEntity.EnableSynchronization(true); var hasRelation = _bossRelations.ContainsKey(bossButton.Name); var available = !hasRelation || (Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item1)) > 0 && Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item2)) > 0); if (Array.IndexOf(GameConfig.EnabledBosses, bossType) == -1) { available = false; } if (available) { var beaten = Game.PlayerData.BossBeatenCounter(bossType) > 0; var hidden = Game.PlayerData.DeathCounter(bossType) == 0 && Game.PlayerData.BossBeatenCounter(bossType) == 0; var buttonTextureSwapName = "xmas-" + bossButton.Name + "-" + ((beaten) ? "beaten" : "available") + "-button"; if (hasRelation && hidden) { buttonTextureSwapName = "hidden-boss-button"; } if (hasRelation) { var relation1 = _bossRelations[bossButton.Name].Item1; var relation2 = _bossRelations[bossButton.Name].Item2; var animationName = (beaten) ? "FlashBeaten" : "FlashAvailable"; _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Play(animationName); _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Play(animationName); _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f; _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f; _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble(); _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble(); } bossButton.Animator().AddTextureSwap( "Graphics/GUI/BossSelection/unknown-boss-button", Assets.GetTexture2D("Graphics/GUI/BossSelection/" + buttonTextureSwapName) ); } else { bossButton.Name = "Unknown"; } Game.GuiManager.AddButton(bossButton); } EnableBossButtons(); }