103 lines
2.7 KiB
C#
103 lines
2.7 KiB
C#
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
namespace ChillConnect
|
|
{
|
|
public class H5UICtrl : BaseUICtrl
|
|
{
|
|
private H5UI ui;
|
|
private H5Model model;
|
|
|
|
private uint openUIMsg = UICtrlMsg.H5UI_Open;
|
|
private uint closeUIMsg = UICtrlMsg.H5UI_Close;
|
|
|
|
private AlphaController _alphaController;
|
|
#region 生命周期
|
|
protected override void OnInit()
|
|
{
|
|
if (_alphaController == null)
|
|
{
|
|
_alphaController = GameObject.Find("AlphaController").GetComponent<AlphaController>();
|
|
}
|
|
|
|
//model = ModuleManager.Instance.GetModel(ModelConst.H5Model) as H5Model;
|
|
}
|
|
|
|
protected override void OnDispose()
|
|
{
|
|
}
|
|
|
|
public override void OpenUI(object args = null)
|
|
{
|
|
OpenSettingAlpha();
|
|
|
|
if (ui == null)
|
|
{
|
|
ui = new H5UI(this);
|
|
ui.Open(args);
|
|
}
|
|
}
|
|
|
|
public override void CloseUI(object args = null)
|
|
{
|
|
if (ui != null && !ui.isClose)
|
|
{
|
|
ui.Close();
|
|
}
|
|
ui = null;
|
|
}
|
|
#endregion
|
|
|
|
#region 消息
|
|
public override uint GetOpenUIMsg(string uiName)
|
|
{
|
|
return openUIMsg;
|
|
}
|
|
public override uint GetCloseUIMsg(string uiName)
|
|
{
|
|
return closeUIMsg;
|
|
}
|
|
|
|
protected override void AddListener()
|
|
{
|
|
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
|
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
|
gameDispatcher.AddListener(GameMsg.H5ViewClickBtn, OnH5ClickBtn);
|
|
}
|
|
protected override void RemoveListener()
|
|
{
|
|
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
|
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
|
gameDispatcher.RemoveListener(GameMsg.H5ViewClickBtn, OnH5ClickBtn);
|
|
}
|
|
void OnH5ClickBtn(object arg)
|
|
{
|
|
// ui?.ClickBtn((string)arg);
|
|
}
|
|
protected override void AddServerListener()
|
|
{
|
|
|
|
}
|
|
protected override void RemoveServerListener()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
// 这个方法绑定到"打开面板"按钮
|
|
public void OpenSettingAlpha()
|
|
{
|
|
// 打开面板时,Unity 渲染层变为全透明
|
|
_alphaController?.SetPlayerAlpha(0.08f);
|
|
}
|
|
|
|
// 这个方法绑定到"关闭面板"按钮
|
|
public void CloseSettingAlpha()
|
|
{
|
|
// 关闭面板时,Unity 渲染层恢复不透明
|
|
_alphaController?.SetPlayerAlpha(1.0f);
|
|
}
|
|
}
|
|
} |