完善对话窗口的透明度设置
This commit is contained in:
parent
306f40ad68
commit
57649da490
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using DataTable;
|
||||
using Definition;
|
||||
using Definition.Enum;
|
||||
using Event;
|
||||
using GameFramework.DataTable;
|
||||
|
|
@ -16,7 +17,7 @@ namespace CustomComponent
|
|||
#region Property
|
||||
|
||||
[SerializeField] private float _playingSpeed = 1.0f;
|
||||
|
||||
|
||||
private const int DialogChapterDivisor = 1000;
|
||||
private const int LineChapterDivisor = 100000000;
|
||||
private const int LineDialogDivisor = 100000;
|
||||
|
|
@ -216,6 +217,8 @@ namespace CustomComponent
|
|||
_formContext.DialogTitle = dialogRow.Title;
|
||||
_formContext.DialogUIMode = dialogRow.UIMode;
|
||||
_formContext.PlayingSpeed = Mathf.Max(0f, _playingSpeed);
|
||||
_formContext.DialogWindowAlpha =
|
||||
(DialogWindowAlpha)GameEntry.Setting.GetInt(Constant.Setting.DialogWindowAlpha);
|
||||
|
||||
_currentLineIndex = 0;
|
||||
ApplyLineToContext(dialogLines[_currentLineIndex], _currentLineIndex, dialogLines.Count);
|
||||
|
|
@ -410,4 +413,4 @@ namespace CustomComponent
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ using Sound;
|
|||
using UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
|
||||
namespace Procedure
|
||||
|
|
@ -23,9 +24,13 @@ namespace Procedure
|
|||
private SettingFormController _settingFormController;
|
||||
|
||||
private const string SettingPrefix = "Setting.";
|
||||
|
||||
private bool _gameStarted = false;
|
||||
|
||||
private void StartGame()
|
||||
{
|
||||
if (_gameStarted) return;
|
||||
_gameStarted = true;
|
||||
}
|
||||
|
||||
private void LoadGame()
|
||||
|
|
@ -71,6 +76,9 @@ namespace Procedure
|
|||
|
||||
protected override void OnLeave(IFsm<IProcedureManager> procedureOwner, bool isShutdown)
|
||||
{
|
||||
_menuFormController?.CloseUI();
|
||||
_settingFormController?.CloseUI();
|
||||
|
||||
var e = GameEntry.Event;
|
||||
e.Unsubscribe(MenuStartEventArgs.EventId, MenuStart);
|
||||
e.Unsubscribe(MenuContinueEventArgs.EventId, MenuContinue);
|
||||
|
|
@ -85,6 +93,12 @@ namespace Procedure
|
|||
float realElapseSeconds)
|
||||
{
|
||||
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
||||
|
||||
if (_gameStarted)
|
||||
{
|
||||
procedureOwner.SetData<VarInt32>("NextSceneId", (int)SceneId.GameplayA);
|
||||
ChangeState<ProcedureChangeScene>(procedureOwner);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -94,11 +108,13 @@ namespace Procedure
|
|||
private void MenuStart(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is MenuStartEventArgs)) return;
|
||||
StartGame();
|
||||
}
|
||||
|
||||
private void MenuContinue(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is MenuContinueEventArgs)) return;
|
||||
LoadGame();
|
||||
}
|
||||
|
||||
private void MenuSetting(object sender, GameEventArgs e)
|
||||
|
|
|
|||
|
|
@ -22,5 +22,7 @@ namespace UI
|
|||
public int LineIndex = -1;
|
||||
public int TotalLines = 0;
|
||||
public bool IsLastLine = false;
|
||||
|
||||
public DialogWindowAlpha DialogWindowAlpha = DialogWindowAlpha.Medium;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using Definition.Enum;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -28,12 +30,15 @@ namespace UI
|
|||
[SerializeField] private float _moveDuration = 0.25f;
|
||||
|
||||
[SerializeField] private Ease _moveEase = Ease.OutCubic;
|
||||
|
||||
|
||||
[SerializeField] private Image[] _dialogBgImages;
|
||||
|
||||
private readonly int _singleSpeakerCenterPosition = Screen.width / 2;
|
||||
|
||||
private string _leftSpeakerToken = string.Empty;
|
||||
private string _rightSpeakerToken = string.Empty;
|
||||
private Sequence _layoutSequence;
|
||||
private DialogWindowAlpha _currentWindowAlpha = DialogWindowAlpha.Medium;
|
||||
|
||||
public override void StartDialog(DialogFormContext context)
|
||||
{
|
||||
|
|
@ -45,6 +50,32 @@ namespace UI
|
|||
|
||||
_context = context;
|
||||
|
||||
if (_context.DialogWindowAlpha != this._currentWindowAlpha)
|
||||
{
|
||||
_currentWindowAlpha = _context.DialogWindowAlpha;
|
||||
float targetAlpha = _currentWindowAlpha switch
|
||||
{
|
||||
DialogWindowAlpha.None => 1,
|
||||
DialogWindowAlpha.Low => 0.75f,
|
||||
DialogWindowAlpha.Medium => 0.5f,
|
||||
DialogWindowAlpha.High => 0.25f,
|
||||
_ => 0.5f
|
||||
};
|
||||
|
||||
if (_dialogBgImages.Length == 0)
|
||||
{
|
||||
//TODO:一个很奇怪的问题,在 prefab 里赋好的值实例化出来就没了,只能先这样赋值
|
||||
_dialogBgImages = GetComponentsInChildren<Image>().Where(image => image.name == "bg").ToArray();
|
||||
}
|
||||
|
||||
foreach (Image image in _dialogBgImages)
|
||||
{
|
||||
Color color = image.color;
|
||||
color.a = targetAlpha;
|
||||
image.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
string speakerName = _context.SpeakerName;
|
||||
|
||||
if (_speakerArea != null)
|
||||
|
|
@ -277,4 +308,4 @@ namespace UI
|
|||
rectTransform.anchoredPosition = anchoredPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -474,7 +474,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0.5019608}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
|
|
@ -586,7 +586,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.39215687, g: 0.39215687, b: 0.39215687, a: 0.39215687}
|
||||
m_Color: {r: 0.39215687, g: 0.39215687, b: 0.39215687, a: 0.5019608}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
|
|
@ -664,6 +664,9 @@ MonoBehaviour:
|
|||
_rightSpritePosition: -450
|
||||
_moveDuration: 0.25
|
||||
_moveEase: 9
|
||||
_dialogBgImages:
|
||||
- {fileID: 7254061520918156868}
|
||||
- {fileID: 8566667250576683572}
|
||||
--- !u!1 &6371466324854950042
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue