void OnFriendChatMsg(GameConnectedFriendChatMsg_t param)
        {
            if (_friendChatCallbacks.Count == 0)
            {
                return;
            }

            var player = GetSteamPlayer(param.m_steamIDUser);

            if (player != null)
            {
                string         data;
                EChatEntryType chatEntryType;
                SteamFriends.GetFriendMessage(param.m_steamIDUser, param.m_iMessageID, out data, 256, out chatEntryType);
                if (chatEntryType == EChatEntryType.k_EChatEntryTypeTyping)
                {
                    // TODO: use this for "user is typing" feature (if appropriate)
                }
                else if (chatEntryType == EChatEntryType.k_EChatEntryTypeChatMsg)
                {
                    if (data.Length > 0)
                    {
                        for (int i = _friendChatCallbacks.Count - 1; i >= 0; --i)
                        {
                            _friendChatCallbacks[i](player.name, (ulong)param.m_steamIDUser, data);
                        }
                    }
                }
                player.Dispose();
            }
        }
Example #2
0
    void OnGameConnectedFriendChatMsg(GameConnectedFriendChatMsg_t pCallback)
    {
        Debug.Log("[" + GameConnectedFriendChatMsg_t.k_iCallback + " - GameConnectedFriendChatMsg] - " + pCallback.m_steamIDUser + " -- " + pCallback.m_iMessageID);

        string         Text;
        EChatEntryType ChatEntryType;
        int            ret = SteamFriends.GetFriendMessage(pCallback.m_steamIDUser, pCallback.m_iMessageID, out Text, 2048, out ChatEntryType); // Must be called from within OnGameConnectedFriendChatMsg

        print(ret + " " + pCallback.m_steamIDUser + ": " + Text);
    }
    void OnGameConnectedFriendChatMsg(GameConnectedFriendChatMsg_t pCallback)
    {
        string         Text;
        EChatEntryType ChatEntryType;

        /*int ret = */ SteamFriends.GetFriendMessage(pCallback.m_steamIDUser, pCallback.m_iMessageID, out Text, 2048, out ChatEntryType);        // Must be called from within OnGameConnectedFriendChatMsg
        if (Text.Length > 0)
        {
            if (_funRecvChatMsg != null)
            {
                int index = GetIndex(pCallback.m_steamIDUser);
                if (index > -1)
                {
                    _funRecvChatMsg(index, Text);
                }
            }
        }
    }