Files

170 lines
5.0 KiB
C#
Raw Permalink Normal View History

2026-04-20 12:06:34 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using FairyGUI;
using SGModule.Common.Extensions;
using SGModule.Common.Helper;
using SGModule.NetKit;
using UnityEngine;
namespace BallKingdomCrush
{
public class SecretDetailUI : BaseUI
{
private SecretDetailUICtrl ctrl;
private SecretDetailModel model;
private FGUI.LG_secretAlbums.com_secretDetail ui;
public SecretDetailUI(SecretDetailUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.SecretDetailUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_secretAlbums";
uiInfo.assetName = "com_secretDetail";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.SecretDetailModel) as SecretDetailModel;
}
protected override void OnClose()
{
if (_loader != null && !_loader.isDisposed && _loader.texture != null)
{
_loader.texture.Dispose();
_loader.texture = null;
}
_loader = null;
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_secretAlbums.com_secretDetail;
}
private DetailData _pictureName;
protected override void OnOpenBefore(object args)
{
if (args == null) return;
_pictureName = (DetailData)args;
InitView();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
#endregion
private GLoader _loader = new GLoader();
//初始化页面逻辑
private void InitView()
{
ui.btn_close.SetClick(CtrlCloseUI);
_loader = ui.com_loader.GetChild("loader") as GLoader;
TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, _pictureName.Name, null,
_pictureName.Name1, FolderNames.SecretName);
var btnDownCoin = ((FGUI.LG_Common.btn_unlock)ui.btn_download_coin);
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
btnDownCoin.title = downloadCoinNum.ToString();
if (GameHelper.GetVipLevel() >= 1)
{
(ui.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
ui.is_vip.selectedIndex = 1;
}
else
{
ui.is_vip.selectedIndex = 0;
btnDownCoin.down_load.selectedIndex = 1;
}
btnDownCoin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
TextureHelper.SaveImageToAlbum(_pictureName.Name, FolderNames.SecretName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() >= 1)
{
TextureHelper.SaveImageToAlbum(_pictureName.Name, FolderNames.SecretName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("secret_albnums", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(_pictureName.Name, FolderNames.SecretName, CtrlCloseUI);
}
});
}
});
}
private void ItemRender(int index, GObject obj)
{
}
private int GetPepleNum(float quantity)
{
// 获取当前时间
DateTime now = DateTime.Now;
// 计算当天已经过去的分钟数(从凌晨 0 点开始算)
int minutesPassedToday = now.Hour * 60 + now.Minute;
// 计算人数
int num = Mathf.FloorToInt(quantity * minutesPassedToday);
return num;
}
}
}