protected override void OnInnerGUI(XCutSceneData data) { EditorGUILayout.Space(); if (!data.GeneralShow) { EditorGUI.BeginChangeCheck(); _id = EditorGUILayout.IntField("ID", _id); if (EditorGUI.EndChangeCheck()) { XEntityStatistics.RowData row = XTableMgr.GetTable <XEntityStatistics>().GetByID(_id); if (row != null) { _name = row.Name; } } _name = EditorGUILayout.TextField("Name", _name); } _discription = EditorGUILayout.TextArea(_discription, GUILayout.Height(80)); EditorGUILayout.BeginHorizontal(); _duration = EditorGUILayout.FloatField("Length", _duration); GUILayout.Label("(s)"); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); _x = EditorGUILayout.FloatField("X", _x); _y = EditorGUILayout.FloatField("Y", _y); }
void Load(XCutSceneData data) { if (EditorApplication.isPlaying) { EditorApplication.isPlaying = false; } InnerLoad(data); }
protected override void OnInnerGUI(XCutSceneData data) { _data.Context = EditorGUILayout.TextArea(_data.Context, GUILayout.Height(80)); EditorGUILayout.BeginHorizontal(); _data.Duration = EditorGUILayout.FloatField("Duration", _data.Duration); GUILayout.Label("(frame)"); EditorGUILayout.EndHorizontal(); }
protected override void OnInnerGUI(XCutSceneData data) { _bind_idx = CutSceneWindow.ActorList.FindIndex(FindActor); _fx = EditorGUILayout.ObjectField("Fx Object", _fx, typeof(GameObject), true) as GameObject; _bind_idx = EditorGUILayout.Popup("Bind To", _bind_idx, CutSceneWindow.ActorList.ToArray()); EditorGUILayout.Space(); if (_bind_idx > 0) { EditorGUI.BeginChangeCheck(); _bone = EditorGUILayout.ObjectField("Bind To", _bone, typeof(GameObject), true) as GameObject; if (EditorGUI.EndChangeCheck() || !_bone_refresh) { if (_bone != null || !_bone_refresh) { if (_bone != null) { _bone_refresh = true; } if (_bone_refresh) { _data.Bone = XClip.LocateBone(_bone); } } else { _data.Bone = null; } } if (_data.Bone != null && _data.Bone.Length > 0) { EditorGUILayout.LabelField("Bone", _data.Bone.Substring(_data.Bone.LastIndexOf("/") + 1)); } _data.Follow = EditorGUILayout.Toggle("Follow", _data.Follow); _data.Scale = EditorGUILayout.FloatField("Scale", _data.Scale); } else { _bone = null; _data.Bone = null; Vector3 Appear = Vector3FieldEx("Appear At", new Vector3(_data.AppearX, _data.AppearY, _data.AppearZ), ref _appear_fold, false, false); _data.AppearX = Appear.x; _data.AppearY = Appear.y; _data.AppearZ = Appear.z; Vector3 Face = XCommon.singleton.FloatToAngle(_data.Face); _data.Face = XCommon.singleton.AngleToFloat(Vector3FieldEx("Face To", Face, ref _face_fold, true, false)); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); _data.Destroy_Delay = EditorGUILayout.FloatField("Delay Destroy", _data.Destroy_Delay); GUILayout.Label("(s)"); EditorGUILayout.EndHorizontal(); _bind_prefab = CutSceneWindow.ActorList[_bind_idx]; }
protected override void OnInnerGUI(XCutSceneData data) { _bind_idx = CutSceneWindow.ActorList.FindIndex(FindActor); _data.Clip = EditorGUILayout.TextField("Clip Name", _data.Clip); _bind_idx = EditorGUILayout.Popup("Bind To", _bind_idx, CutSceneWindow.ActorList.ToArray()); EditorGUILayout.Space(); _data.Channel = (AudioChannel)EditorGUILayout.EnumPopup("Channel", _data.Channel); _bind_prefab = _bind_idx > 0 ? CutSceneWindow.ActorList[_bind_idx] : "None"; EditorGUILayout.Space(); }
void Save() { XCutSceneData data = GetCurrentData(); if (data != null) { _run_data = data; string file = XEditorLibrary.Cts + data.Name + ".txt"; XDataIO <XCutSceneData> .singleton.SerializeData(file, data); } }
void TimeChecker(XCutSceneClip clip, XCutSceneData data) { if (clip.TimeLineAt >= data.TotalFrame) { EditorUtility.DisplayDialog("Confirm your configuration.", "clip play-at time bigger than cutscene length!", "Ok"); throw new Exception("clip time bigger than cutscene time!"); } }
public void DetachCutScene() { GameCamera.Target = XEntityMgr.singleton.Player; GameCamera.ResetIdle(); if (_cutscene_runer != null) { _cutscene_runer.UnLoad(); GameObject.Destroy(_cutscene_runer); UIManager.singleton.OnCutScene(false); } _cutscene_data = null; }
protected override void OnInnerGUI(XCutSceneData data) { _clip1 = EditorGUILayout.ObjectField("Warrior Animation", _clip1, typeof(AnimationClip), true) as AnimationClip; _clip2 = EditorGUILayout.ObjectField("Archer Animation", _clip2, typeof(AnimationClip), true) as AnimationClip; _clip3 = EditorGUILayout.ObjectField("Sorceress Animation", _clip3, typeof(AnimationClip), true) as AnimationClip; _clip4 = EditorGUILayout.ObjectField("Cleric Animation", _clip4, typeof(AnimationClip), true) as AnimationClip; _clip5 = EditorGUILayout.ObjectField("Academic Animation", _clip5, typeof(AnimationClip), true) as AnimationClip; _clip6 = EditorGUILayout.ObjectField("Assassin Animation", _clip6, typeof(AnimationClip), true) as AnimationClip; Vector3 Appear = Vector3FieldEx("Appear At", new Vector3(_data.AppearX, _data.AppearY, _data.AppearZ), ref _appear_fold); _data.AppearX = Appear.x; _data.AppearY = Appear.y; _data.AppearZ = Appear.z; }
XCutSceneData GetCurrentData() { if (_name == null || _name.Length == 0 || _camera == null) { return(null); } XCutSceneData data = new XCutSceneData(); data.CameraClip = XClip.LocateRes(_camera); data.Name = _name; data.Script = _script; data.Scene = _scene; data.TotalFrame = _camera.length * XEditorLibrary.FPS; data.TypeMask = _type_mask; data.AutoEnd = _auto_end; data.GeneralShow = _general_show; data.GeneralBigGuy = _general_bigguy; data.OverrideBGM = _override_bgm; data.Mourningborder = _mourningborder; data.FieldOfView = _fov; data.Length = _length; data.Trigger = _trigger.ToString(); foreach (XClip clip in _clips.Values) { if (clip.Valid) { if (_camera != null) { clip.Dump(); switch (clip.ClipType) { case XClipType.Actor: data.Actors.Add(clip.CutSceneClip as XActorDataClip); break; case XClipType.Player: data.Player.Add(clip.CutSceneClip as XPlayerDataClip); break; case XClipType.Audio: data.Audios.Add(clip.CutSceneClip as XAudioDataClip); break; case XClipType.Fx: data.Fxs.Add(clip.CutSceneClip as XFxDataClip); break; case XClipType.SubTitle: data.SubTitle.Add(clip.CutSceneClip as XSubTitleDataClip); break; case XClipType.Slash: data.Slash.Add(clip.CutSceneClip as XSlashDataClip); break; } } } } return(data); }
public void AttachCutScene(XCutSceneData csd) { if (!IsPlayCutScene) { XAutoFade.FadeOut2In(1f, 0.2f); _cutscene_data = csd; GameCamera.Target = null; _cutscene_runer = GameCamera.CameraObject.AddComponent <XCutSceneRunner>(); _cutscene_runer.cut_scene_data = _cutscene_data; UIManager.singleton.OnCutScene(true); } else { XDebug.LogError("Is Playing Cutscene"); } }
protected override void OnInnerGUI(XCutSceneData data) { _using_id = EditorGUILayout.Toggle("Using ID", _using_id); if (!_using_id) { _id = 0; _prefab = EditorGUILayout.ObjectField("Prefab", _prefab, typeof(GameObject), true) as GameObject; } else { _id = EditorGUILayout.IntField("Statistics ID", _id); _prefab = XEditorLibrary.GetStatics((uint)_id); if (_prefab != null) { EditorGUILayout.ObjectField("Prefab", _prefab, typeof(GameObject), true); } else { _id = 0; } } if (!XEditorLibrary.CheckPrefab(_prefab)) { _prefab = null; } if (_prefab != null) { _clip = EditorGUILayout.ObjectField("Animation", _clip, typeof(AnimationClip), true) as AnimationClip; Vector3 Appear = Vector3FieldEx("Appear At", new Vector3(_data.AppearX, _data.AppearY, _data.AppearZ), ref _appear_fold); _data.AppearX = Appear.x; _data.AppearY = Appear.y; _data.AppearZ = Appear.z; } if (_using_id) { EditorGUILayout.Space(); _common = EditorGUILayout.Toggle("Common", _common); _tag = EditorGUILayout.TextField("Tag", _tag); } }
public void OnGUI(XCutSceneData data) { if (CutSceneClip.TimeLineAt > _time_line_total_frame) { return; } if (_myStyle == null) { _myStyle = new GUIStyle(GUI.skin.label); _myStyle.margin.left = 15; } if (_textStyle == null) { _textStyle = new GUIStyle(EditorStyles.foldout); OnTextColor(); } EditorGUILayout.BeginHorizontal(); _fold_out = EditorGUILayout.Foldout(_fold_out, Title, _textStyle); GUILayout.FlexibleSpace(); if (GUILayout.Button(_content_minor, GUILayout.MaxWidth(25), GUILayout.MaxHeight(15))) { _valid = false; } if (GUILayout.Button(_content_edit, GUILayout.MaxWidth(25), GUILayout.MaxHeight(15))) { XCutSceneTimelineWindow window = EditorWindow.GetWindow <XCutSceneTimelineWindow>(@"Timeline At:"); window._play_at_frame = CutSceneClip.TimeLineAt; window._total_frame = _time_line_total_frame; window._clip = this; } EditorGUILayout.EndHorizontal(); if (_fold_out) { EditorGUILayout.BeginVertical(_myStyle); GUILayout.Box("", _line); OnInnerGUI(data); EditorGUILayout.EndVertical(); } }
void Load() { string path = @"Assets/Resources/Table/CutScene/4_4_start.txt"; _run_data = DeserializeData <XCutSceneData>(path); }
//GameObject o = null; void OnGUI() { if (_labelstyle == null) { _labelstyle = new GUIStyle(EditorStyles.boldLabel); _labelstyle.fontSize = 11; } scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false); EditorGUILayout.Space(); GUILayout.Label("CutScene Editor:", _labelstyle); EditorGUILayout.Space(); _name = EditorGUILayout.TextField("Name", _name); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Scene", _scene); if (GUILayout.Button("Browser", GUILayout.MaxWidth(80))) { string file = EditorUtility.OpenFilePanel("Select unity scene file", XEditorLibrary.Sce, "unity"); if (file.Length != 0) { file = file.Remove(file.LastIndexOf(".")); _scene = file.Remove(0, file.IndexOf(XEditorLibrary.Sce)); Scene scene = EditorSceneManager.GetActiveScene(); if (scene.name.Length == 0 || !EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { EditorSceneManager.OpenScene(_scene + ".unity"); } } } EditorGUILayout.EndHorizontal(); _auto_end = EditorGUILayout.Toggle("Auto End", _auto_end); EditorGUILayout.Space(); _general_show = EditorGUILayout.Toggle("General Clip", _general_show); if (_general_show) { _general_bigguy = EditorGUILayout.Toggle("General Big Guy", _general_bigguy); if (_general_bigguy) { _camera = Resources.Load("Animation/Main_Camera/Cut_Scene/cutscene_generalshow_bigguy", typeof(AnimationClip)) as AnimationClip; } else { _camera = Resources.Load("Animation/Main_Camera/Cut_Scene/cutscene_generalshow", typeof(AnimationClip)) as AnimationClip; } EditorGUILayout.ObjectField("Camera Clip", _camera, typeof(AnimationClip), true); } else { _camera = EditorGUILayout.ObjectField("Camera Clip", _camera, typeof(AnimationClip), true) as AnimationClip; } if (_camera != null) { _length = _camera.length; EditorGUILayout.LabelField("CutScene Length", _length.ToString("F3") + "s" + "\t" + (_length * XEditorLibrary.FPS).ToString("F1") + "(frame)"); } EditorGUILayout.Space(); _type_mask = (int)(EntitySpecies)EditorGUILayout.EnumMaskField("Type Mask", (EntitySpecies)_type_mask); _mourningborder = EditorGUILayout.Toggle("Mourningborder", _mourningborder); EditorGUILayout.Space(); _fov = EditorGUILayout.FloatField("FieldOfVeiw", _fov); _trigger = (CameraTrigger)EditorGUILayout.EnumPopup("Trigger", _trigger); EditorGUILayout.Space(); _override_bgm = EditorGUILayout.Toggle("Override BGM", _override_bgm); EditorGUILayout.Space(); UpdateScript(); GUILayout.Label("TimeLine:", _labelstyle); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); _type = (XClipType)EditorGUILayout.EnumPopup("Add Clip", _type); if (GUILayout.Button(_content_add, GUILayout.MaxWidth(25), GUILayout.MaxHeight(15))) { if (_camera != null && _name != null && _name.Length > 0) { XCutSceneTimelineWindow window = EditorWindow.GetWindow <XCutSceneTimelineWindow>(@"Timeline At:"); window._total_frame = _camera.length * XEditorLibrary.FPS; window._clip = null; } else { EditorUtility.DisplayDialog("Confirm your selection.", "Please select camera clip or name the cutscene", "Ok"); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); ActorList.Clear(); ActorList.Add("None"); foreach (XClip clip in _clips.Values) { if (clip.Valid) { if (_camera != null) { clip.TimeLineTotal = _camera.length * XEditorLibrary.FPS; clip.OnGUI(GetCurrentData()); if (clip.ClipType == XClipType.Actor || clip.ClipType == XClipType.Player) { int all = ActorList.FindAll(s => s == clip.Name).Count; if (all > 0) { ActorList.Add(clip.Name + " " + (all + 1)); } else { ActorList.Add(clip.Name); } } } } } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Run")) { if (_name != null && _name.Length > 0 && _camera != null && !EditorApplication.isPlaying) { EditorApplication.ExecuteMenuItem("Edit/Play"); GameObject _cameraObject = GameObject.Find(@"Main Camera"); GameEntrance entrance = _cameraObject.GetComponent <GameEntrance>(); entrance.enabled = false; XCutSceneRunner runner = _cameraObject.AddComponent <XCutSceneRunner>(); _run_data = GetCurrentData(); runner.is_start_by_editor = true; runner.cut_scene_data = _run_data; } } if (GUILayout.Button("Pause")) { if (EditorApplication.isPlaying) { EditorApplication.isPaused = !EditorApplication.isPaused; } } if (GUILayout.Button("Quit")) { if (EditorApplication.isPlaying) { EditorApplication.isPlaying = false; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { Save(); } if (GUILayout.Button("Open")) { _file = EditorUtility.OpenFilePanel("Select cutscene file", XEditorLibrary.Cts, "txt"); if (_file.Length != 0) { _open_scene = true; Load(XDataIO <XCutSceneData> .singleton.DeserializeData(_file.Substring(_file.IndexOf("Assets/")))); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); }
void InnerLoad(XCutSceneData data) { _run_data = data; _name = data.Name; _script = data.Script; _scene = data.Scene; _camera = Resources.Load(data.CameraClip, typeof(AnimationClip)) as AnimationClip; _type_mask = data.TypeMask; _auto_end = data.AutoEnd; _general_show = data.GeneralShow; _general_bigguy = data.GeneralBigGuy; _override_bgm = data.OverrideBGM; _mourningborder = data.Mourningborder; _fov = data.FieldOfView; _length = data.Length; _trigger = (CameraTrigger)Enum.Parse(typeof(CameraTrigger), data.Trigger); _clips.Clear(); ActorList.Clear(); ActorList.Add("None"); foreach (XActorDataClip clip in data.Actors) { TimeChecker(clip, data); XClip xclip = AddClip(clip); ActorList.Add(xclip.Name); } foreach (XPlayerDataClip clip in data.Player) { TimeChecker(clip, data); XClip xclip = AddClip(clip); ActorList.Add(xclip.Name); } foreach (XFxDataClip clip in data.Fxs) { TimeChecker(clip, data); AddClip(clip); } foreach (XAudioDataClip clip in data.Audios) { TimeChecker(clip, data); AddClip(clip); } foreach (XSubTitleDataClip clip in data.SubTitle) { TimeChecker(clip, data); AddClip(clip); } foreach (XSlashDataClip clip in data.Slash) { TimeChecker(clip, data); AddClip(clip); } if (_open_scene && _scene != null && _scene.Length != 0) { Scene scene = EditorSceneManager.GetActiveScene(); if (scene.name.Length > 0 && !EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { return; } else { EditorSceneManager.OpenScene(_scene + ".unity"); } _open_scene = false; } }
protected abstract void OnInnerGUI(XCutSceneData data);