95 lines
2.1 KiB
C#
95 lines
2.1 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2021-03-28
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "SwordWindow.View" company="Kunpo"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
partial class SwordWindow
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 广告奖励
|
|||
|
/// </summary>
|
|||
|
class SwordAdRewardBox : KUIWidget
|
|||
|
{
|
|||
|
[KUIFlag]
|
|||
|
Button _btnClose;
|
|||
|
[KUIFlag]
|
|||
|
Button _btnAdGet;
|
|||
|
[KUIFlag]
|
|||
|
GameObject __goGains;
|
|||
|
[KUIFlag]
|
|||
|
TextMeshProUGUI _tmpRemain;
|
|||
|
|
|||
|
|
|||
|
PropWidget _gainsPropWidget;
|
|||
|
SmartCostWidget _smartCostWidget;
|
|||
|
|
|||
|
public override void Refresh()
|
|||
|
{
|
|||
|
_gainsPropWidget.SetItem(SwordProxy.Instance.adRewards);
|
|||
|
|
|||
|
var timeInfo = TimeProxy.Instance.GetTimeInfo2(TimeProxy.剑阁广告次数);
|
|||
|
if (timeInfo.remain == timeInfo.max)
|
|||
|
{
|
|||
|
_smartCostWidget.SetFree();
|
|||
|
_tmpRemain.text = "每日首次免费";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_smartCostWidget.SetAdTicket(MoneyProxy.Instance.GetMoney(Item.Id.kAdTicket));
|
|||
|
_tmpRemain.text = $"剩余次数:{timeInfo.remain}/{timeInfo.max - 1}";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OnCloseBtnClick()
|
|||
|
{
|
|||
|
Close();
|
|||
|
}
|
|||
|
|
|||
|
void OnAdGetBtnClick()
|
|||
|
{
|
|||
|
SwordProxy.Instance.GetAdGains((error, message) =>
|
|||
|
{
|
|||
|
if (error == 0)
|
|||
|
{
|
|||
|
Refresh();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PostNotification(GlobalDefine.EVENT_SHOW_TOAST, message);
|
|||
|
}
|
|||
|
});
|
|||
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
}
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
_btnClose.onClick.AddListener(this.OnCloseBtnClick);
|
|||
|
_btnAdGet.onClick.AddListener(this.OnAdGetBtnClick);
|
|||
|
_smartCostWidget = _btnAdGet.gameObject.AddComponent<SmartCostWidget>();
|
|||
|
|
|||
|
_gainsPropWidget = __goGains.AddComponent<PropWidget>();
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
Refresh();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|