private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { //if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) //{ // string strConfigID = NFCKernelModule.Instance().QueryPropertyString(self, "ConfigID"); // Vector3 vec = new Vector3(); // vec.x = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "X"); // vec.y = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "Y"); // vec.z = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "Z"); // string strPrefabPath = ""; // if (strConfigID.Length <= 0) // { // strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab"); // } // else // { // strPrefabPath = NFCElementModule.Instance()..QueryPropertyString(strConfigID, "Prefab"); // } // strPrefabPath = "Player/MainPlayer"; // GameObject playerPerf = Resources.Load<GameObject>(strPrefabPath); // GameObject player = Instantiate(playerPerf); //} //else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) //{ // //DestroyObject(self); //} }
public void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); NFDataList xPropertyNameList = xPropertyManager.GetPropertyList(); for (int i = 0; i < xPropertyNameList.Count(); i++) { string strPropertyName = xPropertyNameList.StringVal(i); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (xProperty.GetUpload()) { xProperty.RegisterCallback(OnPropertyHandler); } } NFIRecordManager xRecordManager = xObject.GetRecordManager(); NFDataList xRecordNameList = xRecordManager.GetRecordList(); for (int i = 0; i < xRecordNameList.Count(); i++) { string strRecodeName = xRecordNameList.StringVal(i); NFIRecord xRecord = xRecordManager.GetRecord(strRecodeName); if (xRecord.GetUpload()) { xRecord.RegisterCallback(OnRecordHandler); } } } }
private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { string strConfigID = NFCKernelModule.Instance.QueryPropertyString(self, "ConfigID"); Vector3 vec = new Vector3(); vec.x = (float)NFCKernelModule.Instance.QueryPropertyFloat(self, "X"); vec.y = (float)NFCKernelModule.Instance.QueryPropertyFloat(self, "Y"); vec.z = (float)NFCKernelModule.Instance.QueryPropertyFloat(self, "Z"); string strPrefabPath = ""; if (strConfigID.Length <= 0) { strPrefabPath = NFCKernelModule.Instance.GetElementModule().QueryPropertyString("Player", "Prefab"); } else { strPrefabPath = NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, "Prefab"); } //CreateObject(self, strPrefabPath, vec, strClassName); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { //DestroyObject(self); } }
void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { mkernelModule.RegisterPropertyCallback(self, propertyName, PropertyEventHandler); } } }
void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (NFNetController.Instance.xMainRoleID == self) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { NFrame.NFCKernelModule.Instance.RegisterPropertyCallback(self, propertyName, PropertyEventHandler); } } }
void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { NFrame.NFGUID xIdent = NFNetController.Instance.xMainRoleID; if (self == xIdent) { if (NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH == eType) { } } }
static void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { Console.Write(self); Console.Write(" "); Console.Write(eType.ToString()); Console.Write(" "); Console.Write(strClassName); Console.Write(" "); Console.Write(strConfigIndex); Console.WriteLine(" "); }
static void OnClassHandler(NFIDENTID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { Debug.Log(self); Debug.Log(" "); Debug.Log(eType.ToString()); Debug.Log(" "); Debug.Log(strClassName); Debug.Log(" "); Debug.Log(strConfigIndex); Debug.Log(" "); }
private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { string strConfigID = NFCKernelModule.Instance.QueryPropertyString(self, NFrame.NPC.ConfigID); NFVector3 vec3 = NFCKernelModule.Instance.QueryPropertyVector3(self, NFrame.NPC.Position); Vector3 vec = new Vector3(); vec.x = vec3.X(); vec.y = vec3.Y(); vec.z = vec3.Z(); string strPrefabPath = ""; if (strConfigID.Length <= 0) { strPrefabPath = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString("Enemy", NPC.Prefab); } else { strPrefabPath = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, NPC.Prefab); } GameObject xNPC = CreateObject(self, strPrefabPath, vec, strClassName); xNPC.name = strConfigIndex; xNPC.transform.Rotate(new Vector3(0, 90, 0)); InitPlayerComponent(self, xNPC, false); NFCKernelModule.Instance.RegisterPropertyCallback(self, NPC.HP, OnNPCHPHandler); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { DestroyObject(self); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { //NFCKernelModule.Instance.RegisterPropertyCallback(self, NFrame.Player.PrefabPath, OnClassPrefabEventHandler); } }
void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (mLoginModule.mRoleID == self) { xGUID = self; if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { NFIRecord xRecord = mkernelModule.FindRecord(self, recordName); if (xRecord != null) { mkernelModule.RegisterRecordCallback(self, recordName, RecordEventHandler); } else { Debug.LogError("no this record " + recordName); } } } }
private void ClassEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { switch (eType) { case NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE: break; case NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA: AttachObjectData(self); break; case NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH: mxObjectDataBuff.Remove(self); break; case NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY: break; default: break; } }
private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { Debug.Log("OBJECT_CREATE:" + self.ToString()); string strConfigID = NFCKernelModule.Instance().QueryPropertyString(self, "ConfigID"); Vector3 vec = new Vector3(); vec.x = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "X"); vec.y = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "Y"); vec.z = (float)NFCKernelModule.Instance().QueryPropertyFloat(self, "Z"); string strPrefabPath = "Player/MainPlayer"; //if (strConfigID.Length <= 0) //{ // strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab"); //} //else //{ // strPrefabPath = NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, "Prefab"); //} //CreateObject(self, strPrefabPath, vec, strClassName); GameObject perfb = Resources.Load <GameObject>(strPrefabPath); GameObject player = GameObject.Instantiate(perfb); player.name = self.ToString(); player.transform.SetParent(transform); player.transform.position = vec; // MainPlayer if (self == NFCPlayerLogic.Instance().mRoleID) { player.AddComponent <MainPlayer>(); } else { player.AddComponent <OtherPlayer>(); } } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { DestroyObject(transform.Find(self.ToString())); } }
private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { string strConfigID = mKernelModule.QueryPropertyString(self, NFrame.Player.ConfigID); Vector3 vec = new Vector3(); NFVector3 vector3 = mKernelModule.QueryPropertyVector3(self, NFrame.Player.Position); //vec.x = vector3.X(); //vec.y = vector3.Y(); //vec.z = vector3.Z(); string strPrefabPath = ""; // if (strConfigID.Length <= 0) // { // strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab"); // } // else // { // strPrefabPath = NFCElementModule.Instance()..QueryPropertyString(strConfigID, "Prefab"); // } strPrefabPath = "Player/AIThirdPersonController"; GameObject playerPerf = Resources.Load <GameObject>(strPrefabPath); GameObject player = GameObject.Instantiate(playerPerf); mGameObjectMap.Add(self, player); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { GameObject go = GetObject(self); if (go != null) { mGameObjectMap.Remove(self); GameObject.DestroyObject(go); } } }
private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { DestroyObject(self); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { NFGUID xHeroID = NFCKernelModule.Instance.QueryPropertyObject(self, NFrame.Player.FightHero); NFDataList.TData data = new NFDataList.TData(); data.Set(xHeroID); OnHeroChangeHandler(self, NFrame.Player.FightHero, data, data); NFCKernelModule.Instance.RegisterPropertyCallback(self, NFrame.Player.FightHero, OnHeroChangeHandler); } }
private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { DestroyObject(self); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { string strCnfID = mKernelModule.QueryPropertyString(self, NFrame.Player.ConfigID); NFDataList.TData data = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING); if (strCnfID != "") { data.Set(strCnfID); } else { data.Set(strConfigIndex); } if (data.StringVal().Length > 0) { OnConfigIDChangeHandler(self, NFrame.Player.ConfigID, data, data, 0); } mKernelModule.RegisterPropertyCallback(self, NFrame.Player.ConfigID, OnConfigIDChangeHandler); mKernelModule.RegisterPropertyCallback(self, NFrame.Player.HP, OnHPChangeHandler); } }
private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { Debug.Log("OBJECT_CREATE:" + self.ToString()); string strConfigID = mKernelModule.QueryPropertyString(self, NFrame.Player.ConfigID); Vector3 vec = new Vector3(); NFVector3 vector3 = mKernelModule.QueryPropertyVector3(self, NFrame.Player.Position); //vec.x = vector3.X(); //vec.y = vector3.Y(); //vec.z = vector3.Z(); //MainPlayer string strPrefabPath = "Player/AIThirdPersonController"; if (self == mLoginModule.mRoleID) { strPrefabPath = "Player/ThirdPersonController"; } //if (strConfigID.Length <= 0) //{ // strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab"); //} //else //{ // strPrefabPath = NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, "Prefab"); //} //CreateObject(self, strPrefabPath, vec, strClassName); GameObject perfb = Resources.Load <GameObject>(strPrefabPath); GameObject player = GameObject.Instantiate(perfb); mGameObjectMap.Add(self, player); GameObject.DontDestroyOnLoad(player); player.name = self.ToString(); player.transform.position = vec; //MainPlayer if (self == mLoginModule.mRoleID) { player.AddComponent <MainPlayer>(); } else { player.AddComponent <OtherPlayer>(); } } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { //DestroyObject(transform.Find(self.ToString())); GameObject go = GetObject(self); if (go != null) { mGameObjectMap.Remove(self); GameObject.DestroyObject(go); } } }
private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA) { } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY) { DestroyObject(self); } else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { string strConfigID = mKernelModule.QueryPropertyString(self, NFrame.NPC.ConfigID); NFVector3 vec3 = mKernelModule.QueryPropertyVector3(self, NFrame.NPC.Position); Vector3 vec = new Vector3(); vec.x = vec3.X(); vec.y = vec3.Y(); vec.z = vec3.Z(); string strPrefabPath = ""; if (strConfigID.Length <= 0) { strPrefabPath = mElementModule.QueryPropertyString("Enemy", NPC.Prefab); } else { strPrefabPath = mElementModule.QueryPropertyString(strConfigID, NPC.Prefab); } GameObject xNPC = CreateObject(self, strPrefabPath, vec, strClassName); if (xNPC == null) { Debug.LogError("Create GameObject fail in " + strConfigID + " " + strPrefabPath); return; } xNPC.name = strConfigIndex; xNPC.transform.Rotate(new Vector3(0, 90, 0)); NFBodyIdent xBodyIdent = xNPC.GetComponent <NFBodyIdent>(); if (null != xBodyIdent) {//不能没有 xBodyIdent.enabled = true; xBodyIdent.SetObjectID(self); xBodyIdent.cnfID = strConfigID; } else { Debug.LogError("No 'BodyIdent' component in " + strConfigID + " " + strPrefabPath); } InitPlayerComponent(self, xNPC, false); } }
private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { NFIClass classObject = mClassModule.GetElement(strClassName); NFIPropertyManager propertyManager = classObject.GetPropertyManager(); NFIRecordManager recordManager = classObject.GetRecordManager(); NFDataList propertyList = propertyManager.GetPropertyList(); NFDataList recordList = recordManager.GetRecordList(); for (int i = 0; i < propertyList.Count(); ++i) { NFIProperty propertyObject = propertyManager.GetProperty(propertyList.StringVal(i)); if (propertyObject.GetUpload()) { mKernelModule.RegisterPropertyCallback(self, propertyObject.GetKey(), OnPropertyDataHandler); } } for (int i = 0; i < recordList.Count(); ++i) { NFIRecord recordObject = recordManager.GetRecord(recordList.StringVal(i)); if (recordObject.GetUpload()) { mKernelModule.RegisterRecordCallback(self, recordObject.GetName(), RecordEventHandler); } } } }