115 lines
2.4 KiB
C#
115 lines
2.4 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Unity
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2017-11-11
|
|||
|
//
|
|||
|
// Last Modified By : Kimch
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "QuickBox" company=""></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
public partial class QuickBox : KUIWindow
|
|||
|
{
|
|||
|
#region Static API
|
|||
|
|
|||
|
public static void ShowEquipment(EntityItemEquipment equipment)
|
|||
|
{
|
|||
|
if (_Instance == null)
|
|||
|
{
|
|||
|
OpenWindow<QuickBox>();
|
|||
|
}
|
|||
|
|
|||
|
if (PlayerProxy.Instance.IsBetterEquipment(equipment))
|
|||
|
{
|
|||
|
var info = new TemplateInfo
|
|||
|
{
|
|||
|
type = 0,
|
|||
|
equipment = equipment,
|
|||
|
};
|
|||
|
_Instance.AddInfo(info);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void Clear()
|
|||
|
{
|
|||
|
if (_Instance != null)
|
|||
|
{
|
|||
|
_Instance.ClearModel();
|
|||
|
_Instance.ClearView();
|
|||
|
}
|
|||
|
CloseWindow<EquipmentDetailBox>();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Model
|
|||
|
|
|||
|
private class TemplateInfo
|
|||
|
{
|
|||
|
public int type;
|
|||
|
public EntityItemEquipment equipment;
|
|||
|
#pragma warning disable CS0649 // 从未对字段“QuickBox.TemplateInfo.quality”赋值,字段将一直保持其默认值 0
|
|||
|
public int quality;
|
|||
|
#pragma warning restore CS0649 // 从未对字段“QuickBox.TemplateInfo.quality”赋值,字段将一直保持其默认值 0
|
|||
|
#pragma warning disable CS0649 // 从未对字段“QuickBox.TemplateInfo.content”赋值,字段将一直保持其默认值 null
|
|||
|
public string content;
|
|||
|
#pragma warning restore CS0649 // 从未对字段“QuickBox.TemplateInfo.content”赋值,字段将一直保持其默认值 null
|
|||
|
}
|
|||
|
|
|||
|
private readonly Queue<TemplateInfo> _infoQueue = new Queue<TemplateInfo>();
|
|||
|
|
|||
|
private void AddInfo(TemplateInfo info)
|
|||
|
{
|
|||
|
if (_infoQueue.Count >= 2)
|
|||
|
_infoQueue.Dequeue();
|
|||
|
_infoQueue.Enqueue(info);
|
|||
|
ShowTemplate();
|
|||
|
}
|
|||
|
|
|||
|
private void RefreshModel()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
private void ClearModel()
|
|||
|
{
|
|||
|
_infoQueue.Clear();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private static QuickBox _Instance;
|
|||
|
|
|||
|
public QuickBox()
|
|||
|
: base(UILayer.kFloat, UIMode.kNone)
|
|||
|
{
|
|||
|
uiPath = "ui_w_equipment_quick";
|
|||
|
_Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
|
|||
|
public override void Awake()
|
|||
|
{
|
|||
|
InitView();
|
|||
|
}
|
|||
|
|
|||
|
public override void OnEnable()
|
|||
|
{
|
|||
|
RefreshModel();
|
|||
|
RefreshView();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|