140 lines
2.8 KiB
C#
140 lines
2.8 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-08
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "MainWindow" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
|
|||
|
using PureMVC.Interfaces;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
public partial class MainWindow : KUIWindow
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public MainWindow()
|
|||
|
: base(UILayer.kNormal, UIMode.kSequenceRemove)
|
|||
|
{
|
|||
|
this.uiPath = "ui_main/ui_w_main.prefab";
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
|
|||
|
public void RefreshModel()
|
|||
|
{
|
|||
|
var openArg = this.data as string;
|
|||
|
if (string.IsNullOrEmpty(openArg))
|
|||
|
{
|
|||
|
var newCL = LevelProxy.Instance.newCompletedLevel;
|
|||
|
if (newCL != 0)
|
|||
|
{
|
|||
|
var newULItem = ItemProxy.Instance.GetStaticItem<ItemLevel>(newCL + 1);
|
|||
|
if (newULItem != null)
|
|||
|
OpenWindow<LevelUnlockBox>(newULItem);
|
|||
|
|
|||
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW, newCL, "new_level");
|
|||
|
}
|
|||
|
}
|
|||
|
else if (openArg == "Cha")
|
|||
|
{
|
|||
|
_toggles[(int)PageType.Cha].isOn = true;
|
|||
|
}
|
|||
|
else if (openArg == "Home")
|
|||
|
{
|
|||
|
_toggles[(int)PageType.World].isOn = true;
|
|||
|
}
|
|||
|
else if (openArg == "Kungfu")
|
|||
|
{
|
|||
|
_toggles[(int)PageType.Kungfu].isOn = true;
|
|||
|
}
|
|||
|
else if (openArg == "Shop")
|
|||
|
{
|
|||
|
_toggles[(int)PageType.Shop].isOn = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Mediator
|
|||
|
|
|||
|
readonly int[] _notificationInterests = new int[]
|
|||
|
{
|
|||
|
GlobalDefine.EVENT_LEVEL_COMPLETED,
|
|||
|
GlobalDefine.EVENT_MAIN_WINDOW_PAGE,
|
|||
|
GlobalDefine.EVENT_MISSION_CHANGED,
|
|||
|
};
|
|||
|
|
|||
|
public override IList<int> ListNotificationInterests()
|
|||
|
{
|
|||
|
return _notificationInterests;
|
|||
|
}
|
|||
|
|
|||
|
public override void HandleNotification(INotification notification)
|
|||
|
{
|
|||
|
if (notification.Name == GlobalDefine.EVENT_LEVEL_COMPLETED)
|
|||
|
{
|
|||
|
}
|
|||
|
else if (notification.Name == GlobalDefine.EVENT_MAIN_WINDOW_PAGE)
|
|||
|
{
|
|||
|
OpenPage(notification.Type.ToInt(), notification.Body);
|
|||
|
}
|
|||
|
else if (notification.Name == GlobalDefine.EVENT_MISSION_CHANGED)
|
|||
|
{
|
|||
|
RefreshUnlock();
|
|||
|
RefreshMission();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Unity
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public override void Awake()
|
|||
|
{
|
|||
|
this.InitView();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public override void OnEnable()
|
|||
|
{
|
|||
|
this.RegisterThis();
|
|||
|
this.RefreshModel();
|
|||
|
this.RefreshView();
|
|||
|
}
|
|||
|
|
|||
|
public override void OnDisable()
|
|||
|
{
|
|||
|
this.UnregisterThis();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public override void UpdatePerSecond()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Reset()
|
|||
|
{
|
|||
|
this.RefreshView();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|