- 完善设置面板的具体功能,全局性的设置项已经可以发挥作用了

- 调整部分项目结构和AB包设置,打包测试设置面板的功能
This commit is contained in:
SepComet 2026-02-12 21:58:05 +08:00
parent 57649da490
commit d4055adbce
7 changed files with 37 additions and 21 deletions

View File

@ -16,8 +16,6 @@ namespace CustomComponent
{ {
#region Property #region Property
[SerializeField] private float _playingSpeed = 1.0f;
private const int DialogChapterDivisor = 1000; private const int DialogChapterDivisor = 1000;
private const int LineChapterDivisor = 100000000; private const int LineChapterDivisor = 100000000;
private const int LineDialogDivisor = 100000; private const int LineDialogDivisor = 100000;
@ -38,8 +36,6 @@ namespace CustomComponent
private bool _isInitialized; private bool _isInitialized;
private bool _isPlaying; private bool _isPlaying;
public float PlayingSpeed => _playingSpeed;
public bool IsInitialized => _isInitialized; public bool IsInitialized => _isInitialized;
public bool IsPlaying => _isPlaying; public bool IsPlaying => _isPlaying;
@ -216,9 +212,8 @@ namespace CustomComponent
_formContext.DialogId = dialogRow.Id; _formContext.DialogId = dialogRow.Id;
_formContext.DialogTitle = dialogRow.Title; _formContext.DialogTitle = dialogRow.Title;
_formContext.DialogUIMode = dialogRow.UIMode; _formContext.DialogUIMode = dialogRow.UIMode;
_formContext.PlayingSpeed = Mathf.Max(0f, _playingSpeed); _formContext.PlayingSpeed = (DialogPlayingSpeed)GameEntry.Setting.GetInt(Constant.Setting.DialogPlayingSpeed);
_formContext.DialogWindowAlpha = _formContext.DialogWindowAlpha = (DialogWindowAlpha)GameEntry.Setting.GetInt(Constant.Setting.DialogWindowAlpha);
(DialogWindowAlpha)GameEntry.Setting.GetInt(Constant.Setting.DialogWindowAlpha);
_currentLineIndex = 0; _currentLineIndex = 0;
ApplyLineToContext(dialogLines[_currentLineIndex], _currentLineIndex, dialogLines.Count); ApplyLineToContext(dialogLines[_currentLineIndex], _currentLineIndex, dialogLines.Count);
@ -358,7 +353,6 @@ namespace CustomComponent
_formContext.Direction = lineRow.Direction; _formContext.Direction = lineRow.Direction;
_formContext.Text = lineRow.Text; _formContext.Text = lineRow.Text;
_formContext.Emphasis = lineRow.Emphasis; _formContext.Emphasis = lineRow.Emphasis;
_formContext.PlayingSpeed = Mathf.Max(0f, _playingSpeed);
_formContext.LineIndex = lineIndex; _formContext.LineIndex = lineIndex;
_formContext.TotalLines = totalLines; _formContext.TotalLines = totalLines;
_formContext.IsLastLine = lineIndex >= totalLines - 1; _formContext.IsLastLine = lineIndex >= totalLines - 1;

View File

@ -17,7 +17,7 @@ namespace Setting
AllowShake = setting.GetBool(Constant.Setting.AllowShake, true), AllowShake = setting.GetBool(Constant.Setting.AllowShake, true),
AllowBlink = setting.GetBool(Constant.Setting.AllowBlink, true), AllowBlink = setting.GetBool(Constant.Setting.AllowBlink, true),
DialogWindowAlpha = (DialogWindowAlpha)setting.GetInt(Constant.Setting.DialogWindowAlpha, 1), DialogWindowAlpha = (DialogWindowAlpha)setting.GetInt(Constant.Setting.DialogWindowAlpha, 2),
DialogPlayingSpeed = (DialogPlayingSpeed)setting.GetInt(Constant.Setting.DialogPlayingSpeed, 1), DialogPlayingSpeed = (DialogPlayingSpeed)setting.GetInt(Constant.Setting.DialogPlayingSpeed, 1),
ScreenResolution = (ScreenResolutionType)setting.GetInt(Constant.Setting.ScreenSolution, 1), ScreenResolution = (ScreenResolutionType)setting.GetInt(Constant.Setting.ScreenSolution, 1),

View File

@ -4,7 +4,7 @@ namespace UI
{ {
public class DialogFormContext : UIContext public class DialogFormContext : UIContext
{ {
public float PlayingSpeed = 1f; public DialogPlayingSpeed PlayingSpeed = DialogPlayingSpeed.Medium;
public int ChapterId = 0; public int ChapterId = 0;
public int DialogId = 0; public int DialogId = 0;

View File

@ -39,6 +39,7 @@ namespace UI
private string _rightSpeakerToken = string.Empty; private string _rightSpeakerToken = string.Empty;
private Sequence _layoutSequence; private Sequence _layoutSequence;
private DialogWindowAlpha _currentWindowAlpha = DialogWindowAlpha.Medium; private DialogWindowAlpha _currentWindowAlpha = DialogWindowAlpha.Medium;
private float _currentPlayingSpeed = 10f;
public override void StartDialog(DialogFormContext context) public override void StartDialog(DialogFormContext context)
{ {
@ -76,6 +77,11 @@ namespace UI
} }
} }
if ((int)(_context.PlayingSpeed + 1) * 5 != (int)_currentPlayingSpeed)
{
_currentPlayingSpeed = 5f * (int)(_context.PlayingSpeed + 1);
}
string speakerName = _context.SpeakerName; string speakerName = _context.SpeakerName;
if (_speakerArea != null) if (_speakerArea != null)
@ -88,7 +94,7 @@ namespace UI
_speakerNameText.text = speakerName; _speakerNameText.text = speakerName;
} }
PlayTypewriter(_contentText, _context.Text, _context.PlayingSpeed); PlayTypewriter(_contentText, _context.Text, _currentPlayingSpeed);
if (string.IsNullOrEmpty(speakerName)) if (string.IsNullOrEmpty(speakerName))
{ {

View File

@ -14,6 +14,8 @@ namespace UI
[SerializeField] private TMP_Text _text; [SerializeField] private TMP_Text _text;
private float _currentPlayingSpeed;
public override void StartDialog(DialogFormContext context) public override void StartDialog(DialogFormContext context)
{ {
if (context == null) if (context == null)
@ -29,7 +31,12 @@ namespace UI
_maskImage.gameObject.SetActive(true); _maskImage.gameObject.SetActive(true);
} }
PlayTypewriter(_text, context.Text, context.PlayingSpeed); if ((int)_context.PlayingSpeed * 5 != (int)_currentPlayingSpeed)
{
_currentPlayingSpeed = 5f * (int)_context.PlayingSpeed;
}
PlayTypewriter(_text, context.Text, _currentPlayingSpeed);
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace UI
public void OnPointerEnter(PointerEventData eventData) public void OnPointerEnter(PointerEventData eventData)
{ {
_fadeSequence.Kill(); KillFadeSequence();
_fadeSequence = DOTween.Sequence(); _fadeSequence = DOTween.Sequence();
_fadeSequence.Append(_bgImage.DOFade(1, _fadeDuration)); _fadeSequence.Append(_bgImage.DOFade(1, _fadeDuration));
_onSelect.Invoke(); _onSelect.Invoke();
@ -28,10 +28,19 @@ namespace UI
public void OnPointerExit(PointerEventData eventData) public void OnPointerExit(PointerEventData eventData)
{ {
_fadeSequence.Kill(); KillFadeSequence();
_fadeSequence = DOTween.Sequence(); _fadeSequence = DOTween.Sequence();
_fadeSequence.Append(_bgImage.DOFade(0, _fadeDuration)); _fadeSequence.Append(_bgImage.DOFade(0, _fadeDuration));
_onDeselect.Invoke(); _onDeselect.Invoke();
} }
private void KillFadeSequence()
{
if (_fadeSequence != null && _fadeSequence.IsActive())
{
_fadeSequence.Kill();
}
}
} }
} }

View File

@ -46,8 +46,8 @@ namespace UI
var setting = context.Setting; var setting = context.Setting;
_bgmVolumeSlider.value = setting.BGMVolume * 4; _bgmVolumeSlider.value = setting.BGMVolume * 5;
_seVolumeSlider.value = setting.SEVolume * 4; _seVolumeSlider.value = setting.SEVolume * 5;
_allowBlinkGroup.SetValue(setting.AllowBlink); _allowBlinkGroup.SetValue(setting.AllowBlink);
_allowShakeGroup.SetValue(setting.AllowShake); _allowShakeGroup.SetValue(setting.AllowShake);
@ -77,8 +77,8 @@ namespace UI
{ {
var setting = new GameSetting var setting = new GameSetting
{ {
BGMVolume = _bgmVolumeSlider.value / 4, BGMVolume = _bgmVolumeSlider.value / 5,
SEVolume = _seVolumeSlider.value / 4, SEVolume = _seVolumeSlider.value / 5,
AllowShake = _allowShakeGroup.GetBoolValue(), AllowShake = _allowShakeGroup.GetBoolValue(),
AllowBlink = _allowBlinkGroup.GetBoolValue(), AllowBlink = _allowBlinkGroup.GetBoolValue(),