public override void OnInspectorGUI() { TextManager manager = (TextManager)target; if (EditorApplication.isPlaying) { s_Util.SeparatorToolbar("Debug", null); OnInspectorDebug("DamagePhysic", manager.DamagePhysic); OnInspectorDebug("DamageMagic", manager.DamageMagic); OnInspectorDebug("Heal", manager.Heal); OnInspectorDebug("Mana", manager.Mana); OnInspectorDebug("Message", manager.Message); } s_Util.SeparatorToolbar("System", null); OnInspectorPrefab("DamagePhysic", manager.DamagePhysic); OnInspectorPrefab("DamageMagic", manager.DamageMagic); OnInspectorPrefab("Heal", manager.Heal); OnInspectorPrefab("Mana", manager.Mana); OnInspectorPrefab("Message", manager.Message); if (GUI.changed || EditorApplication.isPlaying) { EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { SoundManager manager = (SoundManager)target; if (EditorApplication.isPlaying) { s_Util.SeparatorToolbar("Debug", null); EditorGUILayout.LabelField(string.Format("Playing : {0} / {1}", manager.PlayingList.Count, manager.PlayingList.Count + manager.FreeList.Count)); foreach (var source in manager.PlayingList) { EditorGUILayout.LabelField(string.Format("{0} : {1}/{2}", source.clip.name, source.time, source.clip.length)); } } s_Util.SeparatorToolbar("System", null); manager.Prewarm = EditorGUILayout.IntField("Prewarm", manager.Prewarm); manager.volume = EditorGUILayout.Slider("Volume", manager.volume, 0f, 1f); if (GUI.changed || EditorApplication.isPlaying) { EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { // base.OnInspectorGUI(); Character character = (Character)target; CharacterAnimation character_animation = character.GetComponent <CharacterAnimation>(); EditorGUILayout.BeginVertical(); // debug if (Application.isPlaying) { s_Util.SeparatorToolbar("Debug", null); int selected_container = EditorPrefs.GetInt("Character_ActionTarget", 1); int range = EditorPrefs.GetInt("Character_ActionRange", 1); EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 70f; Time.timeScale = EditorGUILayout.FloatField("TimeScale", Time.timeScale, GUILayout.Width(110f)); if (GUILayout.Button("Reset", GUILayout.Width(50f))) { Time.timeScale = 1f; } if (GUILayout.Button("Slow", GUILayout.Width(50f))) { Time.timeScale = 0.1f; } if (GUILayout.Button("Pause", GUILayout.Width(50f))) { Time.timeScale = 0f; } float new_time_skip = EditorGUILayout.FloatField("TimeSkip", time_skip, GUILayout.Width(110f)); if (GUILayout.Button("Reset", GUILayout.Width(50f))) { new_time_skip = 0f; } if (GUILayout.Button("0.5", GUILayout.Width(50f))) { new_time_skip = 0.5f; } if (GUILayout.Button("1", GUILayout.Width(50f))) { new_time_skip = 1f; } if (time_skip != new_time_skip) { time_skip = new_time_skip; } EditorGUIUtility.labelWidth = 0f; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GameObject countdown_object = null; #if SH_ASSETBUNDLE if (m_Recording != RecordState.None) { GUI.backgroundColor = Color.green; } if ((GUILayout.Button("Record") && m_Recording == RecordState.None) && BattleBase.Instance.IsPause == ePauseType.None) { m_Recording = RecordState.Waiting; // m_Recording = RecordState.WaitingWithCamera; if (m_Recording == RecordState.WaitingWithCamera) { BattleTest.Instance._capture._forceFilename = string.Format("{0}_{1}_scaled.avi", character.name, action_list.Selected.AnimationName); } else { BattleTest.Instance._capture._forceFilename = string.Format("{0}_{1}.avi", character.name, action_list.Selected.AnimationName); } BattleTest.Instance._capture.SelectCodec(false); BattleTest.Instance._capture.SelectAudioDevice(false); // We have to queue the start capture otherwise Screen.width and height aren't correct BattleTest.Instance._capture.QueueStartCapture(); BattleTest.Instance.m_Countdown.gameObject.SetActive(true); BattleTest.Instance.m_RecordTime.gameObject.SetActive(true); Debug.Log("Record Start"); } GUI.backgroundColor = Color.white; if (m_Recording == RecordState.Waiting || m_Recording == RecordState.WaitingWithCamera) { countdown_object = BattleTest.Instance.m_Countdown.gameObject; } #endif if ((GUILayout.Button("Play") || m_Recording == RecordState.Waiting && countdown_object.activeInHierarchy == false) && BattleBase.Instance.IsPause == ePauseType.None) { if (m_Recording == RecordState.Waiting) { m_Recording = RecordState.Recording; } CharacterContainer action_target = containers[selected_container]; List <CharacterContainer> target_containers = containers.Where(c => c.transform.parent.name == action_target.transform.parent.name).ToList(); SkillTargetContainer skill_target = new SkillTargetContainer(); skill_target.targets = new List <ISkillTarget>(); skill_target.targets.Add(new SkillTargetDummy(character, action_target.Character)); int target_index = target_containers.FindIndex(c => c == action_target); for (int i = 1; i < range; ++i) { if (target_index - i >= 0) { skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index - i].Character)); } else { skill_target.targets.Add(null); } if (target_index + i < target_containers.Count) { skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index + i].Character)); } else { skill_target.targets.Add(null); } } if (skill_target.targets != null) { skill_target.main_target = skill_target.targets[0].Character.transform; character.DoActionEditor(action_list.SelectedIndex, skill_target, false, character.Creature.Scale - 1f, SkillTargetDummy.BuffDuration); if (new_time_skip > 0f) { character.Creature.PlaybackTime += new_time_skip; } } } if ((GUILayout.Button("Play With Camera") || m_Recording == RecordState.WaitingWithCamera && countdown_object.activeInHierarchy == false) && BattleBase.Instance.IsPause == ePauseType.None) { if (m_Recording == RecordState.WaitingWithCamera) { m_Recording = RecordState.Recording; } CharacterContainer action_target = containers[selected_container]; List <CharacterContainer> target_containers = containers.Where(c => c.transform.parent.name == action_target.transform.parent.name).ToList(); SkillTargetContainer skill_target = new SkillTargetContainer(); skill_target.targets = new List <ISkillTarget>(); skill_target.targets.Add(new SkillTargetDummy(character, action_target.Character)); int target_index = target_containers.FindIndex(c => c == action_target); for (int i = 1; i < range; ++i) { if (target_index - i >= 0) { skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index - i].Character)); } else { skill_target.targets.Add(null); } if (target_index + i < target_containers.Count) { skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index + i].Character)); } else { skill_target.targets.Add(null); } } if (skill_target.targets != null) { skill_target.main_target = skill_target.targets[0].Character.transform; character.DoActionEditor(action_list.SelectedIndex, skill_target, true, BattleBase.LightingScaleValue, SkillTargetDummy.BuffDuration); BattleBase.Instance.AddLighting(character.Creature, character.MainAction.FirstActionTime, character.MainAction.Data.Effect.ScaleTime, character.MainAction.Data.Effect.JumpScale); BattleBase.Instance.AddLightingTargets(character.Creature.IsTeam, skill_target.targets, character.Creature); if (new_time_skip > 0f) { character.Creature.PlaybackTime += new_time_skip; } } } if (GUILayout.Button("Cancel")) { character.CancelAction(false); } EditorGUILayout.EndHorizontal(); if (BattleBase.Instance != null) { EditorGUILayout.BeginHorizontal(); BattleBase.Instance.tween_system.DefaultBundleIndex = EditorGUILayout.Popup("tween", BattleBase.Instance.tween_system.DefaultBundleIndex, BattleBase.Instance.tween_system.bundles.Select(b => b.Name).ToArray()); if (GUILayout.Button("Play")) { BattleBase.Instance.tween_system.Play(BattleBase.Instance.tween_system.DefaultBundleIndex, null, character.GetComponent <HFX_TweenSystem>(), character.transform.GetChild(0)); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); if (character.Creature != null) { eInspectorMapCreatureType scale_type = eInspectorMapCreatureType.Normal; if (character.Creature.Scale == 1f) { scale_type = eInspectorMapCreatureType.Normal; } else if (character.Creature.Scale == 1.2f) { scale_type = eInspectorMapCreatureType.Elite; } else if (character.Creature.Scale == 1.4f) { scale_type = eInspectorMapCreatureType.Boss; } eInspectorMapCreatureType new_scale_type = (eInspectorMapCreatureType)EditorGUILayout.EnumPopup("Scale", scale_type); if (scale_type != new_scale_type) { float new_scale = 1f; if (new_scale_type == eInspectorMapCreatureType.Normal) { new_scale = 1f; } else if (new_scale_type == eInspectorMapCreatureType.Elite) { new_scale = 1.2f; } else if (new_scale_type == eInspectorMapCreatureType.Boss) { new_scale = 1.4f; } character.Creature.Scale = new_scale; character.transform.localScale = Vector3.one * new_scale; } character.Creature.IsDead = EditorGUILayout.Toggle("Dead", character.Creature.IsDead); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); List <string> container_names = new List <string>(); container_names.AddRange(containers.Select(c => c.transform.parent.name + "/" + c.name)); container_names.Add("Self"); container_names.Add("Enemy1"); container_names.Add("Enemy5"); container_names.Add("Mine1"); container_names.Add("Mine5"); selected_container = EditorGUILayout.Popup(selected_container, container_names.ToArray()); if (selected_container >= 0 && selected_container < container_names.Count) { switch (container_names[selected_container]) { case "Self": selected_container = container_names.IndexOf(character.transform.parent.parent.name + "/" + character.transform.parent.name); break; case "Mine1": selected_container = container_names.IndexOf("Mine/Character1"); break; case "Mine5": selected_container = container_names.IndexOf("Mine/Character5"); break; case "Enemy1": selected_container = container_names.IndexOf("Enemy/Character1"); break; case "Enemy5": selected_container = container_names.IndexOf("Enemy/Character5"); break; } } EditorPrefs.SetInt("Character_ActionTarget", selected_container); range = EditorGUILayout.IntSlider(range, 1, 5); EditorPrefs.SetInt("Character_ActionRange", range); EditorGUILayout.EndHorizontal(); if (character.PlayingActions.Count > 0) { foreach (var action in character.PlayingActions) { EditorGUILayout.LabelField(string.Format("{0} - {1}", action.Name, action.Length)); } EditorUtility.SetDirty((MonoBehaviour)character); } #if SH_ASSETBUNDLE else if (m_Recording == RecordState.Recording) { m_Recording = RecordState.Finishing; m_RecordFinishTime = Time.time + 3f; BattleTest.Instance.m_RecordTime.SetFinish(); } if (m_Recording == RecordState.Finishing && Time.time > m_RecordFinishTime) { m_Recording = RecordState.None; BattleTest.Instance._capture.StopCapture(); BattleTest.Instance.m_RecordTime.gameObject.SetActive(false); Debug.Log("Record Finished"); } #endif } s_Util.SeparatorToolbar("System", null); if (GUILayout.Button("Set Sound")) { foreach (var action in character.Actions) { string audio_path = string.Format("Assets/Sounds/Character/{0}_{1}.wav", character.name, action.AnimationName); AudioClip audio = AssetDatabase.LoadAssetAtPath(audio_path, typeof(AudioClip)) as AudioClip; if (audio != null) { if (action.Effect.Casting.Length == 0 || action.Effect.Casting[0].time != 0) { var temp_action_list = action.Effect.Casting.ToList(); temp_action_list.Add(new CharacterAction_EffectCasting()); action.Effect.Casting = temp_action_list.ToArray(); } if (action.Effect.Casting[0].sound_list[0].sound == null) { action.Effect.Casting[0].sound_list[0].sound = audio; Debug.LogFormat("Set Sound : {0}", audio.name); } } } } GUILayout.BeginHorizontal(); character.m_DefaultEffect = EditorGUILayout.ObjectField("Default Effect", character.m_DefaultEffect, typeof(HFX_ParticleSystem), false) as HFX_ParticleSystem; if (GUILayout.Button("Add to scene", GUILayout.Width(150f))) { AddParticleSystemToScene(character, character.m_DefaultEffect, 0f); } GUILayout.EndHorizontal(); CharacterActionData selected_action = action_list.OnInspectorGUI(); if (selected_action != null) { selected_action.AnimationName = CharacterAnimationInspector.OnInspectorAnimation(character_animation, selected_action.AnimationName); selected_action.CameraAnimation = EditorGUILayout.ObjectField("Camera Animation", selected_action.CameraAnimation, typeof(AnimationClip), false) as AnimationClip; if (selected_action.CameraAnimation != null) { selected_action.ActionMode = (BattleBase.eActionMode)EditorGUILayout.EnumPopup("ActionMode", selected_action.ActionMode); selected_action.DelayedApply = EditorGUILayout.Toggle("Delayed Apply", selected_action.DelayedApply); } selected_action.Effect.ScaleTime = EditorGUILayout.FloatField("Scale Time", selected_action.Effect.ScaleTime); selected_action.Effect.MoveScale = EditorGUILayout.FloatField("Move Scale", selected_action.Effect.MoveScale); selected_action.Effect.JumpScale = EditorGUILayout.FloatField("Jump Scale", selected_action.Effect.JumpScale); selected_action.Effect.FxHeight = EditorGUILayout.FloatField("Fx Height", selected_action.Effect.FxHeight); selected_action.Effect.UseSingTarget = EditorGUILayout.Toggle("Use Single Target", selected_action.Effect.UseSingTarget); selected_action.Effect.TargetTimeGap = EditorGUILayout.FloatField("Time Gap", selected_action.Effect.TargetTimeGap); selected_action.Effect.TargetTimeGroup = EditorGUILayout.IntField("Time Group", selected_action.Effect.TargetTimeGroup); action_effect_casting_list.character = character; action_effect_casting_list.container = selected_action.Effect; action_effect_casting_list.OnInspectorGUI(); action_effect_target_list.character = character; action_effect_target_list.container = selected_action.Effect; action_effect_target_list.OnInspectorGUI(); action_effect_hit_list.character = character; action_effect_hit_list.container = selected_action.Effect; action_effect_hit_list.OnInspectorGUI(); action_effect_buff_list.character = character; action_effect_buff_list.container = selected_action.Effect; action_effect_buff_list.OnInspectorGUI(); action_effect_camera_list.character = character; action_effect_camera_list.container = selected_action.Effect; action_effect_camera_list.OnInspectorGUI(); } EditorGUILayout.EndVertical(); EditorGUIUtility.labelWidth = 0f; EditorUtility.SetDirty((MonoBehaviour)character); }