コード例 #1
0
        public override void OnLobbyMessageReceived(GalaxyID lobbyID, GalaxyID senderID, uint messageID, uint messageLength)
        {
            Dictionary <string, string> messageAndSenderDict = new Dictionary <string, string>();
            ChatController chatMenuController = GameObject.Find("OnlineChat").GetComponent <ChatController>();

            Debug.Log("Message from lobby: \'" + lobbyID + "\', sender: \'" + senderID + "\', with value: \'" + message +
                      "\' received.");
            message = matchmaking.GetLobbyMessage(matchmaking.CurrentLobbyID, ref senderID, messageID);
            messageAndSenderDict.Add("sender", friends.GetFriendPersonaName(senderID));
            messageAndSenderDict.Add("message", message);
            chatLobbyMessageHistory.Add(messageAndSenderDict);
            if (chatMenuController != null)
            {
                chatMenuController.DisplayChatMessage(messageAndSenderDict);
            }
            if (GameManager.Instance != null)
            {
                ((Online2PlayerGameManager)GameManager.Instance).PopChatPrompt();
            }
        }
コード例 #2
0
        public override void OnLobbyMessageReceived(GalaxyID lobbyID, GalaxyID senderID, uint messageID, uint messageLength)
        {
            Dictionary <string, string> messageAndSenderDict = new Dictionary <string, string>();

            try
            {
                Debug.Log("Lobby " + lobbyID + " Sender " + senderID + " message " + message);
                message = matchmaking.GetLobbyMessage(GalaxyManager.Instance.Matchmaking.CurrentLobbyID, ref senderID, messageID);
                messageAndSenderDict.Add("sender", GalaxyManager.Instance.Friends.GetFriendPersonaName(senderID));
                messageAndSenderDict.Add("message", message);
                matchmaking.LobbyChat.lobbyMessageHistory.Add(messageAndSenderDict);
                Debug.Log("New message from " + GalaxyManager.Instance.Friends.GetFriendPersonaName(senderID) + " to lobbyID " + lobbyID + ": " + message);
                if (GameManager.Instance != null)
                {
                    ((Online2PlayerGameManager)GameManager.Instance).PopChatPrompt();
                }
            }
            catch (GalaxyInstance.Error e)
            {
                Debug.LogWarning(e);
            }
        }