提交项目
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9717499f5de1c4919858e43697142105
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AdcomingCtrl : BaseCtrl
|
||||
{
|
||||
public static AdcomingCtrl Instance { get; private set; }
|
||||
|
||||
private AdcomingModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.AdcomingModel) as AdcomingModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8bd042de9ef64e59b65fefb9788f71d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AdcomingModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29789969ee11944f8be5196fc0b81532
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using FutureCore;
|
||||
using FairyGUI;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AdcomingUI : BaseUI
|
||||
{
|
||||
private AdcomingUICtrl ctrl;
|
||||
private AdcomingModel model;
|
||||
private FGUI.ZM_Pack_16.com_adcoming ui;
|
||||
|
||||
public AdcomingUI(AdcomingUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.AdcomingUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Pack_16";
|
||||
uiInfo.assetName = "com_adcoming";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AdcomingModel) as AdcomingModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Pack_16.com_adcoming;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.pack_close, playAni);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.pack_close, playAni);
|
||||
}
|
||||
#endregion
|
||||
private int time = 5;
|
||||
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
ui.time_text.text = time.ToString();
|
||||
|
||||
tweer = DOVirtual.Float(time, 0, time, value => { ui.time_text.text = ((int)value).ToString(); });
|
||||
tweer.onComplete += () =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
GameHelper.ShowInterstitial("interstitial_gameend");
|
||||
};
|
||||
|
||||
ui.btn_removead.SetClick(() =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LuckyPackUI_Open,true);
|
||||
tweer.Pause();
|
||||
});
|
||||
|
||||
}
|
||||
private Tween tweer;
|
||||
void playAni(object a)
|
||||
{
|
||||
tweer.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfe9a378b6c07410b91e71ce80c75a05
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AdcomingUICtrl : BaseUICtrl
|
||||
{
|
||||
private AdcomingUI ui;
|
||||
private AdcomingModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.AdcomingUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.AdcomingUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AdcomingModel) as AdcomingModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new AdcomingUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbf393f35eff5477da2f9c69a02c3822
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ec7125d0333e284db6729a02dd964b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AddViewCtrl : BaseCtrl
|
||||
{
|
||||
public static AddViewCtrl Instance { get; private set; }
|
||||
|
||||
private AddViewModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.AddViewModel) as AddViewModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6058e09514454ec394a1478f2775964
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AddViewModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
// protected override void OnReset()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 读取数据
|
||||
// protected override void OnReadData()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 本地存储
|
||||
// protected override void WriteLocalStorage()
|
||||
// {
|
||||
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b0a4fbab97e64d5b982896192bb6483
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using FGUI.ZM_Common_01;
|
||||
using SGModule.NetKit;
|
||||
using Spine.Unity;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AddViewUI : BaseUI
|
||||
{
|
||||
private AddViewUICtrl ctrl;
|
||||
private AddViewModel model;
|
||||
private FGUI.ZM_AddCell_12.com_addView ui;
|
||||
public int ad_cool_down = 120;
|
||||
public btn_watchAd btn_WatchAd;
|
||||
|
||||
public AddViewUI(AddViewUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.AddViewUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_AddCell_12";
|
||||
uiInfo.assetName = "com_addView";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AddViewModel) as AddViewModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI = true;
|
||||
// HallManager.Instance.UpdateSecondEvent -= updateWatchCD;
|
||||
if (GameHelper.IsAdModelOfPay())
|
||||
{
|
||||
AdExchangeManager.Instance.Destroy();
|
||||
}
|
||||
if (need_call) GameHelper.CallShowTurn();
|
||||
}
|
||||
private bool need_call;
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_AddCell_12.com_addView;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
TrackKit.SendEvent(GameHelper.GetEventName(), ADEventTrack.Property.buy_one_show);
|
||||
if (args != null) need_call = (bool)args;
|
||||
// ad_cool_down = ConfigSystem.GetConfig<CommonModel>().exchangeCD;
|
||||
// btn_WatchAd = ui.btn_watch as btn_watchAd;
|
||||
if (GameHelper.IsAdModelOfPay())
|
||||
{
|
||||
AdExchangeManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.buy_one), ui.btn_watch as btn_watchAd, SetTextString);
|
||||
ui.pay_type.selectedIndex = 0;
|
||||
|
||||
|
||||
AdExchangeManager.Instance.Start();
|
||||
SetTextString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.pay_type.selectedIndex = 1;
|
||||
decimal price = (decimal)GameHelper.GetCommonModel().addspace2;
|
||||
ui.btn_max_pay.title = GameHelper.getPrice(price);
|
||||
ui.btn_max_pay.SetClick(() =>
|
||||
{
|
||||
ApplePayClass maxPayData = new ApplePayClass
|
||||
{
|
||||
amount = (int)Math.Round(price * 100),
|
||||
sku =PurchasingManager.GetPaySku(PayType.buy_one),
|
||||
currency = "USD"
|
||||
};
|
||||
MaxPayManager.Instance.Buy(maxPayData);
|
||||
});
|
||||
}
|
||||
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.apple_pay_success, pay_success);
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.apple_pay_success, pay_success);
|
||||
|
||||
}
|
||||
#endregion
|
||||
void pay_success(object str)
|
||||
{
|
||||
string type = (string)str;
|
||||
|
||||
if (type == PurchasingManager.GetPaySku(PayType.buy_one))
|
||||
{
|
||||
CtrlCloseUI();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Action closeCallback = null;
|
||||
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
|
||||
|
||||
var add = FXManager.Instance.SetFx<SkeletonAnimation>(ui.anim_bg, Fx_Type.fx_add_box, ref closeCallback);
|
||||
add.state.SetAnimation(0, "animation", true);
|
||||
|
||||
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
});
|
||||
|
||||
// HallManager.Instance.UpdateSecondEvent += updateWatchCD;
|
||||
// updateWatchCD();
|
||||
|
||||
// checkBtnState();
|
||||
|
||||
}
|
||||
|
||||
public void SetTextString()
|
||||
{
|
||||
var need = AdExchangeManager.Instance.GetCeilingNeedAds(PurchasingManager.GetPaySku(PayType.buy_one));
|
||||
var myAd = AdExchangeManager.Instance.GetLookRewardADNum();
|
||||
|
||||
ui.tips.SetVar("num", need.ToString()).FlushVars();
|
||||
ui.ads.SetVar("num", myAd.ToString()).FlushVars();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40b42d370a2c34db89da3decb4b3ba0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AddViewUICtrl : BaseUICtrl
|
||||
{
|
||||
private AddViewUI ui;
|
||||
private AddViewModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.BuyslotUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.BuyslotUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AddViewModel) as AddViewModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new AddViewUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c4feca1f3dc94e0291dbe534b773067
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0a3a471d4eab4205adfabe3e6e03dfa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlbumDetailCtrl : BaseCtrl
|
||||
{
|
||||
public static AlbumDetailCtrl Instance { get; private set; }
|
||||
|
||||
private AlbumDetailModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 742a1554a1ce547a18f4d2fcde5d052a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlbumDetailModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5b5cfda3c4d14dc6ab5ea147569f119
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,299 @@
|
||||
|
||||
using FGUI.ZM_Common_01;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using System.Collections.Generic;
|
||||
using FGUI.LG_albums;
|
||||
using FGUI.LG_Common;
|
||||
using SGModule.DataStorage;
|
||||
using DG.Tweening;
|
||||
using SGModule.Common.Extensions;
|
||||
using System.Linq;
|
||||
using SGModule.NetKit;
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlbumDetailUI : BaseUI
|
||||
{
|
||||
private AlbumDetailUICtrl ctrl;
|
||||
private AlbumDetailModel model;
|
||||
private FGUI.LG_albums.com_albumsDetail ui;
|
||||
|
||||
public AlbumDetailUI(AlbumDetailUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.AlbumDetailUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_albums";
|
||||
uiInfo.assetName = "com_albumsDetail";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
if (loader != null && !loader.isDisposed && loader.texture != null)
|
||||
{
|
||||
loader.texture.Dispose();
|
||||
loader.texture = null;
|
||||
}
|
||||
loader = null;
|
||||
|
||||
if (new_index != -1)
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.UnlockAlbums, index);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.LG_albums.com_albumsDetail;
|
||||
}
|
||||
private List<LevelUnlock> LevelData;
|
||||
private int new_index = -1;
|
||||
private int index;
|
||||
|
||||
private GLoader loader = new GLoader();
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
index = (int)args;
|
||||
Debug.Log(index);
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
});
|
||||
LevelData = ConfigSystem.GetConfig<LevelUnlock>();
|
||||
// ui.list_.SetVirtual();
|
||||
// ui.list_.itemRenderer = RendererList;
|
||||
// ui.list_.numItems = GameHelper.GetLevel() - 1;
|
||||
// ui.list_.ScrollToView(new_index);
|
||||
|
||||
RendererList();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, refrsh);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, refrsh);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//初始化页面逻辑
|
||||
private void refrsh(object a = null)
|
||||
{
|
||||
DOVirtual.DelayedCall(0.5f, () =>
|
||||
{
|
||||
// ui.list_.numItems = GameHelper.GetLevel() - 1;
|
||||
RendererList();
|
||||
});
|
||||
|
||||
}
|
||||
// void RendererList(int index, GObject obj)
|
||||
void RendererList()
|
||||
{
|
||||
|
||||
item_albumsDetails item = (item_albumsDetails)ui.com_item;
|
||||
|
||||
loader = item.com_loader.GetChild("loader") as GLoader;
|
||||
|
||||
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
|
||||
// {
|
||||
// (item.btn_vip as btn_claim_2).have_vip.selectedIndex = 1;
|
||||
|
||||
// }
|
||||
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
|
||||
// {
|
||||
// (item.btn_watch as btn_claim_1).have_vip.selectedIndex = 1;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
|
||||
var btn_down_coin = (FGUI.LG_Common.btn_unlock_1)item.btn_download_coin;
|
||||
btn_down_coin.title = downloadCoinNum.As<string>();
|
||||
btn_down_coin.down_load.selectedIndex = GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()) ? 0 : 1;
|
||||
|
||||
|
||||
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
|
||||
{
|
||||
(item.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
|
||||
item.is_vip.selectedIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.is_vip.selectedIndex = 0;
|
||||
}
|
||||
if (index < GameHelper.GetCommonModel().MultiModal - 1)
|
||||
{
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
item.btn_download.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
btn_down_coin.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.Get101() >= downloadCoinNum)
|
||||
{
|
||||
GameHelper.AddGold(-downloadCoinNum);
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
|
||||
string file_name = "";
|
||||
if (levelunlock_ != null)
|
||||
{
|
||||
if (levelunlock_.type == 0)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<FreeImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<FreeImageLibrary>().Count - 1;
|
||||
FreeImageLibrary _leveldata = ConfigSystem.GetConfig<FreeImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
file_name = _leveldata.Name;
|
||||
}
|
||||
else if (levelunlock_.type == 1)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<ADImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<ADImageLibrary>().Count - 1;
|
||||
ADImageLibrary _leveldata = ConfigSystem.GetConfig<ADImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
file_name = _leveldata.Name;
|
||||
}
|
||||
else if (levelunlock_.type == 2)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<SpecialImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<SpecialImageLibrary>().Count - 1;
|
||||
SpecialImageLibrary _leveldata = ConfigSystem.GetConfig<SpecialImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
file_name = _leveldata.Name;
|
||||
}
|
||||
else if (levelunlock_.type == 3)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<VIPImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<VIPImageLibrary>().Count - 1;
|
||||
VIPImageLibrary _leveldata = ConfigSystem.GetConfig<VIPImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
file_name = _leveldata.Name;
|
||||
}
|
||||
item.btn_download.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
btn_down_coin.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.Get101() >= downloadCoinNum)
|
||||
{
|
||||
GameHelper.AddGold(-downloadCoinNum);
|
||||
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
|
||||
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
item.btn_download.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
btn_down_coin.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.Get101() >= downloadCoinNum)
|
||||
{
|
||||
GameHelper.AddGold(-downloadCoinNum);
|
||||
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
|
||||
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47ef18a651dc245c587515925adba37d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlbumDetailUICtrl : BaseUICtrl
|
||||
{
|
||||
private AlbumDetailUI ui;
|
||||
private AlbumDetailModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.AlbumDetailUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.AlbumDetailUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new AlbumDetailUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0ae060ce359f4428b4c82fd96f6f2c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 835af6bef1d644831a65b4e33ba7fa24
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlubumCtrl : BaseCtrl
|
||||
{
|
||||
public static AlubumCtrl Instance { get; private set; }
|
||||
|
||||
private AlubumModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.AlubumModel) as AlubumModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afb7ba0a285a24cf6a2b59cbad176778
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlubumModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a84f029a2173e4a74b9b57cdd492a693
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,494 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using FairyGUI;
|
||||
using FGUI.LG_albums;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace LoveLegend
|
||||
|
||||
{
|
||||
public class AlubumUI : BaseUI
|
||||
{
|
||||
private AlubumUICtrl ctrl;
|
||||
private AlubumModel model;
|
||||
private com_albums ui;
|
||||
private long[] UpDatatime;
|
||||
|
||||
public AlubumUI(AlubumUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.AlubumUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_albums";
|
||||
uiInfo.assetName = "com_albums";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
//初始化页面逻辑
|
||||
private void InitView(object a = null)
|
||||
{
|
||||
UpDatatime = new long[LevelData.Count];
|
||||
ImageName = new string[LevelData.Count];
|
||||
ui.list_albums.itemRenderer = RendererList;
|
||||
ui.list_albums.numItems = LevelData.Count;
|
||||
|
||||
InitScroll();
|
||||
}
|
||||
|
||||
private void SetItemData(object obj = null)
|
||||
{
|
||||
UpDatatime[(int)obj] = 0;
|
||||
ui.list_albums.RefreshVirtualList();
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
GLoaderPool.Instance.Init(null, 24, 312, 310);
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
foreach (var t in loader_list)
|
||||
if (t != null && !t.isDisposed && t.texture != null)
|
||||
{
|
||||
t.texture.Dispose();
|
||||
t.texture = null;
|
||||
}
|
||||
|
||||
// 1. 解除 UI 对 Loader 的引用
|
||||
for (var i = 0; i < ui.list_albums.numChildren; i++)
|
||||
{
|
||||
var item = ui.list_albums.GetChildAt(i) as item_albums;
|
||||
if (item != null && item.com_loader.loader != null) item.com_loader.loader = null; // 清掉 GLoader 引用
|
||||
}
|
||||
|
||||
activeLoaders.Clear();
|
||||
_fileIsExist.Clear();
|
||||
|
||||
GLoaderPool.Instance.DisposeAll();
|
||||
|
||||
TextureHelper.ClearMaterialPool();
|
||||
|
||||
// 强制卸载未使用的资源
|
||||
Resources.UnloadUnusedAssets();
|
||||
MemoryManager.CleanMemoryMonitor();
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as com_albums;
|
||||
}
|
||||
|
||||
private List<LevelUnlock> LevelData;
|
||||
|
||||
private readonly List<GLoader> loader_list = new();
|
||||
public SmartInvoker invoker;
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
invoker = new SmartInvoker(() =>
|
||||
{
|
||||
for (int i = 0; i < UpDatatime.Length; i++)
|
||||
{
|
||||
UpDatatime[i] = 0;
|
||||
// ImageName[i] = "";
|
||||
}
|
||||
ui.list_albums.RefreshVirtualList();
|
||||
}, TimeSpan.FromSeconds(0.2f));
|
||||
|
||||
LevelData = ConfigSystem.GetConfig<LevelUnlock>();
|
||||
ui.list_albums.SetVirtual();
|
||||
ui.btn_close1.SetClick(() => { CtrlCloseUI(); });
|
||||
InitView();
|
||||
}
|
||||
|
||||
|
||||
private const int MaxVisibleCount = 18; // 一屏显示18个
|
||||
private const int PreloadCount = 3; // 上下各预加载一屏
|
||||
private readonly Dictionary<int, GLoader> activeLoaders = new();
|
||||
private readonly Dictionary<int, bool> _fileIsExist = new();
|
||||
|
||||
private Throttle _throttle;
|
||||
|
||||
private void InitScroll()
|
||||
{
|
||||
// ui.list_albums.scrollPane.onScroll.Add(OnScrollUpdate);
|
||||
ui.list_albums.scrollPane.onScrollEnd.Add(OnScrollEndCB); // 保留结束时的整理
|
||||
|
||||
OnScrollEnd();
|
||||
}
|
||||
|
||||
|
||||
private void OnScrollEndCB()
|
||||
{
|
||||
// UpdateVisibleAndPreload();
|
||||
|
||||
OnScrollEnd();
|
||||
|
||||
// Debug.Log("更新一次");
|
||||
}
|
||||
|
||||
private void UpdateVisibleAndPreload()
|
||||
{
|
||||
// Debug.Log("[UpdateVisibleAndPreload]--------111111--------- ");
|
||||
// if (LevelData == null || LevelData.Count == 0) return;
|
||||
|
||||
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
|
||||
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
|
||||
|
||||
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
|
||||
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
|
||||
|
||||
// // 回收超出范围 loader
|
||||
// var keysToRemove = new List<int>();
|
||||
// foreach (var kv in activeLoaders)
|
||||
// {
|
||||
// var idx = kv.Key;
|
||||
// if (idx < startIndex || idx > endIndex)
|
||||
// {
|
||||
// GLoaderPool.Instance.ReturnLoader(kv.Value);
|
||||
// var oldItem = ui.list_albums.GetChildAt(idx) as item_albums;
|
||||
// if (oldItem != null) oldItem.com_loader.loader = null;
|
||||
// keysToRemove.Add(idx);
|
||||
// }
|
||||
// }
|
||||
|
||||
// foreach (var k in keysToRemove) activeLoaders.Remove(k);
|
||||
|
||||
|
||||
// // 分配 loader 并加载图片
|
||||
// for (var i = startIndex; i <= endIndex; i++)
|
||||
// {
|
||||
// if (activeLoaders.ContainsKey(i)) continue;
|
||||
|
||||
// var item = ui.list_albums.GetChildAt(i) as item_albums;
|
||||
// if (item == null) continue;
|
||||
|
||||
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
|
||||
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
|
||||
|
||||
// var loader = GLoaderPool.Instance.GetLoader();
|
||||
// item.com_loader.loader = loader;
|
||||
// item.com_loader.AddChild(loader);
|
||||
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
|
||||
|
||||
// _fileIsExist.TryGetValue(i, out var value);
|
||||
// if (!value)
|
||||
// {
|
||||
// var localPath = Path.Combine(TextureHelper.getResPath(), LevelData[i].Name + ".jpg");
|
||||
|
||||
// if (File.Exists(localPath))
|
||||
// {
|
||||
// _fileIsExist[i] = true;
|
||||
// Debug.Log($"[SetImgLoader] 本地存在,直接加载 {LevelData[i].Name}");
|
||||
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
|
||||
// "LevelAlbums/"));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _fileIsExist[i] = false;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
|
||||
// "LevelAlbums/"));
|
||||
// }
|
||||
|
||||
// activeLoaders[i] = loader;
|
||||
// }
|
||||
// Debug.Log($"[ScrollUpdate] active loaders={activeLoaders.Count}, pool={GLoaderPool.Instance.GetPoolCount()}, inUse={GLoaderPool.Instance.GetInUseCount()}");
|
||||
}
|
||||
|
||||
private void OnScrollEnd()
|
||||
{
|
||||
invoker.Invoke();
|
||||
// for (int i = 0; i < UpDatatime.Length; i++)
|
||||
// {
|
||||
// UpDatatime[i] = 0;
|
||||
// // ImageName[i] = "";
|
||||
// }
|
||||
|
||||
// DOVirtual.DelayedCall(0.1f, () =>
|
||||
// {
|
||||
// ui.list_albums.RefreshVirtualList();
|
||||
// });
|
||||
|
||||
// if (LevelData == null || LevelData.Count == 0) return;
|
||||
|
||||
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
|
||||
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
|
||||
|
||||
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
|
||||
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
|
||||
|
||||
// // Debug.Log($"[ScrollEnd] start index={startIndex} end index={endIndex}");
|
||||
|
||||
|
||||
// var tasks = new List<(GLoader loader, string fileName, Action<NTexture> callback, string folder)>();
|
||||
// // 分配 loader 并加载图片
|
||||
// for (var i = startIndex; i <= endIndex; i++)
|
||||
// {
|
||||
// _fileIsExist.TryGetValue(i, out var value);
|
||||
|
||||
// if (value) continue;
|
||||
|
||||
// if (GameHelper.GetLevel() < i + 1) continue;
|
||||
|
||||
// var item = ui.list_albums.GetChildAt(i) as item_albums;
|
||||
// if (item == null) continue;
|
||||
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
|
||||
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
|
||||
// var loader = GLoaderPool.Instance.GetLoader();
|
||||
// item.com_loader.loader = loader;
|
||||
// item.com_loader.AddChild(loader);
|
||||
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
|
||||
|
||||
// var idx = i;
|
||||
// tasks.Add((loader, LevelData[i].Name, NTexture =>
|
||||
// {
|
||||
// if (NTexture != null) _fileIsExist[idx] = true;
|
||||
// }, "LevelAlbums/"));
|
||||
|
||||
// activeLoaders[i] = loader;
|
||||
// }
|
||||
|
||||
// if (tasks.Count > 0) TextureHelper.SetImgLoaders(tasks);
|
||||
}
|
||||
|
||||
private string[] ImageName;
|
||||
|
||||
private void RendererList(int index, GObject obj)
|
||||
{
|
||||
// Debug.Log("Render list" );
|
||||
|
||||
// Debug.Log(JsonConvert.SerializeObject(LevelData[index]));
|
||||
|
||||
item_albums item = (item_albums)obj;
|
||||
item.text_num.text = (index + 1).ToString();
|
||||
if (index < GameHelper.GetCommonModel().MultiModal - 1)
|
||||
{
|
||||
item.type_.selectedIndex = 0;
|
||||
if (GameHelper.GetLevel() > index + 1)
|
||||
{
|
||||
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
|
||||
if (levelunlock_ != null)
|
||||
{
|
||||
item.type_.selectedIndex = levelunlock_.type;
|
||||
}
|
||||
else item.type_.selectedIndex = 0;
|
||||
if (GameHelper.GetLevel() > index + 1)
|
||||
{
|
||||
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GameHelper.GetNowTime() < UpDatatime[index] + 1) return;
|
||||
UpDatatime[index] = GameHelper.GetNowTime();
|
||||
// if (!activeLoaders.ContainsValue(item.com_loader.loader)) activeLoaders[index] = item.com_loader.loader;
|
||||
if (!loader_list.Contains(item.com_loader.GetChild("loader") as GLoader))
|
||||
loader_list.Add(item.com_loader.GetChild("loader") as GLoader);
|
||||
|
||||
|
||||
if (index < GameHelper.GetCommonModel().MultiModal - 1)
|
||||
{
|
||||
if (GameHelper.GetLevel() > index + 1)
|
||||
{
|
||||
item.isUnlock.selectedIndex = 1;
|
||||
if (item.com_loader.loader.texture == null ||
|
||||
item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
|
||||
{
|
||||
// item.isUnlock.selectedIndex = 0;
|
||||
// if (item.com_loader.loader.texture != null)
|
||||
// {
|
||||
// item.com_loader.loader.texture.Dispose(); // 释放 GPU 资源
|
||||
// item.com_loader.loader.texture = null; // 断开引用
|
||||
// }
|
||||
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name,
|
||||
(a) => { Debug.Log(item.com_loader.loader.texture.nativeTexture.name); }, "LevelAlbums/", FolderNames.AlbumName);
|
||||
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
|
||||
item.touchable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isUnlock.selectedIndex = 0;
|
||||
// item.touchable = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
|
||||
|
||||
if (GameHelper.GetLevel() > index + 1)
|
||||
{
|
||||
if (levelunlock_ != null)
|
||||
{
|
||||
item.isUnlock.selectedIndex = 1;
|
||||
|
||||
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != ImageName[index])
|
||||
{
|
||||
|
||||
if (levelunlock_.type == 0)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<FreeImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<FreeImageLibrary>().Count - 1;
|
||||
FreeImageLibrary _leveldata = ConfigSystem.GetConfig<FreeImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
else if (levelunlock_.type == 1)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<ADImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<ADImageLibrary>().Count - 1;
|
||||
ADImageLibrary _leveldata = ConfigSystem.GetConfig<ADImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
else if (levelunlock_.type == 2)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<SpecialImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<SpecialImageLibrary>().Count - 1;
|
||||
SpecialImageLibrary _leveldata = ConfigSystem.GetConfig<SpecialImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
else if (levelunlock_.type == 3)
|
||||
{
|
||||
if (levelunlock_.config_index >= ConfigSystem.GetConfig<VIPImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<VIPImageLibrary>().Count - 1;
|
||||
VIPImageLibrary _leveldata = ConfigSystem.GetConfig<VIPImageLibrary>()[levelunlock_.config_index];
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isUnlock.selectedIndex = 1;
|
||||
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
|
||||
{
|
||||
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
|
||||
ImageName[index] = LevelData[index].Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// item.touchable = false;
|
||||
item.isUnlock.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.UnlockAlbums, SetItemData);
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.UnlockAlbums, SetItemData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
public class SmartInvoker
|
||||
{
|
||||
private readonly Action _action;
|
||||
private readonly TimeSpan _delay;
|
||||
private DateTime _lastImmediateInvoke = DateTime.MinValue;
|
||||
private CancellationTokenSource _cts = null;
|
||||
private readonly object _lock = new object();
|
||||
private bool _hasPending = false;
|
||||
|
||||
public SmartInvoker(Action action, TimeSpan delay)
|
||||
{
|
||||
_action = action;
|
||||
_delay = delay;
|
||||
}
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var timeSinceLast = now - _lastImmediateInvoke;
|
||||
|
||||
if (timeSinceLast >= _delay)
|
||||
{
|
||||
_lastImmediateInvoke = now;
|
||||
_action();
|
||||
Debug.Log("diaoyongyiciiiiiiiiiiiiiii");
|
||||
}
|
||||
else
|
||||
{
|
||||
_hasPending = true;
|
||||
_cts?.Cancel();
|
||||
_cts = new CancellationTokenSource();
|
||||
var token = _cts.Token;
|
||||
|
||||
Task.Delay(_delay, token).ContinueWith(t =>
|
||||
{
|
||||
if (!t.IsCanceled)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_hasPending)
|
||||
{
|
||||
_lastImmediateInvoke = DateTime.UtcNow;
|
||||
_hasPending = false;
|
||||
_action();
|
||||
Debug.Log("diaoyongyiciiiiiiiiiiiiiii");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, TaskScheduler.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8211638a3a24a4f0f9e093343198e8ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class AlubumUICtrl : BaseUICtrl
|
||||
{
|
||||
private AlubumUI ui;
|
||||
private AlubumModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.AlubumUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.AlubumUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AlubumModel) as AlubumModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new AlubumUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1c15e9bbddc64e5ca24ec7c564207a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 372fb7ce72e687245966c9031b91edc6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BroadcastCtrl : BaseCtrl
|
||||
{
|
||||
public static BroadcastCtrl Instance { get; private set; }
|
||||
|
||||
private BroadcastModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 575f1d3d71a8445bc8d960a3f33d8bc1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BroadcastModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2362fee130b6f4067b943f44ba629113
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,221 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using FGUI.ZM_Common_01;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BroadcastUI : BaseUI
|
||||
{
|
||||
private BroadcastUICtrl ctrl;
|
||||
private BroadcastModel model;
|
||||
private com_broadcast1 ui;
|
||||
|
||||
public BroadcastUI(BroadcastUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.BroadcastUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Common_01";
|
||||
uiInfo.assetName = "com_broadcast1";
|
||||
uiInfo.layerType = UILayerType.Highest;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as com_broadcast1;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
InitView();
|
||||
//ui.y = 241;
|
||||
|
||||
if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI))
|
||||
{
|
||||
|
||||
Settop();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Setbuttom();
|
||||
}
|
||||
// ui.visible = false;
|
||||
// if (Screen.safeArea.y != 0)
|
||||
// {//刘海屏
|
||||
// ui.y += Screen.safeArea.y;
|
||||
// }
|
||||
text_ui = ui.broad_cast_text;
|
||||
|
||||
|
||||
text_ui.btn_broad.SetClick(OpenRecord);
|
||||
|
||||
if (ConfigSystem.GetConfig<SubscribePodcast>() == null) return;
|
||||
config_name_list = SubscribePodcastModel.config_name_list;
|
||||
config_vip_level_list = SubscribePodcastModel.config_vip_level_list;
|
||||
|
||||
GameDispatcher.Instance.AddListener(GameMsg.hideBroadCast, hideEvent);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.showBroadCast, showEvent);
|
||||
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.MainUI_Open, Setbuttom);
|
||||
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.RainPlayUI_Open, Settop);
|
||||
}
|
||||
|
||||
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 int time_count = 11;
|
||||
private com_broadcast_text1 text_ui;
|
||||
private List<string> config_name_list;
|
||||
private List<string> config_vip_level_list;
|
||||
private bool main_ui_show = true;
|
||||
//初始化页面逻辑
|
||||
|
||||
private Action closeCallback;
|
||||
private void InitView()
|
||||
{
|
||||
HallManager.Instance.UpdateSecondEvent += timeEvent;
|
||||
|
||||
|
||||
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.broad_cast_text.bg_panel, Fx_Type.fx_broad, ref closeCallback);
|
||||
sk.state.SetAnimation(0, "animation", true);
|
||||
ui.broad_cast_text.bg_panel.SetScale(1.45f, 1.1f);
|
||||
}
|
||||
|
||||
private void OpenRecord()
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RecordViewUI_Open);
|
||||
}
|
||||
private void hideEvent(object sender = null)
|
||||
{
|
||||
// Debug.Log("hide");
|
||||
main_ui_show = false;
|
||||
ui.visible = false;
|
||||
}
|
||||
private void showEvent(object sender = null)
|
||||
{
|
||||
// Debug.Log("show");
|
||||
main_ui_show = true;
|
||||
ui.visible = true;
|
||||
}
|
||||
private void Settop(object sender = null)
|
||||
{
|
||||
ui.group_.y = 350;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
ui.group_.y += 68;
|
||||
}
|
||||
}
|
||||
private void Setbuttom(object sender = null)
|
||||
{
|
||||
ui.group_.y = 170;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
ui.group_.y += 68;
|
||||
}
|
||||
}
|
||||
# if GAME_RELEASE
|
||||
private const int MaxTime = 300;
|
||||
#else
|
||||
private const int MaxTime = 10;
|
||||
#endif
|
||||
void timeEvent()
|
||||
{
|
||||
time_count++;
|
||||
// Debug.Log(time_count);
|
||||
// Debug.Log(MaxTime);
|
||||
if (time_count > MaxTime)
|
||||
{
|
||||
time_count = 0;
|
||||
var name_index = Random.Range(0, config_name_list.Count);
|
||||
var money_index = Random.Range(0, config_vip_level_list.Count);
|
||||
// Debug.Log(text_ui.cast_text.text);
|
||||
|
||||
string name = config_name_list[name_index];
|
||||
if (name.Length > 8)
|
||||
{
|
||||
name = name[..8] + "..";
|
||||
}
|
||||
string broad_text = String.Format(text_ui.hide_text.text, name,
|
||||
config_vip_level_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
|
||||
text_ui.cast_text.text = broad_text;
|
||||
|
||||
var lv = GetVipLevelFromName(config_vip_level_list[money_index]);
|
||||
text_ui.broad_icon_loader.url = $"ui://LG_Common/vip_{lv}";
|
||||
|
||||
// Tweener tweener = DOTween.To(() => ui.broad.x,
|
||||
// x => ui.broad.x = x, 200, 0.5f);
|
||||
ui.t0.Play();
|
||||
|
||||
DOVirtual.DelayedCall(3.5f, () =>
|
||||
{
|
||||
// Tweener tweener = DOTween.To(() => ui.broad.x,
|
||||
// x => ui.broad.x = x, 1080, 0.5f);
|
||||
ui.t1.Play();
|
||||
});
|
||||
string str = name + "#" + config_vip_level_list[money_index] + "#" + DateTimeManager.Instance.GetCurrDateTime();
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.updateRecordList, str);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int GetVipLevelFromName(string name)
|
||||
{
|
||||
var vip_level = 1;
|
||||
switch (name)
|
||||
{
|
||||
case "Gold":
|
||||
vip_level = 1;
|
||||
break;
|
||||
case "Platinum":
|
||||
vip_level = 2;
|
||||
break;
|
||||
case "Diamond":
|
||||
vip_level = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return vip_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9a4125b4c0c64c94857a7ac85479526
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
namespace LoveLegend
|
||||
|
||||
{
|
||||
public class BroadcastUICtrl : BaseUICtrl
|
||||
{
|
||||
private BroadcastUI ui;
|
||||
private BroadcastModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.BroadcastUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.BroadcastUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.BroadcastModel) as BroadcastModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new BroadcastUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35a4fff4d50cc4404951bdbed6e43b22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3a59974b3d5f6d49b4e54ed7605922c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BuyPropCtrl : BaseCtrl
|
||||
{
|
||||
public static BuyPropCtrl Instance { get; private set; }
|
||||
|
||||
private BuyPropModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.BuyPropModel) as BuyPropModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58e27508a01b144eab047fc0579e3520
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BuyPropModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
// protected override void OnReset()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 读取数据
|
||||
// protected override void OnReadData()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 本地存储
|
||||
// protected override void WriteLocalStorage()
|
||||
// {
|
||||
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f1d88ea5dfa34e1a927e5bef7f9c714
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,151 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BuyPropUI : BaseUI
|
||||
{
|
||||
private BuyPropUICtrl ctrl;
|
||||
private BuyPropModel model;
|
||||
private FGUI.ZM_Prop_09.com_prop ui;
|
||||
private int state_ = 0;
|
||||
|
||||
public BuyPropUI(BuyPropUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.BuyPropUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Prop_09";
|
||||
uiInfo.assetName = "com_prop";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.BuyPropModel) as BuyPropModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI = true;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Prop_09.com_prop;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
state_ = (int)args;
|
||||
ui.prop.selectedIndex = state_;
|
||||
ui.btn_buy.GetChild("text_gold").text = GameHelper.Get101Str(ConfigSystem.GetCommonConf().Purchaseprops);
|
||||
ui.btn_buy.SetClick(buyItem);
|
||||
setBtnState(state_);
|
||||
InitView();
|
||||
|
||||
}
|
||||
void buyItem()
|
||||
{
|
||||
if (state_ == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (state_ == 1)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if (state_ == 2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if (GameHelper.CheckGoldNumber(ConfigSystem.GetCommonConf().Purchaseprops))
|
||||
{
|
||||
GameHelper.AddGoldNumber(-ConfigSystem.GetCommonConf().Purchaseprops);
|
||||
int numbers = GameHelper.GetItemNumber(state_);
|
||||
numbers++;
|
||||
GameHelper.SetItemNumber(state_, numbers);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Sheep_item_refresh);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
GameHelper.ShowTips("purchase_succ", true);
|
||||
CtrlCloseUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
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 void InitView()
|
||||
{
|
||||
ui.btn_back.SetClick(() =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SheepwindowUI_Close);
|
||||
});
|
||||
|
||||
// ui.btn_buy0.SetClick(() =>
|
||||
// {
|
||||
// state_ = 0;
|
||||
// ui.prop.selectedIndex = 0;
|
||||
// setBtnState(0);
|
||||
// });
|
||||
// ui.btn_buy1.SetClick(() =>
|
||||
// {
|
||||
// state_ = 1;
|
||||
|
||||
// ui.prop.selectedIndex = 1;
|
||||
// setBtnState(1);
|
||||
|
||||
// });
|
||||
// ui.btn_buy2.SetClick(() =>
|
||||
// {
|
||||
// state_ = 2;
|
||||
|
||||
// ui.prop.selectedIndex = 2;
|
||||
// setBtnState(2);
|
||||
|
||||
// });
|
||||
}
|
||||
|
||||
private void setBtnState(int index)
|
||||
{
|
||||
// ui.btn_buy0.tab_choose.selectedIndex = index == 0 ? 1 : 0;
|
||||
// ui.btn_buy1.tab_choose.selectedIndex = index == 1 ? 1 : 0;
|
||||
// ui.btn_buy2.tab_choose.selectedIndex = index == 2 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d07e071d35d5041feaf834faa7cac3a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BuyPropUICtrl : BaseUICtrl
|
||||
{
|
||||
private BuyPropUI ui;
|
||||
private BuyPropModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.SheepwindowUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.SheepwindowUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.BuyPropModel) as BuyPropModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new BuyPropUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b85f17625775040eb85b386d6c9c5c79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c531c42d4fca4ff7b2785c66a8f93e9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatCtrl : BaseCtrl
|
||||
{
|
||||
public static ChatCtrl Instance { get; private set; }
|
||||
|
||||
private ChatModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ChatModel) as ChatModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f85819b166c34048b8b0e9ca525fe8e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f469f84c20ba64b5994e844b29a7f2fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,352 @@
|
||||
|
||||
using FGUI.ZM_Common_01;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using IgnoreOPS;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using FGUI.LG_AIchat;
|
||||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUI : BaseUI
|
||||
{
|
||||
private ChatUICtrl ctrl;
|
||||
private ChatModel model;
|
||||
private FGUI.LG_AIchat.com_chat ui;
|
||||
|
||||
public ChatUI(ChatUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ChatUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_AIchat";
|
||||
uiInfo.assetName = "com_chat";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatModel) as ChatModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
ChatHelper.chat_red_list[chat_index] = false;
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.RefreshRedDot);
|
||||
UnityManager.ShezhiACT(true);
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.LG_AIchat.com_chat;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
// ChatHelper.GetMessage(1);
|
||||
// ChatHelper.ResetMessage(1);
|
||||
if (args != null) chat_index = (int)args;
|
||||
if (DataMgr.ChatData.Value == null)
|
||||
{
|
||||
DataMgr.ChatData.Value = new List<ChatItem>();
|
||||
}
|
||||
|
||||
if (Screen.safeArea.y != 0)
|
||||
{
|
||||
ui.group_.y += Screen.safeArea.y - 15;
|
||||
}
|
||||
Debug.Log(JsonConvert.SerializeObject(DataMgr.ChatData.Value));
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
ui.type.selectedIndex = ui.btn_tophead.type.selectedIndex = chat_index;
|
||||
InitView();
|
||||
ui.btn_photo.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowTips("launching_soon", true);
|
||||
});
|
||||
ui.btn_video.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowTips("launching_soon", true);
|
||||
});
|
||||
UnityManager.ShezhiACT(false);
|
||||
}
|
||||
public static bool IsSameDay(long timestamp)
|
||||
{
|
||||
// 假设时间戳是 Unix 时间戳(秒),如果是毫秒记得除以 1000
|
||||
DateTime inputTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).DateTime;
|
||||
DateTime now = DateTimeOffset.FromUnixTimeSeconds(GameHelper.GetNowTime()).DateTime;
|
||||
|
||||
// 比较年月日是否一致
|
||||
return inputTime.Date == now.Date;
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.LiveChange, addNewItem);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.AddChatNum, setChatNum);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Gold_refresh, SetTopCurr);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.LiveChange, addNewItem);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.AddChatNum, setChatNum);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, SetTopCurr);
|
||||
}
|
||||
public void SetTopCurr(object a = null)
|
||||
{
|
||||
Debug.Log("??????????");
|
||||
var btn_gold = ui.btn_gold as com_gold;
|
||||
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void addNewItem(object a = null)
|
||||
{
|
||||
_ChatItem = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == ChatType.GetType(chat_index));
|
||||
if (_ChatItem.content_list.Count > list_count)
|
||||
{
|
||||
if (have_inputani && ChatHelper.unshow_message[chat_index] <= 0)
|
||||
{
|
||||
ui.list_.RemoveChildAt(list_count);
|
||||
have_inputani = false;
|
||||
}
|
||||
// else if (have_inputani && ChatHelper.unshow_message[chat_index] > 0)
|
||||
// {
|
||||
|
||||
// }
|
||||
for (int i = list_count; i < _ChatItem.content_list.Count; i++)
|
||||
{
|
||||
if (_ChatItem.content_list[i].type == 1)
|
||||
{
|
||||
item_chatText_left com_msg = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
|
||||
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
|
||||
// if (chat_index == 0) com_msg.head.url = "ui://tksc66j2ljeg27";
|
||||
// else if (chat_index == 1) com_msg.head.url = "ui://tksc66j2ljeg25";
|
||||
// else if (chat_index == 2) com_msg.head.url = "ui://tksc66j2ljeg20";
|
||||
com_msg.type.selectedIndex = chat_index;
|
||||
if (ChatHelper.unshow_message[chat_index] <= 0 || (!have_inputani)) ui.list_.AddChild(com_msg);
|
||||
else ui.list_.AddChildAt(com_msg, ui.list_.numChildren - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// if (ChatHelper.unshow_message[chat_index] > 0)
|
||||
// {
|
||||
// item_chatText_left com_msg_ = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
|
||||
// com_msg_.t0.Play(-1, 0, null);
|
||||
// if (chat_index == 0) com_msg_.head.url = "ui://tksc66j2ljeg27";
|
||||
// else if (chat_index == 1) com_msg_.head.url = "ui://tksc66j2ljeg25";
|
||||
// else if (chat_index == 2) com_msg_.head.url = "ui://tksc66j2ljeg20";
|
||||
// ui.list_.AddChild(com_msg_);
|
||||
// have_inputani = true;
|
||||
// }
|
||||
|
||||
list_count = _ChatItem.content_list.Count;
|
||||
ui.list_.ScrollToView(list_count - 1);
|
||||
}
|
||||
}
|
||||
private void setChatNum(object a = null)
|
||||
{
|
||||
|
||||
if (DataMgr.ChatFreeNumber.Value == 0 && DataMgr.ChatNumber.Value == 0)
|
||||
{
|
||||
// ui.have_free.selectedIndex = 1;
|
||||
// ui.text_remainfreeNum.text = "Free:" + DataMgr.ChatFreeNumber.Value;
|
||||
// ui.btn_send.state.selectedIndex = 0;
|
||||
ui.btn_send.title = Language.GetContent("get_more");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ui.have_free.selectedIndex = 0;
|
||||
// ui.text_remainNum.text = ":" + DataMgr.ChatNumber.Value;
|
||||
// ui.btn_send.state.selectedIndex = 1;
|
||||
ui.btn_send.title = Language.GetContent("Send");
|
||||
}
|
||||
if (DataMgr.ChatFreeNumber.Value > 0)
|
||||
{
|
||||
ui.btn_send.text_remainNum.text = Language.GetContentParams("Free_1", DataMgr.ChatFreeNumber.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_send.text_remainNum.text = DataMgr.ChatNumber.Value.ToString();
|
||||
}
|
||||
// if (DataMgr.ChatFreeNumber.Value <= 0 && DataMgr.ChatNumber.Value <= 0) ui.btn_send.title = "Get More";
|
||||
// else ui.btn_send.title = "Send";
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private ChatItem _ChatItem;
|
||||
private int chat_index = 2;
|
||||
private int list_count = 0;
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
Debug.Log(DataMgr.ChatData.Value);
|
||||
SetTopCurr();
|
||||
_ChatItem = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == ChatType.GetType(chat_index));
|
||||
Debug.Log(JsonConvert.SerializeObject(_ChatItem));
|
||||
if (DataMgr.ChatRecoverDays.Value != DateTime.Now.Day)
|
||||
{
|
||||
DataMgr.ChatFreeNumber.Value = GameHelper.GetCommonModel().FreeMessages;
|
||||
DataMgr.ChatRecoverDays.Value = DateTime.Now.Day;
|
||||
}
|
||||
setChatNum();
|
||||
if (_ChatItem != null)
|
||||
{
|
||||
_ChatItem.content_list.RemoveAll(item => !IsSameDay(item.chat_time));
|
||||
if (_ChatItem.content_list.Count > 100)
|
||||
{
|
||||
_ChatItem.content_list.RemoveRange(0, _ChatItem.content_list.Count - 100);
|
||||
}
|
||||
DataMgr.ChatData.Save();
|
||||
list_count = _ChatItem.content_list.Count;
|
||||
Debug.Log(list_count + "..................");
|
||||
for (int i = 0; i < _ChatItem.content_list.Count; i++)
|
||||
{
|
||||
if (_ChatItem.content_list[i].type == 0)
|
||||
{
|
||||
item_chatText_right com_msg = (item_chatText_right)UIPackage.CreateObject("LG_AIchat", "item_chatText_right");
|
||||
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
|
||||
GameHelper.SetSelfAvatar(com_msg.btn_head.load_avatar, DataMgr.PlayerAvatarId.Value);
|
||||
ui.list_.AddChild(com_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
item_chatText_left com_msg = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
|
||||
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
|
||||
// if (chat_index == 0) com_msg.head.url = "ui://tksc66j2ljeg27";
|
||||
// else if (chat_index == 1) com_msg.head.url = "ui://tksc66j2ljeg25";
|
||||
// else if (chat_index == 2) com_msg.head.url = "ui://tksc66j2ljeg20";
|
||||
com_msg.type.selectedIndex = chat_index;
|
||||
ui.list_.AddChild(com_msg);
|
||||
}
|
||||
}
|
||||
if (list_count > 3) ui.list_.ScrollToView(list_count - 1);
|
||||
ChatHelper.CheckReply();
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatHelper.GetMessage(chat_index);
|
||||
DOVirtual.DelayedCall(1, () =>
|
||||
{
|
||||
ChatHelper.CheckReply();
|
||||
});
|
||||
}
|
||||
|
||||
// DataMgr.ChatData.Value = "";
|
||||
ui.btn_send.SetClick(() =>
|
||||
{
|
||||
if (DataMgr.ChatFreeNumber.Value > 0 || DataMgr.ChatNumber.Value > 0)
|
||||
{
|
||||
if (ui.input_message.text.IsNullOrWhiteSpace())
|
||||
{
|
||||
GameHelper.ShowTips("message_tips", true);
|
||||
return;
|
||||
}
|
||||
Debug.Log(ui.input_message.text.Length);
|
||||
if (ui.input_message.text.Length > 200)
|
||||
{
|
||||
GameHelper.ShowTips("character_limit", true);
|
||||
return;
|
||||
}
|
||||
if (DataMgr.ChatFreeNumber.Value > 0)
|
||||
{
|
||||
DataMgr.ChatFreeNumber.Value--;
|
||||
}
|
||||
else DataMgr.ChatNumber.Value--;
|
||||
setChatNum();
|
||||
ChatHelper.SendMessage(chat_index, ui.input_message.text);
|
||||
|
||||
list_count++;
|
||||
DOVirtual.DelayedCall(4, () =>
|
||||
{
|
||||
Debug.Log("重复一次");
|
||||
ChatHelper.CheckReply();
|
||||
});
|
||||
|
||||
if (have_inputani)
|
||||
{
|
||||
ui.list_.RemoveChildAt(ui.list_.numItems - 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
item_chatText_right com_msg = (item_chatText_right)UIPackage.CreateObject("LG_AIchat", "item_chatText_right");
|
||||
com_msg.text_content.text = ui.input_message.text;
|
||||
GameHelper.SetSelfAvatar(com_msg.btn_head.load_avatar, DataMgr.PlayerAvatarId.Value);
|
||||
ui.list_.AddChild(com_msg);
|
||||
|
||||
item_chatText_left com_msg_ = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
|
||||
com_msg_.t0.Play(-1, 0, null);
|
||||
// if (chat_index == 0) com_msg_.head.url = "ui://tksc66j2ljeg27";
|
||||
// else if (chat_index == 1) com_msg_.head.url = "ui://tksc66j2ljeg25";
|
||||
// else if (chat_index == 2) com_msg_.head.url = "ui://tksc66j2ljeg20";
|
||||
com_msg_.type.selectedIndex = chat_index;
|
||||
ui.list_.AddChild(com_msg_);
|
||||
|
||||
have_inputani = true;
|
||||
|
||||
|
||||
if (_ChatItem == null)
|
||||
{
|
||||
_ChatItem = new ChatItem()
|
||||
{
|
||||
role = ChatType.GetType(chat_index),
|
||||
content_list = new List<ChatText>(),
|
||||
};
|
||||
DataMgr.ChatData.Value.Add(_ChatItem);
|
||||
}
|
||||
_ChatItem.content_list.Add(new ChatText()
|
||||
{
|
||||
type = 0,
|
||||
text_content = ui.input_message.text,
|
||||
chat_time = GameHelper.GetNowTime(),
|
||||
});
|
||||
DataMgr.ChatData.Save();
|
||||
ui.input_message.text = "";
|
||||
ui.list_.ScrollToView(ui.list_.numItems - 1);
|
||||
|
||||
DOVirtual.DelayedCall(1, () =>
|
||||
{
|
||||
ChatHelper.CheckReply();
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatNumberUI_Open);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
private bool have_inputani = false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58ebdba9853c84405a4a4b497e81179c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUICtrl : BaseUICtrl
|
||||
{
|
||||
private ChatUI ui;
|
||||
private ChatModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ChatUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ChatUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatModel) as ChatModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ChatUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8deb89af60a64834a3b0153598b0040
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dacd1cefc6cec44538462f38924495ef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatChooseCtrl : BaseCtrl
|
||||
{
|
||||
public static ChatChooseCtrl Instance { get; private set; }
|
||||
|
||||
private ChatChooseModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9eb2f8cf020ff4c0eb19c2f692b8671a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatChooseModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c92b4256954442228fec21a2bea9c70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,161 @@
|
||||
|
||||
using FGUI.ZM_Common_01;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Common.Extensions;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatChooseUI : BaseUI
|
||||
{
|
||||
private ChatChooseUICtrl ctrl;
|
||||
private ChatChooseModel model;
|
||||
private FGUI.LG_AIchat.com_chatChoose ui;
|
||||
|
||||
public ChatChooseUI(ChatChooseUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ChatChooseUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_AIchat";
|
||||
uiInfo.assetName = "com_chatChoose";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.LG_AIchat.com_chatChoose;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
if (Screen.safeArea.y != 0)
|
||||
{
|
||||
ui.btn_gold.y += Screen.safeArea.y - 15;
|
||||
}
|
||||
InitView();
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatChooseUI_Close);
|
||||
});
|
||||
RefreshRed();
|
||||
ui.btn_0.SetClick(() =>
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value == 0)
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ui.btn_1.SetClick(() =>
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value == 0)
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.btn_2.SetClick(() =>
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DataMgr.IsUnlockChat.Value == 0)
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 2);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public void SetTopCurr(object a = null)
|
||||
{
|
||||
var btn_gold = ui.btn_gold as com_gold;
|
||||
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
|
||||
|
||||
|
||||
|
||||
}
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Gold_refresh, SetTopCurr);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.RefreshRedDot, RefreshRed);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, SetTopCurr);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshRedDot, RefreshRed);
|
||||
}
|
||||
#endregion
|
||||
private void RefreshRed(object isShow = null)
|
||||
{
|
||||
ui.btn_0.red.visible = ChatHelper.GetChatRed(0);
|
||||
ui.btn_1.red.visible = ChatHelper.GetChatRed(1);
|
||||
ui.btn_2.red.visible = ChatHelper.GetChatRed(2);
|
||||
}
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
SetTopCurr();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83e9ae6711260435092c4e1af2e4ff5c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatChooseUICtrl : BaseUICtrl
|
||||
{
|
||||
private ChatChooseUI ui;
|
||||
private ChatChooseModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ChatChooseUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ChatChooseUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ChatChooseUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d217670d04bcc416790bd6b0d443de38
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad5fec9f1e982489eb60757842ee45e9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatNumberCtrl : BaseCtrl
|
||||
{
|
||||
public static ChatNumberCtrl Instance { get; private set; }
|
||||
|
||||
private ChatNumberModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f1c72491f98a47f9984461d5b5797ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatNumberModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b99d4915960364dcf83eda361634c06c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
using FGUI.ZM_Common_01;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatNumberUI : BaseUI
|
||||
{
|
||||
private ChatNumberUICtrl ctrl;
|
||||
private ChatNumberModel model;
|
||||
private FGUI.LG_AIchat.com_ChatNumber ui;
|
||||
|
||||
public ChatNumberUI(ChatNumberUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ChatNumberUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_AIchat";
|
||||
uiInfo.assetName = "com_ChatNumber";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.LG_AIchat.com_ChatNumber;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object 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 void InitView()
|
||||
{
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
});
|
||||
int[] array = GameHelper.GetCommonModel().CoinsAccess;
|
||||
ui.text_coins.SetVar("coin", array[0].ToString()).FlushVars();
|
||||
ui.text_coins.SetVar("num", array[1].ToString()).FlushVars();
|
||||
ui.text_ads.SetVar("num", GameHelper.GetCommonModel().AdAccess.ToString()).FlushVars();
|
||||
ui.btn_coins.title = array[0].ToString();
|
||||
ui.btn_coins.SetClick(() =>
|
||||
{
|
||||
if (DataMgr.Coin.Value >= array[0])
|
||||
{
|
||||
DataMgr.Coin.Value -= array[0];
|
||||
DataMgr.ChatNumber.Value += array[1];
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.AddChatNum);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
CtrlCloseUI();
|
||||
GameHelper.ShowTips("more_message", true);
|
||||
}
|
||||
else GameHelper.ShowTips("no_enough_gold", true);
|
||||
});
|
||||
|
||||
ui.btn_watch.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowVideoAd("TaskReward", (issuccess) =>
|
||||
{
|
||||
if (issuccess)
|
||||
{
|
||||
DataMgr.ChatNumber.Value += GameHelper.GetCommonModel().AdAccess;
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.AddChatNum);
|
||||
CtrlCloseUI();
|
||||
GameHelper.ShowTips("more_message", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6aa550f4b878c46b1b94f94bd8344e29
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatNumberUICtrl : BaseUICtrl
|
||||
{
|
||||
private ChatNumberUI ui;
|
||||
private ChatNumberModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ChatNumberUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ChatNumberUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ChatNumberUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfc256c0532ea497899ef69ce0fc0e54
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 327b4267fce094111a78bb54bdb1e83c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUnlockCtrl : BaseCtrl
|
||||
{
|
||||
public static ChatUnlockCtrl Instance { get; private set; }
|
||||
|
||||
private ChatUnlockModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c093fabf4fa34bf4a1fb3482d8f9761
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUnlockModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47d86987ec02a450ea21d30862f75ef1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
using FGUI.ZM_Common_01;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using Spine.Unity;
|
||||
using System;
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUnlockUI : BaseUI
|
||||
{
|
||||
private ChatUnlockUICtrl ctrl;
|
||||
private ChatUnlockModel model;
|
||||
private FGUI.LG_Unlock.com_chatUnlock ui;
|
||||
|
||||
public ChatUnlockUI(ChatUnlockUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ChatUnlockUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "LG_Unlock";
|
||||
uiInfo.assetName = "com_chatUnlock";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
closeCallback?.Invoke();
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.LG_Unlock.com_chatUnlock;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object 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 Action closeCallback;
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
SkeletonAnimation ske_pot = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent, Fx_Type.fx_chatunlock, ref closeCallback);
|
||||
ske_pot.state.SetAnimation(0, "animation", true);
|
||||
|
||||
SkeletonAnimation ske_pot1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent1, Fx_Type.fx_chatunlock1, ref closeCallback);
|
||||
ske_pot1.state.SetAnimation(0, "animation", true);
|
||||
|
||||
SkeletonAnimation ske_pot2 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent2, Fx_Type.fx_chatunlock2, ref closeCallback);
|
||||
ske_pot2.state.SetAnimation(0, "animation", true);
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d75d7fcc65bbb4bd9bea1bbe54ce9bdd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChatUnlockUICtrl : BaseUICtrl
|
||||
{
|
||||
private ChatUnlockUI ui;
|
||||
private ChatUnlockModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ChatUnlockUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ChatUnlockUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ChatUnlockUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e758e321c0de44349be76c88070b8e85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf8752ba62de0944699341c95ac0fdc8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChoosePropCtrl : BaseCtrl
|
||||
{
|
||||
public static ChoosePropCtrl Instance { get; private set; }
|
||||
|
||||
private ChoosePropModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ChoosePropModel) as ChoosePropModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30f4147b6a9f34f8a98d5bbc0a788e6d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChoosePropModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
// protected override void OnReset()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 读取数据
|
||||
// protected override void OnReadData()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 本地存储
|
||||
// protected override void WriteLocalStorage()
|
||||
// {
|
||||
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24f4458949b044bf5ad0e021638528e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,189 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChoosePropUI : BaseUI
|
||||
{
|
||||
private ChoosePropUICtrl ctrl;
|
||||
private ChoosePropModel model;
|
||||
private FGUI.ZM_Prop_09.com_choose ui;
|
||||
|
||||
public ChoosePropUI(ChoosePropUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ChoosePropUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Prop_09";
|
||||
uiInfo.assetName = "com_choose";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChoosePropModel) as ChoosePropModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Prop_09.com_choose;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object 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 void InitView()
|
||||
{
|
||||
// Debug.Log(GameHelper.GetLevelstate());
|
||||
int state = GameHelper.GetLevelstate();
|
||||
int need_gold = ConfigSystem.GetCommonConf().RevivalCoins;
|
||||
ui.btn_gold_buy.GetChild("text_gold").text = GameHelper.Get101Str(need_gold);
|
||||
|
||||
initProp(state);
|
||||
|
||||
ui.btn_thanks.SetClick(() =>
|
||||
{
|
||||
float[] ch_array = GameHelper.GetRewardValue(2);
|
||||
var temp = new SuccessData();
|
||||
temp.IsWin = false;
|
||||
temp.ch_number = ch_array[0];
|
||||
temp.IsLevelSuccess = true;
|
||||
temp.IsH5Reward = false;
|
||||
temp.boost_array = GameHelper.GetRewardBoost(2);
|
||||
temp.level = GameHelper.GetLevel();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NewEndUI_Open, temp);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
|
||||
});
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
|
||||
float[] ch_array = GameHelper.GetRewardValue(2);
|
||||
var temp = new SuccessData();
|
||||
temp.IsWin = false;
|
||||
temp.ch_number = ch_array[0];
|
||||
temp.IsLevelSuccess = true;
|
||||
temp.IsH5Reward = false;
|
||||
temp.boost_array = GameHelper.GetRewardBoost(2);
|
||||
temp.level = GameHelper.GetLevel();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NewEndUI_Open, temp);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initProp(int state)
|
||||
{
|
||||
int need_gold = ConfigSystem.GetCommonConf().RevivalCoins;
|
||||
|
||||
if (state == 3)
|
||||
{
|
||||
ui.state.selectedIndex = ui._State_all_;
|
||||
ui.btn_ad.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
GameHelper.SetLevelstate(1);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Remake_state, true);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
ui.btn_gold_buy.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.CheckGoldNumber(need_gold))
|
||||
{
|
||||
GameHelper.AddGoldNumber(-need_gold);
|
||||
GameHelper.SetLevelstate(2);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Remake_state, true);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else if (state == 2)
|
||||
{
|
||||
ui.state.selectedIndex = ui._State_ad;
|
||||
ui.btn_ad.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
GameHelper.SetLevelstate(0);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Remake_state, true);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else if (state == 1)
|
||||
{
|
||||
ui.state.selectedIndex = ui._State_gold;
|
||||
ui.btn_gold_buy.SetClick(() =>
|
||||
{
|
||||
if (GameHelper.CheckGoldNumber(need_gold))
|
||||
{
|
||||
GameHelper.AddGoldNumber(-need_gold);
|
||||
GameHelper.SetLevelstate(0);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Remake_state, true);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ChoosePropUI_Close);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05d11be9302224ba99cc14d10974266f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class ChoosePropUICtrl : BaseUICtrl
|
||||
{
|
||||
private ChoosePropUI ui;
|
||||
private ChoosePropModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ChoosePropUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ChoosePropUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ChoosePropModel) as ChoosePropModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ChoosePropUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d012c092edd6c41a2bbbed3c72ca2bfe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b05bab87ee5860d45b1e0e643cda6b64
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user