64 lines
1.4 KiB
C#
64 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using System.IO;
|
|
using DG.Tweening;
|
|
using UnityEngine.UI;
|
|
|
|
public class UITipShow : MonoBehaviour
|
|
{
|
|
public static UITipShow instance;
|
|
|
|
public TextMeshProUGUI tipText;
|
|
|
|
public Button showBtn;
|
|
public Button hideBtn;
|
|
|
|
string basePage=Application.streamingAssetsPath;
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
Debug.Log(transform.GetChild(0).position);
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
showBtn.onClick.AddListener(ShowTip);
|
|
hideBtn.onClick.AddListener(HideTip);
|
|
//UpDateTipText("Á÷³Ì˵Ã÷/122Á÷³Ì.txt");
|
|
HideTip();
|
|
}
|
|
|
|
|
|
public void UpDateTipText(string path)
|
|
{
|
|
string resultPath = Path.Combine(basePage, path);
|
|
tipText.text = File.ReadAllText(resultPath);
|
|
}
|
|
|
|
public void ClearTipText()
|
|
{
|
|
tipText.text = string.Empty;
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void ShowTip()
|
|
{
|
|
transform.GetChild(0).DOLocalMoveX(960, 0.5f);
|
|
showBtn.gameObject.SetActive(false);
|
|
hideBtn.gameObject.SetActive(true);
|
|
|
|
}
|
|
public void HideTip()
|
|
{
|
|
transform.GetChild(0).DOLocalMoveX(1243, 0.5f);
|
|
showBtn.gameObject.SetActive(true);
|
|
hideBtn.gameObject.SetActive(false);
|
|
}
|
|
|
|
|
|
|
|
}
|