90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2021-04-22
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "GetBookBox.View" company="Kunpo"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
partial class GetBookBox
|
|||
|
{
|
|||
|
#region Field
|
|||
|
|
|||
|
#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
[KUIFlag]
|
|||
|
GameObject _goTitle;
|
|||
|
[KUIFlag]
|
|||
|
Button _btnConfirm;
|
|||
|
[KUIFlag]
|
|||
|
Image _imgIcon;
|
|||
|
[KUIFlag]
|
|||
|
TextMeshProUGUI _tmpName;
|
|||
|
[KUIFlag]
|
|||
|
KUIImage _imgBg;
|
|||
|
[KUIFlag]
|
|||
|
KUIImage _imgShine;
|
|||
|
#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public void InitView()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
_btnConfirm.onClick.AddListener(this.OnConfirmBtnClick);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public void RefreshView()
|
|||
|
{
|
|||
|
if (this.data is ItemBook book)
|
|||
|
{
|
|||
|
_goTitle.SetActive(true);
|
|||
|
IconProxy.Instance.SetSprite(_imgIcon, book.icon);
|
|||
|
_tmpName.text = book.name;
|
|||
|
_imgBg.ShowSprite(0);
|
|||
|
_imgShine.ShowSprite(0);
|
|||
|
}
|
|||
|
else if (this.data is ItemProp prop)
|
|||
|
{
|
|||
|
_goTitle.SetActive(false);
|
|||
|
IconProxy.Instance.SetSprite(_imgIcon, prop.icon);
|
|||
|
_tmpName.text = prop.name;
|
|||
|
_imgBg.ShowSprite(1);
|
|||
|
_imgShine.ShowSprite(1);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void OnConfirmBtnClick()
|
|||
|
{
|
|||
|
if (this.data is ItemBook book)
|
|||
|
{
|
|||
|
BookProxy.Instance.UnlockBook(this.data as ItemBook);
|
|||
|
}
|
|||
|
|
|||
|
CloseWindow(this);
|
|||
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|