void ReleaseDesignerOutlets() { if (Bar_Mana != null) { Bar_Mana.Dispose(); Bar_Mana = null; } if (Btn_Enemy1 != null) { Btn_Enemy1.Dispose(); Btn_Enemy1 = null; } if (HPBar_Enemy != null) { HPBar_Enemy.Dispose(); HPBar_Enemy = null; } if (HPBar_Player != null) { HPBar_Player.Dispose(); HPBar_Player = null; } if (Img_Backroung != null) { Img_Backroung.Dispose(); Img_Backroung = null; } if (Tbl_AttackList != null) { Tbl_AttackList.Dispose(); Tbl_AttackList = null; } if (Txt_BattleSummary != null) { Txt_BattleSummary.Dispose(); Txt_BattleSummary = null; } if (Txt_EnemyHealth != null) { Txt_EnemyHealth.Dispose(); Txt_EnemyHealth = null; } if (Txt_Mana != null) { Txt_Mana.Dispose(); Txt_Mana = null; } if (Txt_PlayerHealth != null) { Txt_PlayerHealth.Dispose(); Txt_PlayerHealth = null; } }
partial void TouchEvent_AttackEnemy(UIButton sender) { int attackIndex = -1; int tableSection = -1; try { attackIndex = Tbl_AttackList.IndexPathForSelectedRow.Row; tableSection = Tbl_AttackList.IndexPathForSelectedRow.Section; }catch (System.NullReferenceException) { attackIndex = -1; tableSection = -1; } if (attackIndex >= 0 && tableSection >= 0) { if (tableSection == 0 && playerCharacter.Stamina >= playerCharacter.attacks[attackIndex].GetManaCost()) { AttackBase playerAttack = playerCharacter.attacks[attackIndex]; AttackBase enemyAttack = enemyCharacter.GetRandomAttack(); string msg1; string msg2; //perform battle int damage2 = playerCharacter.Attack(playerAttack, enemyCharacter, out msg1); int damage1 = enemyCharacter.Attack(enemyAttack, playerCharacter, out msg2); UpdateStats(); UpdateHPBars(); Txt_BattleSummary.Text = ""; Txt_BattleSummary.Text += msg1 + '\n'; Txt_BattleSummary.Text += msg2 + '\n'; } else if (tableSection == 0 && playerCharacter.Stamina < playerCharacter.attacks[attackIndex].GetManaCost()) { Txt_BattleSummary.Text = "Not Enough Mana!"; } else { ItemBase playerItem = playerCharacter.bag[attackIndex]; Console.WriteLine(attackIndex); string str = playerCharacter.UseItem(attackIndex, playerCharacter); Tbl_AttackList.ReloadData(); Txt_BattleSummary.Text = ""; Txt_BattleSummary.Text += str + '\n'; } } else { Txt_BattleSummary.Text = "Select an attack or item!"; } Tbl_AttackList.ReloadData(); if (enemyCharacter.Health <= 0 && enemyCharacter.IsFinalBoss()) { VC_DeathScreen deathScreen = new VC_DeathScreen(true); PresentViewController(deathScreen, true, null); } else if (enemyCharacter.Health <= 0) { playerCharacter.Experience += enemyCharacter.GetExpValue(); this.DismissViewController(true, null); } if (playerCharacter.Health <= 0) { VC_DeathScreen deathScreen = new VC_DeathScreen(false); PresentViewController(deathScreen, true, null); } }