示例#1
0
        public bool SendToAllUsers(ServerGame.Core.Connctions.PackSendData PackSendData, Interface.Connctions.ConnctionType ConnctionType, bool sendtoself, IUser userSender)
        {
            try
            {
                byte pramterhi = 0;
                foreach (var data in PackSendData.AllData)
                {
                    if (pramterhi < data.PramterName)
                    {
                        pramterhi = data.PramterName;
                    }
                }
                PackSendData.AllData.Add(new Data.Data(userSender.Name, ++pramterhi));


                if (ServerGame.Interface.Connctions.ConnctionType.UDP == ConnctionType)
                {
                    foreach (var user in this.UserInRoom)
                    {
                        if (user.ConnctionUDP.IPEndPointUDP != null)
                        {
                            if (userSender != user || sendtoself)
                            {
                                //  PackSendData.AllData.Find(x => x.PramterName == pramterhi).DataSChange(userSender.Name);
                                Connctions.Server.ServerOject.Sendudp(user.ConnctionUDP.workSocket, PackSendData, user.ConnctionUDP.IPEndPointUDP);
                            }
                        }
                    }
                }
                else if (ServerGame.Interface.Connctions.ConnctionType.TCP == ConnctionType)
                {
                    foreach (var user in this.UserInRoom)
                    {
                        if (!user.ConnctionTCP.workSocket.Poll(1000, System.Net.Sockets.SelectMode.SelectRead) || !(user.ConnctionTCP.workSocket.Available == 0))
                        {
                            if (userSender != user || sendtoself)
                            {
                                //  PackSendData.AllData.Find(x => x.PramterName == pramterhi).DataSChange(userSender.Name);

                                Connctions.Server.ServerOject.Send(user.ConnctionTCP.workSocket, PackSendData);
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }
        }
示例#2
0
 public bool SendToAllZone(ServerGame.Core.Connctions.PackSendData PackSendData)
 {
     throw new NotImplementedException();
 }
示例#3
0
 public bool SendToUser(ServerGame.Core.Connctions.PackSendData PackSendData, IUser User)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public bool SendToUsers(ServerGame.Core.Connctions.PackSendData PackSendData, List <IUser> ListUsers)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public static bool SendMessgeToAllUserInZoneBy(IZone IZone, ServerGame.Core.Connctions.PackSendData PackSendData)
 {
     throw new NotImplementedException();
 }