void Start() { if (File.Exists(Application.persistentDataPath + "/rbSave.bp")) { actualMoney = SaveLoad.saveGame.data.moneyCount; OnMoneyChange.Invoke(); } }
public void Init() { _status = new GameStatus(); // Proxy the status event _status.OnGameTimeChange += (value, diff) => { OnGameTimeChange?.Invoke(value, diff); }; _status.OnLocationChange += (value, prev) => { OnLocationChange?.Invoke(value, prev); }; _status.OnCareerChange += (value, diff) => { OnCareerChange?.Invoke(value, diff); }; _status.OnMoneyChange += (value, diff) => { OnMoneyChange?.Invoke(value, diff); }; _status.OnEnergyChange += (value, diff) => { OnEnergyChange?.Invoke(value, diff); }; _status.OnPersonalHappinessChange += (value, diff) => { OnPersonalHappinessChange?.Invoke(value, diff); }; _status.OnFamilyHappinessChange += (value, diff) => { OnFamilyHappinessChange?.Invoke(value, diff); }; _status.OnProjectProgressChange += (value, diff) => { OnProjectProgressChange?.Invoke(value, diff); }; View.Init(); View.UpdateUI(); UpdateUI(); }
public void AddMoney(int amount) { money += amount; onMoneyChange?.Invoke(amount, money); }
public void SpendMoney(float money) { CurrentMoney -= money; OnMoneyChange?.Invoke(CurrentMoney); }
public void AddMoney(float money) { CurrentMoney += money; OnMoneyChange?.Invoke(CurrentMoney); }
public void SetMoney(int m) { money = m; OnMoneyChange?.Invoke(); }
private void _evaluteEvent(string parEvent, object[] parArgs) { if (OnEvent != null) { var args = new OnEventArgs(parEvent, parArgs); OnEvent.Invoke(this, args); } //Console.WriteLine(parEvent); //OUTPUTAssist.PrintEvent(parEvent, parArgs); if (parEvent == "PLAYER_TARGET_CHANGED") { OnTargetChange?.Invoke(this, new EventArgs()); } else if (parEvent == "QUEST_FINISHED") { if (QuestFrame.IsOpen) { QuestFrame.Destroy(); } if (QuestGreetingFrame.IsOpen) { QuestGreetingFrame.Destroy(); } } else if (parEvent == "QUEST_PROGRESS" || parEvent == "QUEST_COMPLETE" || parEvent == "QUEST_DETAIL") { DirectX.Instance.Execute(QuestFrame.Create, 100); } else if (parEvent == "QUEST_GREETING") { DirectX.Instance.Execute(QuestGreetingFrame.Create, 100); } else if (parEvent == "UNIT_LEVEL") { if ((string)parArgs[0] != "player") { return; } LevelUp?.Invoke(this, new EventArgs()); } else if (parEvent == "PLAYER_MONEY") { OnMoneyChange?.Invoke(this, new EventArgs()); } else if (parEvent == "CHAT_MSG_LOOT") { // You receive loot: |cff9d9d9d|Hitem:7098:0:0:0|h[Splintered Tusk]|h|rx2. if (OnLoot == null) { return; } var arg1 = (string)parArgs[0]; var argArr = arg1.Split('|'); var itemId = Convert.ToInt32(argArr[2].Split(':')[1]); var itemName = argArr[3].Substring(2, argArr[3].Length - 3); var itemCount = 1; if (argArr[5].Length != 2) { itemCount = Convert.ToInt32(argArr[5].Substring(2, argArr[5].Length - 3)); } OnLoot.Invoke(this, new OnLootArgs(itemId, itemName, itemCount)); } else if (parEvent == "OPEN_STATUS_DIALOG") { if (OnWrongLogin == null) { return; } if (parArgs.Length != 2) { return; } if ((string)parArgs[0] != "OKAY") { return; } if ((string)parArgs[1] != "The information you have entered is not valid.") { return; } OnWrongLogin.Invoke(this, new EventArgs()); } else if (parEvent == "UPDATE_SELECTED_CHARACTER") { OnCharacterListLoaded?.Invoke(this, new EventArgs()); } else if (parEvent == "UPDATE_STATUS_DIALOG") { if (InServerQueue == null) { return; } if (parArgs.Length != 2) { return; } if (!((string)parArgs[0]).Contains("Position in queue:")) { return; } if ((string)parArgs[1] != "Change Realm") { return; } InServerQueue.Invoke(this, new EventArgs()); } else if (parEvent == "GET_PREFERRED_REALM_INFO") { OnChooseRealm?.Invoke(this, new EventArgs()); } else if (parEvent == "DISCONNECTED_FROM_SERVER") { OnDisconnect?.Invoke(this, new EventArgs()); } else if (parEvent == "UI_ERROR_MESSAGE") { OnErrorMessage?.Invoke(this, new OnUiMessageArgs((string)parArgs[0])); } else if (parEvent == "UI_INFO_MESSAGE") { OnUiMessage?.Invoke(this, new OnUiMessageArgs((string)parArgs[0])); } else if (parEvent == "CHAT_MSG_SYSTEM") { OnSystemMessage?.Invoke(this, new OnUiMessageArgs((string)parArgs[0])); } else if (parEvent == "PLAYER_REGEN_ENABLED") { OnFightStop?.Invoke(this, new EventArgs()); } else if (parEvent == "PLAYER_REGEN_DISABLED") { OnFightStart?.Invoke(this, new EventArgs()); } else if (parEvent == "CHAT_MSG_COMBAT_HOSTILE_DEATH") { if (OnUnitKilled == null) { return; } if (!((string)parArgs[0]).Contains("You have")) { return; } OnUnitKilled.Invoke(this, new EventArgs()); } else if (parEvent == "CHAT_MSG_SAY") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Say"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_MONSTER_SAY") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Say"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Npc, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_MONSTER_YELL") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Yell"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Npc, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_YELL") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Yell"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_CHANNEL") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Channel " + (int)parArgs[7]; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_RAID") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Raid"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_GUILD") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, "Guild", chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_PARTY") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Party"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "CHAT_MSG_WHISPER") { if (OnChatMessage == null) { return; } var unitName = (string)parArgs[1]; var chatType = "Whisper"; var chatTag = (string)parArgs[5]; var chatMessage = (string)parArgs[0]; var args = new ChatMessageArgs(Enums.ChatSenderType.Player, chatTag, unitName, chatType, chatMessage); OnChatMessage.Invoke(this, args); } else if (parEvent == "DUEL_REQUESTED") { OnDuelRequest?.Invoke(this, new OnRequestArgs((string)parArgs[0])); } else if (parEvent == "GUILD_INVITE_REQUEST") { if (OnGuildInvite == null) { return; } var player = (string)parArgs[0]; var guild = (string)parArgs[1]; OnGuildInvite.Invoke(this, new GuildInviteArgs(player, guild)); } else if (parEvent == "TRADE_SHOW") { OnTradeShow?.Invoke(this, new EventArgs()); } else if (parEvent == "PARTY_INVITE_REQUEST") { OnPartyInvite?.Invoke(this, new OnRequestArgs((string)parArgs[0])); } else if (parEvent == "PLAYER_DEAD") { OnDeath?.Invoke(this, new EventArgs()); } else if (parEvent == "PLAYER_UNGHOST") { OnResurrect?.Invoke(this, new EventArgs()); } else if (parEvent == "CORPSE_IN_RANGE") { OnCorpseInRange?.Invoke(this, new EventArgs()); } else if (parEvent == "CORPSE_OUT_OF_RANGE") { OnCorpseOutOfRange?.Invoke(this, new EventArgs()); } else if (parEvent == "LOOT_OPENED") { LOOT_HANDLE(LootState.SHOW); } else if (parEvent == "LOOT_CLOSED") { LOOT_HANDLE(LootState.CLOSE); } else if (parEvent == "UNIT_AURA") { AuraChanged?.Invoke(this, new AuraChangedArgs((string)parArgs[0])); } else if (parEvent == "CHAT_MSG_SKILL") { OnSkillMessage?.Invoke(this, new OnUiMessageArgs((string)parArgs[0])); } else if (parEvent == "CHAT_MSG_COMBAT_XP_GAIN") { if (OnXpGain == null) { return; } var str = (string)parArgs[0]; var regex = new Regex("(?i)you gain [0-9]+"); var match = regex.Match(str); regex = new Regex("[0-9]+"); str = regex.Match(match.Value).Value; OnXpGain?.Invoke(this, new OnXpGainArgs(Convert.ToInt32(str))); } else if (parEvent == "UNIT_MODEL_CHANGED") { } else if (parEvent == "GOSSIP_SHOW") { GOSSIP_SHOW(); } else if (parEvent == "GOSSIP_CLOSED") { GOSSIP_CLOSED(); } else if (parEvent == "MERCHANT_SHOW") { Console.WriteLine("MERCHANT_SHOW occured"); MERCHANT_HANDLE(MerchantState.SHOW); } else if (parEvent == "MERCHANT_CLOSED") { MERCHANT_HANDLE(MerchantState.CLOSE); } else if (parEvent == "TAXIMAP_OPENED") { TAXIMAP_OPENED(); } else if (parEvent == "TAXIMAP_CLOSED") { TAXIMAP_CLOSED(); } else if (parEvent == "TRAINER_SHOW") { TRAINER_SHOW(); } else if (parEvent == "TRAINER_CLOSED") { TRAINER_CLOSED(); } else if (parEvent == "BANKFRAME_OPENED") { OnBankFrameOpen?.Invoke(this, new EventArgs()); } else if (parEvent == "BANKFRAME_CLOSED") { OnBankFrameClosed?.Invoke(this, new EventArgs()); } else if (parEvent == "MAIL_SHOW") { OnMailboxOpen?.Invoke(this, new EventArgs()); } else if (parEvent == "MAIL_CLOSED") { OnMailboxClosed?.Invoke(this, new EventArgs()); } }