提交项目
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JMallCtrl : BaseCtrl
|
||||
{
|
||||
public static JMallCtrl Instance { get; private set; }
|
||||
|
||||
private JMallModel model;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b40ead41161ec8439c8d8de3ed9ed0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JMallModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnReset()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 116dc2f5ddd793e4f95ad1f54c8cd279
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using FGUI.JMall;
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JMallUI : BaseUI
|
||||
{
|
||||
private JMallUICtrl ctrl;
|
||||
private JMallModel model;
|
||||
private FGUI.JMall.com_mall ui;
|
||||
|
||||
public JMallUI(JMallUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.JMallUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "JMall";
|
||||
uiInfo.assetName = "com_mall";
|
||||
uiInfo.layerType = UILayerType.Normal;
|
||||
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 FGUI.JMall.com_mall;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
var item1 = ui.list_item.GetChild("item1") as com_mall_carditem;
|
||||
var item2 = ui.list_item.GetChild("item2") as com_mall_carditem;
|
||||
var item3 = ui.list_item.GetChild("item3") as com_mall_carditem;
|
||||
var item4 = ui.list_item.GetChild("item4") as com_mall_coinitem;
|
||||
var item5 = ui.list_item.GetChild("item5") as com_mall_coinitem;
|
||||
|
||||
SetRedeemCard(item1, 1, 10);
|
||||
SetRedeemCard(item2, 3, 30);
|
||||
SetRedeemCard(item3, 10, 90);
|
||||
|
||||
SetRedeemCoin(item4, 10, 10000);
|
||||
SetRedeemCoin(item5, 30, 30000);
|
||||
}
|
||||
|
||||
private void SetRedeemCard(com_mall_carditem item, int count, int consume, Action<bool> action = null)
|
||||
{
|
||||
item.text_count.SetVar("count", count.ToString()).FlushVars();
|
||||
|
||||
item.btn_redeem_coin.title = consume.ToString();
|
||||
item.btn_redeem_coin.type.selectedIndex = 1;
|
||||
item.btn_redeem_coin.SetClick(() =>
|
||||
{
|
||||
TuSystem.Consume(102, consume, isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
GameHelper.Toast($"Get {count} Card Success");
|
||||
GameHelper.GetRewardOnly(104, count, RewardOrigin.Redeem, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.Toast("Get Card Failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void SetRedeemCoin(com_mall_coinitem item, int count, int consume, Action<bool> action = null)
|
||||
{
|
||||
item.text_count.SetVar("count", count.ToString()).FlushVars();
|
||||
item.btn_redeem_coin.title = consume.ToString();
|
||||
item.btn_redeem_coin.SetClick(() =>
|
||||
{
|
||||
TuSystem.Consume(101, consume, isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
GameHelper.Toast($"Redeem Success");
|
||||
GameHelper.GetRewardOnly(102, count, RewardOrigin.Redeem, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.Toast("Redeem Failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d6dd8dd2bf378444b52c56fff9b9248
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JMallUICtrl : BaseUICtrl
|
||||
{
|
||||
private JMallUI ui;
|
||||
private JMallModel model;
|
||||
|
||||
private uint openUIMsg = SkinInfo.JMallUI_Open;
|
||||
private uint closeUIMsg = SkinInfo.JMallUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new JMallUI(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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49507c36b72ae2f4c91ae054d782de68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user