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


C# PacketReader.ReadUnicodeString方法代码示例

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


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

示例1: ChatAction

        public static void ChatAction( NetState state, PacketReader pvSrc )
        {
            if ( !m_Enabled )
                return;

            try
            {
                Mobile from = state.Mobile;
                ChatUser user = ChatUser.GetChatUser( from );

                if ( user == null )
                    return;

                /*string lang = */pvSrc.ReadStringSafe( 4 );
                int actionID = pvSrc.ReadInt16();
                string param = pvSrc.ReadUnicodeString();

                ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID );

                if ( handler != null )
                {
                    Channel channel = user.CurrentChannel;

                    if ( handler.RequireConference && channel == null )
                    {
                        user.SendMessage( 31 ); /* You must be in a conference to do this.
                                                 * To join a conference, select one from the Conference menu.
                                                 */
                    }
                    else if ( handler.RequireModerator && !user.IsModerator )
                    {
                        user.SendMessage( 29 ); // You must have operator status to do this.
                    }
                    else
                    {
                        handler.Callback( user, channel, param );
                    }
                }
                else
                {
                    log.Warn(String.Format("Client: {0}: Unknown chat action 0x{1:X}: {2}",
                                           state, actionID, param));
                }
            }
            catch ( Exception e )
            {
                log.Error( e );
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:49,代码来源:Chat.cs

示例2: ChatAction

		public static void ChatAction( NetState state, PacketReader pvSrc )
		{
			if ( !Enabled )
				return;

			try
			{
				Mobile from = state.Mobile;
				ChatUser user = ChatUser.GetChatUser( from );

				if ( user == null )
					return;

				string lang = pvSrc.ReadStringSafe( 4 );
				int actionId = pvSrc.ReadInt16();
				string param = pvSrc.ReadUnicodeString();

				ChatActionHandler handler = ChatActionHandlers.GetHandler( actionId );

				if ( handler != null )
				{
					Channel channel = user.CurrentChannel;

					if ( handler.RequireConference && channel == null )
					{
						/* You must be in a conference to do this.
						 * To join a conference, select one from the Conference menu.
						 */
						user.SendMessage( 31 );
					}
					else
					{
						handler.Callback( user, channel, param );
					}
				}
				else
				{
					Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param );
				}
			}
			catch ( Exception e )
			{
                Console.WriteLine(e.ToString());
			}
		}
开发者ID:zerodowned,项目名称:justuo-with-ec-support,代码行数:45,代码来源:ChatSystem.cs

示例3: ProfileReq

		public static void ProfileReq( NetState state, PacketReader pvSrc )
		{
			int type = pvSrc.ReadByte();
			Serial serial = pvSrc.ReadInt32();

			Mobile beholder = state.Mobile;
			Mobile beheld = World.FindMobile( serial );

			if ( beheld == null )
				return;

			switch ( type )
			{
				case 0x00: // display request
				{
					EventSink.InvokeProfileRequest( new ProfileRequestEventArgs( beholder, beheld ) );

					break;
				}
				case 0x01: // edit request
				{
					pvSrc.ReadInt16(); // Skip
					int length = pvSrc.ReadUInt16();

					if ( length > 511 )
						return;

					string text = pvSrc.ReadUnicodeString( length );

					EventSink.InvokeChangeProfileRequest( new ChangeProfileRequestEventArgs( beholder, beheld, text ) );

					break;
				}
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:35,代码来源:PacketHandlers.cs

示例4: DisplayWaipoint3D

        // UOSA
        public static void DisplayWaipoint3D(NetState state, PacketReader pvSrc)
        {
            int size = pvSrc.ReadInt16();
            int obj_serial = pvSrc.ReadInt32();

            int x = pvSrc.ReadInt16();
            int y = pvSrc.ReadInt16();
            int z = pvSrc.ReadSByte();
            int mapID = pvSrc.ReadByte();

            int obj_type = pvSrc.ReadInt16();
            int ignore_obj_type = pvSrc.ReadByte();

            int obj_cliloc = pvSrc.ReadInt32();
            string obj_cliloc_args = pvSrc.ReadUnicodeString();

            int unk1 = pvSrc.ReadInt16();

            //no complete
            if (ignore_obj_type == 1)
            {

            }
        }
开发者ID:greeduomacro,项目名称:liberdade-uo-server,代码行数:25,代码来源:PacketHandlers.cs

示例5: ChatAction

        public static void ChatAction(NetState state, PacketReader pvSrc)
        {
            /*if ( !m_Enabled )
                return;
             */

            if (state == null || state.Mobile == null || state.Account == null)
                return;

            try
            {

                /*
                ChatUser user = ChatUser.GetChatUser( from );

                if ( user == null )
                    return;
                 */

                string lang = pvSrc.ReadStringSafe(4);
                int actionID = pvSrc.ReadInt16();
                string param = pvSrc.ReadUnicodeString();

                /*
				ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID );

				if ( handler != null )
				{
					Channel channel = user.CurrentChannel;

					if ( handler.RequireConference && channel == null )
					{
						user.SendMessage( 31 ); // You must be in a conference to do this.
												// To join a conference, select one from the Conference menu.
					}
					else if ( handler.RequireModerator && !user.IsModerator )
					{
						user.SendMessage( 29 ); // You must have operator status to do this.
					}
					else
					{
						handler.Callback( user, channel, param );
					}
				}
				else
				{
					Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param );
				}*/

                // CUSTOM CODE for uoforever--Chat b/w mobs with the same teamflags
                
                
                Mobile from = state.Mobile;
                List<XmlTeam> fromTeams = XmlAttach.GetTeams(from);
                if (fromTeams != null)
                {
                    List<NetState> states = NetState.Instances;
                    foreach (NetState nextstate in states)
                    {
                        if (nextstate.Mobile == null) continue;
                        if (nextstate.Mobile.AccessLevel >= AccessLevel.GameMaster)
                        {
                            // just get the first team
                            nextstate.Mobile.SendMessage(101, "[" + fromTeams[0].TeamVal + "] " + from.Name + ": " + param);
                        }
                        else
                        {
                            if (nextstate.Mobile.CustomTeam)
                            {
                                List<XmlTeam> toTeams = XmlAttach.GetTeams(nextstate.Mobile);
                                if (XmlTeam.SameTeam(fromTeams, toTeams))
                                {
                                    nextstate.Mobile.SendMessage(101, from.Name + ": " + param);
                                }
                            }
                        }
                    }
                }
                else if (from.AccessLevel >= AccessLevel.Counselor 
                    || CreaturePossession.HasAnyPossessPermissions(from))
                {
                    List<NetState> states = NetState.Instances;
                    Mobile sourceMobile = from;
                    if (from is BaseCreature)
                    {
                        sourceMobile = state.Account.GetPseudoSeerLastCharacter();
                    }
                    if (sourceMobile != null)
                    {
                        foreach (NetState nextstate in states)
                        {
                            if (nextstate.Mobile == null) continue;
                            if (nextstate.Mobile.AccessLevel >= AccessLevel.Counselor
                                || CreaturePossession.HasAnyPossessPermissions(nextstate.Mobile))
                            {
                                // just get the first team
                                nextstate.Mobile.SendMessage(101, sourceMobile.Name + ": " + param);
                            }
                            else if (nextstate.Mobile is BaseCreature)
                            {
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:Chat.cs


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