Ejemplo n.º 1
0
 public override void AfterInit()
 {
     mHelpModule   = mPluginManager.FindModule <NFHelpModule>();
     mKernelModule = mPluginManager.FindModule <NFIKernelModule>();
     mLogModule    = mPluginManager.FindModule <NFLogModule>();
     mLoginModule  = mPluginManager.FindModule <NFLoginModule>();
 }
Ejemplo n.º 2
0
 public override void Awake()
 {
     mNetModule    = mPluginManager.FindModule <NFNetModule>();
     mUIModule     = mPluginManager.FindModule <NFUIModule>();
     mEventModule  = mPluginManager.FindModule <NFIEventModule>();
     mKernelModule = mPluginManager.FindModule <NFIKernelModule>();
 }
Ejemplo n.º 3
0
 public override void Awake()
 {
     mKernelModule  = mPluginManager.FindModule <NFIKernelModule>();
     mLoginModule   = mPluginManager.FindModule <NFLoginModule>();
     mNetModule     = mPluginManager.FindModule <NFNetModule>();
     mElementModule = mPluginManager.FindModule <NFIElementModule>();
     mClassModule   = mPluginManager.FindModule <NFIClassModule>();
 }
Ejemplo n.º 4
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.º 5
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.º 6
0
        // Use this for initialization
        public override void Awake()
        {
            mClassModule  = mPluginManager.FindModule <NFIClassModule>();
            mKernelModule = mPluginManager.FindModule <NFIKernelModule>();

            mSceneModule    = mPluginManager.FindModule <NFSceneModule>();
            mNetModule      = mPluginManager.FindModule <NFNetModule>();
            mHelpModule     = mPluginManager.FindModule <NFHelpModule>();
            mNetEventModule = mPluginManager.FindModule <NFNetEventModule>();
            mUIModule       = mPluginManager.FindModule <NFUIModule>();
        }
Ejemplo n.º 7
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.º 8
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.º 9
0
    public void OnGUI(NFIKernelModule kernel, int nHeight, int nWidth)
	{
		if (buttonLeft == null)
		{
	
	        buttonLeft = GUI.skin.button;
	
	        buttonLeft.alignment = TextAnchor.MiddleLeft;
	
	    }

		
		int nElementWidth = 150;
		int nElementHeight = 20;

        GUI.color = Color.red;
        strInfo = GUI.TextField(new Rect(0, nHeight - 20, nElementWidth * 3f + 120, 20), strInfo);
        strCommand = GUI.TextField(new Rect(nElementWidth * 3f + 120, nHeight - 20, 350, 20), strCommand);
        if (GUI.Button(new Rect(nWidth - 100, nHeight - 20, 100, 20),  "cmd"))
        {

        }
        GUI.color = Color.white;


        NFIDataList objectList = kernel.GetObjectList();

        scrollPositionFirst = GUI.BeginScrollView(new Rect(0, nElementHeight, nElementWidth / 2 + 20, nHeight), scrollPositionFirst, new Rect(0, 0, nElementWidth, objectList.Count() * (nElementHeight)));


		//all object
		for (int i = 0; i < objectList.Count(); i++)
		{
			NFGUID ident = objectList.ObjectVal(i);

            if (GUI.Button(new Rect(0, i * nElementHeight, nElementWidth, nElementHeight), ident.nHead64.ToString()  + "_" + ident.nData64.ToString()))
			{
                xTargetIdent = ident;
				strTableName = "";
			}
			
		}
		
		GUI.EndScrollView();
			
		////////////////
		if(!xTargetIdent.IsNull())
		{
			NFIObject go = kernel.GetObject(xTargetIdent);
			
			
			NFIDataList recordLlist = go.GetRecordManager().GetRecordList();
			NFIDataList propertyList = go.GetPropertyManager().GetPropertyList();
			
			int nAllElement = 1;
			for(int j = 0; j < recordLlist.Count(); j++)
			{
				string strRecordName = recordLlist.StringVal(j);
				if(strRecordName.Length > 0)
				{
					nAllElement++;
				}
			}
			for(int j = 0; j < propertyList.Count(); j++)
			{
				string strPropertyName = propertyList.StringVal(j);
				if(strPropertyName.Length > 0)
				{
					nAllElement++;
				}
			}
			//////////////////
            scrollPositionSecond = GUI.BeginScrollView(new Rect(nElementWidth / 2 + 20, nElementHeight, nElementWidth+20, nHeight/2), scrollPositionSecond, new Rect(0, 0, nElementWidth, (nAllElement+1) * (nElementHeight) + 1));

			int nElementIndex = 0;
			GUI.Button(new Rect(0, nElementIndex*nElementHeight, nElementWidth, nElementHeight), xTargetIdent.nData64.ToString());
			nElementIndex++;
			//all record
			for(int j = 0; j < recordLlist.Count(); j++)
			{
				string strRecordName = recordLlist.StringVal(j);
				if(strRecordName.Length > 0)
				{
					if(GUI.Button(new Rect(0, nElementIndex*nElementHeight, nElementWidth, nElementHeight), "++" + strRecordName))
					{
						strTableName = strRecordName;
					}
					
					nElementIndex++;
				}
				
			}
	
			
			///////////////////////////////
			//all property 


            for (int k = 0; k < propertyList.Count(); k++)
            {
                string strPropertyValue = null;
                string strPropertyName = propertyList.StringVal(k);
                NFIProperty property = go.GetPropertyManager().GetProperty(strPropertyName);
                NFIDataList.VARIANT_TYPE eType = property.GetType();
                switch (eType)
                {
                    case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                        strPropertyValue = property.QueryFloat().ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                        strPropertyValue = property.QueryInt().ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                        strPropertyValue = property.QueryObject().nData64.ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                        strPropertyValue = property.QueryString();
                        break;
                    default:
                        strPropertyValue = "?";
                        break;
                }

                if (strPropertyName.Length > 0)
                {
                    if (GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), strPropertyName + ":" + strPropertyValue))
                    {
                        strTableName = "";
                        strInfo = strPropertyName + ":" + strPropertyValue;
                    }
                    nElementIndex++;
                }
				
			}
			
			
			GUI.EndScrollView();
			////////////////////////
			
			
			if(strTableName.Length > 0)
			{
				NFIRecord record = go.GetRecordManager().GetRecord(strTableName);
				if(null != record)
				{
					int nRow = record.GetRows();
					int nCol = record.GetCols();
					int nOffest = 30;

                    scrollPositionThird = GUI.BeginScrollView(new Rect(nElementWidth * 1.5f + 40, nElementHeight, nElementWidth * 2, nHeight/2), scrollPositionThird, new Rect(0, 0, nElementWidth * nCol + nOffest, nRow * nElementHeight + nOffest));
					
						
					string selString = null;
					
					
					for(int row = 0; row < nRow; row++)
					{
						GUI.Button(new Rect(0, row*nElementHeight+nOffest, nOffest, nElementHeight), row.ToString());//row
						for(int col = 0; col < nCol; col++)
						{
							if(0 == row)
							{
                                GUI.Button(new Rect(col * nElementWidth + nOffest, 0, nElementWidth, nElementHeight), col.ToString() + "  [" + record.GetColType(col) + "]");
							}
							
							if(record.IsUsed(row))
							{
								NFIDataList.VARIANT_TYPE eType = record.GetColType(col);
								switch(eType)
								{								
								case NFIDataList.VARIANT_TYPE.VTYPE_INT:
									selString = record.QueryInt(row, col).ToString();
									break;
									
								case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
									selString = record.QueryFloat(row, col).ToString();
									break;
									
								case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
									selString = record.QueryString(row, col).ToString();
									break;
									
								case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
									selString = record.QueryObject(row, col).nData64.ToString();
									break;
									
								default:
									selString = "UnKnowType";
									break;
									
								}
							}
							else
							{
								selString = "NoUse";
							}
							
							if(GUI.Button(new Rect(col*nElementWidth+nOffest, row*nElementHeight+nOffest, nElementWidth, nElementHeight), selString))
							{
								strInfo = "Row:" + row.ToString() + " Col:" + col.ToString() + " " + selString;
							}
			
						}
					}
					
					GUI.EndScrollView();
				}				
			}
			
		}
		

	}
