//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, October 27, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
//Buff数显
|
namespace vnxbqy.UI {
|
|
public class BuffDigitalDisplayWin : Window
|
{
|
[SerializeField]
|
Transform DigitalDisplay;
|
[SerializeField]
|
Button _button;
|
float interval = 0.2f;
|
float nextShowTime = 0f;
|
|
int queueMax = 10;
|
Queue<long> experienceQueue = new Queue<long>();
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
_button.AddListener(()=>
|
{
|
|
OnGetNewExperience(500);
|
|
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
DigitalDisplayBuffPool.RecycleAll();
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
private void OnGetNewExperience(long NUmber)
|
{
|
if (experienceQueue.Count >= queueMax)
|
{
|
experienceQueue.Dequeue();
|
}
|
|
experienceQueue.Enqueue(NUmber);
|
}
|
|
protected override void LateUpdate()
|
{
|
base.LateUpdate();
|
|
if (Time.time > nextShowTime)
|
{
|
if (experienceQueue.Count > 0)
|
{
|
var exp = experienceQueue.Dequeue();
|
var digitalDisplayBuff = DigitalDisplayBuffPool.Require();
|
digitalDisplayBuff.SetActive(true);
|
digitalDisplayBuff.transform.SetParentEx(DigitalDisplay, Vector3.zero, Quaternion.identity, Vector3.one);
|
digitalDisplayBuff.Begin(exp);
|
|
nextShowTime = Time.time + interval;
|
}
|
}
|
|
}
|
#endregion
|
|
}
|
|
}
|