public void InitCutScene() { InitFile(); for (int i = 0; i < FileName.Count; i++) { Transform temp = _CutsceneNode.transform.Find(FileName[i]); if (temp == null) { C_DebugHelper.LogError(FileName[i] + "not find"); return; } Cutscene cut = temp.GetComponent <Cutscene>(); if (cut == null) { C_DebugHelper.LogError(FileName[i] + "not find cutscene"); return; } cutscenes.Add(cut); } }
public void InitCutScene(string start, string end) { bool Record = false; InitCutScene(); GameObject go = GameObject.FindGameObjectWithTag("CutScene"); int count = go.transform.childCount; for (int i = 0; i < FileName.Count; i++) { Transform temp = go.transform.Find(FileName[i]); if (temp == null) { C_DebugHelper.LogError(FileName[i] + "not find"); return; } Cutscene cut = temp.GetComponent <Cutscene>(); if (cut == null) { C_DebugHelper.LogError(FileName[i] + "not find cutscene"); return; } if (FileName[i].Equals(start)) { Record = true; } if (Record) { cutscenes.Add(cut); } if (FileName[i].Equals(end)) { Record = false; } } }
//... public override void OnInspectorGUI() { cutscene = (Cutscene)target; if (UnityEditor.EditorUtility.IsPersistent(cutscene)) { EditorGUILayout.HelpBox("To edit a cutscene prefab please open it first.", MessageType.Info); return; } var e = Event.current; GUI.skin.GetStyle("label").richText = true; if (e.rawType == EventType.MouseDown && e.button == 0) //generic undo { Undo.RegisterFullObjectHierarchyUndo(cutscene.groupsRoot.gameObject, "Cutscene Inspector"); Undo.RecordObject(cutscene, "Cutscene Inspector"); willDirty = true; } if (e.rawType == EventType.MouseUp && e.button == 0 || e.rawType == EventType.KeyUp) { willDirty = true; if (CutsceneUtility.selectedObject != null && CutsceneUtility.selectedObject.startTime <= cutscene.currentTime) { willResample = true; } } GUILayout.Space(5); if (GUILayout.Button("EDIT IN SLATE")) { CutsceneEditor.ShowWindow(cutscene); } GUILayout.Space(5); DoCutsceneInspector(); DoSelectionInspector(); if (willDirty) { willDirty = false; EditorUtility.SetDirty(cutscene); if (CutsceneUtility.selectedObject as UnityEngine.Object != null) { EditorUtility.SetDirty((UnityEngine.Object)CutsceneUtility.selectedObject); } } if (willResample) //resample after the changes on fresh gui pass { willResample = false; //delaycall so that other gui controls are finalized before resample. EditorApplication.delayCall += () => { if (cutscene != null) { cutscene.ReSample(); } }; } Repaint(); }
private string Search(string matchContent = "") { List <string> ResList = new List <string>(); if (!string.IsNullOrEmpty(matchContent)) { string[] data = matchContent.Split('\n'); for (int id = 0; id < data.Length; id++) { ResList.Add(data[id]); } } string content = ""; string mark = "PackagingResources"; for (int i = 0; i < cutscenes.Count; i++) //所有剧情 { Cutscene cutscene = cutscenes[i]; //单个剧情 if (cutscene != null) { for (int ii = 0; ii < cutscene.groups.Count; ii++)//单个剧情的所有轨道 { string[] fileName = cutscene.name.Split('_'); if (fileName.Length < 1) { C_DebugHelper.LogError(string.Format("'{0}'名字不规范 要求类似iuv_cam001 ", cutscene.name)); continue; } if (cutscene.name.Contains("(Clone)")) { int end = name.LastIndexOf("(Clone)"); cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end)); } if (cutscene.name.Contains("(clone)")) { int end = name.LastIndexOf("(clone)"); cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end)); } string dirpath = fileName[0] + "/prefabs/" + cutscene.name + "/" + cutscene.name; ContainContent(dirpath, ResList); //收集cutscene string cutscenepath = fileName[0] + "/cutscene/" + cutscene.name; ContainContent(cutscenepath, ResList); //初始化镜头的所有对象 cutscene.LoadAffectedResEditor(); //对象prefab var actor = cutscene.groups[ii].actor; if (actor == null) { C_DebugHelper.LogWarning("对象:" + dirpath + " actor is null"); } if (actor != null && PrefabUtility.GetPrefabType(actor) == PrefabType.Prefab) { string tempActorName = AssetDatabase.GetAssetPath(actor); tempActorName = tempActorName.Substring(tempActorName.IndexOf(mark) + mark.Length + 1); string temp = C_String.DeleteExpandedName(tempActorName).ToLower(); ContainContent(temp, ResList); } //所有的轨道上资源对象 List <CutsceneTrack> cutsceneTrack = cutscene.groups[ii].tracks; if (cutsceneTrack != null) { for (int iii = 0; iii < cutsceneTrack.Count; iii++) { string path = cutsceneTrack[iii].GetAffectResPath(); string pathTemp = C_String.DeleteExpandedName(path).ToLower(); ContainContent(pathTemp, ResList); List <ActionClip> _actionClips = cutsceneTrack[iii].actionClips; for (int j = 0; j < _actionClips.Count; j++) { string clipPath = _actionClips[j].GetAffectResPath(); string clipPathTemp = C_String.DeleteExpandedName(clipPath).ToLower(); ContainContent(clipPathTemp, ResList); } } } } } } //C_DebugHelper.Log("资源:+" + content); content = ""; //清理重复的名字资源 for (int i = 0; i < ResList.Count; i++) { content += ResList[i] + "\n"; } return(content); }