//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, May 24, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class StoveUpgradWin : Window
|
{
|
[SerializeField] UIAlphaTween m_DisplayAlphaTween;
|
[SerializeField] RawImage m_ModelRawImage;
|
[SerializeField] Image m_TitleIcon;
|
[SerializeField] Text m_PowerUpper;
|
[SerializeField] Button m_CloseBtn;
|
[SerializeField] RectTransform m_ContainerLv;
|
[SerializeField] Text m_LvBeforeValue;
|
[SerializeField] Text m_LvNowValue;
|
[SerializeField] RectTransform m_ContainerProperty;
|
[SerializeField] PropertyCompareBehaviour[] m_Properties;
|
[SerializeField] RectTransform m_ContainerSkill;
|
[SerializeField] StoveRecipeCell[] m_Recipes;
|
|
DateTime openTime = DateTime.Now;
|
#region Built-in
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void AddListeners()
|
{
|
m_CloseBtn.onClick.AddListener(OnClickClose);
|
}
|
|
protected override void OnPreOpen()
|
{
|
m_ModelRawImage.gameObject.SetActive(true);
|
m_ContainerSkill.gameObject.SetActive(false);
|
m_ContainerProperty.gameObject.SetActive(false);
|
m_ContainerLv.gameObject.SetActive(false);
|
m_DisplayAlphaTween.SetStartState();
|
|
openTime = DateTime.Now;
|
Display();
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
m_TitleIcon.SetSprite(ActivateShow.titleIconKey);
|
m_TitleIcon.SetNativeSize();
|
DisplayModel();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
UI3DModelExhibition.Instance.StopShow();
|
UI3DTreasureExhibition.Instance.StopShow();
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
#endregion
|
|
void Display()
|
{
|
switch (ActivateShow.activateType)
|
{
|
case ActivateShow.ActivateFunc.Stove:
|
DisplayFightPower();
|
DisplayLv();
|
DisplayProperty();
|
DisplaySkill();
|
break;
|
}
|
}
|
|
void DisplayFightPower()
|
{
|
m_PowerUpper.text = ActivateShow.fightPower.ToString();
|
}
|
|
void DisplayLv()
|
{
|
m_ContainerLv.gameObject.SetActive(true);
|
m_LvBeforeValue.text = ActivateShow.beforeLv.ToString();
|
m_LvNowValue.text = ActivateShow.currentLv.ToString();
|
}
|
|
void DisplayProperty()
|
{
|
m_ContainerProperty.gameObject.SetActive(true);
|
for (int i = 0; i < m_Properties.Length; i++)
|
{
|
if (i < ActivateShow.propertyCompares.Count)
|
{
|
m_Properties[i].gameObject.SetActive(true);
|
switch (ActivateShow.activateType)
|
{
|
case ActivateShow.ActivateFunc.Stove:
|
m_Properties[i].Display(ActivateShow.propertyCompares[i].key
|
, ActivateShow.propertyCompares[i].beforeValue, ActivateShow.propertyCompares[i].currentValue);
|
break;
|
}
|
}
|
else
|
{
|
m_Properties[i].gameObject.SetActive(false);
|
}
|
}
|
}
|
|
void DisplaySkill()
|
{
|
m_ContainerSkill.gameObject.SetActive(ActivateShow.skills.Count > 0);
|
if (ActivateShow.skills.Count == 0)
|
{
|
return;
|
}
|
for (int i = 0; i < m_Recipes.Length; i++)
|
{
|
if (i < ActivateShow.skills.Count)
|
{
|
m_Recipes[i].gameObject.SetActive(true);
|
m_Recipes[i].SetDisplayModel(ActivateShow.skills[i]);
|
}
|
else
|
{
|
m_Recipes[i].gameObject.SetActive(false);
|
}
|
}
|
}
|
|
void DisplayModel()
|
{
|
switch (ActivateShow.activateType)
|
{
|
case ActivateShow.ActivateFunc.Stove:
|
m_ModelRawImage.rectTransform.sizeDelta = new Vector2(600, 600);
|
UI3DTreasureExhibition.Instance.BeginShowTreasure(301, m_ModelRawImage);
|
break;
|
}
|
}
|
|
private void OnClickClose()
|
{
|
if ((DateTime.Now - openTime).TotalSeconds < 3f)
|
{
|
return;
|
}
|
CloseClick();
|
}
|
}
|
|
}
|
|
|
|
|