63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Kill.Managers;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
namespace Kill.UI.Pages
|
||
|
|
{
|
||
|
|
public class FAQPage : MonoBehaviour
|
||
|
|
{
|
||
|
|
public ScrollRect scrollRect;
|
||
|
|
public FAQAnswerPage[] cnQuestionPages;
|
||
|
|
|
||
|
|
public FAQAnswerPage[] enQuestionPages;
|
||
|
|
/// <summary>
|
||
|
|
/// 0中文 1英文
|
||
|
|
/// </summary>
|
||
|
|
public GameObject[] questionLists;
|
||
|
|
public Button back;
|
||
|
|
Action callback;
|
||
|
|
int languageType;
|
||
|
|
public void Init(Action callback)
|
||
|
|
{
|
||
|
|
this.callback=callback;
|
||
|
|
back.onClick.RemoveAllListeners();
|
||
|
|
back.onClick.AddListener(Back);
|
||
|
|
UIManager.Instance.RegisterBackAction(Back);
|
||
|
|
languageType=(int)LanguageManager.Instance.languageType;
|
||
|
|
questionLists[languageType].SetActive(true);
|
||
|
|
questionLists[1-languageType].SetActive(false);
|
||
|
|
scrollRect.content=questionLists[languageType].GetComponent<RectTransform>();
|
||
|
|
}
|
||
|
|
public void ShowQuestionPage(int index)
|
||
|
|
{
|
||
|
|
FAQAnswerPage page=null;
|
||
|
|
if(languageType==0)
|
||
|
|
{
|
||
|
|
page=Instantiate(cnQuestionPages[index],transform);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
page=Instantiate(enQuestionPages[index],transform);
|
||
|
|
}
|
||
|
|
if(page!=null)
|
||
|
|
{
|
||
|
|
page.gameObject.SetActive(true);
|
||
|
|
page.Init(()=>{UIManager.Instance.RegisterBackAction(Back);});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
public FeedbackPage feedbackPagePrefab;
|
||
|
|
public void EnterFeedbackPage()
|
||
|
|
{
|
||
|
|
FeedbackPage feedbackPage=Instantiate(feedbackPagePrefab,transform);
|
||
|
|
feedbackPage.Init(()=>{UIManager.Instance.RegisterBackAction(Back);});
|
||
|
|
}
|
||
|
|
public void Back()
|
||
|
|
{
|
||
|
|
callback?.Invoke();
|
||
|
|
Destroy(gameObject);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|