feat(): 完成将Manager从Gameplay转移到Core,实现循环次数持久化,实现设置面板
This commit is contained in:
48
Assets/Script/Gameplay/UI/SettingViewer.cs
Normal file
48
Assets/Script/Gameplay/UI/SettingViewer.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Core;
|
||||
using Script.Gameplay.Global;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Script.Gameplay.Input;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class SettingViewer : UIBase
|
||||
{
|
||||
[SerializeField] private TMP_Text TitleText;
|
||||
[SerializeField] private TMP_Text ContentText;
|
||||
|
||||
private InputManager inputManager;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
inputManager = InputManager.Instance;
|
||||
inputManager.Input.Player.Setting.performed+= ctx =>
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
Show();
|
||||
inputManager.SetInputForLook(false);
|
||||
inputManager.SetInputForMove(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide();
|
||||
inputManager.SetInputForLook(true);
|
||||
inputManager.SetInputForMove(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
ContentText.text = "循环次数:" + GameDataManager.Instance.TotalLoopCount.ToString();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
base.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user