ball 项目提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class AddViewoffCtrl : BaseCtrl
|
||||
{
|
||||
public static AddViewoffCtrl Instance { get; private set; }
|
||||
|
||||
private AddViewoffModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.AddViewoffModel) as AddViewoffModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6254fab7306ab4f54b9ddc37e9f9c554
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class AddViewoffModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8927197c6cb1f412d83d93ded8cf1589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,234 @@
|
||||
|
||||
using FairyGUI;
|
||||
using SGModule.NetKit;
|
||||
using Spine.Unity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DontConfuse;
|
||||
using IgnoreOPS;
|
||||
using FGUI.ZM_Common_01;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class AddViewoffUI : BaseUI
|
||||
{
|
||||
private AddViewoffUICtrl ctrl;
|
||||
private AddViewoffModel model;
|
||||
private FGUI.ZM_AddCell_12.com_addView_off ui;
|
||||
private Action closeCallback;
|
||||
private bool isAutoPop = false;
|
||||
|
||||
public AddViewoffUI(AddViewoffUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.AddViewoffUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_AddCell_12";
|
||||
uiInfo.assetName = "com_addView_off";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AddViewoffModel) as AddViewoffModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI = true;
|
||||
HallManager.Instance.UpdateSecondEvent -= updateWatchCD;
|
||||
if (GameHelper.IsAdModelOfPay())
|
||||
{
|
||||
AdExchangeManager.Instance.Destroy();
|
||||
}
|
||||
closeCallback?.Invoke();
|
||||
if (isAutoPop)
|
||||
{
|
||||
GameHelper.CallShowTurn();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_AddCell_12.com_addView_off;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
isAutoPop = (bool)args;
|
||||
}
|
||||
|
||||
TrackKit.SendEvent(GameHelper.getTrackEvenName(), ADEventTrack.Property.BuyOneOffShow);
|
||||
|
||||
// ad_cool_down = ConfigSystem.GetCommonConf().exchangeCD;
|
||||
// btn_WatchAd = ui.btn_watch as btn_watchAd;
|
||||
if (GameHelper.IsAdModelOfPay())
|
||||
{
|
||||
AdExchangeManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.buy_one_off), ui.btn_watch as btn_watchAd, SetTextString);
|
||||
ui.pay_type.selectedIndex = 0;
|
||||
ui.text_old_price.text = GameHelper.GetCommonModel().addspace + "ADs";
|
||||
btn_watchAd btn = ui.btn_watch as btn_watchAd;
|
||||
|
||||
AdExchangeManager.Instance.Start();
|
||||
SetTextString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.pay_type.selectedIndex = 1;
|
||||
ui.text_old_price.text = GameHelper.getPrice((decimal)GameHelper.GetCommonModel().addspace2);
|
||||
decimal price = (decimal)GameHelper.GetCommonModel().AddDiscount2;
|
||||
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_off),
|
||||
currency = "USD"
|
||||
};
|
||||
MaxPayManager.Instance.Buy(maxPayData);
|
||||
});
|
||||
}
|
||||
|
||||
if (GameHelper.IsGiftSwitch())
|
||||
{
|
||||
ui.broad.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.broad.visible = false;
|
||||
}
|
||||
|
||||
InitView();
|
||||
InitBroadCast();
|
||||
}
|
||||
|
||||
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_off))
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AddViewoffUI_Close);
|
||||
SaveData.GetSaveObject().have_slot = true;
|
||||
SaveData.SaveDataFunc();
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Slot_refresh);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.resurgence_close);
|
||||
CtrlCloseUI();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
// var tAnimation = FXManager.Instance.SetFx<SkeletonAnimation>(ui.tip_parent, Fx_Type.Fx_AddBoxTip, ref _closeCallback);
|
||||
// tAnimation.state.AddAnimation(0, "animation", true, 0);
|
||||
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.resurgence_close);
|
||||
CtrlCloseUI();
|
||||
});
|
||||
|
||||
HallManager.Instance.UpdateSecondEvent += updateWatchCD;
|
||||
// updateWatchCD();
|
||||
|
||||
// checkBtnState();
|
||||
|
||||
}
|
||||
void updateWatchCD()
|
||||
{
|
||||
ui.text_time.text = CommonHelper.TimeFormat((int)SaveData.GetSaveObject().addview_off_time - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
|
||||
|
||||
broadtime++;
|
||||
BroadCast();
|
||||
}
|
||||
|
||||
public void SetTextString()
|
||||
{
|
||||
var need = AdExchangeManager.Instance.GetCeilingNeedAds(PurchasingManager.GetPaySku(PayType.buy_one_off));
|
||||
var myAd = AdExchangeManager.Instance.GetLookRewardADNum();
|
||||
|
||||
ui.tips.SetVar("num", need.ToString()).FlushVars();
|
||||
ui.ads.SetVar("num", myAd.ToString()).FlushVars();
|
||||
}
|
||||
|
||||
private int broadtime = 1;
|
||||
private List<string> config_name_list = LevelAttemptsModel.config_name_list;
|
||||
private List<string> config_money_list = LevelAttemptsModel.config_money_list;
|
||||
private List<string[]> broad_list = new List<string[]>();
|
||||
private void BroadCast()
|
||||
{
|
||||
if (broadtime % 3 == 0)
|
||||
{
|
||||
(ui.broad as com_broadcast_new).t1.Play(() =>
|
||||
{
|
||||
broad_list.RemoveAt(0);
|
||||
int name_index = UnityEngine.Random.Range(0, config_name_list.Count);
|
||||
int money_index = UnityEngine.Random.Range(0, config_money_list.Count);
|
||||
broad_list.Add(new string[2] { config_name_list[name_index], config_money_list[money_index] });
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
text_list[i].text = "Congratulations,User [color=#ad4800][size=36]" + broad_list[i][0] + "[/size][/color] !After purchasing the +1 Block Pack,play [color=#ad4800]" + broad_list[i][1] + "[/color] matcher to clear the level!";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private List<GTextField> text_list = new List<GTextField>();
|
||||
private void InitBroadCast()
|
||||
{
|
||||
text_list.Add((ui.broad as com_broadcast_new).text_0);
|
||||
text_list.Add((ui.broad as com_broadcast_new).text_1);
|
||||
text_list.Add((ui.broad as com_broadcast_new).text_2);
|
||||
text_list.Add((ui.broad as com_broadcast_new).text_3);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
int name_index = UnityEngine.Random.Range(0, config_name_list.Count);
|
||||
int money_index = UnityEngine.Random.Range(0, config_money_list.Count);
|
||||
broad_list.Add(new string[2] { config_name_list[name_index], config_money_list[money_index] });
|
||||
text_list[i].text = "Congratulations,User [color=#ad4800][size=36]" + broad_list[i][0] + "[/size][/color] !After purchasing the +1 Block Pack,play [color=#ad4800]" + broad_list[i][1] + "[/color] matcher to clear the level!";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95a4ab1450a704a8a86208f20b15f859
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class AddViewoffUICtrl : BaseUICtrl
|
||||
{
|
||||
private AddViewoffUI ui;
|
||||
private AddViewoffModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.AddViewoffUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.AddViewoffUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.AddViewoffModel) as AddViewoffModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new AddViewoffUI(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: 0482db053a1ce45d989a2e4a715dff81
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user