对话框
This commit is contained in:
@@ -1346,7 +1346,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 729a2e952309e2547a3747b2cdd9a36f, type: 3}
|
||||
m_Name: ShapesRenderFeature
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 1
|
||||
m_Active: 0
|
||||
--- !u!114 &5440560837828023301
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
@@ -1444,7 +1444,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 9c53165b379c3d94ca34b12cb8eb10f1, type: 3}
|
||||
m_Name: VolFx
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 0
|
||||
m_Active: 1
|
||||
_event: 550
|
||||
_format:
|
||||
enabled: 1
|
||||
@@ -1593,7 +1593,7 @@ MonoBehaviour:
|
||||
enabled: 1
|
||||
value:
|
||||
serializedVersion: 2
|
||||
m_Bits: 2080
|
||||
m_Bits: 2048
|
||||
_source:
|
||||
_source: 1
|
||||
_globalTex: _inputTex
|
||||
|
||||
@@ -673,68 +673,6 @@ MonoBehaviour:
|
||||
configKey:
|
||||
curState:
|
||||
shown: 0
|
||||
--- !u!1 &1639833600533724552
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8231646934124754229}
|
||||
m_Layer: 0
|
||||
m_Name: point1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8231646934124754229
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639833600533724552}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -18.69, y: -0.8780389, z: 0.17592919}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5133231342155857510}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1798749109056220643
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4758456051447362104}
|
||||
m_Layer: 0
|
||||
m_Name: point2
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4758456051447362104
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1798749109056220643}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 8.91642, y: -0.8780389, z: 0.17592919}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5133231342155857510}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2098514882770315859
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -898,65 +836,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4969470428602197235
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5133231342155857510}
|
||||
- component: {fileID: 1678425565379988174}
|
||||
m_Layer: 0
|
||||
m_Name: CharacterSpawner
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &5133231342155857510
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4969470428602197235}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 1.5335798, y: -5.9219613, z: -0.17592919}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8231646934124754229}
|
||||
- {fileID: 4758456051447362104}
|
||||
m_Father: {fileID: 7333995943917754426}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1678425565379988174
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4969470428602197235}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3ff36d886d83ad44fb2a731efee3b46e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
characterPrefabs:
|
||||
- {fileID: 7830587467202021117, guid: e374290142145aa49aca3d0f2f925268, type: 3}
|
||||
- {fileID: 6853557543518115512, guid: 877a0bd4086d355479b6f6737177c32a, type: 3}
|
||||
- {fileID: 753276960053003704, guid: 08806bc91bf9b8642bbe827cb6b48fe1, type: 3}
|
||||
- {fileID: 7821253403148704578, guid: 52af00ac86616dd4da00f41e40611ae6, type: 3}
|
||||
- {fileID: 4522040687628375693, guid: f68b21d02a533714cbc72e4ba4975496, type: 3}
|
||||
spawnPoints:
|
||||
- {fileID: 8231646934124754229}
|
||||
- {fileID: 4758456051447362104}
|
||||
IntervalBetweenWave: {x: 2, y: 4}
|
||||
minSpawnCount: 2
|
||||
maxSpawnCount: 4
|
||||
IntervalBetweenCharacter: {x: 4, y: 6}
|
||||
--- !u!1 &5505251028286205928
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1159,7 +1038,6 @@ Transform:
|
||||
- {fileID: 997395576468173360}
|
||||
- {fileID: 8988582123737961170}
|
||||
- {fileID: 1289813725535206033}
|
||||
- {fileID: 5133231342155857510}
|
||||
- {fileID: 8348444316318293934}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
||||
@@ -14016,7 +14016,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &2035067109
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
+704
-657
File diff suppressed because it is too large
Load Diff
@@ -121,7 +121,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
if (eventData is PointerEventData pointerData)
|
||||
{
|
||||
transform.position = CommonUtil.GetMouseWorldPos(pointerData.position, transform);
|
||||
transform.position = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace AibisDream
|
||||
if (data is not PointerEventData pointerData) return;
|
||||
|
||||
// 计算鼠标位置与分针中心点的向量
|
||||
Vector2 worldPoint = CommonUtil.GetMouseWorldPos(pointerData.position);
|
||||
Vector2 worldPoint = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
Vector2 direction = worldPoint - new Vector2(transform.position.x, transform.position.y);
|
||||
// 计算当前角度
|
||||
float mouseAngle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
|
||||
@@ -7,7 +7,6 @@ using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
@@ -18,6 +17,8 @@ namespace AibisDream.Framework
|
||||
private const int HighPriority = 10;
|
||||
|
||||
#region 相机组件
|
||||
|
||||
private static Camera _mainCam;
|
||||
|
||||
private CinemachineBrain _orthoCameraBrain;
|
||||
private CinemachineBrain _perspectiveCameraBrain;
|
||||
@@ -222,6 +223,27 @@ namespace AibisDream.Framework
|
||||
_perspectiveMainCamera :
|
||||
_orthoMainCamera;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取鼠标在世界中的位置
|
||||
/// </summary>
|
||||
/// <param name="mousePoint">鼠标界面位置</param>
|
||||
/// <returns>世界位置</returns>
|
||||
public static Vector3 GetMouseWorldPos(Vector3 mousePoint)
|
||||
{
|
||||
if (!_mainCam) _mainCam = Camera.main;
|
||||
|
||||
mousePoint.z = 0;
|
||||
return _mainCam.ScreenToWorldPoint(mousePoint);
|
||||
}
|
||||
|
||||
public static Vector3 GetScreenPos(Vector3 worldPos)
|
||||
{
|
||||
if (!_mainCam) _mainCam = Camera.main;
|
||||
|
||||
worldPos.z = 0;
|
||||
return _mainCam.WorldToScreenPoint(worldPos);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CinemachineExtension
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace AibisDream
|
||||
NextYarn,
|
||||
PlugIn,
|
||||
PlugOut,
|
||||
OpenScreen,
|
||||
CloseScreen,
|
||||
SceneLoad,
|
||||
FixStateSwitch,
|
||||
CutStart,
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace AibisDream
|
||||
|
||||
private void SetDragTarget(Vector3 mousePos)
|
||||
{
|
||||
var worldPos = CommonUtil.GetMouseWorldPos(mousePos, transform);
|
||||
var worldPos = CameraKit.GetMouseWorldPos(mousePos);
|
||||
|
||||
var dragY = CommonUtil.Limit(worldPos.y, _initPos.y, _initPos.y - maxDistance);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace AibisDream
|
||||
if (!IsActive) return;
|
||||
// 正常情况下不会出错
|
||||
if (eventData is not PointerEventData pointerData) return;
|
||||
transform.position = CommonUtil.GetMouseWorldPos(pointerData.position, transform);
|
||||
transform.position = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
|
||||
targetShaft?.PlugOutGear();
|
||||
transform.DOPause();
|
||||
@@ -127,7 +127,7 @@ namespace AibisDream
|
||||
// 正常情况下不会出错
|
||||
if (eventData is not PointerEventData pointerData) return;
|
||||
|
||||
transform.position = CommonUtil.GetMouseWorldPos(pointerData.position, transform);
|
||||
transform.position = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
var tempShaft = _gearSystem.CheckClosestShaft(transform.position, radius);
|
||||
if (!tempShaft) return;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace AibisDream
|
||||
|
||||
if (eventData is PointerEventData pointerData)
|
||||
{
|
||||
transform.position = CommonUtil.GetMouseWorldPos(pointerData.position, transform);
|
||||
transform.position = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
UpdateCable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc1856a44ab49a588dbd9deec04c196
|
||||
timeCreated: 1747214459
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28d8f35a42df4a9a961767b891ad14f9
|
||||
timeCreated: 1747214498
|
||||
@@ -1,23 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
[System.Serializable]
|
||||
public class DeepInPlayableAsset : PlayableAsset
|
||||
{
|
||||
public ExposedReference<GameObject> targetObject;
|
||||
public Sprite[] sprites;
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
var playable = ScriptPlayable<DeepInPlayableBehaviour>.Create(graph, 0);
|
||||
var behaviour = playable.GetBehaviour();
|
||||
|
||||
behaviour.targetObject = targetObject.Resolve(graph.GetResolver());
|
||||
behaviour.sprites = sprites;
|
||||
|
||||
return playable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 605cbd24495e41f49b99eaeca6146819
|
||||
timeCreated: 1747215251
|
||||
@@ -1,43 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class DeepInPlayableBehaviour : PlayableBehaviour
|
||||
{
|
||||
public GameObject targetObject;
|
||||
public Sprite[] sprites;
|
||||
|
||||
#region 一些索引
|
||||
|
||||
private SpriteRenderer _renderer1;
|
||||
private SpriteRenderer _renderer2;
|
||||
private int _index;
|
||||
private float _progress;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 循环开始
|
||||
/// </summary>
|
||||
/// <param name="playable"></param>
|
||||
/// <param name="info"></param>
|
||||
public override void OnBehaviourPlay(Playable playable, FrameData info)
|
||||
{
|
||||
_renderer2 = targetObject.transform.Find("Renderer1").GetComponent<SpriteRenderer>();
|
||||
}
|
||||
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
if (targetObject != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnBehaviourPause(Playable playable, FrameData info)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3430f811c8b4e67b317237a954adead
|
||||
timeCreated: 1747216004
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8036b5d104f4f6ea6c2ffdc93451946
|
||||
timeCreated: 1747288555
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class SpriteLoopPlayableAsset : PlayableAsset
|
||||
{
|
||||
public ExposedReference<GameObject> targetObject;
|
||||
public Sprite[] sprites;
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b97eda884604ff5bd906f2a7a4859f1
|
||||
timeCreated: 1747288570
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9cb39e4c7764dcf8f99fe429a8edc19
|
||||
timeCreated: 1749038925
|
||||
@@ -0,0 +1,72 @@
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using Febucci.UI.Core;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class Bubble : MonoBehaviour
|
||||
{
|
||||
private TypewriterCore _typewriter;
|
||||
private TMP_Text _actorName;
|
||||
|
||||
#region 参数
|
||||
|
||||
[SerializeField] public ActorRole role;
|
||||
[SerializeField] public int idx;
|
||||
[SerializeField] private int maxCharNum;
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsShowingText => _typewriter.isShowingText;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_typewriter = GetComponentInChildren<TypewriterCore>();
|
||||
_actorName = transform.Find("Actor")?.GetComponent<TMP_Text>();
|
||||
_typewriter.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShown));
|
||||
}
|
||||
|
||||
public void ShowActorName(CharacterVo characterVo)
|
||||
{
|
||||
if (!_actorName) return;
|
||||
|
||||
_actorName.text = string.IsNullOrEmpty(characterVo.GetActorName())
|
||||
? string.Empty
|
||||
: characterVo.GetActorName();
|
||||
}
|
||||
|
||||
public void ShowLine(string line)
|
||||
{
|
||||
_typewriter.TextAnimator.SetText("");
|
||||
gameObject.SetActive(true);
|
||||
var formattedLine = CommonUtil.SplitString(line, maxCharNum);
|
||||
_typewriter.ShowText(formattedLine);
|
||||
}
|
||||
|
||||
public void SkipLine()
|
||||
{
|
||||
if (_typewriter.isShowingText)
|
||||
{
|
||||
_typewriter.SkipTypewriter();
|
||||
}
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnLocalizationChanged(string value)
|
||||
{
|
||||
var textParam = JsonUtil.ReadBeanByText<TextParam>(value);
|
||||
var tmp = GetComponentInChildren<TMP_Text>();
|
||||
|
||||
tmp.characterSpacing = textParam.charSpace;
|
||||
_actorName.characterSpacing = textParam.charSpace;
|
||||
maxCharNum = textParam.maxCharNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6adb9d7cc075457a8fece1b14ca4c429
|
||||
timeCreated: 1749022700
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleGroup : MonoBehaviour, IDialogView
|
||||
{
|
||||
private BubbleOption[] _options;
|
||||
private Dictionary<ActorRole, Bubble[]> _bubbleDict;
|
||||
|
||||
#region 一些索引
|
||||
|
||||
private Action _nextStep;
|
||||
private Bubble _curBubble;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 生命周期
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 注册泡泡
|
||||
EnumEventSystem.Global.Register(DialogEventEnum.OptionSelected, HideOptions);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
HideDialog();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
EnumEventSystem.Global.UnRegister(DialogEventEnum.OptionSelected, HideOptions);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 对话框功能实现
|
||||
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId,
|
||||
bool isAutoSkip = false)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (TryGetBubble(character.role, character.bubbleIdx, out var bubble))
|
||||
{
|
||||
bubble.ShowActorName(character);
|
||||
bubble.ShowLine(dialogLine);
|
||||
// 将非选定的Bubble隐藏
|
||||
HideDialog(bubble);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"{character.GetActorName()}的Role没有对应Bubble");
|
||||
return;
|
||||
}
|
||||
|
||||
// 保留信息
|
||||
_nextStep = nextStep;
|
||||
_curBubble = bubble;
|
||||
}
|
||||
|
||||
public void ShowOptions(DialogOption[] dialogueOptions)
|
||||
{
|
||||
HideDialog();
|
||||
// 要求最多三个选项
|
||||
for (var i = 0; i < dialogueOptions.Length; i++)
|
||||
{
|
||||
_options[i].ShowOption(dialogueOptions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void HideDialog()
|
||||
{
|
||||
foreach (var textBubble in _bubbleDict.Values.SelectMany(inner => inner))
|
||||
{
|
||||
textBubble.Hide();
|
||||
}
|
||||
|
||||
HideOptions();
|
||||
}
|
||||
|
||||
public bool TrySkipLine(bool isForceSkip = false)
|
||||
{
|
||||
if (_curBubble.IsShowingText)
|
||||
{
|
||||
_curBubble.SkipLine();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void NextStep()
|
||||
{
|
||||
if (_nextStep == null) return;
|
||||
|
||||
EnumEventSystem.Global.Send(DialogEventEnum.LineEnd);
|
||||
var next = _nextStep;
|
||||
_nextStep = null;
|
||||
|
||||
_curBubble?.Hide();
|
||||
|
||||
next?.Invoke();
|
||||
}
|
||||
|
||||
public void OnLocalizationChanged(string value)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void HideDialog(Bubble activeBubble)
|
||||
{
|
||||
foreach (var textBubble in _bubbleDict.Values.SelectMany(inner => inner))
|
||||
{
|
||||
if (activeBubble != textBubble)
|
||||
{
|
||||
textBubble.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
HideOptions();
|
||||
}
|
||||
|
||||
private bool TryGetBubble(ActorRole role, int idx, out Bubble bubble)
|
||||
{
|
||||
if (_bubbleDict.TryGetValue(role, out var bubbles))
|
||||
{
|
||||
bubble = bubbles.FirstOrDefault(item => item.idx == idx);
|
||||
return bubble != null;
|
||||
}
|
||||
|
||||
bubble = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void HideOptions()
|
||||
{
|
||||
foreach (var option in _options)
|
||||
{
|
||||
option.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a76234ef7ee34400b306a4823081ba62
|
||||
timeCreated: 1749022020
|
||||
@@ -0,0 +1,37 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleOption : MonoBehaviour
|
||||
{
|
||||
public int optionIdx;
|
||||
private TMP_Text _text;
|
||||
private DialogOption _option;
|
||||
private Button _button;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
_text = GetComponent<TMP_Text>();
|
||||
}
|
||||
|
||||
public void ShowOption(DialogOption dialogOption)
|
||||
{
|
||||
_button.onClick.RemoveAllListeners();
|
||||
_text.text = "";
|
||||
// 清理旧数据
|
||||
gameObject.SetActive(true);
|
||||
_text.text = dialogOption.Line;
|
||||
_button.onClick.AddListener(() =>
|
||||
{
|
||||
dialogOption.Select();
|
||||
});
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 468ec4615ee64b2cb5ef8b1a66339dac
|
||||
timeCreated: 1749024963
|
||||
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleOptionSlot : MonoBehaviour
|
||||
{
|
||||
private BubbleOptionSlotData _data;
|
||||
|
||||
public BubbleOptionSlotData Data
|
||||
{
|
||||
get
|
||||
{
|
||||
_data.slotPosition = transform.position;
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct BubbleOptionSlotData
|
||||
{
|
||||
[HideInInspector] public Vector3 slotPosition;
|
||||
public int optionIdx;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1a72c4bf33546244b7030c41b1b2b05
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleSlot : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private BubbleSlotData data;
|
||||
|
||||
public BubbleSlotData Data
|
||||
{
|
||||
get
|
||||
{
|
||||
data.slotPosition = CameraKit.GetScreenPos(transform.position);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct BubbleSlotData
|
||||
{
|
||||
[HideInInspector] public Vector3 slotPosition;
|
||||
public ActorRole actorRole;
|
||||
public int idx;
|
||||
public bool hasActorName;
|
||||
public int maxCharNum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbc0dde0e8b8a9c498545e1b5b508241
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class BubbleSlotGroup
|
||||
{
|
||||
public BubbleSlotGroupData data;
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct BubbleSlotGroupData
|
||||
{
|
||||
public DialogViewType dialogViewType;
|
||||
[HideInInspector] public BubbleSlotData[] bubbleSlots;
|
||||
[HideInInspector] public BubbleOptionSlotData[] bubbleOptionSlots;
|
||||
}
|
||||
|
||||
public enum PivotType {
|
||||
Center,
|
||||
CenterLeft,
|
||||
CenterRight,
|
||||
Top,
|
||||
Bottom
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8225446392f64688813d628ffb56cc7c
|
||||
timeCreated: 1749042853
|
||||
@@ -18,18 +18,12 @@ namespace AibisDream
|
||||
private Action _nextStep;
|
||||
|
||||
#endregion
|
||||
|
||||
private bool _skipLineDelay;
|
||||
|
||||
private TextParam _textParam;
|
||||
|
||||
[Header("跳过阻塞延迟时间/ms")] [SerializeField]
|
||||
private int delayTime = 300;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitComponents();
|
||||
AddSomeListener();
|
||||
}
|
||||
|
||||
private void InitComponents()
|
||||
@@ -37,16 +31,6 @@ namespace AibisDream
|
||||
_dialogText = transform.Find("Dialog Text")?.gameObject.GetComponent<TypewriterByCharacter>();
|
||||
}
|
||||
|
||||
private void AddSomeListener()
|
||||
{
|
||||
// 对话显示后有一段延时不可跳过
|
||||
_dialogText.onTypewriterStart.AddListener(() =>
|
||||
{
|
||||
_skipLineDelay = true;
|
||||
_ = CommonUtil.Delay(delayTime, () => { _skipLineDelay = false; });
|
||||
});
|
||||
}
|
||||
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId, bool isAutoSkip = false)
|
||||
{
|
||||
// 把原有对话清掉
|
||||
@@ -75,11 +59,6 @@ namespace AibisDream
|
||||
|
||||
public bool TrySkipLine(bool isForceSkip)
|
||||
{
|
||||
if (_skipLineDelay && !isForceSkip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_dialogText.isShowingText)
|
||||
{
|
||||
_dialogText.SkipTypewriter();
|
||||
|
||||
@@ -15,8 +15,6 @@ namespace AibisDream
|
||||
private IDialogView _defaultView;
|
||||
private IDialogView _showingView;
|
||||
|
||||
public TempTextBox tempText;
|
||||
|
||||
private IActionController _autoNext;
|
||||
private IActionController _block;
|
||||
private IActionController _hideDialog;
|
||||
@@ -50,10 +48,6 @@ namespace AibisDream
|
||||
RegisterDialogView(DialogViewType.CenterText, centerText);
|
||||
var centerOption = transform.Find("Center Option").GetComponent<IDialogView>();
|
||||
RegisterDialogView(DialogViewType.CenterOption, centerOption);
|
||||
if (tempText != null)
|
||||
{
|
||||
RegisterDialogView(DialogViewType.Temp, tempText);
|
||||
}
|
||||
|
||||
_defaultView = _dialogViewDict[DialogViewType.OldBox];
|
||||
}
|
||||
@@ -205,7 +199,7 @@ namespace AibisDream
|
||||
// 根据状况选择不同的选择框
|
||||
if (viewType == DialogViewType.Default)
|
||||
{
|
||||
if (_showingView != _dialogViewDict[DialogViewType.OldBox])
|
||||
if (_showingView != _defaultView)
|
||||
{
|
||||
_showingView?.HideDialog();
|
||||
}
|
||||
@@ -214,12 +208,13 @@ namespace AibisDream
|
||||
_hideDialog?.Deinit();
|
||||
_hideDialog = null;
|
||||
}
|
||||
_showingView = _defaultView;
|
||||
|
||||
_dialogViewDict[DialogViewType.OldBox].ShowOptions(dialogueOptions);
|
||||
_showingView.ShowOptions(dialogueOptions);
|
||||
}
|
||||
else
|
||||
else if(_dialogViewDict.TryGetValue(viewType, out var view))
|
||||
{
|
||||
if (_showingView != _dialogViewDict[viewType])
|
||||
if (_showingView != view)
|
||||
{
|
||||
_showingView?.HideDialog();
|
||||
}
|
||||
@@ -228,8 +223,8 @@ namespace AibisDream
|
||||
_hideDialog?.Deinit();
|
||||
_hideDialog = null;
|
||||
}
|
||||
|
||||
_dialogViewDict[viewType].ShowOptions(dialogueOptions);
|
||||
_showingView = view;
|
||||
_showingView.ShowOptions(dialogueOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,6 +314,7 @@ namespace AibisDream
|
||||
CenterText,
|
||||
CenterOption,
|
||||
Task,
|
||||
Temp
|
||||
ClinicBubble,
|
||||
ModuleBubble
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
@@ -14,14 +13,10 @@ namespace AibisDream
|
||||
|
||||
#region 一些索引
|
||||
|
||||
private bool _skipLineDelay;
|
||||
private Action _nextStep;
|
||||
|
||||
private TextBubble _curBubble;
|
||||
|
||||
[Header("跳过阻塞延迟时间/ms")] [SerializeField]
|
||||
private int delayTime = 300;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 初始化
|
||||
@@ -60,9 +55,6 @@ namespace AibisDream
|
||||
if (TryGetBubble(character.role, character.bubbleIdx ,out var bubble))
|
||||
{
|
||||
bubble.ShowLine(dialogLine, OnTextShowed);
|
||||
// 设置延时
|
||||
_skipLineDelay = true;
|
||||
_ = CommonUtil.Delay(delayTime, () => { _skipLineDelay = false; });
|
||||
// 将非选定的Bubble隐藏
|
||||
HideDialog(bubble);
|
||||
}
|
||||
@@ -103,11 +95,6 @@ namespace AibisDream
|
||||
|
||||
public bool TrySkipLine(bool isForceSkip)
|
||||
{
|
||||
if (_skipLineDelay && !isForceSkip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_curBubble.IsShowingText)
|
||||
{
|
||||
_curBubble.SkipLine();
|
||||
|
||||
@@ -102,33 +102,6 @@ namespace AibisDream.Utility
|
||||
return newTarget;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取鼠标在世界中的位置
|
||||
/// </summary>
|
||||
/// <param name="mousePoint">鼠标界面位置</param>
|
||||
/// <param name="transform">物体形状</param>
|
||||
/// <returns>世界位置</returns>
|
||||
public static Vector3 GetMouseWorldPos(Vector3 mousePoint, Transform transform)
|
||||
{
|
||||
if (!_mainCam) _mainCam = Camera.main;
|
||||
|
||||
mousePoint.z = _mainCam.WorldToScreenPoint(transform.position).z;
|
||||
return _mainCam.ScreenToWorldPoint(mousePoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取鼠标在世界中的位置
|
||||
/// </summary>
|
||||
/// <param name="mousePoint">鼠标界面位置</param>
|
||||
/// <returns>世界位置</returns>
|
||||
public static Vector3 GetMouseWorldPos(Vector3 mousePoint)
|
||||
{
|
||||
if (!_mainCam) _mainCam = Camera.main;
|
||||
|
||||
mousePoint.z = 0;
|
||||
return _mainCam.ScreenToWorldPoint(mousePoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性复制
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user