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

- 调整部分项目结构和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

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

View File

@ -17,7 +17,7 @@ namespace Setting
AllowShake = setting.GetBool(Constant.Setting.AllowShake, 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),
ScreenResolution = (ScreenResolutionType)setting.GetInt(Constant.Setting.ScreenSolution, 1),

View File

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

View File

@ -39,6 +39,7 @@ namespace UI
private string _rightSpeakerToken = string.Empty;
private Sequence _layoutSequence;
private DialogWindowAlpha _currentWindowAlpha = DialogWindowAlpha.Medium;
private float _currentPlayingSpeed = 10f;
public override void StartDialog(DialogFormContext context)
{
@ -61,7 +62,7 @@ namespace UI
DialogWindowAlpha.High => 0.25f,
_ => 0.5f
};
if (_dialogBgImages.Length == 0)
{
//TODO:一个很奇怪的问题,在 prefab 里赋好的值实例化出来就没了,只能先这样赋值
@ -76,6 +77,11 @@ namespace UI
}
}
if ((int)(_context.PlayingSpeed + 1) * 5 != (int)_currentPlayingSpeed)
{
_currentPlayingSpeed = 5f * (int)(_context.PlayingSpeed + 1);
}
string speakerName = _context.SpeakerName;
if (_speakerArea != null)
@ -88,7 +94,7 @@ namespace UI
_speakerNameText.text = speakerName;
}
PlayTypewriter(_contentText, _context.Text, _context.PlayingSpeed);
PlayTypewriter(_contentText, _context.Text, _currentPlayingSpeed);
if (string.IsNullOrEmpty(speakerName))
{

View File

@ -13,6 +13,8 @@ namespace UI
[SerializeField] private Image _maskImage;
[SerializeField] private TMP_Text _text;
private float _currentPlayingSpeed;
public override void StartDialog(DialogFormContext context)
{
@ -29,7 +31,12 @@ namespace UI
_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)
{
_fadeSequence.Kill();
KillFadeSequence();
_fadeSequence = DOTween.Sequence();
_fadeSequence.Append(_bgImage.DOFade(1, _fadeDuration));
_onSelect.Invoke();
@ -28,10 +28,19 @@ namespace UI
public void OnPointerExit(PointerEventData eventData)
{
_fadeSequence.Kill();
KillFadeSequence();
_fadeSequence = DOTween.Sequence();
_fadeSequence.Append(_bgImage.DOFade(0, _fadeDuration));
_onDeselect.Invoke();
}
private void KillFadeSequence()
{
if (_fadeSequence != null && _fadeSequence.IsActive())
{
_fadeSequence.Kill();
}
}
}
}

View File

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