static public NFMsg.Vector3 NFToPB(NFVector3 value) { NFMsg.Vector3 vector = new NFMsg.Vector3(); vector.x = value.X(); vector.y = value.Y(); vector.z = value.Z(); return(vector); }
public bool OnPlayerMove(NFIDataList valueList) { NFGUID tar = valueList.ObjectVal(0); if (tar == NFCPlayerLogic.Instance().mRoleID) { return(true); } OtherPlayer player = transform.Find(tar.ToString()).GetComponent <OtherPlayer>(); double fSpeed = valueList.FloatVal(1); NFVector3 pos = valueList.Vector3Val(2); player.MoveTo(new Vector3(pos.X(), pos.Y(), pos.Z())); Debug.Log("Player Move:" + new Vector3(pos.X(), pos.Y(), pos.Z()).ToString()); return(true); }
private void OnHeroChangeHandler(NFGUID self, string strProperty, NFDataList.TData oldVar, NFDataList.TData newVar) { Vector3 vec = new Vector3(); vec = GetRenderObjectPosition(self); DestroyObject(self); if (vec.Equals(Vector3.zero)) { NFVector3 vec3 = NFCKernelModule.Instance.QueryPropertyVector3(self, NPC.Position); vec.x = vec3.X(); vec.y = vec3.Y(); vec.z = vec3.Z(); } string strPrefabPath = ""; NFGUID xHeroID = NFCKernelModule.Instance.QueryPropertyObject(self, NFrame.Player.FightHero); NFIRecord xRecord = NFCKernelModule.Instance.FindRecord(self, NFrame.Player.PlayerHero.ThisName); int nRow = xRecord.FindObject((int)NFrame.Player.PlayerHero.GUID, xHeroID); if (nRow >= 0) { String strCnfID = xRecord.QueryString(nRow, (int)NFrame.Player.PlayerHero.ConfigID); strPrefabPath = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strCnfID, NPC.Prefab); } GameObject xPlayer = CreateObject(self, strPrefabPath, vec, NFrame.Player.ThisName); xPlayer.name = NFrame.Player.ThisName; xPlayer.transform.Rotate(new Vector3(0, 90, 0)); if (self == NFNetController.Instance.xMainRoleID) { InitPlayerComponent(self, xPlayer, true); } else { InitPlayerComponent(self, xPlayer, false); } Debug.Log("Create Object " + NFrame.Player.ThisName + " " + vec.ToString() + " " + 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 = 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); } }