//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, April 03, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using Spine.Unity;
|
|
namespace Snxxz.UI
|
{
|
|
public class LaunchBackGroundWin : Window
|
{
|
[SerializeField] RectTransform m_StaticBackGround;
|
[SerializeField] Image m_BackGroundImage;
|
[SerializeField] CanvasGroup m_CanvasGroup;
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
var sprite = BuiltInLoader.LoadSprite("LoginBackGround");
|
m_BackGroundImage.overrideSprite = sprite;
|
m_StaticBackGround.gameObject.SetActive(true);
|
|
this.transform.SetAsFirstSibling();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
StartCoroutine(Co_FadeIn());
|
}
|
|
public void FadeOut()
|
{
|
StartCoroutine(Co_FadeOut());
|
}
|
|
IEnumerator Co_FadeIn()
|
{
|
var timer = 0f;
|
while (timer < 0.5f)
|
{
|
timer += Time.deltaTime;
|
m_CanvasGroup.alpha = Mathf.Clamp01(timer * 2f);
|
yield return null;
|
}
|
|
m_CanvasGroup.alpha = 1f;
|
}
|
|
IEnumerator Co_FadeOut()
|
{
|
var timer = 0f;
|
while (timer < 0.5f)
|
{
|
timer += Time.deltaTime;
|
m_CanvasGroup.alpha = Mathf.Clamp01(1 - timer * 2f);
|
yield return null;
|
}
|
|
m_CanvasGroup.alpha = 0f;
|
WindowCenter.Instance.Close<LaunchBackGroundWin>();
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|