public abstract RegisterClassCallBack ( string strClassName, |
||
strClassName | string | |
handler | ||
return | void |
public override void Init() { mKernelModule.RegisterClassCallBack(NFrame.Player.ThisName, ClassEventHandler); mKernelModule.RegisterClassCallBack(NFrame.NPC.ThisName, ClassEventHandler); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.EventResult, EGMI_EVENT_RESULT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckEnterGame, EGMI_ACK_ENTER_GAME); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckSwapScene, EGMI_ACK_SWAP_SCENE); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckEnterGameFinish, EGMI_ACK_ENTER_GAME_FINISH); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckObjectEntry, EGMI_ACK_OBJECT_ENTRY); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckObjectLeave, EGMI_ACK_OBJECT_LEAVE); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckMove, EGMI_ACK_MOVE); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckMoveImmune, EGMI_ACK_MOVE_IMMUNE); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPosSync, EGMI_ACK_POS_SYNC); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyInt, EGMI_ACK_PROPERTY_INT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyFloat, EGMI_ACK_PROPERTY_FLOAT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyString, EGMI_ACK_PROPERTY_STRING); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyObject, EGMI_ACK_PROPERTY_OBJECT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyVector2, EGMI_ACK_PROPERTY_VECTOR2); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyVector3, EGMI_ACK_PROPERTY_VECTOR3); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckPropertyClear, EGMI_ACK_PROPERTY_CLEAR); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRecordInt, EGMI_ACK_RECORD_INT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRecordFloat, EGMI_ACK_RECORD_FLOAT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRecordString, EGMI_ACK_RECORD_STRING); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRecordObject, EGMI_ACK_RECORD_OBJECT); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckSwapRow, EGMI_ACK_SWAP_ROW); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckAddRow, EGMI_ACK_ADD_ROW); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRemoveRow, EGMI_ACK_REMOVE_ROW); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckRecordClear, EGMI_ACK_RECORD_CLEAR); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckObjectRecordEntry, EGMI_ACK_OBJECT_RECORD_ENTRY); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckObjectPropertyEntry, EGMI_ACK_OBJECT_PROPERTY_ENTRY); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckDataFinished, EGMI_ACK_DATA_FINISHED); mNetModule.AddReceiveCallBack((int)NFMsg.EGameMsgID.AckSkillObjectx, EGMI_ACK_SKILL_OBJECTX); //////////////////////////////////////////////////////////////////////// }
public override void Init() { mKernelModule.RegisterClassCallBack(NFrame.Player.ThisName, ClassEventHandler); mKernelModule.RegisterClassCallBack(NFrame.NPC.ThisName, ClassEventHandler); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_EVENT_RESULT, EGMI_EVENT_RESULT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_ENTER_GAME, EGMI_ACK_ENTER_GAME); //mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_SWAP_SCENE, EGMI_ACK_SWAP_SCENE); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_ENTER_GAME_FINISH, EGMI_ACK_ENTER_GAME_FINISH); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY, EGMI_ACK_OBJECT_ENTRY); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_LEAVE, EGMI_ACK_OBJECT_LEAVE); /* * mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_MOVE, EGMI_ACK_MOVE); * mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE, EGMI_ACK_MOVE_IMMUNE); * mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_STATE_SYNC, EGMI_ACK_STATE_SYNC); * mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_POS_SYNC, EGMI_ACK_POS_SYNC); */ mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT, EGMI_ACK_PROPERTY_INT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_FLOAT, EGMI_ACK_PROPERTY_FLOAT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_STRING, EGMI_ACK_PROPERTY_STRING); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_OBJECT, EGMI_ACK_PROPERTY_OBJECT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR2, EGMI_ACK_PROPERTY_VECTOR2); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR3, EGMI_ACK_PROPERTY_VECTOR3); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_INT, EGMI_ACK_RECORD_INT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_FLOAT, EGMI_ACK_RECORD_FLOAT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_STRING, EGMI_ACK_RECORD_STRING); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, EGMI_ACK_RECORD_OBJECT); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_SWAP_ROW, EGMI_ACK_SWAP_ROW); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, EGMI_ACK_ADD_ROW); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_REMOVE_ROW, EGMI_ACK_REMOVE_ROW); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_RECORD_ENTRY, EGMI_ACK_OBJECT_RECORD_ENTRY); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_PROPERTY_ENTRY, EGMI_ACK_OBJECT_PROPERTY_ENTRY); mNetModule.AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_DATA_FINISHED, EGMI_ACK_DATA_FINISHED); }
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); } }
public void MainU3D() { Debug.Log("****************NFIDataList******************"); NFIDataList var = new NFCDataList(); 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); Debug.Log(n); Debug.Log(f); Debug.Log(str); } Debug.Log("***************NFProperty*******************"); NFGUID ident = new NFGUID(0, 1); NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "", "", new NFCDataList()); NFIDataList valueProperty = new NFCDataList(); valueProperty.AddInt(112221); gameObject.GetPropertyManager().AddProperty("111", valueProperty); Debug.Log(gameObject.QueryPropertyInt("111")); Debug.Log("***************NFRecord*******************"); NFIDataList valueRecord = new NFCDataList(); valueRecord.AddInt(0); valueRecord.AddFloat(0); valueRecord.AddString(""); valueRecord.AddObject(ident); gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221); xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f); xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221"); xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident); Debug.Log(gameObject.QueryRecordInt("testRecord", 0, 0)); Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1)); Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2)); Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3)); Debug.Log(" "); Debug.Log("***************PropertyNFEvent*******************"); //挂属性回调,挂表回调 xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler); xKernel.SetPropertyInt(ident, "111", 2456); Debug.Log(" "); Debug.Log("***************RecordNFEvent*******************"); xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111); Debug.Log(" "); Debug.Log("***************ClassNFEvent*******************"); xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler); xKernel.CreateObject(new NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList()); xKernel.DestroyObject(new NFGUID(0, 2)); Debug.Log(" "); Debug.Log("***************NFHeartBeat*******************"); xKernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1); }
public override void Init() { mKernelModule.RegisterClassCallBack(NFrame.Player.ThisName, OnClassPlayerEventHandler); }