コード例 #1
0
    public void RemoveFriendsData(string friendID)
    {
        if (_friendList.Count == 0)
        {
            CommonDebug.LogWarning("저장된 친구가 없습니다.");
            return;
        }

        for (int i = 0; i < _friendDataKeyList.Count; i++)
        {
            string friendKey   = _friendDataKeyList[i];
            string friendValue = PlayerPrefs.GetString(friendKey);

            if (friendValue.Equals(friendID))
            {
                PlayerPrefs.SetString(friendKey, string.Empty);
                break;
            }
        }

        _friendList.Remove(friendID);

        PlayerPrefs.Save();

        ChatManager.Instance.RemoveFriend(friendID);
    }
コード例 #2
0
    public void AddFriendsData(string friendID)
    {
        if (_friendList.Count >= MAX_FRIEND_COUNT)
        {
            CommonDebug.LogWarning("친구 목록이 가득 찼습니다.");
            return;
        }

        for (int i = 0; i < _friendDataKeyList.Count; i++)
        {
            string friendKey   = _friendDataKeyList[i];
            string friendValue = PlayerPrefs.GetString(friendKey);

            if (string.IsNullOrEmpty(friendValue))
            {
                PlayerPrefs.SetString(friendKey, friendID);
                break;
            }
        }

        _friendList.Add(friendID);

        PlayerPrefs.Save();

        ChatManager.Instance.AddFriend(friendID);
    }
コード例 #3
0
    public override void OnJoinedRoom()
    {
        base.OnJoinedRoom();
        CommonDebug.Log("NetworkManager >> OnJoinedRoom");

        GameManager.Instance.CreatePlayer();
    }
コード例 #4
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnGetMessages(string channelName, string[] senders, object[] messages)
 {
     CommonDebug.Log($"OnGetMessages >> 채널 : {channelName}, 유저 아이디 : {senders[0]}, 메세지 : {messages[0]}");
     if (channelName.Equals(_currentChannel))
     {
         UpdateChatMessage(_currentChannel);
     }
 }
コード例 #5
0
 public virtual void OnPhotonRandomJoinFailed()
 {
     CommonDebug.Log("OnPhotonRandomJoinFailed >> 새로운 방을 생성합니다.");
     PhotonNetwork.CreateRoom(null, new RoomOptions()
     {
         MaxPlayers = 4
     }, null);
 }
コード例 #6
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnPrivateMessage(string sender, object message, string channelName)
 {
     CommonDebug.Log("OnPrivateMessage");
     if (channelName.Equals(_currentChannel))
     {
         UpdateChatMessage(_currentChannel);
     }
 }
コード例 #7
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 void Disconnect()
 {
     if (_chatClient != null)
     {
         CommonDebug.Log($"ID : {_userID}, 로그아웃 하였습니다.");
         _userID = string.Empty;
         _chatClient.Disconnect();
     }
     _chatClient = null;
 }
コード例 #8
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
    void Connect()
    {
        CommonDebug.Log($"ID : {_userID}, 로그인 하였습니다.");

        _chatClient = new ChatClient(this);
#if !UNITY_WEBGL
        _chatClient.UseBackgroundWorkerForSending = true;
#endif

        _chatClient.Connect(_chatAppSettings.AppId, "1.0", new Photon.Chat.AuthenticationValues(_userID));
    }
コード例 #9
0
    public void DebugLogSaveData()
    {
        for (int i = 0; i < _friendDataKeyList.Count; i++)
        {
            string friendKey   = _friendDataKeyList[i];
            string friendValue = PlayerPrefs.GetString(friendKey);
            CommonDebug.Log($"PlayerPrefs에 저장된 친구 데이터 >> Key : {friendKey}, Value : {friendValue}");
        }

        for (int i = 0; i < _friendList.Count; i++)
        {
            CommonDebug.Log($"저장된 친구 이름 : {_friendList[i]}");
        }
    }
