tsq康养仿真
This commit is contained in:
parent
c54b58f5b2
commit
2a50a57bb2
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TipMangner : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 存放的字
|
||||
/// </summary>
|
||||
public List<string> tips = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 显示的文本内容
|
||||
/// </summary>
|
||||
public TextMeshProUGUI text;
|
||||
|
||||
/// <summary>
|
||||
/// 下一个按钮
|
||||
/// </summary>
|
||||
public Button Next_BTn;
|
||||
|
||||
/// <summary>
|
||||
/// 上一个按钮
|
||||
/// </summary>
|
||||
public Button Prev_BTn;
|
||||
|
||||
private int index = 0;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Next_BTn.onClick.AddListener(() =>
|
||||
{
|
||||
Next();
|
||||
});
|
||||
Prev_BTn.onClick.AddListener(() =>
|
||||
{
|
||||
Prev();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上一步按钮
|
||||
/// </summary>
|
||||
public void Prev()
|
||||
{
|
||||
index--;
|
||||
if (index == 0)
|
||||
{
|
||||
index = 0;
|
||||
Prev_BTn.gameObject.SetActive(false);
|
||||
}
|
||||
if (index >= 0)
|
||||
{
|
||||
Next_BTn.gameObject.SetActive(true);
|
||||
text.text = tips[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下一步按钮
|
||||
/// </summary>
|
||||
public void Next()
|
||||
{
|
||||
index++;
|
||||
if (index < tips.Count)
|
||||
{
|
||||
Debug.Log(index);
|
||||
Prev_BTn.gameObject.SetActive(true);
|
||||
text.text = tips[index];
|
||||
}
|
||||
if (index >= tips.Count - 1)
|
||||
{
|
||||
Next_BTn.gameObject.SetActive(false);
|
||||
index = tips.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b89cd42814fd7a54ca2bb9faeccfeb79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue