diff --git a/Assets/RawResources/Cursor/disabled.png b/Assets/RawResources/Cursor/disabled.png index 3eea3f27d..4182ce4f5 100644 --- a/Assets/RawResources/Cursor/disabled.png +++ b/Assets/RawResources/Cursor/disabled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68f763ec85810ad83e900c72ceda973d64bd1e033cb5eeff2775041b5e5a85fb -size 562 +oid sha256:2112c578f26fa76fb099e50212cf99d961396d553de356d7a225844b51892f4a +size 724 diff --git a/Assets/RawResources/Cursor/hand_closed.png b/Assets/RawResources/Cursor/hand_closed.png index 6b3943fe7..ae8f17c85 100644 --- a/Assets/RawResources/Cursor/hand_closed.png +++ b/Assets/RawResources/Cursor/hand_closed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:248611743a1ba4395b2d1b44a97d1bdbe94ab5416954150aeab626682e8bde02 -size 436 +oid sha256:784464e54d60d0da08ba7c46fafbe0862f40d248e31d8fdf2fd2967b950c3d0b +size 552 diff --git a/Assets/RawResources/Cursor/hand_open.png b/Assets/RawResources/Cursor/hand_open.png index 88bae4d2a..f8bcf88c4 100644 --- a/Assets/RawResources/Cursor/hand_open.png +++ b/Assets/RawResources/Cursor/hand_open.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d01a038ab94c0d6e21448c97d58760a688aedf2cd09d5367f72fc6a9d9ca0fc -size 507 +oid sha256:1ece0f4b5305f0308c044dd84da11b21a05d05af5e0ffd8e4d05442736110133 +size 639 diff --git a/Assets/RawResources/Cursor/hand_point_n.png b/Assets/RawResources/Cursor/hand_point_n.png index 58a3aa0be..d7c88a8fe 100644 --- a/Assets/RawResources/Cursor/hand_point_n.png +++ b/Assets/RawResources/Cursor/hand_point_n.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9accfcb302483c7fac73a0a98bd3f8f2e999ce4543afd77a26acd48f12dc0f50 -size 423 +oid sha256:65697d38d26efa9a0db9ccba2b280449a973811943bf4f8ec51c67ca06b76283 +size 541 diff --git a/Assets/RawResources/Cursor/look_c.png b/Assets/RawResources/Cursor/look_c.png index ce6465467..9455f1bc4 100644 --- a/Assets/RawResources/Cursor/look_c.png +++ b/Assets/RawResources/Cursor/look_c.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a69fd89dcbef76c34aa4a8122b9a7dfce5e7716aeb8255299da3dd69e42600cb -size 543 +oid sha256:ebdce1f5f7db9913b48ab541579d57eae60008ae01fecfb37661db82a45487dc +size 676 diff --git a/Assets/RawResources/Cursor/message_dots_square.png b/Assets/RawResources/Cursor/message_dots_square.png index 7a092a5b8..3357c6398 100644 --- a/Assets/RawResources/Cursor/message_dots_square.png +++ b/Assets/RawResources/Cursor/message_dots_square.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:df0e704e4125c4fa7634750880451d5afe397a666a141945b72114e06d532b85 -size 353 +oid sha256:5e85d670d52effc4352690d3fdef8d8c52f3e977523c55556b979be57b8729a3 +size 436 diff --git a/Assets/RawResources/Cursor/message_next.png b/Assets/RawResources/Cursor/message_next.png new file mode 100644 index 000000000..69945e5b0 --- /dev/null +++ b/Assets/RawResources/Cursor/message_next.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60ea3d89d562570c74a74fe175c2caee6c5f76d20867ec3fd13d75c4271a9d29 +size 952 diff --git a/Assets/RawResources/Cursor/message_square_next.png.meta b/Assets/RawResources/Cursor/message_next.png.meta similarity index 100% rename from Assets/RawResources/Cursor/message_square_next.png.meta rename to Assets/RawResources/Cursor/message_next.png.meta diff --git a/Assets/RawResources/Cursor/message_square_next.png b/Assets/RawResources/Cursor/message_square_next.png deleted file mode 100644 index 163738cc9..000000000 --- a/Assets/RawResources/Cursor/message_square_next.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f8f69be3527421e14926020bf3ee985094ec479481a7282006a0cbd21fbb36c5 -size 755 diff --git a/Assets/RawResources/Cursor/pointer_c.png b/Assets/RawResources/Cursor/pointer_c.png index 61a892ea4..8bc579053 100644 --- a/Assets/RawResources/Cursor/pointer_c.png +++ b/Assets/RawResources/Cursor/pointer_c.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c148f84d848c6fa42adb2e15b6b2e14bab9475cec36f23f57df2bcaaf0a9b1af -size 383 +oid sha256:2333c0f0c23f4103cf0bea547f8008adba225c6f66920098aed353e25dabd93b +size 461 diff --git a/Assets/Resources/Art/Cursor/Cursor Atlas.spriteatlasv2 b/Assets/Resources/Art/Cursor/Cursor Atlas.spriteatlasv2 index 87571e2ca..a1d73018c 100644 --- a/Assets/Resources/Art/Cursor/Cursor Atlas.spriteatlasv2 +++ b/Assets/Resources/Art/Cursor/Cursor Atlas.spriteatlasv2 @@ -17,5 +17,5 @@ SpriteAtlasAsset: - {fileID: 2800000, guid: 66a05b2333c3fa644a843877ae9da3bd, type: 3} - {fileID: 2800000, guid: acc8d5eb5db1c184ba494e0142fa4d85, type: 3} - {fileID: 2800000, guid: c79f612e713a64245b3c78d6ac145b52, type: 3} - - {fileID: 2800000, guid: 3bdd9ca7d32af494fb1a336b1258c780, type: 3} + - {fileID: 21300000, guid: 3bdd9ca7d32af494fb1a336b1258c780, type: 3} m_IsVariant: 0 diff --git a/Assets/Scenes/Persistence.unity b/Assets/Scenes/Persistence.unity index 4c17c2bd0..057bbcc00 100644 --- a/Assets/Scenes/Persistence.unity +++ b/Assets/Scenes/Persistence.unity @@ -10145,6 +10145,7 @@ MonoBehaviour: defaultCursor: {fileID: 21300000, guid: 69e8ac6bfd4e13b4991bc41c753333a5, type: 3} nextTalk: {fileID: 21300000, guid: 30fbfe292e9612d49b4b769609614868, type: 3} talking: {fileID: 21300000, guid: 6e52eb8333e54ec42a101210cb6b4264, type: 3} + option: {fileID: 21300000, guid: 36cede42403990247aced1b45d623dd5, type: 3} interactive: {fileID: 21300000, guid: 66a05b2333c3fa644a843877ae9da3bd, type: 3} holding: {fileID: 21300000, guid: acc8d5eb5db1c184ba494e0142fa4d85, type: 3} disable: {fileID: 21300000, guid: c79f612e713a64245b3c78d6ac145b52, type: 3} @@ -19637,9 +19638,9 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 928, y: -572} - m_SizeDelta: {x: 64, y: 64} - m_Pivot: {x: 0, y: 0} + m_AnchoredPosition: {x: 1224.8, y: -582.3} + m_SizeDelta: {x: 128, y: 128} + m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2006133631 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Dialog System/DialogueInterrupter.cs b/Assets/Scripts/Dialog System/DialogueInterrupter.cs deleted file mode 100644 index e47da143d..000000000 --- a/Assets/Scripts/Dialog System/DialogueInterrupter.cs +++ /dev/null @@ -1,37 +0,0 @@ -using AibisDream; -using UnityEngine; -using Yarn.Unity; - -public class DialogueInterrupter : MonoBehaviour -{ - //public DialogueRunner originalDialogueRunner; // 原始 DialogueRunner - public DialogueRunner newDialogueRunnerPrefab; // 新的 DialogueRunner 预制体 - public YarnProject originalProject; // 原始 YarnProject - public YarnProject newProject; // 新的 YarnProject - - // 触发新对话并启动新的 DialogueRunner - public void StartNewDialogue(string nodeName) - { - // 创建新的 DialogueRunner 实例 - DialogueRunner newDialogueRunner = Instantiate(newDialogueRunnerPrefab); - - // 将新的 YarnProject 分配给新的 DialogueRunner - newDialogueRunner.yarnProject = newProject; - - // 开始新的对话 - newDialogueRunner.StartDialogue(nodeName); - - // 可选:关闭原始对话或保持原对话继续运行 - //originalDialogueRunner.Stop(); - } - - // 恢复原始对话 - // public void RestoreOriginalDialogue() - // { - // // 恢复原始 DialogueRunner - // originalDialogueRunner.StartDialogue("StartNode"); - - // // 你可以选择关闭新对话的 DialogueRunner,或保留它继续运行 - // Destroy(newDialogueRunnerPrefab.gameObject); // 删除新对话的 Runner 实例 - // } -} diff --git a/Assets/Scripts/Dialog System/DialogueInterrupter.cs.meta b/Assets/Scripts/Dialog System/DialogueInterrupter.cs.meta deleted file mode 100644 index f48310ecb..000000000 --- a/Assets/Scripts/Dialog System/DialogueInterrupter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 90a05456e1a9b4444b6c99e5b2d34d1e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Dialog System/LineView.cs b/Assets/Scripts/Dialog System/LineView.cs index 0650ea027..46a1db8cb 100644 --- a/Assets/Scripts/Dialog System/LineView.cs +++ b/Assets/Scripts/Dialog System/LineView.cs @@ -21,7 +21,7 @@ namespace AibisDream return; } - EnumEventSystem.Global.Send(EventEnum.DialogLine, DialogLine.GetLine(dialogueLine)); + EnumEventSystem.Global.Send(DialogEventEnum.LineStart, DialogLine.GetLine(dialogueLine)); Action jumpVoice = SkipVoice; HandleLineOutput(dialogueLine, jumpVoice, onDialogueLineFinished); @@ -62,7 +62,8 @@ namespace AibisDream base.RunOptions(dialogueOptions, onOptionSelected); return; } - + + EnumEventSystem.Global.Send(DialogEventEnum.OptionShow); var options = DialogOption.GeneOptions(dialogueOptions, onOptionSelected); DialogCanvasManager.GetCurView().ShowOptions(options); } @@ -85,5 +86,21 @@ namespace AibisDream requestInterrupt?.Invoke(); } } + + /// + /// 跳到下一句 + /// + public void JumpLine() + { + if (_isInCommand) + { + return; + } + + if (DialogController.Instance.IsBlock) + { + return; + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Game Loop/EventEnums.cs b/Assets/Scripts/Game Loop/EventEnums.cs index 85c751477..6978843dc 100644 --- a/Assets/Scripts/Game Loop/EventEnums.cs +++ b/Assets/Scripts/Game Loop/EventEnums.cs @@ -7,11 +7,21 @@ namespace AibisDream public enum EventEnum { NextYarn, - DialogLine, + DialogOption, PlugIn, PlugOut } + public enum DialogEventEnum + { + LineStart, + OptionShow, + OptionSelected, + LineShowed, + LineEnd, + Command + } + public struct DialogLine { public bool isOption; diff --git a/Assets/Scripts/UI/Cursor/CursorManager.cs b/Assets/Scripts/UI/Cursor/CursorManager.cs index 6ad64bf2d..0671e38ea 100644 --- a/Assets/Scripts/UI/Cursor/CursorManager.cs +++ b/Assets/Scripts/UI/Cursor/CursorManager.cs @@ -8,7 +8,7 @@ namespace AibisDream public class CursorManager : MonoBehaviour { [Header("指针图片")] public Sprite defaultCursor; - public Sprite nextTalk, talking, interactive, holding, disable, eye; + public Sprite nextTalk, talking, option, interactive, holding, disable, eye; private Image _cursor; private RectTransform _cursorCanvas; @@ -52,21 +52,36 @@ namespace AibisDream private void RegisterEvent() { // 此处监听所有可能对鼠标状态产生影响的事件 + // 对话相关 + EnumEventSystem.Global.Register(DialogEventEnum.LineStart, OnDialogLineStart); + EnumEventSystem.Global.Register(DialogEventEnum.OptionShow, () => SwitchCursorImage(option)); + } - private void Update() + private void LateUpdate() { - var mousePos = Input.mousePosition; // 获取鼠标指针在UI Camera上的位置 - RectTransformUtility.ScreenPointToLocalPointInRectangle(_cursorCanvas, mousePos, + RectTransformUtility.ScreenPointToLocalPointInRectangle(_cursorCanvas, Input.mousePosition, CameraKit.Instance.uiCamera, out var worldPos); - - _cursor.transform.localPosition = worldPos; + + _cursor.rectTransform.localPosition = worldPos; } private void SwitchCursorImage(Sprite sprite) { _cursor.sprite = sprite; } + + private void OnDialogLineStart(DialogLine line) + { + // 对话指针 + if (!line.isOption) SwitchCursorImage(talking); + } + + private void OnDialogLineEnd() + { + // 下一句指针 + SwitchCursorImage(nextTalk); + } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs b/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs index 9e1da4ee6..981d18ad4 100644 --- a/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs +++ b/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs @@ -1,11 +1,11 @@ using System; +using AibisDream.Framework; using AibisDream.Kit; using AibisDream.Utility; using Febucci.UI; using TMPro; using UnityEngine; using UnityEngine.UI; -using Yarn.Unity; namespace AibisDream { @@ -105,12 +105,11 @@ namespace AibisDream ShowActorName(character); dialogText.ShowText(dialogLine); - // TODO 如果有头像的对话框要加入头像处理 - // 自动跳过的回调很难独立Remove,只能全部清空再注册,下策 dialogText.onTextShowed.RemoveAllListeners(); dialogText.onTextShowed.AddListener(() => nextArray.gameObject.SetActive(true)); dialogText.onTextShowed.AddListener(() => onTextShowed?.Invoke()); + dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShowed)); // 执行自动跳过结局 if (isAutoSkip) @@ -119,11 +118,15 @@ namespace AibisDream } } + public virtual void NextStep() + { + + } + /// /// 展示选项 /// /// 对话选项 - /// 选项选择 public virtual void ShowOptions(DialogOption[] dialogueOptions) { gameObject.SetActive(true); diff --git a/Assets/Scripts/UI/DialogUI/DialogBubbleViewer.cs b/Assets/Scripts/UI/DialogUI/DialogBubbleViewer.cs index 49c2e974b..a5567d2dc 100644 --- a/Assets/Scripts/UI/DialogUI/DialogBubbleViewer.cs +++ b/Assets/Scripts/UI/DialogUI/DialogBubbleViewer.cs @@ -72,6 +72,11 @@ namespace AibisDream return _currentView == null || _currentView.TrySkipLine(); } + public void NextStep() + { + throw new NotImplementedException(); + } + private IDialogView SelectBubbleByCharacter(CharacterVo characterVo) { var targetBubble = characterVo.role switch diff --git a/Assets/Scripts/UI/DialogUI/DialogCanvasManager.cs b/Assets/Scripts/UI/DialogUI/DialogCanvasManager.cs index 4cfab1f66..cb2e13812 100644 --- a/Assets/Scripts/UI/DialogUI/DialogCanvasManager.cs +++ b/Assets/Scripts/UI/DialogUI/DialogCanvasManager.cs @@ -40,7 +40,8 @@ namespace AibisDream private void InitEvent() { - _rmvList.Add(EnumEventSystem.Global.Register(EventEnum.DialogLine, AddDialogueLine)); + _rmvList.Add(EnumEventSystem.Global.Register(DialogEventEnum.LineStart, AddDialogueLine)); + _rmvList.Add(EnumEventSystem.Global.Register(DialogEventEnum.OptionSelected, AddDialogueLine)); _rmvList.Add(EnumEventSystem.Global.Register(EventEnum.NextYarn, CleanDialogHistory)); } diff --git a/Assets/Scripts/UI/DialogUI/DialogOldBox.cs b/Assets/Scripts/UI/DialogUI/DialogOldBox.cs deleted file mode 100644 index 870652df0..000000000 --- a/Assets/Scripts/UI/DialogUI/DialogOldBox.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace AibisDream -{ - public class DialogOldBox : DialogBoxBase - { - private void OnEnable() - { - DialogController.OnDialogueComplete += HideDialog; - } - - private void OnDisable() - { - DialogController.OnDialogueComplete -= HideDialog; - } - } -} - diff --git a/Assets/Scripts/UI/DialogUI/DialogOldBox.cs.meta b/Assets/Scripts/UI/DialogUI/DialogOldBox.cs.meta deleted file mode 100644 index af979d7eb..000000000 --- a/Assets/Scripts/UI/DialogUI/DialogOldBox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2f063fd2d0404e04a809d7614c5b7532 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UI/DialogUI/IDialogView.cs b/Assets/Scripts/UI/DialogUI/IDialogView.cs index 0d9ef0a34..0081d8899 100644 --- a/Assets/Scripts/UI/DialogUI/IDialogView.cs +++ b/Assets/Scripts/UI/DialogUI/IDialogView.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using AibisDream.Framework; using AibisDream.Kit; @@ -19,6 +18,8 @@ namespace AibisDream public void HideDialog(); public bool TrySkipLine(); + + public void NextStep(); } public struct DialogOption @@ -40,7 +41,7 @@ namespace AibisDream return; } - EnumEventSystem.Global.Send(EventEnum.DialogLine, TransToLine()); + EnumEventSystem.Global.Send(DialogEventEnum.OptionSelected, TransToLine()); _onOptionSelected.Invoke(_option.DialogueOptionID); }