コード例 #10
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
    public void OnSubscribed(string[] channels, bool[] results)
    {
        CommonDebug.Log($"OnSubscribed >> 채널명 : {channels[0]}");

        // Array로 받지만 한 채널씩 들어옴.
        foreach (string channel in channels)
        {
            // Default 채널을 시작 채널로 설정함
            if (channel.Equals(DefaultChannel))
            {
                SetChannel(channel);
            }
        }
    }
コード例 #11
0
    public void OnClickBtnLogin()
    {
        var inputUserID = _inputFieldID.text.Trim();

        if (!string.IsNullOrEmpty(inputUserID))
        {
            ChatManager.Instance.Login(inputUserID);
            _inputFieldID.text = string.Empty;
        }
        else
        {
            CommonDebug.Log("로그인 오류! 아이디가 입력되지 않았습니다!");
        }
    }
コード例 #12
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void DebugReturn(DebugLevel level, string message)
 {
     if (level == DebugLevel.ERROR)
     {
         CommonDebug.LogError(message);
     }
     else if (level == DebugLevel.WARNING)
     {
         CommonDebug.LogWarning(message);
     }
     else
     {
         CommonDebug.Log(message);
     }
 }
コード例 #13
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
    public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
    {
        CommonDebug.Log($"OnStatusUpdate >> UserID : {user}");

        if (status == ChatUserStatus.Online)
        {
            _chatUI.AddLoginFriend(user);
        }
        else if (status == ChatUserStatus.Offline)
        {
            _chatUI.RemoveLoginFriend(user);
        }
        else
        {
            Debug.LogWarning("온라인, 오프라인 이외의 상태입니다.");
        }
    }
コード例 #14
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
    public void OnConnected()
    {
        CommonDebug.Log("OnConnected");

        if (_channels == null || _channels.Length == 0)
        {
            Debug.LogError("접속할 채널이 없습니다.");
            return;
        }

        _chatClient.Subscribe(_channels);
        _chatClient.SetOnlineStatus(ChatUserStatus.Online);

        InitComplete();

        _loadingPopup.ClosePopup();
    }
コード例 #15
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
    void UpdateChatMessage(string channelName)
    {
        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        ChatChannel channel = null;
        bool        isValid = _chatClient.TryGetChannel(channelName, out channel);

        if (!isValid)
        {
            CommonDebug.LogError("채널이 존재하지 않습니다. ChannelName : " + channelName);
            return;
        }

        _chatUI.TxtChatMessage.text = channel.ToStringMessages();
    }
コード例 #16
0
 void OnAttack()
 {
     CommonDebug.Log("Attack!!!");
 }
コード例 #17
0
 public void OnJoinedRoom()
 {
     CommonDebug.Log("OnJoinedRoom");
 }
コード例 #18
0
    // the following methods are implemented to give you some context. re-implement them as needed.

    public virtual void OnFailedToConnectToPhoton(DisconnectCause cause)
    {
        CommonDebug.LogError("OnFailedToConnectToPhoton >> Cause: " + cause);
    }
コード例 #19
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnUnsubscribed(string[] channels)
 {
     CommonDebug.Log("OnUnsubscribed");
 }
コード例 #20
0
 public virtual void OnJoinedLobby()
 {
     CommonDebug.Log("OnJoinedLobby >> 랜덤 방에 접속을 시도합니다.");
     PhotonNetwork.JoinRandomRoom();
 }
コード例 #21
0
 public virtual void OnConnectedToMaster()
 {
     CommonDebug.Log("OnConnectedToMaster >> 랜덤 방에 접속을 시도합니다.");
     PhotonNetwork.JoinRandomRoom();
 }
コード例 #22
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnUserUnsubscribed(string channel, string user)
 {
     CommonDebug.Log($"OnUserUnsubscribed >> 채널 : {channel}, 유저 아이디 : {user}");
 }
コード例 #23
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnDisconnected()
 {
     CommonDebug.Log("OnDisconnected");
     Logout();
 }
コード例 #24
0
ファイル: ChatManager.cs プロジェクト: sub3Dreamer/PhotonChat
 public void OnChatStateChange(ChatState state)
 {
     CommonDebug.Log("OnChatStateChange >> state : " + state.ToString());
 }