122 lines
2.2 KiB
C#
122 lines
2.2 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2021-04-17
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "RootWindow" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace G.UI
|
|
{
|
|
public partial class RootWindow : KUIWindow
|
|
{
|
|
#region Constructor
|
|
|
|
public RootWindow()
|
|
: base(UILayer.kBackground, UIMode.kNone)
|
|
{
|
|
uiPath = "ui_common/ui_w_root.prefab";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
public void LoadCommon()
|
|
{
|
|
StartCoroutine(LoadEffectRoot());
|
|
}
|
|
|
|
IEnumerator LoadEffectRoot()
|
|
{
|
|
yield return new WaitForSeconds(1f);
|
|
var handle = AssetProxy.Instance.TryGetGlobalAssetAsync<GameObject>("ui_effect_root");
|
|
yield return handle;
|
|
Object.Instantiate(handle.Result);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Unity
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void Awake()
|
|
{
|
|
InitView();
|
|
LoadCommon();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void OnEnable()
|
|
{
|
|
RegisterThis();
|
|
RefreshView();
|
|
}
|
|
|
|
public override void OnDisable()
|
|
{
|
|
UnregisterThis();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void Update()
|
|
{
|
|
UpdateView();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public override void UpdatePerSecond()
|
|
{
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Mediator
|
|
|
|
readonly int[] _notificationInterests = new int[]
|
|
{
|
|
GlobalDefine.EVENT_PLAYER_ATTRIBUTES_CHANGED,
|
|
};
|
|
|
|
public override IList<int> ListNotificationInterests()
|
|
{
|
|
return _notificationInterests;
|
|
}
|
|
|
|
public override void HandleNotification(PureMVC.Interfaces.INotification notification)
|
|
{
|
|
if (notification.Name == GlobalDefine.EVENT_PLAYER_ATTRIBUTES_CHANGED)
|
|
{
|
|
int addCV = (int)notification.Body;
|
|
if (addCV > 0)
|
|
{
|
|
#if UNITY_EDITOR
|
|
Debug.Log($"{notification.Type} 战力增加 {addCV}");
|
|
#endif
|
|
ToastBox.ShowCombatValue(PlayerProxy.Instance.combatValue, addCV, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|