public void CreatePlayerCutscene() { EditorGUILayout.LabelField("第四步:创建剧情运行配置文本"); EditorGUILayout.BeginHorizontal("box"); // SavePathRect = ; //将上面的框作为文本输入框 _PlayCutsceneFilePath = EditorGUI.TextField(EditorGUILayout.GetControlRect(true, GUILayout.ExpandWidth(true)), _PlayCutsceneFilePath); UtilityTools.DropToTextFiled(SavePathRect, ref _PlayCutsceneFilePath); FileTools.GetFileNameWithoutExtionAndFullPath(_PlayCutsceneFilePath, ref _PlayCutsceneFilePath); if (GUILayout.Button("复制运行文本")) { if (_ActiveDestionScene == null) { _ActiveDestionScene = EditorSceneManager.OpenScene(_DestiionSceneName, OpenSceneMode.Additive); } EditorSceneManager.SetActiveScene(_ActiveDestionScene); GameObject player = GameObject.Find("CutsceneSequencePlayer"); if (player == null) { player = new GameObject("CutsceneSequencePlayer"); } CutsceneSequencePlayer playercutscene = player.GetComponent <CutsceneSequencePlayer>(); if (playercutscene == null) { playercutscene = player.AddComponent <CutsceneSequencePlayer>(); } playercutscene.fileName = _PlayCutsceneFilePath; } EditorGUILayout.EndHorizontal(); }
protected override void OnUpdate(float time) { if (!mStop && !CutsceneSequencePlayer.isPause()) { CutsceneSequencePlayer.PauseCurrentCutscene(); } }
protected void OnSceneChanged(Scene scene1, Scene scene2) { switch (_UnloadAndGameLoadState) { case UnloadAndGameLoadState.start: case UnloadAndGameLoadState.sceneload: { CloseUI(); } break; case UnloadAndGameLoadState.over: { if (mStop) { _SceneLoadEvent.UnregisterEvent(); _MainSceneLoadEvent.UnregisterEvent(); CutsceneSequencePlayer.StopCurrentCutscene(); //关闭ui CloseUI(); } } break; default: break; } }
protected void Back() { mStop = true; if (!string.IsNullOrEmpty(_MainSceneName)) { _ActiveSceneName = _MainSceneName; } else { _ActiveSceneName = newScenName.Split(',')[0]; } SetMainScene(_ActiveSceneName); #if TEST_MAIN_MOUDLE CutsceneSequencePlayer.BackToMainScene(); #endif }
protected virtual void DoUpdate() { if (!mStop && !CutsceneSequencePlayer.isPause()) { CutsceneSequencePlayer.PauseCurrentCutscene(); } if (_SetActive) { //判断当前的场景是否为active 场景 Scene activeScene = SceneManager.GetActiveScene(); if (activeScene != null && activeScene.name.Equals(_ActiveSceneName)) { _SetActive = false; OnSceneChanged(activeScene, activeScene); } } }
protected override void OnEnter() { CutsceneSequencePlayer.PauseCurrentCutscene(); _UnloadAndGameLoadState = UnloadAndGameLoadState.start; _SetActive = false; mStop = false; _SceneLoadEvent.RegisterEvent(C_EnumEventChannel.Global, "UnloadAndSceneLoadEvent", (object[] result) => { UnloadAndSceneLoadEvent(result); }); _MainSceneLoadEvent.RegisterEvent(C_EnumEventChannel.Global, "MainSceneLoadEvent", (object[] result) => { MainSceneLoadEvent(result); }); //if (string.IsNullOrEmpty(oldScenName)) //{ // C_DebugHelper.LogError("scenename is null"); // return; //} // Game_Minor.G_MinorCoreConfigData.SetGameCoreName(newScenName, NextStorySceneName); string sceneName = string.Empty; if (newApi) { // string sceneName = Game_Minor.G_MinorCoreConfigData.GetLoadNextSceneName(); if (string.IsNullOrEmpty(uiName)) { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, sceneName, loadConfig, () => { LoadOver(); }); } else { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, sceneName, loadConfig, () => { LoadOver(); }, uiName); } } else { if (string.IsNullOrEmpty(uiName)) { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, newScenName, loadConfig, () => { LoadOver(); }); } else { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, newScenName, loadConfig, () => { LoadOver(); }, uiName); } _ActiveSceneName = newScenName; } }
protected override void OnRootUpdated(float time, float previousTime) { if (StopFlag) { return; } new_y = Input.acceleration.y; currentDistance = new_y - old_y; old_y = new_y; if (currentDistance > distance) { StopFlag = true; Handheld.Vibrate(); //手机的震动效果 CutsceneSequencePlayer.ResumeCurrentCutscene(); } }
////按照单集的每个分割点进行收集数据 protected void SaveSplitLoadingRes(string key, bool msg = true) { string Result = ""; int sum = 0; foreach (string k in _DicSplitRes[key].Keys)///每一个key对应一个保存信息的文本 { Result = ""; EditorUtility.DisplayProgressBar("加载资源信息收集: ", k, (float)sum++ / (float)_DicSplitRes[key].Keys.Count); //对每个资源进行加载 //k表示每个资源的文件名字,每个资源_DicSplitRes[key][k][i] if (!string.IsNullOrEmpty(_DicSplitRes[key][k][0]) && !string.IsNullOrEmpty(_DicSplitRes[key][k][_DicSplitRes[key][k].Count - 1])) { //打开对应的场景,并做相应的移动,只支持一个场景 _ActiveDestionScene = EditorSceneManager.OpenScene(_Dic[key][0], OpenSceneMode.Additive); EditorSceneManager.SetActiveScene(_ActiveDestionScene); //找到cutsceneplayer ,获取所有对象 GameObject player = GameObject.Find("CutsceneSequencePlayer"); if (player != null) { CutsceneSequencePlayer cutPlayer = player.GetComponent <CutsceneSequencePlayer>(); if (cutPlayer == null) { MessageBoxEditor.ShowErrorBox("加载资源信息收集出错", key + "没有CutsceneSequencePlayer对象,加载文件创建失败,请检查后重试", "好的"); return; } Result += cutPlayer.ReadLoadingMsg(_DicSplitRes[key][k][0], _DicSplitRes[key][k][_DicSplitRes[key][k].Count - 1], Result); } EditorSceneManager.CloseScene(_ActiveDestionScene, true); //更新当前角色的动画设置 FileTools.CreateDir(savePath); FileTools.CreateFile(savePath + k + ".txt", Result); } EditorUtility.ClearProgressBar(); } if (msg) { MessageBoxEditor.ShowErrorBox("收集结束", key + "加载文件创建完成", "好的"); } }
protected override void OnEnter() { if (string.IsNullOrEmpty(mainScenName)) { Debug.LogError("scenename is null"); return; } CutsceneSequencePlayer.PauseCurrentCutscene(); mStop = false; if (string.IsNullOrEmpty(uiName)) { SceneLoadingMgr.GetInstance().PreLoadMulitSceneAsync(mainScenName, otherSceneName, loadConfig, () => { Back(); }); } else { SceneLoadingMgr.GetInstance().PreLoadMulitSceneAsync(mainScenName, otherSceneName, loadConfig, () => { Back(); }, uiName); } }
protected override void OnEnter() { if (string.IsNullOrEmpty(oldScenName)) { Debug.LogError("scenename is null"); return; } CutsceneSequencePlayer.PauseCurrentCutscene(); Resources.UnloadUnusedAssets(); mStop = false; if (string.IsNullOrEmpty(uiName)) { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, newScenName, loadConfig, () => { Back(); }); } else { SceneLoadingMgr.GetInstance().PreUnloadSceneAndLoadNewSceneAsync(oldScenName, newScenName, loadConfig, () => { Back(); }, uiName); } }
protected virtual string Load(string key) { bool mark = false; string Result = ""; for (int i = 0; i < _Dic[key].Count; i++) { if (!string.IsNullOrEmpty(_Dic[key][i])) { mark = true; EditorUtility.DisplayProgressBar("加载资源信息收集: ", _Dic[key][i], (float)i / (float)_Dic[key].Count); //打开对应的场景,并做相应的移动 _ActiveDestionScene = EditorSceneManager.OpenScene(_Dic[key][i], OpenSceneMode.Additive); EditorSceneManager.SetActiveScene(_ActiveDestionScene); //找到cutsceneplayer ,获取所有对象 GameObject player = GameObject.Find("CutsceneSequencePlayer"); if (player != null) { CutsceneSequencePlayer cutPlayer = player.GetComponent <CutsceneSequencePlayer>(); if (cutPlayer == null) { MessageBoxEditor.ShowErrorBox("加载资源信息收集出错", key + "没有CutsceneSequencePlayer对象,加载文件创建失败,请检查后重试", "好的"); return(""); } Result += cutPlayer.NewReadLoadingMsg(key, Result); } EditorSceneManager.CloseScene(_ActiveDestionScene, true); } } if (mark) { EditorUtility.ClearProgressBar(); } return(Result); }
void Back() { CutsceneSequencePlayer.StopCurrentCutscene(); }
protected void OnSceneChanged(Scene scene1, Scene scene2) { CutsceneSequencePlayer.StopCurrentCutscene(); CloseUI(); }
protected virtual void StoryGoMainCityAction() { Stop(); CutsceneSequencePlayer.BackToMainScene(); }
protected override void OnEnter() { StopFlag = false; CutsceneSequencePlayer.PauseCurrentCutscene(); }