您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
755 B
38 行
755 B
using GameplayIngredients;
|
|
using GameplayIngredients.Logic;
|
|
using NaughtyAttributes;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SettingUI : MonoBehaviour
|
|
{
|
|
public string SettingName = "Setting";
|
|
|
|
public TextMeshProUGUI ValueText;
|
|
public string[] Values;
|
|
|
|
private void Start()
|
|
{
|
|
UpdateText();
|
|
}
|
|
|
|
public void ToggleSetting()
|
|
{
|
|
Manager.Get<SettingManager>().SetValue(SettingName, (GetValue() + 1) % Values.Length);
|
|
UpdateText();
|
|
}
|
|
|
|
void UpdateText()
|
|
{
|
|
ValueText.text = Values[GetValue()];
|
|
}
|
|
|
|
int GetValue()
|
|
{
|
|
return Manager.Get<SettingManager>().GetValue(SettingName);
|
|
}
|
|
|
|
}
|