You've already forked taptap2024_GJ_chidouren
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using System;
|
|
using Framework.UI;
|
|
using Game.EventDefine;
|
|
using IcecreamView;
|
|
using Script.Core.Utils.Extend;
|
|
using UniFramework.Event;
|
|
using UnityEngine;
|
|
|
|
namespace Views.Common
|
|
{
|
|
public class CommonCardHubTip : IcecreamView.IC_AbstractModule
|
|
{
|
|
public CommonTipBoxFrame _propTipBox; // 道具提示框
|
|
private bool _hasShowWeaponTip;
|
|
|
|
|
|
private EventGroup _eventGroup;
|
|
|
|
public override void OnInitView ()
|
|
{
|
|
this._propTipBox.InitBox ();
|
|
this._eventGroup = new EventGroup ();
|
|
this._eventGroup.AddListener<GameEventDefine.ShowTipBox> (this.OnShowTipBox);
|
|
UIManager.Instance.OnViewFocusChanged += this.OnViewFocusChanged;
|
|
}
|
|
|
|
private void OnShowTipBox (IEventMessage obj)
|
|
{
|
|
var message = obj as GameEventDefine.ShowTipBox;
|
|
if (message == null || message.tipText == null)
|
|
{
|
|
this._propTipBox.CloseTipBox ();
|
|
return;
|
|
}
|
|
|
|
if ((this.ViewConnector.HasFocusView && this._hasShowWeaponTip) || !this.ViewConnector.HasFocusView)
|
|
{
|
|
var msg = new CommonTipBox.Message ();
|
|
msg.title = message.tipText;
|
|
msg.content = message.content;
|
|
this._propTipBox.ShowTipBox (message.box , msg);
|
|
}
|
|
}
|
|
|
|
public override void OnCloseView ()
|
|
{
|
|
this._propTipBox.ReleaseTipBox ();
|
|
this._eventGroup.RemoveAllListener ();
|
|
UIManager.Instance.OnViewFocusChanged -= this.OnViewFocusChanged;
|
|
}
|
|
|
|
private void OnViewFocusChanged (IC_AbstractView obj)
|
|
{
|
|
}
|
|
|
|
public override void OnFocusActive ()
|
|
{
|
|
this._hasShowWeaponTip = true;
|
|
}
|
|
|
|
public override void OnFocusInactive ()
|
|
{
|
|
this._hasShowWeaponTip = false;
|
|
}
|
|
}
|
|
} |