首次提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace ScrewsMaster
|
||||
{
|
||||
public class ReviveCtrl : BaseCtrl
|
||||
{
|
||||
public static ReviveCtrl Instance { get; private set; }
|
||||
|
||||
private ReviveModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.ReviveModel) as ReviveModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53a0e00701127434680a1c04854804f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace ScrewsMaster
|
||||
{
|
||||
public class ReviveModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 715570fb13192e143aea595fafb8362b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,171 @@
|
||||
|
||||
using FGUI.A000_common;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using DG.Tweening;
|
||||
using Roy.Datas;
|
||||
using SGame;
|
||||
|
||||
namespace ScrewsMaster
|
||||
{
|
||||
public class ReviveUI : BaseUI
|
||||
{
|
||||
private ReviveUICtrl ctrl;
|
||||
private ReviveModel model;
|
||||
private FGUI.G008_reward.com_revive ui;
|
||||
|
||||
private bool isRevive;
|
||||
|
||||
public ReviveUI(ReviveUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.ReviveUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "G008_reward";
|
||||
uiInfo.assetName = "com_revive";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = true;
|
||||
uiInfo.isNeedCloseAnim = true;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
model = ModuleManager.Instance.GetModel(ModelConst.ReviveModel) as ReviveModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.G008_reward.com_revive;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
isRevive = false;
|
||||
ui.cont_iswacth.selectedIndex = GameHelper.GetIsWacthAd();
|
||||
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnCloseUIAnimEnd()
|
||||
{
|
||||
base.OnCloseUIAnimEnd();
|
||||
if (isRevive)
|
||||
{
|
||||
ShowScrews.Instance.OnResurrect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
ui.cont_iswacth.selectedIndex = GameHelper.GetIsWacthAd();
|
||||
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_AdRevive.GetChild("img_saveingpot") as GImage).visible = true;
|
||||
|
||||
ui.btn_AdRevive.onClick.Add(() =>
|
||||
{
|
||||
//观看广告复活
|
||||
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
ui.btn_back.SetClick(() => { });
|
||||
ui.btn_close.SetClick(() => { });
|
||||
ui.btn_revive.SetClick(() => { });
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
GameHelper.SetIsWatchAd(1);
|
||||
GameHelper.SetReviveCount();
|
||||
isRevive = true;
|
||||
ctrl.CloseUI();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var revivalCoins = ConfigSystem.GetConfig<CommonModel>().RevivalCoins;
|
||||
if (ui.btn_revive is btn_revive btnRevive) btnRevive.txt_coin.text = revivalCoins.ToString();
|
||||
ui.btn_revive.onClick.Add(() =>
|
||||
{
|
||||
if (!GameHelper.CheckGoldNumber(revivalCoins))
|
||||
{
|
||||
GameHelper.ShowTips("Not Enough Coins");
|
||||
return;
|
||||
}
|
||||
//消耗金币复活
|
||||
GameHelper.AddGoldNumber(-revivalCoins);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
//CtrlCloseUI();
|
||||
GameHelper.SetIsWatchAd(2);
|
||||
GameHelper.SetReviveCount();
|
||||
isRevive = true;
|
||||
ctrl.CloseUI();
|
||||
});
|
||||
|
||||
ui.btn_close.onClick.Add(() =>
|
||||
{
|
||||
ctrl.CloseUI();
|
||||
float[] cash_array = GameHelper.GetRewardValue(2);
|
||||
|
||||
var temp = new SettlementData
|
||||
{ is_success = false, cash_number = cash_array[0], is_level_success = true, is_h5_reward = false };
|
||||
|
||||
DOVirtual.DelayedCall(0.5f, () =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
|
||||
});
|
||||
});
|
||||
|
||||
ui.btn_back.onClick.Add(() =>
|
||||
{
|
||||
ctrl.CloseUI();
|
||||
float[] cash_array = GameHelper.GetRewardValue(2);
|
||||
|
||||
var temp = new SettlementData
|
||||
{ is_success = false, cash_number = cash_array[0], is_level_success = true, is_h5_reward = false };
|
||||
|
||||
DOVirtual.DelayedCall(0.5f, () =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 976df284e6e1b174fa1ecc9b6897b44c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
namespace ScrewsMaster
|
||||
{
|
||||
public class ReviveUICtrl : BaseUICtrl
|
||||
{
|
||||
private ReviveUI ui;
|
||||
private ReviveModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.ReviveUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.ReviveUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.ReviveModel) as ReviveModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new ReviveUI(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: fbc37ced5acf9bf498bd7fc434f091b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user