feat:1、创建项目
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RewardboxCtrl : BaseCtrl
|
||||
{
|
||||
public static RewardboxCtrl Instance { get; private set; }
|
||||
|
||||
private RewardboxModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.RewardboxModel) as RewardboxModel;
|
||||
}
|
||||
|
||||
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: 475737b2327d44d4ea721739dc354479
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RewardboxModel : 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: 94870495d6abb40eaaca680d24852477
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,211 @@
|
||||
// using FGUI.A000_common;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using FairyGUI;
|
||||
using FGUI.Common_01;
|
||||
using FGUI.Game_04;
|
||||
using IgnoreOPS;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RewardboxUI : BaseUI {
|
||||
private RewardboxUICtrl ctrl;
|
||||
private RewardboxModel model;
|
||||
private com_rewardbox ui;
|
||||
|
||||
public RewardboxUI(RewardboxUICtrl ctrl) : base(ctrl) {
|
||||
uiName = UIConst.RewardboxUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo) {
|
||||
uiInfo.packageName = "Game_04";
|
||||
uiInfo.assetName = "com_rewardbox";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit() {
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.RewardboxModel) as RewardboxModel;
|
||||
}
|
||||
private float cash_num;
|
||||
protected override void OnClose() {
|
||||
GameHelper.showGameUI = true;
|
||||
}
|
||||
|
||||
protected override void OnBind() {
|
||||
ui = baseUI as com_rewardbox;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args) {
|
||||
|
||||
if (GameHelper.IsGiftSwitch())
|
||||
ui.switchgift.selectedIndex = 1;
|
||||
else
|
||||
ui.switchgift.selectedIndex = 0;
|
||||
// (ui.btn_lookad as btn_tabad).color.selectedIndex = btn_tabad.Color_green;
|
||||
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims) {
|
||||
(ui.btn_lookad as btn_claim).state.selectedIndex = 1;
|
||||
}
|
||||
else if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) {
|
||||
(ui.btn_lookad.GetChild("img_saveingpot") as GImage).visible = true;
|
||||
}
|
||||
// btn_claim3 btnlook = ui.btn_lookad as btn_claim3;
|
||||
// btnlook.ad_icon.x += 50;
|
||||
|
||||
float[] cash_array = GameHelper.GetRewardValue(2);
|
||||
ui.btn_lookad.SetClick(() => {
|
||||
// GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||||
// {
|
||||
// if (isSuccess)
|
||||
// {
|
||||
// GameDispatcher.Instance.Dispatch(GameMsg.Ad_success, cash_array[0]);
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardboxUI_Close);
|
||||
// }
|
||||
// });
|
||||
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims) {
|
||||
StartScroll();
|
||||
ui.touchable = false;
|
||||
}
|
||||
else {
|
||||
GameHelper.ShowVideoAd("reward_lobby", isSuccess => {
|
||||
if (isSuccess) {
|
||||
StartScroll();
|
||||
ui.touchable = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ui.btn_close.SetClick(() => {
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardboxUI_Close);
|
||||
GameHelper.addInterAdnumber();
|
||||
});
|
||||
// var num = cash_array[0];
|
||||
// ui.gold_text.SetVar("count", num.ToString()).FlushVars();
|
||||
cash_num = cash_array[0];
|
||||
rate = (int) cash_array[1];
|
||||
|
||||
// ui.gold_text.SetVar("count", cash_num.ToString()).FlushVars();
|
||||
ui.gold_text.text = GameHelper.Get102Str((decimal) cash_num);
|
||||
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() {
|
||||
boost_array = GameHelper.GetRewardBoost(2);
|
||||
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() => {
|
||||
rate_idnex++;
|
||||
ui.btn_lookad.title = GameHelper.getChString((decimal)cash_num * boost_array[rate_idnex % 5]) ;
|
||||
});
|
||||
ui.btn_lookad.title = GameHelper.getChString((decimal)cash_num * boost_array[rate_idnex]);
|
||||
|
||||
list_1 = new List<item_wheel>() { (ui.wheel.GetChild("wheel_") as wheel_).item_0, (ui.wheel.GetChild("wheel_") as wheel_).item_1, (ui.wheel.GetChild("wheel_") as wheel_).item_2, (ui.wheel.GetChild("wheel_") as wheel_).item_3, (ui.wheel.GetChild("wheel_") as wheel_).item_4, (ui.wheel.GetChild("wheel_") as wheel_).item_5, (ui.wheel.GetChild("wheel_") as wheel_).item_6, (ui.wheel.GetChild("wheel_") as wheel_).item_7, };
|
||||
// list_1[2].img_light.visible = true;
|
||||
|
||||
for (int i = 0; i < list_1.Count; i++) {
|
||||
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
||||
list_1[i].text_rate.text = "X" + boost_array[i % boost_array.Length];
|
||||
}
|
||||
|
||||
}
|
||||
//初始化页面逻辑
|
||||
private int[] boost_array;
|
||||
List<item_wheel> list_1;
|
||||
private int rate_idnex = 3;
|
||||
private int scroll_number;
|
||||
List<int> rate_list = new List<int>();
|
||||
private int scroll_type = 1;
|
||||
private int rate;
|
||||
private void StartScroll() {
|
||||
ui.btn_lookad.SetClick(() => { });
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 5.0f;
|
||||
scroll_type = 2;
|
||||
}
|
||||
private void Scroll() {
|
||||
if (scroll_type == 1) {
|
||||
scroll_number++;
|
||||
rate_list.Clear();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
rate_list.Add(boost_array[(scroll_number + i) % boost_array.Length]);
|
||||
}
|
||||
for (int i = 0; i < list_1.Count; i++) {
|
||||
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
||||
list_1[i].text_rate.text = "X" + rate_list[i];
|
||||
}
|
||||
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() => {
|
||||
rate_idnex++;
|
||||
ui.btn_lookad.title = GameHelper.getChString((decimal) cash_num * boost_array[rate_idnex % boost_array.Length]);
|
||||
});
|
||||
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
scroll_number++;
|
||||
|
||||
rate_list.Clear();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
rate_list.Add(boost_array[(scroll_number + i) % boost_array.Length]);
|
||||
}
|
||||
|
||||
// bool need_return = false;
|
||||
if (((ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale < 2f) && (list_1[4].text_rate.text == ("X" + rate))) {
|
||||
//开始领取
|
||||
float reward = cash_num * rate;
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Ad_success, reward);
|
||||
SaveData.GetSaveObject().LargeRewardNum++;
|
||||
SaveData.saveDataFunc();
|
||||
DOVirtual.DelayedCall(1.5f, () => {
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardboxUI_Close);
|
||||
});
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < list_1.Count; i++) {
|
||||
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
||||
list_1[i].text_rate.text = "X" + rate_list[i];
|
||||
}
|
||||
|
||||
// if (need_return)
|
||||
// {
|
||||
// (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 0;
|
||||
// return;
|
||||
// }
|
||||
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() => {
|
||||
rate_idnex++;
|
||||
ui.btn_lookad.title = GameHelper.getChString((decimal) cash_num * boost_array[rate_idnex % boost_array.Length]);
|
||||
});
|
||||
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
||||
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale - 0.3f;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 107c313d002eb42708a62beb702590ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RewardboxUICtrl : BaseUICtrl
|
||||
{
|
||||
private RewardboxUI ui;
|
||||
private RewardboxModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.RewardboxUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.RewardboxUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.RewardboxModel) as RewardboxModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new RewardboxUI(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: 694209ebe845a485f81ac656bf536fb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user