Пример #1
0
        public void AddRoomProperties(KeyValuePair <object, object> roomProperties, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            if (RoomProperties.ContainsKey(roomProperties.Key) == true)
            {
                Debug.Log("The key is already contains RoomProperties. Update the value");
                RoomProperties[roomProperties.Key] = roomProperties.Value;
            }
            else
            {
                RoomProperties.Add(roomProperties.Key, roomProperties.Value);
            }

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable()
                {
                    { roomProperties.Key, roomProperties.Value }
                });
            }
#endif
        }
Пример #2
0
        public void RemoveBlockedPlayer(string playerId, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            if (BlockedPlayerIdList.ContainsKey(playerId) == false)
            {
                Debug.Log("Target player is not in the BlockedPlayerList");
                return;
            }

            BlockedPlayerIdList.Remove(playerId);

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable()
                {
                    { RoomOptionKey.BlockedPlayerIdList, BlockedPlayerIdList }
                });
            }
#endif
        }
Пример #3
0
        public void RemoveRoomProperties(string roomPropertiesKey, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            if (RoomProperties.ContainsKey(roomPropertiesKey) == false)
            {
                Debug.Log("The key is not in the RoomProperties.");
                return;
            }

            RoomProperties.Remove(roomPropertiesKey);

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable()
                {
                    { roomPropertiesKey, null }
                });
            }
#endif
        }
        // Don't use this method
        public void SendMessageToPlayer(string userID, string message)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            relayServer?.SendMessageToTarget(userID, message);
        }
        public void RespondInviteRoom(string userID, string roomName, bool acceptInvite)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            relayServer?.RespondInviteRoom(userID, roomName, acceptInvite);
        }
        public void InvitePlayerToRoom(string userID, string roomName, string hostName = "")
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            relayServer?.InvitePlayerToRoom(userID, roomName, hostName);
        }
Пример #7
0
        public void SetExpectPlayerList(HashSet <string> expectPlayerIdList, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            ExpectPlayerIdList = expectPlayerIdList;
        }
Пример #8
0
        public bool AddExpectPlayer(Player player, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return(false);
            }

            if (ExpectPlayerIdList.Contains(player.userId) == true)
            {
                Debug.Log("Target player is already contains ExpectPlayerList");
                return(false);
            }

            return(ExpectPlayerIdList.Add(player.userId));
        }
Пример #9
0
        public bool RemoveExpectPlayer(Player player, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return(false);
            }

            if (ExpectPlayerIdList.Contains(player.userId) == false)
            {
                Debug.Log("Target player is not in the ExpectPlayerList");
                return(false);
            }

            return(ExpectPlayerIdList.Remove(player.userId));
        }
Пример #10
0
        public void SetMaxPlayerCount(int maxPlayerCount, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            MaxPlayerCount = maxPlayerCount;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.MaxPlayers = (byte)MaxPlayerCount;
            }
#endif
        }
Пример #11
0
        public void SetIsOpen(bool isOpen, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            IsOpen = isOpen;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.IsOpen = IsOpen;
            }
#endif
        }
Пример #12
0
        public void SetRoomProperties(Dictionary <object, object> roomProperties, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            RoomProperties = roomProperties;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties((Hashtable)RoomProperties);
            }
#endif
        }
Пример #13
0
        public void SetBlockedPlayerList(Dictionary <string, string> blockedPlayerIdList, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            BlockedPlayerIdList = blockedPlayerIdList;
#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable()
                {
                    { RoomOptionKey.BlockedPlayerIdList, BlockedPlayerIdList }
                });
            }
#endif
        }
Пример #14
0
        public void SetIsVisible(bool isVisible, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            IsVisible = isVisible;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable()
                {
                    { RoomOptionKey.IsVisible, isVisible }
                });
            }
#endif
        }
