168 lines
4.4 KiB
C#
168 lines
4.4 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2022-02-28
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "WomanWindow" company="Kunpo"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public partial class FunctionRewardsWindow
|
|||
|
{
|
|||
|
class FunctionBoxWidget : KUIWidget
|
|||
|
{
|
|||
|
#region Fide
|
|||
|
#pragma warning disable CS0649 // <20><>δ<EFBFBD><CEB4><EFBFBD>ֶθ<D6B6>ֵ<EFBFBD><D6B5><EFBFBD>ֶν<D6B6>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ null
|
|||
|
[KUIFlag]
|
|||
|
Button _btnReceive;
|
|||
|
[KUIFlag]
|
|||
|
TextMeshProUGUI _tmpPrice;
|
|||
|
[KUIFlag]
|
|||
|
KUIList __listRewards;
|
|||
|
[KUIFlag]
|
|||
|
TextMeshProUGUI _tmpGet;
|
|||
|
[KUIFlag]
|
|||
|
Image _imgIcon;
|
|||
|
#pragma warning restore CS0649 // <20><>δ<EFBFBD><CEB4><EFBFBD>ֶθ<D6B6>ֵ<EFBFBD><D6B5><EFBFBD>ֶν<D6B6>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ null
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
public override void Refresh()
|
|||
|
{
|
|||
|
if (this.data is FunctionProxy.Function function)
|
|||
|
{
|
|||
|
if (function.IsUnlock())
|
|||
|
{
|
|||
|
_imgIcon.color = Color.white;
|
|||
|
_tmpPrice.gameObject.SetActive(false);
|
|||
|
_btnReceive.gameObject.SetActive(true);
|
|||
|
if (function.status < 2)
|
|||
|
{
|
|||
|
_btnReceive.interactable = true;
|
|||
|
_tmpGet.text = "<22><>ȡ";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_btnReceive.interactable = false;
|
|||
|
_tmpGet.text = "<22><><EFBFBD><EFBFBD>ȡ";
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_imgIcon.color = new Color32(150, 150, 150, 255);
|
|||
|
_tmpPrice.gameObject.SetActive(true);
|
|||
|
_btnReceive.gameObject.SetActive(false);
|
|||
|
_tmpPrice.text = function.lockTips;
|
|||
|
}
|
|||
|
IconProxy.Instance.SetSprite(_imgIcon, function.icon);
|
|||
|
__listRewards.Clear();
|
|||
|
foreach (var itemInfo in function.rewardInfos)
|
|||
|
{
|
|||
|
__listRewards.GetItem<PropWidget>().SetItem(itemInfo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
private void OnReceiveBtnClick() //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if (this.data is FunctionProxy.Function function)
|
|||
|
{
|
|||
|
FunctionProxy.Instance.GetRewards(function);
|
|||
|
GetWindow<FunctionRewardsWindow>().RefreshView();
|
|||
|
PostNotification(GlobalDefine.EVENT_MISSION_CHANGED, "FunctionRewards");
|
|||
|
}
|
|||
|
}
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
_btnReceive.onClick.AddListener(this.OnReceiveBtnClick);
|
|||
|
__listRewards.AddTemplate<PropWidget>(true);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
#region Constructor
|
|||
|
#pragma warning disable CS0649 // <20><>δ<EFBFBD><CEB4><EFBFBD>ֶθ<D6B6>ֵ<EFBFBD><D6B5><EFBFBD>ֶν<D6B6>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ null
|
|||
|
[KUIFlag]
|
|||
|
Button _btnClose;
|
|||
|
[KUIFlag]
|
|||
|
KUIList __listRankings;
|
|||
|
|
|||
|
#pragma warning restore CS0649 // <20><>δ<EFBFBD><CEB4><EFBFBD>ֶθ<D6B6>ֵ<EFBFBD><D6B5><EFBFBD>ֶν<D6B6>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ null
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
public void RefreshView()
|
|||
|
{
|
|||
|
var functions = FunctionProxy.Instance.Functions;
|
|||
|
var mask = __listRankings.transform.Find("goMask");
|
|||
|
if (mask)
|
|||
|
{
|
|||
|
mask.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
bool isAllUnlock = true;
|
|||
|
__listRankings.Clear();
|
|||
|
var timer = 3;
|
|||
|
foreach (var function in functions)
|
|||
|
{
|
|||
|
if (function.status < 2)
|
|||
|
{
|
|||
|
isAllUnlock = false;
|
|||
|
if (function.IsUnlock())
|
|||
|
{
|
|||
|
__listRankings.GetItem().SetData(function);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
timer--;
|
|||
|
if (timer < 0)
|
|||
|
{
|
|||
|
if (mask)
|
|||
|
{
|
|||
|
mask.gameObject.SetActive(true);
|
|||
|
mask.SetAsLastSibling();
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
__listRankings.GetItem().SetData(function);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//foreach (var function in functions)
|
|||
|
//{
|
|||
|
// if (function.status == 2)
|
|||
|
// {
|
|||
|
// __listRankings.GetItem().SetData(function);
|
|||
|
// }
|
|||
|
//}
|
|||
|
if (isAllUnlock)
|
|||
|
{
|
|||
|
CloseWindow(this);
|
|||
|
}
|
|||
|
}
|
|||
|
private void OnCloseBtnClick()
|
|||
|
{
|
|||
|
CloseWindow(this);
|
|||
|
}
|
|||
|
|
|||
|
private void InitView()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
_btnClose.onClick.AddListener(this.OnCloseBtnClick);
|
|||
|
|
|||
|
__listRankings.AddTemplate<FunctionBoxWidget>(true);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|