Ejemplo n.º 10
0
        public static void Main()
        {
            NFIKernelModule kernel = NFCKernelModule.Instance;

            Console.WriteLine("****************NFDataList******************");

            NFDataList var = new NFDataList();

            for (int i = 0; i < 9; i += 3)
            {
                var.AddInt(i);
                var.AddFloat((float)i + 1);
                var.AddString((i + 2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64  n   = var.IntVal(i);
                double f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Console.WriteLine(n);
                Console.WriteLine(f);
                Console.WriteLine(str);
            }


            Console.WriteLine("***************NFProperty*******************");

            NFGUID    ident      = new NFGUID(0, 1);
            NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFDataList());

            NFDataList valueProperty = new NFDataList();

            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Console.WriteLine(gameObject.QueryPropertyInt("111"));

            Console.WriteLine("***************NFRecord*******************");

            NFDataList valueRecord = new NFDataList();

            valueRecord.AddInt(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            kernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            kernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            kernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            kernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Console.WriteLine(gameObject.QueryRecordInt("testRecord", 0, 0));
            Console.WriteLine(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Console.WriteLine(gameObject.QueryRecordString("testRecord", 0, 2));
            Console.WriteLine(gameObject.QueryRecordObject("testRecord", 0, 3));

            Console.WriteLine(" ");
            Console.WriteLine("***************PropertyNFEvent*******************");

            //挂属性回调,挂表回调
            kernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            kernel.SetPropertyInt(ident, "111", 2456);

            Console.WriteLine(" ");
            Console.WriteLine("***************RecordNFEvent*******************");

            kernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            kernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Console.WriteLine(" ");
            Console.WriteLine("***************ClassNFEvent*******************");

            kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            kernel.CreateObject(new NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFDataList());
            kernel.DestroyObject(new NFGUID(0, 2));


            Console.WriteLine(" ");
            Console.WriteLine("***************NFHeartBeat*******************");
            kernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1);

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.Execute(1.0f);
            }
        }