public void DoCommand(string username, int platformCode, ICommand command) { if (command == null) { return; } if (m_debug) { Debug.Log(string.Format("GameManager12:DoCommand() => username:{0} feedback:{1} response:{2}", username, command.feedbackUser, command.response)); } Platform platform = (Platform)platformCode; if (command.feedbackUser) { Message msg = new Message("Game Admin", command.response, Message.GetCurrentTimeUTC(), Platform.Game); ChatAPI.SendMessageToUser(username, platform, msg); } else { if (command.response == "!START" && !gameIsStarted) { gameIsStarted = true; m_physicsManager.StartGame(); } string userId = platformCode + " " + username; string formattedCommand = command.response.Substring(1).ToUpper(); m_physicsManager.SetCommandFromPlayer(userId, formattedCommand); } }
// Use this for initialization IEnumerator Test() { while (true) { yield return(new WaitForSeconds(5)); ChatAPI.SendMessageToUser("drnd93", Platform.Twitch, new Message("GameMaster", "Bonjour toi", Message.GetCurrentTimeUTC(), Platform.Game)); ChatAPI.SendMessageToEveryUsers(new Message("GameMaster", "T:" + Message.GetCurrentTimeUTC(), Message.GetCurrentTimeUTC(), Platform.Game)); } }
private void HandleMessage(Message message) { ICommand command = m_commandManager.Parse( message.GetUserName(), (int)message.GetPlatform(), message.GetMessage(), message.GetTimestamp() ); if (command == null) { return; } if (command.feedbackUser) { m_input.SendFeedback(command); Message msg = new Message("Game Admin", command.response, Message.GetCurrentTimeUTC(), Platform.Game); //ChatAPI.SendMessageToEveryUsers(msg); ChatAPI.SendMessageToUser(message.GetUserName(), message.GetPlatform(), msg); } else { if (command.response == "!START") { List <string> playerList = new List <string>(m_commandManager.userDataBase.Keys); m_gameEngine.AssignFactionToPlayers(playerList); } string userId = (int)message.GetPlatform() + " " + message.GetUserName(); string formattedCommand = command.response.Substring(1).ToUpper(); m_gameEngine.GetCommandFromPlayer(userId, formattedCommand); } }
private void SendWhisperToUser(string userToWhisper, string theWhisper) { Message whisper = new Message(userToWhisper, theWhisper, Message.GetCurrentTimeUTC(), Platform.Game); ChatAPI.SendMessageToUser(userToWhisper, Platform.Twitch, whisper); }
private void SendMessageToPlayer(Platform platform, string playerName, string message) { Message msg = new Message(playerName, message, GetTimestamp(), platform); ChatAPI.SendMessageToUser(playerName, platform, msg); }