Inheritance: NFILogicModule
Ejemplo n.º 1
0
        public override void AfterInit()
        {
            mxEventProcessModule = GetMng().GetModule <NFCEventModule>();
            mxKernelModule       = GetMng().GetModule <NFIKernelModule>();
            mxLogicClassModule   = GetMng().GetModule <NFILogicClassModule>();
            mxElementInfoModule  = GetMng().GetModule <NFIElementModule>();

            System.Diagnostics.Debug.Assert(null != mxEventProcessModule);
            System.Diagnostics.Debug.Assert(null != mxKernelModule);
            System.Diagnostics.Debug.Assert(null != mxLogicClassModule);
            System.Diagnostics.Debug.Assert(null != mxElementInfoModule);

            NFILogicClass xLogicClass = mxLogicClassModule.GetElement("Server");

            if (xLogicClass != null)
            {
                List <string> xNameList = xLogicClass.GetConfigNameList();

                foreach (string strConfigName in xNameList)
                {
                    long nServerID   = mxElementInfoModule.QueryPropertyInt(strConfigName, "ServerID");
                    long nServerType = mxElementInfoModule.QueryPropertyInt(strConfigName, "Type");
                    if (nServerType == (long)NFServer_def.NF_SERVER_TYPES.NF_ST_GAME)
                    {
                        Int64  nPort       = mxElementInfoModule.QueryPropertyInt(strConfigName, "Port");
                        Int64  nMaxConnect = mxElementInfoModule.QueryPropertyInt(strConfigName, "MaxOnline");
                        Int64  nCpus       = mxElementInfoModule.QueryPropertyInt(strConfigName, "CpuCount");
                        Int64  nAreaID     = mxElementInfoModule.QueryPropertyInt(strConfigName, "AreaID");
                        string strName     = mxElementInfoModule.QueryPropertyString(strConfigName, "Name");
                        string strIP       = mxElementInfoModule.QueryPropertyString(strConfigName, "IP");

                        ConnectObjectData xConnectObjectData = new ConnectObjectData();

                        xConnectObjectData.fMaxReconnectTime = 10.0f;//重连时间
                        //xConnectObjectData.xNextTriggerTime = new DateTime();//下次重连时间

                        xConnectObjectData.nServerID    = nServerID;
                        xConnectObjectData.meServerType = (NFServer_def.NF_SERVER_TYPES)nServerType;
                        xConnectObjectData.mstrIP       = strIP;
                        xConnectObjectData.mstrDns      = strIP;
                        xConnectObjectData.mstrAuth     = "";

                        xConnectObjectData.mnPort   = nPort;
                        xConnectObjectData.mnAreaID = nAreaID;
                        //public NFNetModule xNetModule;
                        xConnectObjectData.eState = NFClusterClientModule.ClusterClientState.ADDING;

                        //GetNetHandler().RegisterEventCallback(OnSocketEvent);
                        //GetNetHandler().RegisterPackCallback(-1, OnRecivePack);

                        AddNetInfo(xConnectObjectData);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void AfterInit()
        {
            mxEventProcessModule = GetMng().GetModule<NFCEventModule>();
            mxKernelModule = GetMng().GetModule<NFIKernelModule>();
            mxLogicClassModule = GetMng().GetModule<NFILogicClassModule>();
            mxElementInfoModule = GetMng().GetModule<NFIElementModule>();

            System.Diagnostics.Debug.Assert(null != mxEventProcessModule);
            System.Diagnostics.Debug.Assert(null != mxKernelModule);
            System.Diagnostics.Debug.Assert(null != mxLogicClassModule);
            System.Diagnostics.Debug.Assert(null != mxElementInfoModule);

            NFILogicClass xLogicClass = mxLogicClassModule.GetElement("Server");
            if (xLogicClass != null)
            {
                List<string> xNameList = xLogicClass.GetConfigNameList();

                foreach (string strConfigName in xNameList)
                {
                    long nServerID = mxElementInfoModule.QueryPropertyInt(strConfigName, "ServerID");
                    long nServerType = mxElementInfoModule.QueryPropertyInt(strConfigName, "Type");
                    if (nServerType == (long)NFServer_def.NF_SERVER_TYPES.NF_ST_WORLD)
                    {
                        Int64 nPort = mxElementInfoModule.QueryPropertyInt(strConfigName, "Port");
                        Int64 nMaxConnect = mxElementInfoModule.QueryPropertyInt(strConfigName, "MaxOnline");
                        Int64 nCpus = mxElementInfoModule.QueryPropertyInt(strConfigName, "CpuCount");
                        Int64 nAreaID = mxElementInfoModule.QueryPropertyInt(strConfigName, "AreaID");
                        string strName = mxElementInfoModule.QueryPropertyString(strConfigName, "Name");
                        string strIP = mxElementInfoModule.QueryPropertyString(strConfigName, "IP");

                        ConnectObjectData xConnectObjectData = new ConnectObjectData();

                        xConnectObjectData.fMaxReconnectTime = 10.0f;//重连时间
                        //xConnectObjectData.xNextTriggerTime = new DateTime();//下次重连时间

                        xConnectObjectData.nServerID = nServerID;
                        xConnectObjectData.meServerType = (NFServer_def.NF_SERVER_TYPES)nServerType;
                        xConnectObjectData.mstrIP = strIP;
                        xConnectObjectData.mstrDns = strIP;
                        xConnectObjectData.mstrAuth = "";

                        xConnectObjectData.mnPort = nPort;
                        xConnectObjectData.mnAreaID = nAreaID;
                        //public NFNetModule xNetModule;
                        xConnectObjectData.eState = NFClusterClientModule.ClusterClientState.ADDING;

                        //GetNetHandler().RegisterEventCallback(OnSocketEvent);
                        //GetNetHandler().RegisterPackCallback(-1, OnRecivePack);

                        AddNetInfo(xConnectObjectData);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public override void AfterInit()
        {
            mxEventProcessModule = GetMng().GetModule <NFCEventModule>();
            mxKernelModule       = GetMng().GetModule <NFIKernelModule>();
            mxLogicClassModule   = GetMng().GetModule <NFILogicClassModule>();
            mxProxyToWorldModule = GetMng().GetModule <NFIProxyToWorldModule>();
            mxProxyToGameModule  = GetMng().GetModule <NFIProxyToGameModule>();
            mxElementInfoModule  = GetMng().GetModule <NFIElementModule>();

            System.Diagnostics.Debug.Assert(null != mxEventProcessModule);
            System.Diagnostics.Debug.Assert(null != mxKernelModule);
            System.Diagnostics.Debug.Assert(null != mxLogicClassModule);
            System.Diagnostics.Debug.Assert(null != mxProxyToWorldModule);
            System.Diagnostics.Debug.Assert(null != mxProxyToGameModule);
            System.Diagnostics.Debug.Assert(null != mxElementInfoModule);


            NFILogicClass xLogicClass = mxLogicClassModule.GetElement("Server");

            if (xLogicClass != null)
            {
                List <string> xNameList = xLogicClass.GetConfigNameList();

                foreach (string strConfigName in xNameList)
                {
                    Int64 nServerType = mxElementInfoModule.QueryPropertyInt(strConfigName, "Type");
                    Int64 nServerID   = mxElementInfoModule.QueryPropertyInt(strConfigName, "ServerID");
                    if (nServerType == (long)NFServer_def.NF_SERVER_TYPES.NF_ST_PROXY && GetMng().GetAPPID() == nServerID)
                    {
                        long   nPort       = mxElementInfoModule.QueryPropertyInt(strConfigName, "Port");
                        long   nMaxConnect = mxElementInfoModule.QueryPropertyInt(strConfigName, "MaxOnline");
                        long   nCpus       = mxElementInfoModule.QueryPropertyInt(strConfigName, "CpuCount");
                        string strName     = mxElementInfoModule.QueryPropertyString(strConfigName, "Name");
                        string strIP       = mxElementInfoModule.QueryPropertyString(strConfigName, "IP");

                        //GetNetHandler().RegisterEventCallback(OnSocketEvent);
                        //GetNetHandler().RegisterPackCallback(-1, OnRecivePack);

                        Initialization((UInt32)nMaxConnect, (UInt16)nPort);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public override void AfterInit()
        {
            mxEventProcessModule = GetMng().GetModule<NFCEventModule>();
            mxKernelModule = GetMng().GetModule<NFIKernelModule>();
            mxLogicClassModule = GetMng().GetModule<NFILogicClassModule>();
            mxProxyToWorldModule = GetMng().GetModule<NFIProxyToWorldModule>();
            mxProxyToGameModule = GetMng().GetModule<NFIProxyToGameModule>();
            mxElementInfoModule = GetMng().GetModule<NFIElementModule>();

            System.Diagnostics.Debug.Assert(null != mxEventProcessModule);
            System.Diagnostics.Debug.Assert(null != mxKernelModule);
            System.Diagnostics.Debug.Assert(null != mxLogicClassModule);
            System.Diagnostics.Debug.Assert(null != mxProxyToWorldModule);
            System.Diagnostics.Debug.Assert(null != mxProxyToGameModule);
            System.Diagnostics.Debug.Assert(null != mxElementInfoModule);

            NFILogicClass xLogicClass = mxLogicClassModule.GetElement("Server");
            if (xLogicClass != null)
            {
                List<string> xNameList = xLogicClass.GetConfigNameList();

                foreach(string strConfigName in xNameList)
                {
                    Int64 nServerType = mxElementInfoModule.QueryPropertyInt(strConfigName, "Type");
                    Int64 nServerID = mxElementInfoModule.QueryPropertyInt(strConfigName, "ServerID");
                    if (nServerType == (long)NFServer_def.NF_SERVER_TYPES.NF_ST_PROXY && GetMng().GetAPPID() == nServerID)
                    {
                        long nPort = mxElementInfoModule.QueryPropertyInt(strConfigName, "Port");
                        long nMaxConnect = mxElementInfoModule.QueryPropertyInt(strConfigName, "MaxOnline");
                        long nCpus = mxElementInfoModule.QueryPropertyInt(strConfigName, "CpuCount");
                        string strName = mxElementInfoModule.QueryPropertyString(strConfigName, "Name");
                        string strIP = mxElementInfoModule.QueryPropertyString(strConfigName, "IP");

                        //GetNetHandler().RegisterEventCallback(OnSocketEvent);
                        //GetNetHandler().RegisterPackCallback(-1, OnRecivePack);

                        Initialization((UInt32)nMaxConnect, (UInt16)nPort);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public override void Init()
 {
     mxLogicModule = null;
 }