public void LoadSceneEnd(int nSceneID) { if (!mbInitSend) { mbInitSend = true; //NFNetController.Instance.mxNetSender.RequireEnterGameFinish (NFNetController.Instance.xMainRoleID); } if (false == mbLoadedScene) { return; } BeforeLoadSceneEnd(nSceneID); mbLoadedScene = false; //主角贴地,出生点 /* * GameObject xGameObject = (GameObject)mhtObject[mLoginModule.mRoleID]; * if (null != xGameObject) * { * xGameObject.transform.position = mvSceneBornPos; * //xGameObject.GetComponent<NFCStateMachineMng> ().ChangeState (NFAnimaStateType.Idle); * } */ GameObject xGameObject = (GameObject)mhtObject[mLoginModule.mRoleID]; foreach (Transform child in xGameObject.GetComponentsInChildren <Transform>()) { if (child.name.Contains("Shadow")) { child.GetComponent <MeshRenderer>().enabled = false; } if (child.name.Contains("Hero001")) { foreach (Transform grandchild in child.GetComponentsInChildren <Transform>()) { if (!grandchild.name.Contains("Shadow")) { continue; } } } } GameObject xModelGameObject = new GameObject(); xModelGameObject.transform.parent = xGameObject.transform.parent; Transform shadow = GetChild(xGameObject.transform, "Shadow (1)"); shadow.gameObject.GetComponent <MeshRenderer>().enabled = false; Transform heroMesh = GetChild(xGameObject.transform, "Customer"); heroMesh.gameObject.GetComponent <SkinnedMeshRenderer>().enabled = false; // xGameObject.GetComponent<MeshRenderer>().enabled = false; InitCadModel(xModelGameObject); mModelObject = xModelGameObject; NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>(); if (!xHeroCameraFollow) { xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>(); } xHeroCameraFollow.SetPlayer(mModelObject.transform); NFMsg.ESceneType nType = (NFMsg.ESceneType)mElementModule.QueryPropertyInt(nSceneID.ToString(), NFrame.Scene.Type); mUIModule.CloseAllUI(); mUIModule.ShowUI <NFUIMain>(); // mUIModule.ShowUI<NFUIEstateBar>(); mUIModule.ShowUI <NFUIJoystick>(); Debug.Log("LoadSceneEnd: " + nSceneID + " " + nType); }
private void OnConfigIDChangeHandler(NFGUID self, string strProperty, NFDataList.TData oldVar, NFDataList.TData newVar, Int64 reason) { Vector3 vec = GetRenderObjectPosition(self); DestroyObject(self); if (vec.Equals(Vector3.zero)) { NFVector3 vec3 = mKernelModule.QueryPropertyVector3(self, NPC.Position); vec.x = vec3.X(); vec.y = vec3.Y(); vec.z = vec3.Z(); } string strCnfID = newVar.StringVal(); string strPrefabPath = mElementModule.QueryPropertyString(strCnfID, NPC.Prefab); if (strPrefabPath.Length <= 0) { strPrefabPath = mElementModule.QueryPropertyString("DefaultObject", NPC.Prefab); } GameObject xPlayer = CreateObject(self, strPrefabPath, vec, NFrame.Player.ThisName); if (xPlayer) { xPlayer.name = NFrame.Player.ThisName; xPlayer.transform.Rotate(new Vector3(0, 90, 0)); NFBodyIdent xBodyIdent = xPlayer.GetComponent <NFBodyIdent>(); if (null != xBodyIdent) {//不能没有 xBodyIdent.enabled = true; xBodyIdent.SetObjectID(self); xBodyIdent.cnfID = strCnfID; } else { Debug.LogError("No 'BodyIdent' component in " + strPrefabPath); } if (self == mLoginModule.mRoleID) { InitPlayerComponent(self, xPlayer, true); } else { InitPlayerComponent(self, xPlayer, false); } if (Camera.main && self == mLoginModule.mRoleID) { NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>(); if (!xHeroCameraFollow) { xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>(); } xHeroCameraFollow.SetPlayer(xPlayer.transform); } Debug.Log("Create Object successful" + NFrame.Player.ThisName + " " + vec.ToString() + " " + self.ToString()); } else { Debug.LogError("Create Object failed" + NFrame.Player.ThisName + " " + vec.ToString() + " " + self.ToString()); } }