Пример #15
0
        public void SetPassword(string password, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            Password = password;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                Hashtable ht = new Hashtable();
                ht.Add(RoomOptionKey.Password, Password);

                PhotonNetwork.CurrentRoom.SetCustomProperties(ht);
            }
#endif
        }
Пример #16
0
        public void AddUserProperties(KeyValuePair <object, object> userProperty, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            if (this.userProperties.ContainsKey(userProperty.Key) == true)
            {
                Debug.Log("The key is already contains UserProperties. Update the value");
                this.userProperties[userProperty.Key] = userProperty.Value;
            }
            else
            {
                this.userProperties.Add(userProperty.Key, userProperty.Value);
            }

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                if (userId == UserManager.Instance.userID)
                {
                    PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable()
                    {
                        { userProperty.Key, userProperty.Value }
                    });
                }
                else
                {
                    Photon.Realtime.Player photonPlayer = Photon.Pun.PhotonNetwork.CurrentRoom.GetPlayer(dynamicCodeInRoom);
                    photonPlayer.SetCustomProperties(new Hashtable()
                    {
                        { userProperty.Key, userProperty.Value }
                    });
                }
            }
#endif
        }
Пример #17
0
        public void SetUserProperties(Dictionary <object, object> userProperties, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            this.userProperties = userProperties;

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                Hashtable ht = new Hashtable();

                var eProp = userProperties.GetEnumerator();
                while (eProp.MoveNext() == true)
                {
                    ht.Add(eProp.Current.Key, eProp.Current.Value);
                }

                if (ht.Count == 0)
                {
                    return;
                }

                if (userId == UserManager.Instance.userID)
                {
                    PhotonNetwork.LocalPlayer.SetCustomProperties((Hashtable)userProperties);
                }
                else
                {
                    Photon.Realtime.Player photonPlayer = Photon.Pun.PhotonNetwork.CurrentRoom.GetPlayer(dynamicCodeInRoom);
                    photonPlayer.SetCustomProperties((Hashtable)userProperties);
                }
            }
#endif
        }
Пример #18
0
        public void RemoveUserProperties(string userPropertyKey, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            if (userProperties.ContainsKey(userPropertyKey) == false)
            {
                Debug.Log("The key is not in the UserProperties.");
                return;
            }

            userProperties.Remove(userPropertyKey);

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                if (userId == UserManager.Instance.userID)
                {
                    PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable()
                    {
                        { userPropertyKey, null }
                    });
                }
                else
                {
                    Photon.Realtime.Player photonPlayer = Photon.Pun.PhotonNetwork.CurrentRoom.GetPlayer(dynamicCodeInRoom);
                    photonPlayer.SetCustomProperties(new Hashtable()
                    {
                        { userPropertyKey, null }
                    });
                }
            }
#endif
        }
Пример #19
0
        public void SetRoomPropertiesForLobby(List <string> roomPropertiesForLobby = null, bool reqSyncData = true)
        {
            if (SalinTokens.ValidateTokenUserToken() == false)
            {
                return;
            }

            RoomPropertiesForLobby = roomPropertiesForLobby;

            if (RoomPropertiesForLobby == null)
            {
                RoomPropertiesForLobby = new List <string>();
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.Password) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.Password);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.IsVisible) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.IsVisible);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.RoomName) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.RoomName);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.BlockedPlayerIdList) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.BlockedPlayerIdList);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.HostPlayerId) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.HostPlayerId);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.HostPlayerName) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.HostPlayerName);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.KeyPlayerId) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.KeyPlayerId);
            }

            if (RoomPropertiesForLobby.Contains(RoomOptionKey.KeyPlayerName) == false)
            {
                RoomPropertiesForLobby.Add(RoomOptionKey.KeyPlayerName);
            }

#if PHOTON_UNITY_NETWORKING
            if (reqSyncData == true)
            {
                PhotonNetwork.CurrentRoom.SetPropertiesListedInLobby(RoomPropertiesForLobby.ToArray());
            }
#endif
        }