57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class UI_TopTitlePanel : BasePanel
|
|
{
|
|
public Button AskBtn; //问答按钮
|
|
public TextMeshProUGUI NameText; //用户名
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
OnInit();
|
|
}
|
|
|
|
public void OnInit()
|
|
{
|
|
AskBtn = GetControl<Button>("问答按钮");
|
|
NameText = GetControl<TextMeshProUGUI>("用户名");
|
|
}
|
|
|
|
public override void ShowMe()
|
|
{
|
|
base.ShowMe();
|
|
Scene currentScene = SceneManager.GetActiveScene();
|
|
if (currentScene.name == "xianchang-TSQ")
|
|
{
|
|
AskBtn.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public override void HideMe()
|
|
{
|
|
base.HideMe();
|
|
}
|
|
|
|
protected override void OnClick(string btnPath)
|
|
{
|
|
base.OnClick(btnPath);
|
|
switch (btnPath)
|
|
{
|
|
case "问答按钮":
|
|
Bootstrap.Instance.uiManager.ShowPanel<UI_TeacherStudentPanel>(this, E_UI_Layer.Mid,
|
|
(panel) =>
|
|
{
|
|
Debug.Log("问答面板显示");
|
|
GameObject Player=GameObject.FindGameObjectWithTag("Player");
|
|
Player.GetComponent<FirstPersonController>().enabled = false;
|
|
|
|
});
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
} |