public void LoadLevel(int nSceneID, NFMsg.AckMiningTitle strData) { mnSceneID = nSceneID; NFRender.Instance.SetMainRoleAgentState(false); mnProgress = 0; NFrame.NFIElement xElement = NFrame.NFCKernelModule.Instance.GetElementModule().GetElement(nSceneID.ToString()); if (null != xElement) { string strName = xElement.QueryString("SceneName"); string strUIName = xElement.QueryString("LoadingUI"); UnityEngine.SceneManagement.Scene xSceneInfo = SceneManager.GetActiveScene(); if (xSceneInfo.name == strName) { //Debug.LogWarning ("begin the same scene" + strSceneID); //SceneManager.LoadScene (xSceneInfo.buildIndex); //Debug.LogWarning ("end the same scene" + strSceneID); //load a empty scene then load this scene asy SceneManager.LoadScene("EmptyScene"); } StartCoroutine(LoadLevel(strName, strUIName, strData)); } else { Debug.LogError("LoadLevel error: " + nSceneID); } //NFRender.Instance.SetMainRoleAgentState(true); }
void PlaySceneMusic(int nSceneID) { NFrame.NFIElement xElement = NFrame.NFCKernelModule.Instance.GetElementModule().GetElement(nSceneID.ToString()); if (null != xElement) { string strName = xElement.QueryString("SoundList"); string[] sArray = strName.Split(','); if (sArray.Length > 0) { //随机播放一个 int nIndex = Random.Range(0, (int)sArray.Length); if (nIndex >= 0 && nIndex < sArray.Length) { string strMusicName = sArray[nIndex]; if (mstrLastMusicName != strMusicName) { mstrLastMusicName = strMusicName; AudioClip xAudioClip = GameObject.Instantiate(Resources.Load(strMusicName)) as AudioClip; mxAudioSource.clip = xAudioClip; mxAudioSource.rolloffMode = AudioRolloffMode.Custom; mxAudioSource.volume = fVolume; mxAudioSource.loop = true; mxAudioSource.Play(); //mxAudioSource.PlayDelayed(fStartDelayTime); } } } } }
public override string QueryPropertyString(string strConfigName, string strPropertyName) { NFIElement xElement = GetElement(strConfigName); if (null != xElement) { return(xElement.QueryString(strPropertyName)); } return(NFIDataList.NULL_STRING); }