添加转场

This commit is contained in:
2024-08-18 11:40:17 +08:00
parent 33bed58bfc
commit 5454569fb1
9 changed files with 144 additions and 27 deletions
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 560a88da2bbc70140bed167f0ba7fe37
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fb01be13d6e88ca488dda82150319bfc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 117dcc671050f5247bd8743b91ecaab7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+78 -2
View File
@@ -1188,7 +1188,7 @@ GameObject:
- component: {fileID: 731599310}
- component: {fileID: 731599309}
m_Layer: 5
m_Name: Background
m_Name: TV Scene
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -1251,6 +1251,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 731599307}
m_CullTransparentMesh: 1
--- !u!1 &761395782
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 761395783}
- component: {fileID: 761395785}
- component: {fileID: 761395784}
m_Layer: 5
m_Name: Fade Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &761395783
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 761395782}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 984233631}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &761395784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 761395782}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &761395785
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 761395782}
m_CullTransparentMesh: 1
--- !u!1 &973075152
GameObject:
m_ObjectHideFlags: 0
@@ -1391,6 +1466,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 731599308}
- {fileID: 761395783}
m_Father: {fileID: 1343879457}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -1708,9 +1784,9 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1604842429}
- {fileID: 984233631}
- {fileID: 1788453626}
- {fileID: 1604842429}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1557925019
@@ -1,27 +1,23 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Yarn.Markup;
using Yarn.Unity;
namespace AibisDream
{
public class CommandOptionView : DialogueViewBase
{
// 进入指令选项模式
// 进入指令选项模式
private bool isInCommand;
private string commandName;
public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
{
// 判断是否进入Command状态
// 判断是否进入Command状态
isInCommand = dialogueLine.Text.TryGetCommandAttr(out var name);
if (isInCommand)
{
// 保存指令
// 保存指令
commandName = name;
// 进入下一步
// 进入下一步
onDialogueLineFinished.Invoke();
}
else
@@ -32,14 +28,14 @@ namespace AibisDream
public override void RunOptions(DialogueOption[] dialogueOptions, Action<int> onOptionSelected)
{
// 非指令直接跳过
// 非指令直接跳过
if (!isInCommand)
{
base.RunOptions(dialogueOptions, onOptionSelected);
return;
}
// 传输选项
// 传输选项
YarnOption[] options = YarnOption.GeneOptions(dialogueOptions, onOptionSelected);
DialogController.Instance.InvokeOptionCommand(commandName, options);
commandName = null;
@@ -12,7 +12,7 @@ namespace AibisDream
{
private DialogueRunner dialogueRunner;
private Dictionary<string, Action<YarnOption[]>> commandMap = new Dictionary<string, Action<YarnOption[]>>();
private Dictionary<string, Action<YarnOption[]>> commandMap;
private void Start()
{
+1 -1
View File
@@ -8,7 +8,7 @@ namespace AibisDream
{
public class LineView : DialogueViewBase
{
// ½øÈëÖ¸ÁîÑ¡Ïîģʽ
// 进入指令选项模式
private bool isInCommand;
public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
+7 -7
View File
@@ -19,7 +19,7 @@ namespace AibisDream
}
/// <summary>
/// 选项中的文字
/// 选项中的文字
/// </summary>
public string Text
{
@@ -30,13 +30,13 @@ namespace AibisDream
}
/// <summary>
/// 选择该选项
/// 选择该选项
/// </summary>
public void SelectOption()
{
if (onOptionSelected == null)
{
Debug.LogWarning($"选项 {Text} 已经执行过了");
Debug.LogWarning($"选项 {Text} 已经执行过了");
}
else
{
@@ -46,11 +46,11 @@ namespace AibisDream
}
/// <summary>
/// 生成选项
/// 生成选项
/// </summary>
/// <param name="options">原始选项</param>
/// <param name="onOptionSelected">选择</param>
/// <returns>包装选项</returns>
/// <param name="options">原始选项</param>
/// <param name="onOptionSelected">选择</param>
/// <returns>包装选项</returns>
public static YarnOption[] GeneOptions(DialogueOption[] options, Action<int> onOptionSelected)
{
YarnOption[] yarnOptions = new YarnOption[options.Length];
+30 -6
View File
@@ -1,20 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace AibisDream
{
public class MainUIController : Singleton<MainUIController>
{
private const string TVScene = "TV Scene";
private const string FadeImage = "Fade Image";
#region
private Image _tvScene;
private Image _fadeImage;
#endregion
protected override void Awake()
{
InitChildObj();
}
public void FadeIn()
{
}
public IEnumerator FadeInSync()
{
yield return null;
}
public void HideMainUI()
{
gameObject.SetActive(false);
}
public void ShowMainUI()
private void InitChildObj()
{
gameObject.SetActive(true);
_tvScene = transform.Find(TVScene).gameObject.GetComponent<Image>();
_fadeImage = transform.Find(FadeImage).gameObject.GetComponent<Image>();
}
}
}
}