Ejemplo n.º 1
0
        public void ForceSendMessageToServer(string method, string json)
        {
            var msg = new CustomNetworkMessage(_thisClientObject.uid, method, json);

            //DebugLog(msg.method);
            try
            {
                thisClient.Send(SimpleCustomMessageSendingId, msg);
            }
            catch (Exception e)
            {
                Debug.LogWarning(e.ToString());
            }
        }
Ejemplo n.º 2
0
        public void SendMessageByClient(NetworkClientObject client, string method, string json)
        {
            if (!_isServerRunning)
            {
                return;
            }

            var msg = new CustomNetworkMessage(method, json);

            try
            {
                NetworkServer.SendToClient(client.connectionId, SimpleCustomMessageSendingId, msg);
            }
            catch (Exception e)
            {
                DebugLog(e.ToString());
            }
        }
Ejemplo n.º 3
0
        public void SendMessageToAll(string method, string json)
        {
            if (!_isServerRunning)
            {
                return;
            }

            var msg = new CustomNetworkMessage(method, json);

            try
            {
                NetworkServer.SendToAll(SimpleCustomMessageSendingId, msg);
            }
            catch (Exception e)
            {
                DebugLog(e.ToString());
            }
        }
Ejemplo n.º 4
0
        public void SendMessageToActive(string method, string json)
        {
            if (!_isServerRunning)
            {
                return;
            }

            var msg = new CustomNetworkMessage(method, json);

            try
            {
                var actives = Clients.FindAll(x => !x.isPassive);
                for (int i = 0, n = actives.Count; i < n; i++)
                {
                    NetworkServer.SendToClient(actives[i].connectionId, SimpleCustomMessageSendingId, msg);
                }
            }
            catch (Exception e)
            {
                DebugLog(e.ToString());
            }
        }
Ejemplo n.º 5
0
        public void SendMessageToPassive(string method, string json)
        {
            if (!_isServerRunning)
            {
                return;
            }

            var msg = new CustomNetworkMessage(method, json);

            try
            {
                var passives = _networkConnections.GetConnections(NetworkInstanceType.ListeningClient);
                for (int i = 0, n = passives.Count; i < n; i++)
                {
                    NetworkServer.SendToClient(passives[i].connectionId, SimpleCustomMessageSendingId, msg);
                }
            }
            catch (Exception e)
            {
                DebugLog(e.ToString());
            }
        }
Ejemplo n.º 6
0
        public void SendMessageToType(string method, string json, NetworkInstanceType type)
        {
            if (!_isServerRunning)
            {
                return;
            }

            var msg = new CustomNetworkMessage(method, json);

            try
            {
                var clients = _networkConnections.GetSessionConnections(type);
                for (int i = 0, n = clients.Count; i < n; i++)
                {
                    NetworkServer.SendToClient(clients[i].connectionId, SimpleCustomMessageSendingId, msg);
                }
            }
            catch (Exception e)
            {
                DebugLog(e.ToString());
            }
        }