当前位置: 首页>>代码示例>>C#>>正文


C# ServerMessage.GetBytes方法代码示例

本文整理汇总了C#中Phoenix.Messages.ServerMessage.GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.GetBytes方法的具体用法?C# ServerMessage.GetBytes怎么用?C# ServerMessage.GetBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phoenix.Messages.ServerMessage的用法示例。


在下文中一共展示了ServerMessage.GetBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BroadcastMessage

 internal void BroadcastMessage(ServerMessage Message)
 {
     byte[] bytes = Message.GetBytes();
     for (int i = 0; i < this.Session.Length; i++)
     {
         GameClient Session = this.Session[i];
         if (Session != null)
         {
             try
             {
                 Session.GetConnection().SendData(bytes);
             }
             catch { }
         }
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:16,代码来源:GameClientManager.cs

示例2: processCommand


//.........这里部分代码省略.........
                        adapter.ExecuteQuery(s);
                    }
                    break;

                case "alert":
                    string text6 = s.Split(new char[] { ' ' })[0];
					text5 = s.Substring(text6.Length + 1);
					ServerMessage Message8 = new ServerMessage(808);
					Message8.AppendStringWithBreak(TextManager.GetText("mus_alert_title"));
					Message8.AppendStringWithBreak(text5);
					PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(text6)).SendMessage(Message8);
                    break;

                case "sa":						
                    ServerMessage Message = new ServerMessage(134);
					Message.AppendUInt(0);
					Message.AppendString("PHX: " + s);
					PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessageToStaff(Message, Message);                        
                    break;

                case "ha":		
                    ServerMessage Message2 = new ServerMessage(808);
					Message2.AppendStringWithBreak(TextManager.GetText("mus_ha_title"));
					Message2.AppendStringWithBreak(s);
					ServerMessage hotelView = new ServerMessage(161);
					hotelView.AppendStringWithBreak(s);
					PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message2, hotelView);
                    break;

                case "hal":						
                    string text4 = s.Split(new char[] { ' ' })[0];
				    text5 = s.Substring(text4.Length + 1);
					ServerMessage Message4 = new ServerMessage(161u);
					Message4.AppendStringWithBreak(string.Concat(new string[]
					{
						TextManager.GetText("mus_hal_title"),
						"\r\n",
						text5,
						"\r\n-",
						TextManager.GetText("mus_hal_tail")
					}));
					Message4.AppendStringWithBreak(text4);
					PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message4);
                    break;

                case "updatemotto":
                case "updatelook":			
                uint_2 = uint.Parse(s);
				clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint_2);
				using (DatabaseClient class2 = PhoenixEnvironment.GetDatabase().GetClient())
				{
					Row = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1");
				}
                clientByUserID.GetHabbo().Look = (string)Row["look"];
                clientByUserID.GetHabbo().Gender = Row["gender"].ToString().ToLower();
                clientByUserID.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars((string)Row["motto"]);
                clientByUserID.GetHabbo().BlockNewFriends = PhoenixEnvironment.EnumToBool(Row["block_newfriends"].ToString());
				ServerMessage Message5 = new ServerMessage(266);
				Message5.AppendInt32(-1);
				Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Look);
				Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower());
				Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Motto);
				clientByUserID.SendMessage(Message5);
				if (clientByUserID.GetHabbo().InRoom)
				{
					room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId);
					RoomUser class6 = room.GetRoomUserByHabbo(clientByUserID.GetHabbo().Id);
					ServerMessage Message6 = new ServerMessage(266u);
					Message6.AppendInt32(class6.VirtualId);
					Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Look);
					Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower());
					Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Motto);
					Message6.AppendInt32(clientByUserID.GetHabbo().AchievementScore);
					Message6.AppendStringWithBreak("");
					room.SendMessage(Message6, null);
				}
				text3 = str.ToLower();
                //if (text3 == null)
                //{
                //    ServerMessage message = new ServerMessage(1);
                //    message.AppendString("Hello Housekeeping, Love from Phoenix Emu");
                //    socket.Send(message.GetBytes());
                //}
				if (text3 == "updatemotto")
				{
					PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 5u, 1);
				}
				if (text3 == "updatelook")
				{
					PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 1u, 1);
				}
                break;

                default:                    
                    ServerMessage message11 = new ServerMessage(1);
                    message11.AppendString("Hello Housekeeping, Love from Phoenix Emu");
                    socket.Send(message11.GetBytes());
                break;
            }
		}
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:101,代码来源:MusConnection.cs

