//--------------------------------------------------------
|
// [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] RectTransform m_DynamicBackGround;
|
[SerializeField] SkeletonGraphic m_SkeletonGraphic;
|
|
GameObject loginEffect;
|
|
bool useStaticBackGround = false;
|
#region Built-in
|
protected override void BindController()
|
{
|
loginEffect = this.transform.Find("Pivot/Effect_DengLu").gameObject;
|
}
|
|
protected override void AddListeners()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
var sprite = BuiltInLoader.LoadSprite("LoginBackGround");
|
useStaticBackGround = sprite != null;
|
|
if (useStaticBackGround)
|
{
|
m_BackGroundImage.overrideSprite = sprite;
|
m_StaticBackGround.gameObject.SetActive(true);
|
m_DynamicBackGround.gameObject.SetActive(false);
|
}
|
else
|
{
|
m_StaticBackGround.gameObject.SetActive(false);
|
m_DynamicBackGround.gameObject.SetActive(true);
|
}
|
|
if (loginEffect != null)
|
{
|
loginEffect.gameObject.SetActive(false);
|
}
|
|
this.transform.SetAsFirstSibling();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
StageLoad.Instance.onStageLoadFinish += ShowLoginEffect;
|
if (StageLoad.Instance.currentStage is LoginStage)
|
{
|
ShowLoginEffect();
|
}
|
}
|
|
protected override void OnPreClose()
|
{
|
StageLoad.Instance.onStageLoadFinish -= ShowLoginEffect;
|
Resources.UnloadAsset(m_SkeletonGraphic.material);
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
|
if (!useStaticBackGround)
|
{
|
if (m_SkeletonGraphic != null)
|
{
|
m_SkeletonGraphic.AnimationState.SetEmptyAnimations(0);
|
}
|
}
|
}
|
#endregion
|
|
void ShowLoginEffect()
|
{
|
if (!useStaticBackGround)
|
{
|
if (loginEffect != null)
|
{
|
loginEffect.gameObject.SetActive(true);
|
}
|
|
if (m_SkeletonGraphic != null)
|
{
|
m_SkeletonGraphic.AnimationState.SetAnimation(0, "animation2", true);
|
}
|
}
|
}
|
|
}
|
|
}
|
|
|
|
|