/// <summary> /// Method of UIMangager, which gets called by the ButtonHandler class. Only if a computer is the Button Identity. /// </summary> /// <param name="identity">Identity of the Button which is clicked.</param> /// <param name="type">Type of action of the Button which is clicked</param> /// <param name="identifier">ID of the computer</param> internal void ButtonClickedEvent(Defines.ButtonIdentiy identity, Defines.ButtonType type, int identifier) { var environment = gameManager.GetEnvironment(); var computer = environment.GetComputer(); if (identifier >= computer.Count) { if (environment.BuyComputer()) { NewMessage("You bought a new computer."); } else { NewMessage("Purchase failed. Do you have enought money? Sell some gold!"); } } else { if (computer[identifier].UpgradeComputer()) { NewMessage("You upgraded your computer."); } else { NewMessage("Upgrade failed. Do you have enought money? Sell some gold!"); } } }
/// <summary> /// Method of UIMangager, which gets called by the ButtonHandler class. /// </summary> /// <param name="identity">Identity of the Button which is clicked.</param> /// <param name="type">Type of action of the Button which is clicked</param> internal void ButtonClickedEvent(Defines.ButtonIdentiy identity, Defines.ButtonType type) { switch (identity) { case Defines.ButtonIdentiy.Gold: if (type == Defines.ButtonType.Activate) { gameManager.GetCharacter().CharacterGoldClick(); } if (type == Defines.ButtonType.UpgradeMoney) { if (gameManager.GetCharacter().UpgradeClick()) { NewMessage("Upgrade Successful"); } else { NewMessage("Upgrade failed. Do you have enought money?"); } } break; case Defines.ButtonIdentiy.GoldSell: if (type == Defines.ButtonType.Sell) { var result = gameManager.GetCharacter().SellGold(); NewMessage("You sold " + result[0] + " gold for " + result[1] + " $."); } break; case Defines.ButtonIdentiy.Mother: if (type == Defines.ButtonType.Activate) { if (gameManager.GetCharacter().ActivateMotherEvent()) { NewMessage("You doing some work for your Mother. You are busy now."); } } break; case Defines.ButtonIdentiy.Bot: if (type == Defines.ButtonType.Buy) { if (gameManager.GetEnvironment().BuyBot()) { NewMessage("You bought a new Bot Licence."); } else { NewMessage("Purchase failed. Do you have enought money or space."); } } if (type == Defines.ButtonType.UpgradeMoney) { if (gameManager.GetEnvironment().UpgradeBot()) { NewMessage("You upgraded your bots. They are now more efficient."); } else { NewMessage("Upgrade failed. Do you have enought money? Sell some gold!"); } } if (type == Defines.ButtonType.UpgradeKnowledge) { if (gameManager.GetEnvironment().UpgradeBotKnowledge()) { NewMessage("You upgraded your bots. They are now more efficient."); } else { NewMessage("Upgrade failed. Do you have enought knowledge? Go to school!"); } } break; case Defines.ButtonIdentiy.Subscriptions: if (type == Defines.ButtonType.Buy) { if (gameManager.GetEnvironment().BuySubscription()) { NewMessage("You bought a new subscription."); } else { NewMessage("Purchase failed. Do you have enought money or space."); } } if (type == Defines.ButtonType.Activate) { if (gameManager.GetEnvironment().ToggleAutobuy()) { NewMessage("You toggled the autobuy function! Expired subscriptions are history now."); } else { NewMessage("You toggled the autobuy function! You wanna do it by yourself? Fine."); } } break; case Defines.ButtonIdentiy.School: { if (type == Defines.ButtonType.Activate) { gameManager.GetCharacter().ToggleSchool(); } break; } default: Debug.Log("Not a vaild combination"); break; } }