示例3: TestClientConnections

 private void TestClientConnections()
 {
     int millisecondsTimeout = int.Parse(PhoenixEnvironment.GetConfig().data["client.ping.interval"]);
     if (millisecondsTimeout <= 100)
     {
         throw new ArgumentException("Invalid configuration value for ping interval! Must be above 100 miliseconds.");
     }
     while (true)
     {
         try
         {
             ServerMessage Message = new ServerMessage(50);
             List<GameClient> SuccessTest = new List<GameClient>();
             List<GameClient> FailTest = new List<GameClient>();
             for (int i = 0; i < this.Session.Length; i++)
             {
                 GameClient Session = this.Session[i];
                 if (Session != null)
                 {
                     if (Session.PongOK)
                     {
                         Session.PongOK = false;
                         FailTest.Add(Session);
                     }
                     else
                     {
                         SuccessTest.Add(Session);
                     }
                 }
             }
             foreach (GameClient Session in SuccessTest)
             {
                 try
                 {
                     Session.Disconnect();
                 }
                 catch { }
             }
             byte[] bytes = Message.GetBytes();
             foreach (GameClient Session in FailTest)
             {
                 try
                 {
                     Session.GetConnection().SendData(bytes);
                 }
                 catch { }
             }
         }
         catch (Exception ex)
         {
             Logging.LogThreadException(ex.ToString(), "Connection checker task");
         }
         Thread.Sleep(millisecondsTimeout);
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:55,代码来源:GameClientManager.cs

示例4: SendStaffChat

 internal void SendStaffChat(GameClient Session, ServerMessage Message)
 {
     byte[] bytes = Message.GetBytes();
     for (int i = 0; i < this.Session.Length; i++)
     {
         GameClient session = this.Session[i];
         if (session != null && session != Session)
         {
             try
             {
                 if (session.GetHabbo().HasRole("receive_sa"))
                 {
                     session.GetConnection().SendData(bytes);
                 }
             }
             catch { }
         }
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:19,代码来源:GameClientManager.cs

示例5: method_61

 public void method_61(ServerMessage Message5_0)
 {
     try
     {
         byte[] array = Message5_0.GetBytes();
         for (int i = 0; i < this.UserList.Length; i++)
         {
             RoomUser @class = this.UserList[i];
             if (@class != null && [email protected])
             {
                 GameClient class2 = @class.GetClient();
                 if (class2 != null && this.CheckRights(class2))
                 {
                     try
                     {
                         class2.GetConnection().SendData(array);
                     }
                     catch
                     {
                     }
                 }
             }
         }
     }
     catch (InvalidOperationException)
     {
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:28,代码来源:Room.cs

示例6: method_60

 internal void method_60(ServerMessage Message5_0, int int_17)
 {
     try
     {
         byte[] array = Message5_0.GetBytes();
         for (int i = 0; i < this.UserList.Length; i++)
         {
             RoomUser @class = this.UserList[i];
             if (@class != null && [email protected])
             {
                 GameClient class2 = @class.GetClient();
                 if (class2 != null && class2.GetHabbo() != null && (ulong)class2.GetHabbo().Rank >= (ulong)((long)int_17))
                 {
                     try
                     {
                         class2.GetConnection().SendData(array);
                     }
                     catch
                     {
                     }
                 }
             }
         }
     }
     catch (InvalidOperationException)
     {
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:28,代码来源:Room.cs

示例7: SendMessage

 internal void SendMessage(ServerMessage Message5_0, List<uint> list_18)
 {
     try
     {
         if (this.UserList != null)
         {
             byte[] array = Message5_0.GetBytes();
             for (int i = 0; i < this.UserList.Length; i++)
             {
                 RoomUser @class = this.UserList[i];
                 if (@class != null && [email protected])
                 {
                     GameClient class2 = @class.GetClient();
                     if (class2 != null && (list_18 == null || !list_18.Contains(class2.GetHabbo().Id)))
                     {
                         try
                         {
                             class2.GetConnection().SendData(array);
                         }
                         catch
                         {
                         }
                     }
                 }
             }
         }
     }
     catch (InvalidOperationException)
     {
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:31,代码来源:Room.cs

示例8: SendMessage

 public void SendMessage(ServerMessage Message)
 {
     if (Message != null)
     {
         this.SendData(Message.GetBytes());
     }
 }
开发者ID:neto737,项目名称:Phoenix_3.0,代码行数:7,代码来源:TcpConnection.cs


注:本文中的Phoenix.Messages.ServerMessage.GetBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。