Пример #1
0
        public static TAClient createClient(TAServer server, TcpClient clientConnection)
        {
            TAClient c = new TAClient(server, clientConnection);

            WebsocketUtility.websocketHandshake(clientConnection);
            new Thread(c.clientListenCycle).Start();
            return(c);
        }
Пример #2
0
 public void sendAllBut(string data, TAClient exclude)
 {
     //var filtered = clients.ToArray();
     //var filList = filtered.ToList();
     //filList.Remove(exclude);
     //sendMessage(data, filList.ToArray());
     //The below should be able to replace the above, but im not sure yet
     sendIf(data, delegate(TAClient client){ return(client != exclude); });
 }
Пример #3
0
        public void receiveMessage(Byte[] data, TAClient sender)
        {
            TAServerLog.log("RX msg from client: " + sender.clientName + ", ID: " + sender.clientID + " at " + DateTime.Now, LogType.CLIENT_MESSAGE_RX);
            Byte[] decodedMsg    = WebsocketUtility.decodeWebsocketMessage(data);
            string messageString = Encoding.UTF8.GetString(decodedMsg);

            sender.parseMessage(messageString);
            //do whatever with the message string from here
        }
Пример #4
0
        public void addClient(TcpClient c)
        {
            var newClient = TAClient.createClient(this, c);

            clients.Add(newClient);
            TAServerLog.log("Added new client: " + newClient.clientName + ", ID: " + newClient.clientID + " at " + DateTime.Now, LogType.CLIENT_MESSAGE_RX);
            sendSelectiveStory("Welcome to the server!", newClient.clientName + " has joined the server!", newClient);
            newClient.locationUpdate();
            sendProgressBarEntry("Loading Character!", 100, newClient);
        }
 //A special client gets story1, everyone else gets story2
 public void sendSelectiveStory(string story1, string story2, TAClient story1rcv)
 {
     sendStoryAllBut(story2, story1rcv);
     sendStoryMessage(story1, story1rcv);
 }
 public void sendStoryAllBut(string storyMsg, TAClient exclude)
 {
     sendAllBut(makeStoryString(storyMsg), exclude);
 }
 public void sendStoryMessage(string storyMsg, TAClient target)
 {
     sendMessage(makeStoryString(storyMsg), target);
 }