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


C# NetState.GetComponent方法代码示例

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


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

示例1: Realm_HandleRegisterRealmResult

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void Realm_HandleRegisterRealmResult( NetState netState, PacketReader packetReader )
        {
            RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealmResult(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == true )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealmResult(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            uint iRealmSerial = packetReader.ReadUInt32();

            extendData.RegisterRealmResult.Serial = new Serial( iRealmSerial );

            // 已经登陆
            extendData.IsLoggedIn = true;

            // 3分钟 向服务端发一次心跳信号
            TimeSlice.StartTimeSlice( TimerPriority.Lowest, TimeSpan.FromMinutes( 3 ), TimeSpan.FromMinutes( 3 ), new TimeSliceCallback( SendPing ) );

            LOGs.WriteLine( LogMessageType.MSG_INFO, "RealmServer:登陆RealmServer服务器成功 返回的标示ID({0})", extendData.RegisterRealmResult.Serial.ToString() );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:32,代码来源:HandleRegisterRealmResult.cs

示例2: ZoneCluster_HandlerLoginZoneCluster

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void ZoneCluster_HandlerLoginZoneCluster( NetState netState, PacketReader packetReader )
        {
            ZoneCluster_ListenerExtendData extendData = netState.GetComponent<ZoneCluster_ListenerExtendData>( ZoneCluster_ListenerExtendData.COMPONENT_ID );
            if ( extendData == null )
                throw new Exception( "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData == null error!" );

            if ( extendData.IsLoggedIn == true )
            {
                LOGs.WriteLine( LogMessageType.MSG_ERROR, "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            string strZoneClusterPassword = packetReader.ReadUTF8String();
            string strZoneOrDomainPassword = packetReader.ReadUTF8String();

            if ( extendData.ConfigZoneCluster.ZoneClusterPassword == strZoneClusterPassword )
            {
                extendData.IsLoggedIn = true;

                // 检查是 Domain 服务端登陆 还是 Zone客户端登陆
                if ( extendData.ConfigZoneCluster.DomainPassword == strZoneOrDomainPassword )
                    extendData.IsDomainServer = true;
                else
                    extendData.IsZoneServer = true;

                extendData.ServerPassword = strZoneOrDomainPassword;
            }

            netState.Send( new ZoneCluster_LoginZoneClusterResult( extendData.IsLoggedIn ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:35,代码来源:HandlerLoginZoneCluster.cs

示例3: World_HandleRealmSplitStateRequest

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void World_HandleRealmSplitStateRequest( NetState netState, PacketReader packetReader )
        {
            LOGs.WriteLine( LogMessageType.MSG_HACK, "World_HandleRealmSplitStateRequest...... {0} ", packetReader.Size );

            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            if ( packetReader.Size < 10 /*ProcessNet.WORLD_HEAD_SIZE + 0*/)
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData.Size < 10 error!" );
                return;
            }

            uint iUnknown = packetReader.ReadUInt32();

            netState.Send( new Word_RealmSplitStateRequest( iUnknown ) );
            //netState.Send( new Word_CharEnumResponse( new WowCharacterInfo[0] ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:33,代码来源:HandleRealmSplitStateRequest.cs

示例4: Realm_HandleRequestSession

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Realm_HandleRequestSession( NetState netState, PacketReader packetReader )
        {
            RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            uint iSerial = packetReader.ReadUInt32();
            string strAccountName = packetReader.ReadUTF8StringSafe();

            WowAccount wowAccount = WowAccountHandler.GetAccount( strAccountName );
            if ( wowAccount == null )
            {
                netState.Send( new Realm_RequestSessionResultError( iSerial ) );
                return;
            }

            SecureRemotePassword srp = SrpHandler.GetSRP( strAccountName );
            if ( srp == null )
            {
                netState.Send( new Realm_RequestSessionResultError( iSerial ) );
                return;
            }

            netState.Send( new Realm_RequestSessionResult( iSerial, wowAccount, srp ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:39,代码来源:HandleRequestSession.cs

示例5: Auth_HandleAuthProof

        /// <summary>
        /// 登陆验证
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Auth_HandleAuthProof( NetState netState, PacketReader packetReader )
        {
            AuthExtendData extendData = netState.GetComponent<AuthExtendData>( AuthExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            extendData.AuthProof.AuthLogonProof = AuthLogonProof.ReadAuthLogonProof( packetReader );

            extendData.SRP.PublicEphemeralValueA = extendData.AuthProof.AuthLogonProof.PublicEphemeralValueA;

            if ( extendData.SRP.IsClientProofValid( extendData.AuthProof.AuthLogonProof.ClientProof ) == false )
            {
                // Authentication failed.
                //netState.Send( new RealmList_AuthProofResultError( RealmListErrorsInfo.LOGIN_NO_ACCOUNT ) );
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_NO_ACCOUNT ) );
                return;
            }

            // 添加到全局的Key中
            SrpHandler.AddSRP( extendData.WowAccount.AccountName, extendData.SRP );

            // we're authenticated now :)
            extendData.IsAuthenticated = true;

            netState.Send( new Auth_AuthProofResult( extendData.SRP ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:40,代码来源:HandleAuthProof.cs

示例6: Auth_HandleAuthChallenge

        /// <summary>
        /// 登陆握手
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Auth_HandleAuthChallenge( NetState netState, PacketReader packetReader )
        {

            AuthExtendData extendData = netState.GetComponent<AuthExtendData>( AuthExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_HandleAuthChallenge(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == true )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_HandleAuthChallenge(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            extendData.AuthChallenge.AuthLogonChallenge = AuthLogonChallenge.ReadAuthLogonChallenge( packetReader );

            // 版本验证
            if ( extendData.AuthChallenge.AuthLogonChallenge.Build > (ushort)CLIENT_VERSIONS.CLIENT_MAX || extendData.AuthChallenge.AuthLogonChallenge.Build < (ushort)CLIENT_VERSIONS.CLIENT_MIN )
            {
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_WRONG_BUILD_NUMBER ) );
                return;
            }

            // 帐号是否存在
            WowAccount wowAccount = WowAccountHandler.GetAccount( extendData.AuthChallenge.AuthLogonChallenge.AccountName );
            if ( wowAccount == null )
            {
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_NO_ACCOUNT ) );
                return;
            }
            extendData.WowAccount = wowAccount;

            // 帐号是否停用
            if ( wowAccount.Banned )
            {
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_ACCOUNT_CLOSED ) );
                return;
            }

            // 帐号是否在线
            if ( wowAccount.Locked )
            {
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_ACCOUNT_FREEZED ) );
                return;
            }

            // 成功 更新IP
            WowAccountHandler.UpdateAccountLastIP( wowAccount.AccountName, netState.NetAddress.Address.ToString() );

            // 登陆成功
            extendData.IsLoggedIn = true;

            // 获取SRP的Key
            extendData.SRP = new SecureRemotePassword( true, wowAccount.AccountName, wowAccount.Password );

            netState.Send( new Auth_AuthChallengeResult( extendData.SRP ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:64,代码来源:HandleAuthChallenge.cs

示例7: Realm_HandlePong

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void Realm_HandlePong( NetState netState, PacketReader packetReader )
        {
            RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandlePong(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandlePong(...) - extendData.IsLoggedIn == false error!" );
                return;
            }
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:20,代码来源:HandlePong.cs

示例8: World_HandleCancelTrade

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void World_HandleCancelTrade( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleCancelTrade(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleCancelTrade(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            netState.Send( new Word_TradeStatus( TRADE_STATUS.TRADE_STATUS_CANCELLED ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:22,代码来源:HandleCancelTrade.cs

示例9: World_HandleEnableMicrophone

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void World_HandleEnableMicrophone( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleEnableMicrophone(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleEnableMicrophone(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            bool bVoiceEnabled = packetReader.ReadBoolean();
            bool bMicEnabled = packetReader.ReadBoolean();
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:23,代码来源:HandleEnableMicrophone.cs

示例10: Realm_HandleRegisterRealm

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Realm_HandleRegisterRealm( NetState netState, PacketReader packetReader )
        {
            RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == true )
            {
                Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            Realm realm = new Realm();

            realm.Name = packetReader.ReadUTF8String();
            realm.Address = packetReader.ReadUTF8String();

            string strIcon = packetReader.ReadUTF8String();
            if ( Insensitive.Equals( strIcon, "PVP" ) )
                realm.Icon = (uint)RealmIconType.REALMTYPE_PVP;
            else if ( Insensitive.Equals( strIcon, "RP" ) )
                realm.Icon = (uint)RealmIconType.REALMTYPE_RP;
            else if ( Insensitive.Equals( strIcon, "RPPVP" ) )
                realm.Icon = (uint)RealmIconType.REALMTYPE_RPPVP;
            else
                realm.Icon = (uint)RealmIconType.REALMTYPE_NORMAL;

            realm.Colour = packetReader.ReadUInt32();
            realm.TimeZone = packetReader.ReadUInt32();
            realm.Population = packetReader.ReadFloat();

            extendData.RequestSession.Serial = RealmHandler.RealmsExclusiveSerial.GetExclusiveSerial();

            // Add to the main realm list
            RealmHandler.AddRealm( extendData.RequestSession.Serial, realm );

            extendData.IsLoggedIn = true;

            // Send back response packet.
            netState.Send( new Realm_RegisterRealmResult( extendData.RequestSession.Serial ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:49,代码来源:HandleRegisterRealm.cs

示例11: World_HandleChannelNumMembersQuery

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void World_HandleChannelNumMembersQuery( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleChannelNumMembersQuery(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleChannelNumMembersQuery(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            string strChannelName = packetReader.ReadUTF8String();

            netState.Send( new Word_ChannelNumMembersQueryResponse( strChannelName, 0, 0 ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:24,代码来源:HandleHandleChannelNumMembersQuery.cs

示例12: Zone_HandlerLoginZoneClusterResult

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void Zone_HandlerLoginZoneClusterResult( NetState netState, PacketReader packetReader )
        {
            Zone_ConnecterExtendData extendData = netState.GetComponent<Zone_ConnecterExtendData>( Zone_ConnecterExtendData.COMPONENT_ID );
            if ( extendData == null )
                throw new Exception( "Zone_PacketHandlers.Zone_HandlerLoginZoneClusterResult(...) - extendData == null error!" );

            if ( extendData.IsLoggedIn == true )
            {
                LOGs.WriteLine( LogMessageType.MSG_ERROR, "Zone_PacketHandlers.Zone_HandlerLoginZoneClusterResult(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            LoginZoneClusterResult loginZoneClusterResult = LoginZoneClusterResult.GetLoginZoneClusterResult( packetReader );
            if ( loginZoneClusterResult.IsCheckPass )
            {
                LOGs.WriteLine( LogMessageType.MSG_INFO, "ZoneWorld:登陆ZoneCluster服务器 成功!" );

                extendData.IsLoggedIn = true;
            }
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:25,代码来源:HandlerLoginZoneClusterResult.cs

示例13: World_HandlePing

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void World_HandlePing( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandlePing(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandlePing(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            uint iPing = packetReader.ReadUInt32();
            extendData.Ping.Latency = packetReader.ReadUInt32();

            netState.Send( new Word_Pong( iPing ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:25,代码来源:HandlePing.cs

示例14: World_HandlePlayerLogin

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void World_HandlePlayerLogin( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleCharDelete(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "World_PacketHandlers.World_HandleCharDelete(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            ulong iGuid = packetReader.ReadULong64();

            CharLoginSQL charLoginSQL = new CharLoginSQL( extendData, netState, (long)iGuid );
            WaitExecuteInfo<CharLoginSQL> waitExecuteInfo = new WaitExecuteInfo<CharLoginSQL>( charLoginSQL, WorldPacketHandlers.SQL_HandleCharLogin );

            ProcessServer.WowZoneCluster.World.WaitExecute.JoinWaitExecuteQueue( waitExecuteInfo );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:27,代码来源:HandlePlayerLogin.cs

示例15: World_HandleAuthSession

        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void World_HandleAuthSession( NetState netState, PacketReader packetReader )
        {
            WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "World_PacketHandlers.World_AuthSession(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == true )
            {
                Debug.WriteLine( "World_PacketHandlers.World_AuthSession(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            extendData.AuthSession = AuthSession.ReadWorldAuthSession( packetReader );

            Serial serial = PendingLogins.ExclusiveSerial.GetExclusiveSerial();
            PendingLogins.AddAuthenticate( serial, netState ); // 等待登陆

            // 通知 Realm Server 有新的客户端需要验证
            ProcessServer.RealmNetState.Send( new Realm_RequestSession( serial, extendData.AuthSession.AccountName ) );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:28,代码来源:HandleAuthSession.cs


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