本演示项目在Unity for Android Build中启用部分华为HMS和AGC服务,对应的类和函数的名称和用法相同。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

66 行
1.6 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HuaweiAuthDemo
{
public class PanelController : MonoBehaviour
{
private AbstractPanel m_CurrentPanel;
private static PanelController panelController;
[SerializeField] public static PopupController popupinstance;
public static UserAccount userInfo;
void Awake()
{
if (popupinstance == null)
{
popupinstance = GameObject.Find("PopUp").GetComponent<PopupController>();
}
if (userInfo == null)
{
userInfo= GameObject.Find("UserAccount").GetComponent<UserAccount>();
}
}
public void OpenPanel(AbstractPanel panel)
{
if (m_CurrentPanel == null || panel.name != m_CurrentPanel?.name)
{
panel.OpenPanel();
m_CurrentPanel?.ClosePanel();
m_CurrentPanel = panel;
}
}
public void Start()
{
panelController = this;
}
public void OnBack()
{
m_CurrentPanel.Back();
m_CurrentPanel = m_CurrentPanel.ParentPanel;
}
public void OnClose()
{
m_CurrentPanel?.ClosePanel();
m_CurrentPanel = null;
}
public static PanelController getInstance()
{
return panelController == null
? GameObject.Find("Panels").GetComponent<PanelController>()
: panelController;
}
}
}