This commit is contained in:
2026-07-15 16:19:07 +08:00
parent 64bad7c077
commit 544f4b2d01
7963 changed files with 447731 additions and 972637 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 988b707cb9f64d54c988a4304e5174e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
namespace ScrewsMaster
{
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,43 @@
namespace ScrewsMaster
{
public class AdcomingModel : 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: 29789969ee11944f8be5196fc0b81532
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,107 @@
using DG.Tweening;
namespace ScrewsMaster
{
public class AdcomingUI : BaseUI
{
private AdcomingUICtrl ctrl;
private AdcomingModel model;
private FGUI.G008_reward.com_adcoming ui;
public AdcomingUI(AdcomingUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.AdcomingUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G008_reward";
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.G008_reward.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(() =>
{
if (UIManager.Instance.IsExistUI(UIConst.PackrewardUI))
{
var ui = UIManager.Instance.GetDynamicUI(UIConst.PackrewardUI);
ui.baseUI.sortingOrder = 100;
}
else
{
PackRewardData param = new PackRewardData();
param.isAutoPop = false;
param.isNeedScroll = true;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
}
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,71 @@
namespace ScrewsMaster
{
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: 23ca926049ce946478bede18b0bef7f1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
namespace ScrewsMaster
{
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 ScrewsMaster
{
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,207 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FutureCore;
using FairyGUI;
using FGUI.A000_common;
using System;
using DG.Tweening;
using Spine.Unity;
namespace ScrewsMaster
{
public class BroadcastUI : BaseUI
{
private BroadcastUICtrl ctrl;
private BroadcastModel model;
private FGUI.A000_common.com_broadcast1 ui;
public BroadcastUI(BroadcastUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.BroadcastUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "A000_common";
uiInfo.assetName = "com_broadcast1";
uiInfo.layerType = UILayerType.Top;
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.A000_common.com_broadcast1;
}
protected override void OnOpenBefore(object args)
{
InitView();
//ui.y = 241;
// if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI))
// {
// Setbuttom();
// }
// else
// {
Settop();
//}
// ui.visible = false;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// ui.y += Screen.safeArea.y;
// }
text_ui = ui.broad_cast_text;
ui.btn_record.SetClick(OpenRecord);
ui.broad_cast_text.btn_broad.SetClick(OpenRecord);
if (ConfigSystem.GetConfig<exBrPoolModel>() == null) return;
config_name_list = ConfigSystem.GetConfig<exBrPoolModel>().config_name_list;
config_money_list = ConfigSystem.GetConfig<exBrPoolModel>().config_money_list;
GameDispatcher.Instance.AddListener(GameMsg.hideBroadCast, hideEvent);
GameDispatcher.Instance.AddListener(GameMsg.showBroadCast, showEvent);
// UICtrlDispatcher.Instance.AddListener(UICtrlMsg.MainUI_Open, Settop);
// UICtrlDispatcher.Instance.AddListener(UICtrlMsg.RainPlayUI_Open, Setbuttom);
}
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_money_list;
private bool main_ui_show = true;
//初始化页面逻辑
private Action closeCallback = null;
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);
}
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 = 196;
if (Screen.safeArea.y != 0)
{//刘海屏
ui.group_.y += Screen.safeArea.y;
}
}
private void Setbuttom(object sender = null)
{
ui.group_.y = GRoot.inst.height - 300;
}
void timeEvent()
{
time_count++;
// if (time_count > 30)
// {
// time_count = 0;
// var name_index = UnityEngine.Random.Range(0, config_name_list.Count);
// var money_index = UnityEngine.Random.Range(0, config_money_list.Count);
// if (main_ui_show)
// {
// ui.visible = true;
// }
// Debug.Log(text_ui.cast_text.text);
// text_ui.cast_text.text = String.Format(text_ui.hide_text.text, config_name_list[name_index],
// config_money_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
// text_ui.cast_text.x = 686;
// Tweener tweener = DOTween.To(() => text_ui.cast_text.x,
// x => text_ui.cast_text.x = x, -1300, 10);
// }
// time_count = 0;
//Debug.Log($"barry broad time count======== {time_count}");
if (time_count > 20)
{
time_count = 0;
var name_index = UnityEngine.Random.Range(0, config_name_list.Count);
var money_index = UnityEngine.Random.Range(0, config_money_list.Count);
Debug.Log(text_ui.cast_text.text);
string name = config_name_list[name_index];
if (name.Length > 4)
{
name = name[..4] + "...";
}
string broad_text = String.Format(text_ui.hide_text.text, name,
"$" + config_money_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
text_ui.cast_text.text = broad_text;
// 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_money_list[money_index] + "-" + DateTimeManager.Instance.GetCurrDateTime();
GameDispatcher.Instance.Dispatch(GameMsg.updateRecordList, str);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9a4125b4c0c64c94857a7ac85479526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
namespace ScrewsMaster
{
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,3 @@
fileFormatVersion: 2
guid: d8a71a4c41804ca9b8fddff13e97aecf
timeCreated: 1729595199
@@ -0,0 +1,42 @@
namespace ScrewsMaster
{
public class BuygoldCtrl : BaseCtrl
{
public static BuygoldCtrl Instance { get; private set; }
private BuygoldModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.BuygoldModel) as BuygoldModel;
}
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: 2342594a3679d4cc3871150e477d7ffb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
namespace ScrewsMaster
{
public class BuygoldModel : 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: 14fccb4c1b1fb4e7188a1c7a070629dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,436 @@
using System.Collections.Generic;
using UnityEngine;
using FGUI.G012_openReward;
using System;
using DG.Tweening;
using FairyGUI;
namespace ScrewsMaster
{
public class BuygoldUI : BaseUI
{
private BuygoldUICtrl ctrl;
private BuygoldModel model;
private FGUI.G012_openReward.com_buygold ui;
public BuygoldUI(BuygoldUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.BuygoldUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G012_openReward";
uiInfo.assetName = "com_buygold";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.BuygoldModel) as BuygoldModel;
}
protected override void OnClose()
{
GameHelper.showGameUI = true;
HallManager.Instance.UpdateSecondEvent -= InitList;
}
protected override void OnBind()
{
ui = baseUI as FGUI.G012_openReward.com_buygold;
}
protected override void OnOpenBefore(object args)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.gold_show, 1);
ui.pay_type.selectedIndex = GameHelper.IsAdModelOfPay() ? 0 : 1;
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);
GameDispatcher.Instance.AddListener(GameMsg.AdRewardClaimed, OnAdRewardClaimed);
GameDispatcher.Instance.AddListener(GameMsg.AdWatchCountUpdated, OnAdWatchCountUpdated);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.apple_pay_success, pay_success);
GameDispatcher.Instance.RemoveListener(GameMsg.AdRewardClaimed, OnAdRewardClaimed);
GameDispatcher.Instance.RemoveListener(GameMsg.AdWatchCountUpdated, OnAdWatchCountUpdated);
}
private void OnAdRewardClaimed(object args)
{
InitList();
}
private void OnAdWatchCountUpdated(object args)
{
InitList();
}
#endregion
void pay_success(object str)
{
string type = (string)str;
if (type.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = type[startIndex..]; // 截取 "gold" 后的所有字符
int suffix_num = int.Parse(suffix);
switch (suffix_num)
{
case 0:
SaveData.GetSaveobject()._goldtime0 = (int)GameHelper.GetNowTime();
break;
case 1:
SaveData.GetSaveobject()._goldtime1 = (int)GameHelper.GetNowTime();
break;
case 2:
SaveData.GetSaveobject()._goldtime2 = (int)GameHelper.GetNowTime();
break;
case 3:
SaveData.GetSaveobject()._goldtime3 = (int)GameHelper.GetNowTime();
break;
case 4:
SaveData.GetSaveobject()._goldtime4 = (int)GameHelper.GetNowTime();
break;
case 5:
SaveData.GetSaveobject()._goldtime5 = (int)GameHelper.GetNowTime();
break;
case 6:
SaveData.GetSaveobject()._goldtime6 = (int)GameHelper.GetNowTime();
break;
default:
return;
}
SaveData.saveDataFunc();
var start = GameHelper.GetUICenterPosition((ui.list_item.GetChildAt(suffix_num) as buygold_item).coin_text);
var end = GameHelper.GetUICenterPosition(ui.top_gold.GetChild("number_text"));
reward_data temp = new reward_data() { start = start, end = end, change = list[suffix_num].Actual_coins, type = 101 };
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
GameHelper.AddGoldNumber(list[suffix_num].Actual_coins);
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
DOVirtual.DelayedCall(1, () =>
{
DOVirtual.Float(0, (float)GameHelper.GetGoldNumber(), 1f,
value => { ui.top_gold.GetChild("number_text").text = ((int)value).ToString(); });
});
InitList();
}
}
//初始化页面逻辑
private void InitView()
{
if (Screen.safeArea.y != 0)
{//刘海屏
ui.top_gold.y += Screen.safeArea.y;
}
ui.top_gold.GetChild("number_text").text = GameHelper.GetGoldNumber().ToString();
ui.btn_close.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Close); });
// item_list.Add(ui.item4);
InitList();
//
//Debug.Log(ConfigSystem.GetConfig<PaidcoinsModel>().dataList);
HallManager.Instance.UpdateSecondEvent += InitList;
}
void InitList()
{
ui.text_hasADsCount.text = $"Owner ADs:{GameHelper.GetAdWatchCount()}";
ui.list_item.itemRenderer = setRemaintime;
ui.list_item.numItems = list.Count;
// for (int i = 0; i < item_list.Count; i++)
// {
// item_list[i].index.selectedIndex = i;
// setRemaintime(i, item_list[i]);
// }
}
private List<Paidcoins> list = ConfigSystem.GetConfig<PaidcoinsModel>().dataList;
// void setPayClick(int index, buygold_item item)
// {
// var start = GameHelper.GetUICenterPosition(item.gold_bg);
// var end = GameHelper.GetUICenterPosition(ui.top_gold.GetChild("number_text"));
// reward_data temp = new reward_data() { start = start, end = end, change = 3, type = 101 };
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
// GameHelper.addGoldNumber(3);
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
// DOVirtual.DelayedCall(1, () =>
// {
// DOVirtual.Float(0, (float)GameHelper.getGoldNumber(), 1f,
// value => { ui.top_gold.GetChild("number_text").text = ((int)value).ToString(); });
// });
// }
void setRemaintime(int index, GObject obj)
{
int time = 0;
if (index == 0) time = SaveData.GetSaveobject()._goldtime0;
else if (index == 1) time = SaveData.GetSaveobject()._goldtime1;
else if (index == 2) time = SaveData.GetSaveobject()._goldtime2;
else if (index == 3) time = SaveData.GetSaveobject()._goldtime3;
else if (index == 4) time = SaveData.GetSaveobject()._goldtime4;
else if (index == 5) time = SaveData.GetSaveobject()._goldtime5;
else if (index == 6) time = SaveData.GetSaveobject()._goldtime6;
buygold_item item = obj as buygold_item;
if (index <= 4) item.index.selectedIndex = index;
else item.index.selectedIndex = 4;
item.btn_buy.img_saveingpot.visible = false;
var needWatchAds = false;
item.coin_text.text = "x" + list[index].Actual_coins.ToString();
item.pay_type.selectedIndex = GameHelper.IsAdModelOfPay() ? 0 : 1;
if (list[index].Discount_rate != 0)
{
item.off_text.text = list[index].Discount_rate + "%";
item.show_off.selectedIndex = 1;
}
else item.show_off.selectedIndex = 0;
decimal price = 0;
price = Mathf.RoundToInt(list[index].Payment_amount);
if (time + list[index].receive_CD < GameHelper.GetNowTime()) //没在冷却
{
if (!GameHelper.IsAdModelOfPay())
{
price = (decimal)list[index].Payment_amount2;
item.btn_buy.btn_text.text = "$ "+price;
if (index == 0)
{
item.btn_buy.btn_text.text = "Free";
item.btn_buy.SetClick(() =>
{
PaySuccess(0);
});
}
else
{
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
{
item.btn_buy.img_saveingpot.visible = true;
}
item.btn_buy.SetClick(() =>
{
ApplePayClass maxPayData = new ApplePayClass()
{
amount = (int)Math.Round(price * 100),
sku = getShopName(index),
currency = "USD",
shopName = $"buy_gold{index}"
};
MaxPayManager.Instance.Buy(maxPayData);
});
item.btn_buy.y = 330;
}
}
else
{
if (index == 0)
{
item.btn_buy.btn_text.text = "Free";
}
// else item.btn_buy.btn_text.text = GameHelper.GetPaymentTypeVO().payicon + list[index].Payment_amount;
else
{
item.btn_buy.touchable = true;
item.btn_buy.grayed = false;
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
{
item.btn_buy.img_saveingpot.visible = true;
}
if (GameHelper.CheckAdWatchCount((int)price))
{
item.btn_buy.btn_text.text = "Claim";
item.btn_buy.img_saveingpot.visible = false;
}
else if (GameHelper.InAdRewardCooldown())
{
item.btn_buy.btn_text.text = CommonHelper.TimeFormat((int)GameHelper.GetAdRewardCooldownTime() - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
item.btn_buy.touchable = false;
item.btn_buy.grayed = true;
item.btn_buy.img_saveingpot.visible = false;
}
else
{
needWatchAds = true;
item.btn_buy.btn_text.text = $"Watch Ad";
}
}
item.btn_buy.SetClick(() =>
{
if (index == 0)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.gold_click + "_" + (index ), 1);
PaySuccess(0);
}
else
{
if (needWatchAds)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.gold_click + "_" + (index ), 1);
GameHelper.ShowVideoAd($"buy_gold{index}", success =>
{
if (success)
{
GameHelper.UpdateAdRewardExchangeTime();
}
});
return;
}
if (GameHelper.CheckAdWatchCount((int)price))
{
GameHelper.AddAdWatchCount(-(int)price);
PaySuccess(index);
}
else
{
GameHelper.ShowTips("Insufficient AdWatchCount");
}
}
});
}
item.btn_buy.can_buy.selectedIndex = 0;
}
else
{
if (index != 0 && !GameHelper.IsAdModelOfPay())
{
item.btn_buy.y = 340;
}
item.btn_buy.img_saveingpot.visible = false;
item.btn_buy.can_buy.selectedIndex = 1;
item.btn_buy.btn_text.text = CommonHelper.TimeFormat(time + list[index].receive_CD - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
item.btn_buy.SetClick(() =>
{
});
}
item.text_priceDescription.text = index == 0 ? $"Daily Rewards" : $"Need {price} ADs";
}
public string getShopName(int index)
{
string name;
switch(index)
{
case 1:
name = PurchasingManager.buy_gold_1;
break;
case 2:
name = PurchasingManager.buy_gold_2;
break;
case 3:
name = PurchasingManager.buy_gold_3;
break;
case 4:
name = PurchasingManager.buy_gold_4;
break;
case 5:
name = PurchasingManager.buy_gold_5;
break;
default:
return "";
}
return name;
}
void PaySuccess(int index)
{
switch (index)
{
case 0:
SaveData.GetSaveobject()._goldtime0 = (int)GameHelper.GetNowTime();
break;
case 1:
SaveData.GetSaveobject()._goldtime1 = (int)GameHelper.GetNowTime();
break;
case 2:
SaveData.GetSaveobject()._goldtime2 = (int)GameHelper.GetNowTime();
break;
case 3:
SaveData.GetSaveobject()._goldtime3 = (int)GameHelper.GetNowTime();
break;
case 4:
SaveData.GetSaveobject()._goldtime4 = (int)GameHelper.GetNowTime();
break;
case 5:
SaveData.GetSaveobject()._goldtime5 = (int)GameHelper.GetNowTime();
break;
case 6:
SaveData.GetSaveobject()._goldtime6 = (int)GameHelper.GetNowTime();
break;
default:
return;
}
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.GoldSuccess + "_" + (index ), 1);
SaveData.saveDataFunc();
var start = GameHelper.GetUICenterPosition((ui.list_item.GetChildAt(index) as buygold_item).coin_text);
var end = GameHelper.GetUICenterPosition(ui.top_gold.GetChild("number_text"));
reward_data temp = new reward_data() { start = start, end = end, change = list[index].Actual_coins, type = 101 };
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
GameHelper.AddGoldNumber(list[index].Actual_coins);
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
DOVirtual.DelayedCall(1, () =>
{
DOVirtual.Float(0, (float)GameHelper.GetGoldNumber(), 1f,
value => { ui.top_gold.GetChild("number_text").text = ((int)value).ToString(); });
});
InitList();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7de4ee29003a34adbb4ff4e0c97ed52c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
namespace ScrewsMaster
{
public class BuygoldUICtrl : BaseUICtrl
{
private BuygoldUI ui;
private BuygoldModel model;
private uint openUIMsg = UICtrlMsg.BuygoldUI_Open;
private uint closeUIMsg = UICtrlMsg.BuygoldUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.BuygoldModel) as BuygoldModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new BuygoldUI(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: bfad94d0fa70d40bd8308f8fb11b9520
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 412aa0ea70abed443860a83b921a12d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
namespace ScrewsMaster
{
public class CoinWnd_newCtrl : BaseCtrl
{
public static CoinWnd_newCtrl Instance { get; private set; }
private CoinWnd_newModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.CoinWnd_newModel) as CoinWnd_newModel;
}
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: 82125970c45e44fa3afcdd751aaa5418
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
namespace ScrewsMaster
{
public class CoinWnd_newModel : 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: ed7f9244ac32c442f874bfa7eac2cfc0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,258 @@
using UnityEngine;
using FairyGUI;
using FGUI.G601_Coin;
using System;
using System.Text;
using DG.Tweening;
namespace ScrewsMaster
{
public class CoinWnd_newUI : BaseUI
{
private CoinWnd_newUICtrl ctrl;
private CoinWnd_newModel model;
private FGUI.G601_Coin.Com_CoinWnd_new ui;
private reward_data pos_arr;
private bool isUpdate = false;
private int completeSum = 0;
private float toSizeAniTime = 0.4f;
private float moveAniTime = 0.5f;
private float showAniTime = 0.1f;
private bool isRiseUI;
private Action CloseCb;
public CoinWnd_newUI(CoinWnd_newUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.CoinWnd_newUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G601_Coin";
uiInfo.assetName = "Com_CoinWnd_new";
uiInfo.layerType = UILayerType.Animation;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
}
public override void OnUpdate()
{
if (!isUpdate)
{
if (isRiseUI)
{
// if (data.rewardSingleData.id == 101 || data.rewardSingleData.id == 111)
// {
GameHelper.OnRiseUIRecover(pos_arr.type, UILayerType.Normal);
isRiseUI = false;
//}
}
return;
}
//data?.Update();
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.CoinWnd_newModel) as CoinWnd_newModel;
}
protected override void OnClose()
{
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MaskUI_Close);//2024年9月10日检查发现动画会调用全屏遮罩影响游戏体验,故而关闭
CloseCb?.Invoke();
}
protected override void OnBind()
{
ui = baseUI as FGUI.G601_Coin.Com_CoinWnd_new;
}
protected override void OnOpenBefore(object args)
{
if (AudioManager.Instance.IsOpenEffect)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.CoinFly);
}
pos_arr = (reward_data)args;
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MaskUI_Open);//2024年9月10日检查发现动画会调用全屏遮罩影响游戏体验,故而关闭
// if (args is RewardDisplayData displayModel)
// {
// data = displayModel;
// if (data.isPlayAudio)
// {
// AudioManager.Instance.PlayDynamicEffect(data.audioName);
// }
// }
if (true)
{
// if (!data.isSingle)
// {
ShowText();
// }
// ui.com_Coins.cont_coin.selectedIndex = !data.isSingle ? com_Coins.Coin_more : com_Coins.Coin_single;
// ui.com_Coins.position = data.rewardSingleData.startPosition;
ui.com_Coins.cont_coin.selectedIndex = com_Coins.Coin_more;
ui.com_Coins.position = pos_arr.start;
float val = 0f;
ui.fx_enter.position = ui.com_Coins.position;
foreach (var o in ui.com_Coins.GetChildren())
{
var item = (com_Coin)o;
if (!item.visible)
{
continue;
}
item.visible = false;
TextureHelper.GetItemIcon(pos_arr.type, spr => { item.icon.texture = spr; });
float def = val;
DOVirtual.DelayedCall(0.05f, () =>
{
item.visible = true;
Vector2 tar = new Vector2(UnityEngine.Random.Range(0, item.parent.size.x / 1),
UnityEngine.Random.Range(0, item.parent.size.y / 1));
item.size = Vector2.zero;
item.position = new Vector2(item.parent.width / 2, item.parent.height / 2);
// if (!data.isSingle)
// {
// }
// else
// {
// toSizeAniTime = 0.2f;
// }
item.TweenMove(tar, toSizeAniTime + def);
DOTween.To(() => item.size, (e) => item.size = e, Vector2.one, toSizeAniTime + def);
item.icon.visible = true;
DOVirtual.DelayedCall(toSizeAniTime + def, () =>
{
var moveTime = moveAniTime;
DOTween.To(() => item.icon.alpha, (e) => { item.icon.alpha = e; }, 0.6f, moveTime);
item.TweenMove(pos_arr.end - (Vector2)item.parent.position +
item.parent.size / 2, moveTime);
DOVirtual.DelayedCall(moveTime, () =>
{
item.icon.visible = false;
completeSum++;
var fxPlayData = FxPlayData.Get(Fx_Type.fx_ui_jinbi_click, 1,
item.LocalToRoot(Vector2.zero, GRoot.inst));
uiCtrlDispatcher.Dispatch(UICtrlMsg.PlayUIFX, fxPlayData);
if (!isUpdate)
{
isUpdate = true;
}
if (completeSum >= ui.com_Coins.numChildren)
{
DOVirtual.DelayedCall(0.2f, () => { CtrlCloseUI(); });
}
});
});
});
val += 0.02f;
}
}
}
private void ShowText()
{
var sb = new StringBuilder();
sb.Append("+");
// if (data.rewardSingleData.id == 101 || data.rewardSingleData.id == 111)
// {
// sb.Append((data.rewardSingleData.GetTotalValue() * GameHelper.GetPaymentMulti()).ToString("N"));
sb.Append(pos_arr.change);
//}
// else
// {
// sb.Append(data.rewardSingleData.GetTotalValue().ToString("N0"));
// }
ui.text_Add.SetText(sb.ToString());
ui.text_Add.position = pos_arr.start;
ui.fx_addSum.Play();
}
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()
{
}
}
}
class reward_data
{
public Vector2 start;
public Vector2 end;
public float change;
public int type;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6320d97d6a3f34715a9194dc1bfc1336
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
namespace ScrewsMaster
{
public class CoinWnd_newUICtrl : BaseUICtrl
{
private CoinWnd_newUI ui;
private CoinWnd_newModel model;
private uint openUIMsg = UICtrlMsg.CoinWnd_newUI_Open;
private uint closeUIMsg = UICtrlMsg.CoinWnd_newUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.CoinWnd_newModel) as CoinWnd_newModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new CoinWnd_newUI(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: 4074fed29af2547328f8116c839e8121
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:
@@ -0,0 +1,19 @@
namespace ScrewsMaster
{
public class CurrencyRewardCtrl : BaseCtrl
{
public static CurrencyRewardCtrl Instance { get; private set; }
private CurrencyRewardModel model;
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 232c5fc22d0ebec41a34e1cf91ec335e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,15 @@
namespace ScrewsMaster
{
public class CurrencyRewardModel : BaseModel
{
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 08a25e84634bcd943ab1514b27f5f927
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,181 @@
namespace ScrewsMaster
{
using System;
using FairyGUI;
using UnityEngine;
using DG.Tweening;
using System.Text;
using FGUI.G601_Coin;
using Random = UnityEngine.Random;
public class CurrencyRewardUI : BaseUI
{
private CurrencyRewardUICtrl ctrl;
private CurrencyRewardModel model;
private FGUI.G601_Coin.Com_CoinWnd ui;
public RewardDisplayData data;
private bool isUpdate = false;
private int completeSum = 0;
private float toSizeAniTime = 0.4f;
private float moveAniTime = 0.5f;
private float showAniTime = 0.1f;
private bool isRiseUI;
private Action CloseCb;
public CurrencyRewardUI(CurrencyRewardUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.CurrencyRewardUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G601_Coin";
uiInfo.assetName = "Com_CoinWnd";
uiInfo.layerType = UILayerType.Animation;
uiInfo.isTickUpdate = true;
}
public override void OnUpdate()
{
if (!isUpdate)
{
if (isRiseUI)
{
if (data.rewardSingleData.id is 101 or 102)
{
GameHelper.OnRiseUIRecover(data.rewardSingleData.id, UILayerType.Normal);
isRiseUI = false;
}
}
return;
}
data?.Update();
}
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.RewardAniModel) as CurrencyRewardModel;
}
protected override void OnClose()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MaskUI_Close);
data?.EndEvent();
DOVirtual.DelayedCall(Time.deltaTime, delegate
{
data?.UICloseEvent();
data?.Dispose();
});
CloseCb?.Invoke();
}
protected override void OnBind()
{
ui = baseUI as Com_CoinWnd;
}
protected override void OnOpenBefore(object args)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MaskUI_Open);
if (args is RewardDisplayData displayModel)
{
data = displayModel;
if (data.isPlayAudio)
{
AudioManager.Instance.PlayDynamicEffect(data.audioName);
}
}
if (data.isNeedFly)
{
if (!data.isSingle)
{
ShowText();
}
ui.com_Coins.cont_coin.selectedIndex = !data.isSingle ? com_Coins.Coin_more : com_Coins.Coin_single;
ui.com_Coins.position = data.rewardSingleData.startPosition;
var val = 0f;
ui.fx_enter.position = ui.com_Coins.position;
foreach (var o in ui.com_Coins.GetChildren())
{
var item = (com_Coin)o;
if (!item.visible)
{
continue;
}
item.visible = false;
TextureHelper.GetItemIcon(data.rewardSingleData.id, spr => { item.icon.texture = spr; });
var def = val;
DOVirtual.DelayedCall(0.05f, () =>
{
item.visible = true;
var tar = new Vector2(Random.Range(0, item.parent.size.x / (!data.isSingle ? 1 : 2)),
Random.Range(0, item.parent.size.y / (!data.isSingle ? 1 : 2)));
item.size = Vector2.zero;
item.position = new Vector2(item.parent.width / 2, item.parent.height / 2);
if (data.isSingle)
{
toSizeAniTime = 0.2f;
}
item.TweenMove(tar, toSizeAniTime + def);
DOTween.To(() => item.size, (e) => item.size = e, Vector2.one, toSizeAniTime + def);
item.icon.visible = true;
DOVirtual.DelayedCall(toSizeAniTime + def, () =>
{
var moveTime = moveAniTime;
DOTween.To(() => item.icon.alpha, (e) => { item.icon.alpha = e; }, 0.6f, moveTime);
item.TweenMove(data.rewardSingleData.endPosition - (Vector2)item.parent.position +
item.parent.size / 2, moveTime);
DOVirtual.DelayedCall(moveTime, () =>
{
item.icon.visible = false;
completeSum++;
var fxPlayData = FxPlayData.Get(Fx_Type.fx_ui_jinbi_click, 1,
item.LocalToRoot(Vector2.zero, GRoot.inst));
uiCtrlDispatcher.Dispatch(UICtrlMsg.PlayUIFX, fxPlayData);
if (!isUpdate)
{
isUpdate = true;
}
if (completeSum >= ui.com_Coins.numChildren)
{
DOVirtual.DelayedCall(0.2f, CtrlCloseUI);
}
});
});
});
val += 0.02f;
}
}
}
private void ShowText()
{
var sb = new StringBuilder();
sb.Append("+");
sb.Append(data.rewardSingleData.id is 101 or 102 or 111
? (data.rewardSingleData.GetTotalValue()).ToString("N")
: data.rewardSingleData.GetTotalValue().ToString("N0"));
ui.text_Add.SetText(sb.ToString());
ui.text_Add.position = data.rewardSingleData.startPosition;
ui.fx_addSum.Play();
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9d2d9fbd8465dce4a9a3d6b7c76a1b5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,57 @@
namespace ScrewsMaster
{
public class CurrencyRewardUICtrl : BaseUICtrl
{
private CurrencyRewardUI ui;
private CurrencyRewardModel model;
private uint openUIMsg = UICtrlMsg.RewardAniUI_Open;
private uint closeUIMsg = UICtrlMsg.RewardAniUI_Close;
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
ui = new CurrencyRewardUI(this);
ui.Open(args);
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
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);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53e075cd42f5230469d7b5a03e008a68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 428c3222e38348c499d511fd1ab2ab45
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3e6c7df2af55497c964e70e37ced4f9a
timeCreated: 1675931929
@@ -0,0 +1,19 @@
namespace ScrewsMaster
{
public class FXWndCtrl : BaseCtrl
{
public static FXWndCtrl Instance { get; private set; }
private FXWndModel model;
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b80fe266a6824af6ac721d23dea8b29c
timeCreated: 1675931929
@@ -0,0 +1,15 @@
namespace ScrewsMaster
{
public class FXWndModel : BaseModel
{
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 448f05696d5d484a8fde8dad54e29a82
timeCreated: 1675931929
@@ -0,0 +1,171 @@
namespace ScrewsMaster
{
using System;
using FairyGUI;
using DG.Tweening;
using Spine.Unity;
using UnityEngine;
public class FXWndUI : BaseUI
{
private FXWndUICtrl ctrl;
private FXWndModel model;
private FGUI.G502_Fx.com_FX ui;
private Transform parTrf;
public FXWndUI(FXWndUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.FXWndUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G502_Fx";
uiInfo.assetName = "com_FX";
uiInfo.layerType = UILayerType.Animation;
}
public void PlayFx(FxPlayData fxPlayData)
{
FxPlayData data = fxPlayData;
GameObject arg = null;
Transform trf = null;
Action recFx = null;
if (data.isParticleSystem)
{
ParticleSystem system = FXManager.Instance.GetFx<ParticleSystem>(data.fxType);
system.Play();
arg = system.gameObject;
trf = system.transform;
recFx = delegate { FXManager.Instance.RecFx<ParticleSystem>(data.fxType, system); };
}
else
{
SkeletonAnimation system = FXManager.Instance.GetFx<SkeletonAnimation>(data.fxType);
trf = system.transform;
arg = system.gameObject;
recFx = delegate { FXManager.Instance.RecFx<SkeletonAnimation>(data.fxType, system); };
}
trf.SetParent(parTrf);
arg.SetLayer("UI");
Action cb = SetSortingOrder(arg);
data.endEvent += (e) => cb?.Invoke();
Vector3 startPot = GameHelper.FguiPotToUnityTrfLocalPot(data.startPot);
trf.localPosition = startPot;
trf.localScale = Vector3.one * data.size;
trf.localEulerAngles = Vector3.zero;
fxPlayData.startEvent?.Invoke(arg);
DOVirtual.DelayedCall(data.duration, () =>
{
data.endEvent?.Invoke(arg);
recFx?.Invoke();
FxPlayData.Release(data);
});
}
private Action SetSortingOrder(GameObject obj)
{
Action action = null;
Renderer[] renders = obj.GetComponentsInChildren<Renderer>();
foreach (Renderer render in renders)
{
if (render != null)
{
render.sortingOrder += 300;
action += () => { render.sortingOrder -= 300; };
}
}
return action;
}
#region
protected override void OnInit()
{
}
protected override void OnClose()
{
CommonHelper.FadeOut(ui);
}
protected override void OnBind()
{
ui = baseUI as FGUI.G502_Fx.com_FX;
}
protected override void OnOpenBefore(object args)
{
parTrf = ui.displayObject.cachedTransform;
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
#endregion
}
public class FxPlayData
{
private static ObjectPool<FxPlayData> _Pool = new ObjectPool<FxPlayData>();
public static FxPlayData Get(Fx_Type fx_Type, float _duration, Vector2 _pot)
{
FxPlayData data = _Pool.Get();
if (_pot == Vector2.zero)
{
data.startPot = GRoot.inst.size / 2;
}
else
{
data.startPot = _pot;
}
if (_duration == 0)
{
data.duration = 1;
}
else
{
data.duration = _duration;
}
data.fxType = fx_Type;
return data;
}
public static void Release(FxPlayData data)
{
data.duration = 0;
data.startEvent = null;
data.endEvent = null;
data.isParticleSystem = true;
data.startPot = Vector2.zero;
_Pool.Release(data);
}
public float duration;
public Fx_Type fxType;
public bool isParticleSystem = true;
public Vector2 startPot;
public Action<GameObject> startEvent;
public Action<GameObject> endEvent;
public int size = 100;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 186b49b6b475454bbadfdf90b0b7d4b2
timeCreated: 1675931929
@@ -0,0 +1,83 @@
namespace ScrewsMaster
{
public class FXWndUICtrl : BaseUICtrl
{
private FXWndUI ui;
private FXWndModel model;
private uint openUIMsg = UICtrlMsg.FXWndUI_Open;
private uint closeUIMsg = UICtrlMsg.FXWndUI_Close;
private bool isOpen = false;
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null || ui.isClose)
{
ui = new FXWndUI(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);
uiCtrlDispatcher.AddListener(UICtrlMsg.PlayUIFX, PlayFx);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
uiCtrlDispatcher.RemoveListener(UICtrlMsg.PlayUIFX, PlayFx);
}
private void PlayFx(object obj)
{
if (!isOpen)
{
OpenUI();
}
FxPlayData fxType = (FxPlayData)obj;
ui.PlayFx(fxType);
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 67c44481d43948a78f1cf27e8df6f06a
timeCreated: 1675931929
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5902d91a945346c7b5579b701a08db45
timeCreated: 1729664385
@@ -0,0 +1,42 @@
namespace ScrewsMaster
{
public class FirstRewardCtrl : BaseCtrl
{
public static FirstRewardCtrl Instance { get; private set; }
private FirstRewardModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.FirstRewardModel) as FirstRewardModel;
}
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: 2b10e7a12f76b4e9c9389034c3bcee2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
namespace ScrewsMaster
{
public class FirstRewardModel : 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: 139c7e95f3a174f9f996d4aaf7465f2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,150 @@
using System;
using UnityEngine;
using FGUI.G002_main;
using Spine.Unity;
using DG.Tweening;
namespace ScrewsMaster
{
public class FirstRewardUI : BaseUI
{
private FirstRewardUICtrl ctrl;
private FirstRewardModel model;
private FGUI.G002_main.com_firstreward ui;
private Action closeCallback;
private Action open_sign;
private bool is_get = false;
public FirstRewardUI(FirstRewardUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.FirstRewardUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G002_main";
uiInfo.assetName = "com_firstreward";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
model = ModuleManager.Instance.GetModel(ModelConst.FirstRewardModel) as FirstRewardModel;
}
protected override void OnClose()
{
closeCallback();
//open_sign();
}
protected override void OnBind()
{
ui = baseUI as FGUI.G002_main.com_firstreward;
}
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{//刘海屏
ui.money.y += Screen.safeArea.y;
}
InitView();
}
protected override void OnOpen(object args)
{
//open_sign = (System.Action)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.text_num.text = GameHelper.GetPaymentTypeVO().payicon + ConfigSystem.GetConfig<CommonModel>().InitialNum;
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.spine_parent, Fx_Type.fx_first_reward, ref closeCallback);
sk.state.SetAnimation(0, "newbie_reward_an01", false);
sk.state.Complete += (a) =>
{
sk.state.SetAnimation(0, "newbie_reward_an02", true);
ui.btn_getreward.SetClick(() =>
{
ui.btn_getreward.visible = false;
sk.state.SetAnimation(0, "newbie_reward_an03", false);
sk.state.Complete += (a) =>
{
ui.state.selectedIndex = com_firstreward.State_page;
};
});
};
ui.btn_get.SetClick(GetReward);
ui.btn_close.SetClick(GetReward);
ui.money.GetChild("number_text").text = GameHelper.Get102Str(GameHelper.Get102());
var lightSk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_win_light, ref closeCallback);
lightSk.state.SetAnimation(0, "animation", true);
}
private void GetReward()
{
if (is_get) return;
is_get = true;
// GameHelper.GetRewardOnly(ConfigSystem.GetConfig<CommonModel>().InitialNum, RewardOrigin.OpenReward, ui.btn_get, ui.end_point, isSuccess =>
// {
// // PreferencesMgr.Instance.IsShowOpenReward = false;
// // PreferencesMgr.Instance.OpenRewardCount++;
// });
var start = GameHelper.GetUICenterPosition(ui.img_cash);
var end = GameHelper.GetUICenterPosition(ui.money.GetChild("number_text"));
float cash = (float)ConfigSystem.GetConfig<CommonModel>().InitialNum;
reward_data temp = new reward_data() { start = start, end = end, change = cash, type = 111 };
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
GameHelper.AddMoney(cash);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
Debug.Log(cash);
DOVirtual.DelayedCall(1, () =>
{
DOVirtual.Float(0, (float)GameHelper.Get102(), 1,
value => { ui.money.GetChild("number_text").text = GameHelper.Get102Str((decimal)value); });
PlayerPrefs.SetInt("FirstReward", 1);
});
DOVirtual.DelayedCall(2.5f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FirstRewardUI_Close);
});
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10ed78edd8a4f471d8230502a75e04f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
namespace ScrewsMaster
{
public class FirstRewardUICtrl : BaseUICtrl
{
private FirstRewardUI ui;
private FirstRewardModel model;
private uint openUIMsg = UICtrlMsg.FirstRewardUI_Open;
private uint closeUIMsg = UICtrlMsg.FirstRewardUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.FirstRewardModel) as FirstRewardModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new FirstRewardUI(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: 943432b7abe7d41eb9b023894a945fcf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a25bdf932ba72d4c97c6ec5baf10251
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
namespace ScrewsMaster
{
public class GameHomeCtrl : BaseCtrl
{
public static GameHomeCtrl Instance { get; private set; }
private GameHomeModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.GameHomeModel) as GameHomeModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1a4f944f53b1184b8abd1ca2a328f37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace ScrewsMaster
{
public class GameHomeModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 482684869b96f8941af63ec69ed864c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,610 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using FGUI.A000_common;
using UnityEngine;
using FairyGUI;
using FGUI.G003_play;
using FGUI.G018_GameHome;
using btn_noads = FGUI.A000_common.btn_noads;
using Random = UnityEngine.Random;
using Unity.VisualScripting;
using Newtonsoft.Json;
using System.IO;
using Spine.Unity;
namespace ScrewsMaster
{
public class GameHomeUI : BaseUI
{
private GameHomeUICtrl ctrl;
private GameHomeModel model;
private GameHome ui;
private MakeupTaskData _makeupTaskData;
private Makeup _makeup;
private bool is_first_login_go_to_h5;
private btn_noads _btnNoAds;
public GameHomeUI(GameHomeUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.GameHomeUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G018_GameHome";
uiInfo.assetName = "GameHome";
uiInfo.layerType = UILayerType.Normal;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GameHomeModel) as GameHomeModel;
}
protected override void OnClose()
{
HallManager.Instance.UpdateSecondEvent -= UpData;
}
protected override void OnBind()
{
ui = baseUI as GameHome;
}
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{
ui.TopBox.y += Screen.safeArea.y;
}
HallManager.Instance.UpdateSecondEvent += UpData;
AudioManager.Instance.PlayBGM(AudioConst.MainBg);
InitView();
UpData();
var loginModel = GameHelper.GetLoginModel();
is_first_login_go_to_h5 = CommonHelper.GetBoolByChance(ConfigSystem.GetConfig<CommonModel>().loginhallrate / 100f);
is_first_login_go_to_h5 = false;
GameHelper.is_first_login = loginModel.new_player;
if (GameHelper.IsGiftSwitch() && !loginModel.new_player && is_first_login_go_to_h5)
{
GotoH5();
}
else if (GameHelper.IsGiftSwitch() && loginModel.new_player)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FirstRewardUI_Open);
loginModel.new_player = false;
}
RefreshSaveingPot();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
PreferencesDispatcher<int>.Instance.AddListener(PreferencesMsg.playerAvatarId, OnChangeAvatar);
GameDispatcher.Instance.AddListener(GameMsg.BattleLevelUp, OnBattleLevelUp);
GameDispatcher.Instance.AddListener(GameMsg.Gold_refresh, SetTopCurr);
GameDispatcher.Instance.AddListener(GameMsg.RefreshMakeupData, SetMoneyCurr);
GameDispatcher.Instance.AddListener(GameMsg.BuyPack, OnBuyPack);
GameDispatcher.Instance.AddListener(GameMsg.BuyRemoveAdPack, OnBuyPack);
HallManager.Instance.UpdateSecondEvent += TimeEvent;
HallManager.Instance.UpdateEvent += UpdateEvent;
}
protected override void RemoveListener()
{
PreferencesDispatcher<int>.Instance.RemoveListener(PreferencesMsg.playerAvatarId, OnChangeAvatar);
GameDispatcher.Instance.RemoveListener(GameMsg.BattleLevelUp, OnBattleLevelUp);
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, SetTopCurr);
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshMakeupData, SetMoneyCurr);
GameDispatcher.Instance.RemoveListener(GameMsg.BuyPack, OnBuyPack);
GameDispatcher.Instance.RemoveListener(GameMsg.BuyRemoveAdPack, OnBuyPack);
HallManager.Instance.UpdateSecondEvent -= TimeEvent;
HallManager.Instance.UpdateEvent -= UpdateEvent;
}
private void OnBuyPack(object args)
{
SetBtnAds();
}
#endregion
//初始化页面逻辑
private void InitView()
{
// ShowScrews.Instance.gameMode = GameHome.Mode_simple;
ui.switchgift.selectedIndex = GameHelper.IsGiftSwitch() ? 1 : 0;
var showH5Btn = false;
if (GameHelper.IsGiftSwitch())
{
showH5Btn = true;
}
else
{
showH5Btn = GameHelper.GetCommonModel().WVswitch != 0;
// if (showH5Btn)
// {
// var uiBtnH5 = ui.btn_h5 as btn_hall;
// if (uiBtnH5 != null) uiBtnH5.t0.Stop();
// }
}
/// ui.btn_h5.visible = showH5Btn;
//ui.NoAdsBtn.visible = GameHelper.IsGiftSwitch();
// ui.broadcast.visible = false;
_btnNoAds = ui.NoAdsBtn as btn_noads;
InitButtons();
SetAvatar();
SetTopCurr();
SetMoneyCurr();
SetBtnTask();
SetBtnAds();
int level = GameHelper.GetLevel();
ui.PlayBtn.text = "Level " + level;
if (GameHelper.IsGiftSwitch())
{
ui.Mode.selectedIndex = 1;
ui.PlayBtn.text = "Level " + level;
}
else
{
ui.Mode.selectedIndex = ShowScrews.Instance.gameMode;
}
checkThreeGift();
}
void SetTopCurr(object a = null)
{
ui.gold.number_text.text = GameHelper.GetGoldNumber().ToString();
}
private List<Paidcoins> _paidcoinsList;
void UpData()
{
_paidcoinsList ??= ConfigSystem.GetConfig<PaidcoinsModel>().dataList;
int time = SaveData.GetSaveobject()._goldtime0;
if (time + _paidcoinsList[0].receive_CD < GameHelper.GetNowTime())
{
ui.gold.state.selectedIndex = 2;
ui.gold.red.visible = true;
}
else
{
ui.gold.state.selectedIndex = 1;
}
ui.BattleBtn.red.visible = SaveData.getRed();
ui.SignInBtn.red.visible = CheckSignState();
}
private bool CheckSignState()
{
var signDays = PreferencesMgr.Instance.SignState.Count;
if (signDays == 0)
{
return true;
}
var isToday = false;
if (signDays > 0)
isToday = GameHelper.InToday(PreferencesMgr.Instance.SignState[signDays - 1], 0, true);
return !isToday;
}
private int _timeCount = 11;
private com_broadcast_text1 _textUI;
void TimeEvent()
{
if (!GameHelper.IsGiftSwitch()) return;
RefreshSaveingPot();
checkThreeGift();
// _timeCount++;
// if (_timeCount > 10)
// {
// ui.broadcast.visible = false;
// }
// var exBrPoolModel = ConfigSystem.GetConfig<exBrPoolModel>();
// var configNameList = exBrPoolModel.config_name_list;
// var configMoneyList = exBrPoolModel.config_money_list;
// var nameIndex = Random.Range(0, configNameList.Count);
// var moneyIndex = Random.Range(0, configMoneyList.Count);
// if (_timeCount > 30)
// {
// _timeCount = 0;
// ui.broadcast.visible = true;
// _textUI ??= ui.broadcast.GetChild("broad_cast_text") as com_broadcast_text1;
// if (_textUI != null)
// {
// _textUI.cast_text.text = String.Format(_textUI.show_text.text,
// configNameList[nameIndex],
// configMoneyList[moneyIndex],
// DateTimeManager.Instance.GetCurrDateTime());
// _textUI.t0.Play(() => { ui.broadcast.visible = false; });
// }
// }
}
public void SetMoneyCurr(object a = null)
{
ui.money.visible = GameHelper.IsGiftSwitch();
ui.money.GetChild("number_text").text = GameHelper.Get102Str(GameHelper.Get102());
if (GameHelper.IsGiftSwitch())
{
if (PreferencesMgr.Instance.MakeupTaskHistory.Count == 0)
{
return;
}
_makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
_makeup = ConfigSystem.GetConfig<MakeupModel>().GetData(_makeupTaskData.tableId);
}
}
private void OnChangeAvatar(ChangeValue<int> obj)
{
SetAvatar();
}
private void SetAvatar()
{
GameHelper.SetSelfAvatar((ui.btn_menu.GetChild("loader_avatar") as GComponent).GetChild("loader_avatar") as GLoader);
}
private void OnBattleLevelUp(object obj = null)
{
SetBtnTask();
}
void SetBtnTask()
{
ui.BattleBtn.number_text.text = "Lv." + GameHelper.GetBattleLv();
if (GameHelper.GetBattleLv() >= ConfigSystem.GetConfig<PassportrewardsModel>().dataList.Count)
{
ui.BattleBtn.progress.width = 135;
}
else
{
ui.BattleBtn.progress.width =
Mathf.Min((float)GameHelper.GetGameExp() / ConfigSystem.GetConfig<PassportrewardsModel>().dataList[GameHelper.GetBattleLv()].Eliminating_quantity, 1) * 135;
}
}
void SetBtnAds()
{
if (!SaveData.GetSaveobject().is_get_removead && !SaveData.GetSaveobject().is_get_packreward)
{
_btnNoAds.t0.Play(-1, 0, null);
}
else if (SaveData.GetSaveobject().is_get_removead && SaveData.GetSaveobject().is_get_packreward)
{
_btnNoAds.t0.Stop();
_btnNoAds.visible = false;
}
else if (SaveData.GetSaveobject().is_get_packreward)
{
_btnNoAds.t0.Stop();
_btnNoAds.t1.Play();
_btnNoAds.img_pack.visible = false;
_btnNoAds.img_ad.visible = true;
}
else if (SaveData.GetSaveobject().is_get_removead)
{
_btnNoAds.t0.Stop();
_btnNoAds.t1.Play();
_btnNoAds.img_pack.visible = true;
_btnNoAds.img_ad.visible = false;
}
}
void GotoH5(object obj = null)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.H5UI_Open);
GameHelper.showGameUI = false;
}
private void InitButtons()
{
ui.LeftBtn.SetClick(OnClickLeftBtn);
ui.RightBtn.SetClick(OnClickRightBtn);
ui.LuckySpinBtn.SetClick(OnLuckySpinBtn);
ui.btn_menu.SetClick(OnClickMenuBtn);
ui.btn_setting.SetClick(OnClickSetBtn);
ui.SignInBtn.SetClick(OnClickSignInBtn);
ui.BattleBtn.SetClick(OnClickBattleBtn);
ui.PlayBtn.SetClick(OnClickPlayBtn);
ui.RankBtn.SetClick(OnClickRankBtn);
ui.btn_restore.SetClick(() =>
{
PurchasingManager.Instance.IosRestore((success, message) =>
{
// Debug.Log("[barry] restore success message: " + message);
if (success)
{
// Debug.Log("[barry] restore success: " + success);
GameHelper.ShowTips("Restore Purchases Success!");
SaveData.GetSaveobject().is_get_removead = success;
SaveData.GetSaveobject().is_get_battlepass = success;
SaveData.GetSaveobject().have_slot = success;
GameDispatcher.Instance.Dispatch(GameMsg.BuyRemoveAdPack);
GameDispatcher.Instance.Dispatch(GameMsg.BuyPack);
GameHelper.SetPayBox1(true);
GameHelper.SetPayBox2(true);
SaveData.saveDataFunc();
}
else
{
// Debug.Log("[barry] restore failed: " + success);
GameHelper.ShowTips("There are no recoverable transactions");
}
});
});
// ui.money.btn_cashout.SetClickDownEffect(0.8f, 1);
ui.money.GetChild("btn_cashout").SetClick(() =>
{
if (!GameHelper.IsGiftSwitch()) return;
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, _makeupTaskData);
});
// ui.btn_h5.SetClick(() =>
// {
// GotoH5();
// });
ui.gold.btn_buygold.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Open);
GameHelper.showGameUI = false;
});
ui.NoAdsBtn.SetClick(() =>
{
if (!SaveData.GetSaveobject().is_get_packreward && !SaveData.GetSaveobject().is_get_removead)
{
if (_btnNoAds.img_ad.visible)
{
PackRewardData param = new PackRewardData();
param.isAutoPop = false;
param.isNeedScroll = true;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open);
}
}
else if (SaveData.GetSaveobject().is_get_packreward)
{
PackRewardData param = new PackRewardData();
param.isAutoPop = false;
param.isNeedScroll = true;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open);
}
GameHelper.showGameUI = false;
});
ui.btn_three_day.SetClick(() =>
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ThreeDaysGiftUI_Open);
});
ui.btn_failpack.SetClick(() =>
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ResurgenceUI_Open);
});
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 0 || !GameHelper.IsGiftSwitch())
{
ui.btn_saveingpot.visible = false;
}
ui.btn_saveingpot.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open); });
var ske_pot = FXManager.Instance.SetFx<SkeletonAnimation>((ui.btn_saveingpot as btn_saveingpot).ani_parent, Fx_Type.fx_savepot_icon, ref closeCallback);
ske_pot.state.SetAnimation(0, "animation", true);
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
{
Debug.Log(PlayerPrefs.GetInt("pot_day", 0));
Debug.Log(DateTime.Now.Day);
if (PlayerPrefs.GetInt("pot_day", 0) == 0)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open);
PlayerPrefs.SetInt("pot_day", DateTime.Now.Day);
}
else
{
if (DateTime.Now.Day != PlayerPrefs.GetInt("pot_day", 0))
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open);
PlayerPrefs.SetInt("pot_day", DateTime.Now.Day);
}
}
Debug.Log(PlayerPrefs.GetInt("pot_day", 0));
}
}
private void checkThreeGift(object obj = null)
{
// if (SaveData.GetSaveobject().is_get_ThreeDaysGift) {
var isToday = GameHelper.InToday(SaveData.GetSaveobject().last_got_three_gift_time, 0, true);
int three_gift_got_index = SaveData.GetSaveobject().three_gift_got_index;
if (three_gift_got_index > (int)rewardState.day3)
{
ui.btn_three_day.visible = false;
}
else if (!isToday)
{
ui.btn_three_day.GetChild("red").visible = true;
}
else
{
ui.btn_three_day.GetChild("red").visible = false;
}
}
void UpdateEvent()
{
long t = SaveData.GetSaveobject().failed_pack_time;
if (SaveData.GetSaveobject().failed_pack_time > GameHelper.GetNowTime())
{
ui.btn_failpack.visible = true;
long time_ = t * 1000 - GameHelper.getNowTimeByMillisecond();
DateTime oldDate = new DateTime(1970, 1, 1);
oldDate = oldDate.AddMilliseconds(time_);
ui.btn_failpack.GetChild("lab_time").text = DateTimeManager.Instance.DateTimeToFFFString(oldDate);
}
else
{
ui.btn_failpack.visible = false;
}
}
private void RefreshSaveingPot(object isShow = null)
{
(ui.btn_saveingpot as btn_saveingpot).text_nowcash.text = SaveingPotHelper.getCashString(SaveData.GetSaveobject().saveingpot_cash);
}
private Action closeCallback;
private void OnClickLeftBtn()
{
ShowScrews.Instance.gameMode = GameHome.Mode_simple;
ui.Mode.selectedIndex = ShowScrews.Instance.gameMode;
// int level = GameHelper.GetLevel();
// ui.PlayBtn.text = "Level " + level;
}
private void OnClickRightBtn()
{
ShowScrews.Instance.gameMode = GameHome.Mode_difficult;
ui.Mode.selectedIndex = ShowScrews.Instance.gameMode;
}
private void OnLuckySpinBtn()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrizeWheelUI_Open);
}
private void OnClickMenuBtn()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ProfileUI_Open);
}
private void OnClickSetBtn()
{
int mode = 0;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MenuUI_Open, mode);
}
private void OnClickSignInBtn()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SignInUI_Open);
}
private void OnClickBattleBtn()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NewTaskUI_Open);
}
private void OnClickPlayBtn()
{
CtrlCloseUI();
// var level = ShowScrews.Instance.gameMode == GameHome.Mode_difficult ? ShowScrews.Instance.GetCurMaxLevel() : GameHelper.GetLevel();;
var level = ShowScrews.Instance.gameMode == GameHome.Mode_difficult ? 1 : GameHelper.GetLevel(); ;
ShowScrews.Instance.InitLogic(level);
AudioManager.Instance.PlayBGM(AudioConst.PlayingBg);
}
private void OnClickRankBtn()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RankUI_Open);
}
// private void OpenFailPack()
// {
// var grade = ShowScrews.Instance.gameMode == GameHome.Mode_difficult ? 1 : GameHelper.GetLevel();
// Debug.Log(grade);
// var index = grade - 1;
// var levelDataModel = ConfigSystem.GetConfig<LevelDataModel>();
// var _levelDataList = levelDataModel.dataList;
// index = index < _levelDataList.Count ? index : _levelDataList.Count - 1;
// var levelData = _levelDataList[index];
// var screwCount = levelData.screwCount;
// var _screwCountForLevel = screwCount;
// var _pendingScrewCount = _screwCountForLevel;
// var _screwBoxCount = _pendingScrewCount / 3;
// var _curScrewBoxCount = _screwBoxCount;
// _screwBoxCount = _pendingScrewCount / 3;
// var progress = (float)(_screwBoxCount - _curScrewBoxCount) / _screwBoxCount;
// Debug.Log(_screwBoxCount);
// Debug.Log(_curScrewBoxCount);
// Debug.Log(progress);
// progress = Mathf.Clamp(progress, 0, 1);
// var endNum = Mathf.RoundToInt(progress * 100);
// Debug.Log(endNum);
// //gameProgressText.text = $"{endNum}%";
// }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 166e639996315324196342e45dcc28c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,73 @@
namespace ScrewsMaster
{
public class GameHomeUICtrl : BaseUICtrl
{
private GameHomeUI ui;
private GameHomeModel model;
private uint openUIMsg = UICtrlMsg.GameHomeUI_Open;
private uint closeUIMsg = UICtrlMsg.GameHomeUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GameHomeModel) as GameHomeModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new GameHomeUI(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: aff246ed6b496f34db4e209de6989707
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 47eb9299e68a4344a901834dacddbf41
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
namespace ScrewsMaster
{
public class GameLoginCtrl : BaseCtrl
{
public static GameLoginCtrl Instance { get; private set; }
private GameLoginModel model;
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5089dfe313b4fc64c92cf29d58609006
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,15 @@
namespace ScrewsMaster
{
public class GameLoginModel : BaseModel
{
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b46e3ae2b0959c14ba484e8ead2dc449
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,160 @@
using SGame;
using UnityEngine;
namespace ScrewsMaster
{
using DG.Tweening;
using FGUI.A000_common;
using FGUI.G018_GameHome;
using Spine.Unity;
using System;
public class GameLoginUI : BaseUI
{
private GameLoginUICtrl ctrl;
private GameLoginModel model;
private FGUI.G001_login.com_login ui;
private Action closeCallback;
public GameLoginUI(GameLoginUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.GameLoginUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G001_login";
uiInfo.assetName = "com_login";
uiInfo.layerType = UILayerType.Normal;
}
protected override void OnInit()
{
}
protected override void OnClose()
{
netFbloadBindLogin?.Kill();
CommonHelper.FadeOut(ui);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenBgUI_Close);
}
protected override void OnBind()
{
ui = baseUI as FGUI.G001_login.com_login;
}
protected override void OnOpenBefore(object args)
{
// var login = FXManager.Instance.SetFx<SkeletonAnimation>(ui.Title_parent, Fx_Type.fx_title, ref closeCallback);
// login.state.SetAnimation(0, "animation", true);
//
// var rabbit = FXManager.Instance.SetFx<SkeletonAnimation>(ui.logo_parent, Fx_Type.fx_rabbit, ref closeCallback);
// rabbit.state.SetAnimation(0, "animation", true);
InitView();
var reqData = new RespLoginFunnelData
{
type = "enterButtonShow",
payload = ""
};
NetworkKit.PostFunnelLogin(reqData);
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
private void InitView()
{
ui.btn_login.SetClick(OnClickBtn, true);
App.HideLoadingUI();
((com_loadingBlacklist)ui.com_blklist1).text_privacy.SetClick(OnClickPrivacy);
((com_loadingBlacklist)ui.com_blklist1).text_privacy.onClickLink.Add((content) =>
{
switch (content.data)
{
case "link_href":
OnClickTerms();
break;
case "link_href1":
OnClickPrivacy();
break;
}
});
// Action closeCallback = null;
// var meteor = FXManager.Instance.SetFx<SkeletonAnimation>(ui.pla1, Fx_Type.meteor, ref closeCallback);
// meteor.state.SetAnimation(0, "liziguang1", true);
//var login = FXManager.Instance.SetFx<SkeletonAnimation>(ui.pla, Fx_Type.fx_login, ref closeCallback);
//login.state.SetAnimation(0, "animation", true);
// var lantern = FXManager.Instance.SetFx<SkeletonAnimation>(ui.pla1, Fx_Type.lantern, ref closeCallback);
// lantern.state.SetAnimation(0, "deng", true);
}
private Tween netFbloadBindLogin;
public void OnClickBtn()
{
UIManagerRegister.AdaptSafeArea();
var reqData = new RespLoginFunnelData
{
type = "enterButtonClick",
payload = ""
};
NetworkKit.PostFunnelLogin(reqData);
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_Start);
CtrlCloseUI();
ShowScrews.Instance.maskImg.gameObject.SetActive(false);
// ShowScrews.Instance.InitLogic();
ShowScrews.Instance.InitAllLeveData();
ShowScrews.Instance.InitItemBar();
ShowScrews.Instance.InitSaveData();
int roomrate = GameHelper.GetCommonModel().roomrate;
if (UnityEngine.Random.Range(1, 100) < roomrate)
{
var level = ShowScrews.Instance.gameMode == GameHome.Mode_difficult ? 1 : GameHelper.GetLevel(); ;
ShowScrews.Instance.InitLogic(level);
AudioManager.Instance.PlayBGM(AudioConst.PlayingBg);
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameHomeUI_Open);
}
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameHomeUI_Open);
Debug.Log("dakaidatingjiemian");
}
private void OnClickPrivacy()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open);
}
private void OnClickTerms()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, true);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e6a93efe97683744a3a2ae64d433320
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,60 @@
namespace ScrewsMaster
{
public class GameLoginUICtrl : BaseUICtrl
{
private GameLoginUI ui;
private GameLoginModel model;
private uint openUIMsg = UICtrlMsg.GameLoginUI_Open;
private uint closeUIMsg = UICtrlMsg.GameLoginUI_Close;
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new GameLoginUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
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);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 760e515e19f493145b362fec54a155fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3d4c902793000af4d9f134414c660f48
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
namespace ScrewsMaster
{
public class GetTaskRewardCtrl : BaseCtrl
{
public static GetTaskRewardCtrl Instance { get; private set; }
private GetTaskRewardModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.GetTaskRewardModel) as GetTaskRewardModel;
}
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: 87ee97ded9a294cd39e08c80f08dd72d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
namespace ScrewsMaster
{
public class GetTaskRewardModel : 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: 4ecff54cb7d2546328d5e92f9f89abad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,375 @@
using UnityEngine;
using FairyGUI;
using Spine.Unity;
using System;
using System.Linq;
using DG.Tweening;
using FGUI.A000_common;
using FGUI.G008_reward;
using FGUI.G009_video;
using Newtonsoft.Json;
using Roy.Datas;
using Random = UnityEngine.Random;
using DontConfuse;
namespace ScrewsMaster
{
public class GetTaskRewardUI : BaseUI
{
private GetTaskRewardUICtrl ctrl;
private GetTaskRewardModel model;
private FGUI.G009_video.com_gettaskreward ui;
private float _rewardNum;
private float _rateNum;
private SettlementData _settlementData;
private bool _isTaskReward;
private bool _isGiftSwitch;
private string _broadTextTemplate;
public GetTaskRewardUI(GetTaskRewardUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.GetTaskRewardUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G009_video";
uiInfo.assetName = "com_gettaskreward";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GetTaskRewardModel) as GetTaskRewardModel;
}
protected override void OnClose()
{
HallManager.Instance.UpdateSecondEvent -= TimeEvent;
closeCallback?.Invoke();
if (_settlementData != null && _settlementData.is_h5_reward)
{
SdkManager.Instance.ShowH5View(true);
GameDispatcher.Instance.Dispatch(GameMsg.resetH5progress);
}
}
protected override void OnBind()
{
ui = baseUI as FGUI.G009_video.com_gettaskreward;
}
private Action closeCallback;
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{//刘海屏
ui.gold.y += Screen.safeArea.y;
ui.top_money.y += Screen.safeArea.y;
ui.tips_bg.y += Screen.safeArea.y;
ui.tips_text.y += Screen.safeArea.y;
}
_rateNum = 2;
if (args is SettlementData settlementData)
{
_settlementData = settlementData;
_rewardNum = _settlementData.cash_number;
_rateNum = _settlementData.rate;
if (_settlementData.is_h5_reward)
{
SdkManager.Instance.ShowH5View(false);
}
_isTaskReward = false;
}
else if (args is int num)
{
_rewardNum = num;
_isTaskReward = true;
}
_isGiftSwitch = GameHelper.IsGiftSwitch();
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.switchgift.selectedIndex = _isGiftSwitch && !_isTaskReward ? 1 : 0;
if (_isGiftSwitch)
{
InitCashView();
}
ui.top_money.GetChild("number_text").text = GameHelper.Get102Str(GameHelper.Get102());
ui.gold.GetChild("number_text").text = GameHelper.GetGoldNumber().ToString();
//添加特效动画
// var sk = FXManager.Instance.SetFx<SkeletonAnimation>(baseUI.GetChild("bg_parent") as GGraph, Fx_Type.fx_win, ref closeCallback);
// sk.state.SetAnimation(0, "out", true);
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(baseUI.GetChild("bg_parent") as GGraph, Fx_Type.fx_win_light, ref closeCallback);
sk.state.SetAnimation(0, "animation", true);
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_adclaim.GetChild("img_saveingpot") as GImage).visible = true;
// int number = (int)args;
ui.money_text.text = _rewardNum.ToString();
ui.btn_adclaim.text = $"Claim X{_rateNum}";
// ((btn_tabad)ui.btn_adclaim).color.selectedIndex = 1;
ui.btn_claim.SetClick(() =>
{
SetButtonsTouchable(false);
DistributeReward(false);
});
ui.btn_adclaim.SetClick(() =>
{
SetButtonsTouchable(false);
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
{
if (isSuccess)
{
DistributeReward(true);
}
else
{
SetButtonsTouchable(true);
}
});
});
}
/// <summary>
/// 禁用界面上所有按钮点击
/// </summary>
/// <param name="enable"></param>
private void SetButtonsTouchable(bool enable)
{
ui.btn_adclaim.touchable = enable;
ui.btn_claim.touchable = enable;
ui.com_cash.touchable = enable;
ui.top_money.GetChild("btn_cashout").touchable = enable;
}
private MakeupTaskData _makeupTaskData;
private com_success_cash _com_cash;
private float _progressBarWidth = -1;
private void InitCashView()
{
var exBrPoolModel = ConfigSystem.GetConfig<exBrPoolModel>();
var configNameList = exBrPoolModel.config_name_list;
var configMoneyList = exBrPoolModel.config_money_list;
var nameIndex =
Random.Range(0, configNameList.Count);
var moneyIndex =
Random.Range(0, configMoneyList.Count);
_com_cash = ui.com_cash as com_success_cash;
if (_com_cash == null) return;
if (string.IsNullOrEmpty(_broadTextTemplate))
{
_broadTextTemplate = _com_cash.broad.cast_text.text;
}
if (_progressBarWidth < 0)
{
_progressBarWidth = _com_cash.progress.width;
}
_com_cash.broad.cast_text.text = string.Format(
_broadTextTemplate,
configNameList[nameIndex],
configMoneyList[moneyIndex]);
_makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
var vo = ConfigSystem.GetConfig<MakeupModel>().GetData(_makeupTaskData.tableId);
// Debug.Log(JsonConvert.SerializeObject(vo));
string cashTextStr;
float progressWidth;
string progressTextStr;
if (GameHelper.GetLevel() <= vo.levels_need)
{
cashTextStr = "Withdrawals can be made through level " + vo.levels_need;
progressWidth = _progressBarWidth * (GameHelper.GetLevel() - 1) / vo.levels_need;
progressTextStr = (GameHelper.GetLevel() - 1) + "/" + vo.levels_need;
}
else if ((float)GameHelper.Get102() < vo.item_need)
{
cashTextStr = "Collect " + GameHelper.Get102Str(vo.item_need) + " to cash out";
progressWidth = _progressBarWidth * ((float)GameHelper.Get102() / vo.item_need);
progressTextStr = GameHelper.Get102Str(GameHelper.Get102()) + "/" +
GameHelper.Get102Str(vo.item_need);
}
else if ((float)PreferencesMgr.Instance.MakeupTaskH5Time < vo.task_need)
{
cashTextStr = "Cumulataive " + (vo.task_need / 60) + @" minutes in ""Game"" to cash out";
progressWidth = _progressBarWidth * ((float)PreferencesMgr.Instance.MakeupTaskH5Time / vo.task_need);
progressTextStr = Math.Round(((float)(PreferencesMgr.Instance.MakeupTaskH5Time / 60)), 2) + "/" +
(vo.task_need / 60);
}
else if (_makeupTaskData.videoCount < vo.ad_need)
{
cashTextStr = "Watch " + vo.ad_need + " Reward Ads to cash out";
progressWidth = _progressBarWidth * ((float)_makeupTaskData.videoCount / vo.ad_need);
progressTextStr = _makeupTaskData.videoCount + "/" + vo.ad_need;
}
else
{
cashTextStr = "Watch " + vo.ad_need + " Reward Ads to cash out";
progressWidth = _makeupTaskData.videoCount > vo.ad_need
? _progressBarWidth
: _progressBarWidth * ((float)_makeupTaskData.videoCount / vo.ad_need);
progressTextStr = _makeupTaskData.videoCount > vo.ad_need
? vo.ad_need + "/" + vo.ad_need
: _makeupTaskData.videoCount + "/" + vo.ad_need;
}
_com_cash.cash_text.text = cashTextStr;
_com_cash.progress.width = progressWidth;
_com_cash.progress_text.text = progressTextStr;
_com_cash.btn_cash.SetClick(OnClickCash);
HallManager.Instance.UpdateSecondEvent += TimeEvent;
}
private int _timeCount = 0;
void TimeEvent()
{
_timeCount++;
if (_timeCount > 3)
{
_timeCount = 0;
_com_cash.broad.t0.Play(() =>
{
var exBrPoolModel = ConfigSystem.GetConfig<exBrPoolModel>();
var name_index = Random.Range(0, exBrPoolModel.config_name_list.Count);
var money_index = Random.Range(0, exBrPoolModel.config_money_list.Count);
// System.DateTime oldtime = System.DateTime.Now.AddSeconds(-Random.Range(1 * 3600, 2 * 3600));
// var str = "Congratulations, [color=#e3a13a]" +
// exBrPoolModel.config_name_list[name_index] +
// "[/color] withdrew [color=#83c93c]" +
// exBrPoolModel.config_money_list[money_index] +
// "[/color]dollars";
var str = string.Format(
_broadTextTemplate,
exBrPoolModel.config_name_list[name_index],
exBrPoolModel.config_money_list[money_index]);
_com_cash.broad.cast_text.text = str;
_com_cash.broad.t1.Play();
});
}
}
/// <summary>
/// 点击CashOUt按钮
/// </summary>
private void OnClickCash()
{
SetButtonsTouchable(false);
DistributeReward(false);
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, _makeupTaskData);
}
private void DistributeReward(bool isMultiRewardEnabled)
{
if (_isTaskReward)
{
GameDispatcher.Instance.Dispatch(GameMsg.GetTaskReward, isMultiRewardEnabled);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GetTaskRewardUI_Close);
return;
}
var start = GameHelper.GetUICenterPosition(ui.btn_adclaim);
var end = GameHelper.GetUICenterPosition(_isGiftSwitch
? ui.top_money.GetChild("number_text")
: ui.gold.GetChild("number_text"));
var startNum = 0f;
var endNum = 0f;
GObject numText;
reward_data temp = new reward_data() { start = start, end = end};
var changeNum = _rewardNum * (isMultiRewardEnabled ? _rateNum : 1);
temp.change = changeNum;
temp.type = 111;
GameHelper.AddMoney(temp.change);
startNum = (float)GameHelper.Get102() - changeNum;
endNum = (float)GameHelper.Get102();
numText = ui.top_money.GetChild("number_text") as GTextField;
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
DOVirtual.DelayedCall(1, () =>
{
DOVirtual.Float(startNum, endNum, 1f,
value =>
{
var str = _isGiftSwitch ? GameHelper.Get102Str((decimal)value) : ((int)value).ToString();
if (numText != null)
numText.text = str;
});
DOVirtual.DelayedCall(1.5f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GetTaskRewardUI_Close);
if (!isMultiRewardEnabled)
{
GameHelper.AddInterAdNumber();
}
});
});
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 68d77870ef81f4afaabf33d1c0470495
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
namespace ScrewsMaster
{
public class GetTaskRewardUICtrl : BaseUICtrl
{
private GetTaskRewardUI ui;
private GetTaskRewardModel model;
private uint openUIMsg = UICtrlMsg.GetTaskRewardUI_Open;
private uint closeUIMsg = UICtrlMsg.GetTaskRewardUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GetTaskRewardModel) as GetTaskRewardModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new GetTaskRewardUI(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: 89cba9dc9d404422291d75698d7fcb60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 941cf5d1593450941bb4acff81c032c0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
namespace ScrewsMaster
{
public class H5Ctrl : BaseCtrl
{
private H5Model model;
public static H5Ctrl Instance { get; private set; }
#region
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 82ac50f0742e4d4093a6da34f4a2576a
timeCreated: 1671094546
@@ -0,0 +1,29 @@
namespace ScrewsMaster
{
public class H5Model : BaseModel
{
public decimal show102;
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
// protected override void OnReset()
// {
// }
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 52d962fd3bd24ab19816d15a8cb11f9e
timeCreated: 1671094546
@@ -0,0 +1,583 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using DontConfuse;
using FGUI.G004_webview;
using Roy.Datas;
using UnityEngine;
using Random = UnityEngine.Random;
namespace ScrewsMaster
{
public class H5UI : BaseUI
{
private Tween bubbleMoveTween;
private Action closeCallBack;
private CountDownKit countDownKit;
private H5UICtrl ctrl;
private int currentTabIndex;
private int flyClickCount;
private int flyNeedClickCount;
private int iconClickCount;
private decimal iconTime;
private bool isAddFinger;
private bool isCurrentTaskFinish;
private bool isCurrentTimeTask;
private bool isLoadFinish;
private bool isScrolling;
private bool isTimeOut = false;
private decimal makeupTaskH5NeedTime;
private H5Model model;
private readonly List<Vector3> movePointList = new();
private long openTime;
private decimal scrollOutTime;
public com_webview ui;
private decimal updateTime;
private bool _flySwitch;
private bool _propSwitch;
private bool isFlyShow = false;
public H5UI(H5UICtrl ctrl) : base(ctrl)
{
uiName = UIConst.H5UI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G004_webview";
uiInfo.assetName = "com_webview";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
uiInfo.uiMaskCustomColor = Color.white;
uiInfo.isTickUpdate = true;
}
public override void OnUpdate()
{
if (iconTime < ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD)
{
iconTime += (decimal)Time.deltaTime;
UpdateIcon();
}
updateTime += (decimal)Time.deltaTime;
if (makeupTaskData_saveing.status == SaveingPotTaskStatus.None)
{
if (PreferencesMgr.Instance.ExchangeAccount != null)
{
makeupTaskData_saveing.H5Time += (float)updateTime;
}
}
if (makeupTaskH5NeedTime > 0 && PreferencesMgr.Instance.MakeupTaskH5Time < makeupTaskH5NeedTime)
if (updateTime >= 1)
{
PreferencesMgr.Instance.MakeupTaskH5Time += updateTime;
updateTime = 0;
}
}
private void InitData()
{
_flySwitch = GameHelper.GetCommonModel().flyswitch == 1;
_propSwitch = GameHelper.GetCommonModel().propswitch == 1;
SdkManager.Instance.ShowFlyBtn(true);
// HallManager.Instance.SetInH5(true);
model.show102 = GameHelper.Get102();
flyNeedClickCount = Random.Range(ConfigSystem.GetConfig<CommonModel>().flyAdTime[0],
ConfigSystem.GetConfig<CommonModel>().flyAdTime[1] + 1);
if (PreferencesMgr.Instance.MakeupTaskHistory.Count > 0)
{
var taskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
if (taskData != null)
{
var cardRedeemModel = ConfigSystem.GetConfig<MakeupModel>();
var makeupVo = cardRedeemModel.dataList.FirstOrDefault(redeem => redeem.id == taskData.tableId);
if (makeupVo != null) makeupTaskH5NeedTime = makeupVo.task_need;
}
}
#if UNITY_EDITOR
isLoadFinish = true;
#endif
}
private void InitView()
{
Set101();
// WebThroughUtil.WebThroughCreate(H5WebThroughType.OnlineH5, ui.btn_icon);
ui.btn_close.SetClick(() =>
{
// uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Open);
// uiCtrlDispatcher.Dispatch(UICtrlMsg.BackgroundUI_Open);
// uiCtrlDispatcher.Dispatch(UICtrlMsg.CurrencyUI_Open);
//CreatSheepCard.instance.SetCameraVisible(true);
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.Webview_StateChange, WebUIType.Game);
uiCtrlDispatcher.Dispatch(UICtrlMsg.H5UI_Close);
if (GameHelper.is_first_login)
{
GameDispatcher.Instance.Dispatch(GameMsg.RefreshGame);
}
// CtrlCloseUI();
});
ui.com_fly.visible = false;
ui.btn_icon.visible = false;
InitIcon();
CheckShowFly();
ui.com_fly.SetClick(OnClickFlyCash);
DOVirtual.Float(0, (float)GameHelper.Get102(), 1,
value => { ui.com_top.text_num.text = GameHelper.Get102Str((decimal)value); });
SetMakeup();
ui.btn_out.visible = GameHelper.IsGiftSwitch();
ui.com_top.ContentBox.visible = GameHelper.IsGiftSwitch();
}
private void InitIcon()
{
ui.btn_icon.cont_state.selectedIndex = btn_icon.State_none;
ui.btn_icon.fx_ready.Stop();
ui.btn_icon.SetClick(OnClickIcon);
ui.btn_icon.visible = false;
UpdateIcon();
}
private SaveingPotClass makeupTaskData_saveing;
void OnRefreshMakeupData(object obj)
{
SetMakeup();
}
private void UpdateIcon()
{
if (!_propSwitch)
{
return;
}
float amount = (float)iconTime / ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD;
SdkManager.Instance.SetIconProgress(amount);
if (!_propSwitch)
{
return;
}
// if (_propSwitch && !ui.btn_icon.visible)
// {
// ui.btn_icon.visible = true;
// }
ui.btn_icon.pb_time.fillAmount = (float)iconTime / ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD;
if (iconTime >= ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD)
{
if (!ui.btn_icon.fx_ready.playing) ui.btn_icon.fx_ready.Play();
ui.btn_icon.cont_state.selectedIndex = btn_icon.State_ready;
}
else
{
ui.btn_icon.fx_ready.Stop();
}
}
private void OnClickIcon()
{
// if (UIManager.Instance.IsExistUI(UIConst.DialogRewardUI)) return;
// WebThroughUtil.WebThroughClick(H5WebThroughType.OnlineH5, ui.btn_icon);
if (iconTime < ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD) return;
// var rewardData = new RewardData();
// var rewardType = GameHelper.GetCommonModel().ThroughRewardType;
float[] cash_array = GameHelper.GetRewardValue(2);
// var temp = new { is_success = true, cash_number = cash_array[0], rate = cash_array[1], is_level_success = false, is_h5_reward = true };
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
var temp = new SettlementData { cash_number = cash_array[0], rate = cash_array[1], is_h5_reward = true };
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GetTaskRewardUI_Open, temp);
// decimal rewardValue = GameHelper.GetCommonModel().ThroughReward.RandomInt();
// var rewardSingleData = new RewardSingleData(rewardType, (decimal)cash_array[0], RewardOrigin.H5Icon)
// {
// startPosition = new Vector2(GameHelper.GetUICenterPosition(ui.btn_icon).x - 250, GameHelper.GetUICenterPosition(ui.btn_icon).y - 50),//GameHelper.GetUICenterPosition(ui.btn_icon),
// endPosition = GameHelper.GetUICenterPosition(ui.com_top.icon_101)
// };
// rewardData.AddReward(rewardSingleData);
// rewardData.AddCompleted(isSuccess =>
// {
ui.btn_icon.cont_state.selectedIndex = btn_icon.State_none;
// iconTime = 0;
// SetMakeup();
// });
// rewardData.condition = RewardCondition.AD;
// rewardData.displayType =
// RewardDisplayType.Dialog | RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
// GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
}
public void Set101(decimal cash = -1)
{
if (cash < 0) cash = GameHelper.Get102();
var cashNumt = GameHelper.Get101String(cash);
ui.com_top.text_num.text = $"{cashNumt}";
}
public void OnLoadFinish()
{
isLoadFinish = true;
}
private void SetMakeup()
{
var comBox = ui.com_top;
comBox.text_num.text = $"{GameHelper.Get101String()}";
if (!GameHelper.IsGiftSwitch()) return;
if (PreferencesMgr.Instance.MakeupTaskHistory.Count == 0) return;
var makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
var vo = ConfigSystem.GetConfig<MakeupModel>().dataList
.FirstOrDefault(redeem => redeem.id == makeupTaskData.tableId);
if (vo == null) return;
var leftCash = (double)Math.Max(vo.item_need - GameHelper.Get102(), 0);
comBox.text_more.SetVar("money", $"{GameHelper.Get102Str((decimal)leftCash)}").FlushVars();
// comBox.text_more.text = GameHelper.Get101Str((decimal)leftCash);
comBox.pb_num.max = vo.item_need;
comBox.pb_num.TweenValue(vo.item_need - leftCash, 0.1f);
comBox.pb_num.GetChild("title").text =
$"{GameHelper.Get102Str((decimal)(vo.item_need - leftCash))}/{GameHelper.Get102Str((decimal)comBox.pb_num.max)}";
ui.btn_out.SetClick(() =>
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
});
}
public void SetCash(string str102 = null)
{
if (str102 == null)
str102 = GameHelper.Get102() == -1
? GameHelper.GetCommonModel().InitialNum.ToString("N")
: GameHelper.Get102().ToString("N");
ui.com_top.text_num.text = "$" + str102;
}
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.H5Model) as H5Model;
}
protected override void OnClose()
{
GameHelper.showGameUI = true;
SdkManager.Instance.ShowH5View(false);
// WebThroughUtil.WebThroughDisable(H5WebThroughType.OnlineH5, ui.btn_icon);
StopFly();
countDownKit?.OnDestroy();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
CommonHelper.FadeOut(ui);
}
public Camera orthoCamera;
protected override void OnBind()
{
ui = baseUI as com_webview;
}
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{
ui.TopBox.height += Screen.safeArea.y;
// ui.TopBox.y += Screen.safeArea.y;
}
SdkManager.Instance.ShowH5View(true);
makeupTaskData_saveing = SaveData.GetSaveobject().saveingpot_history[SaveData.GetSaveobject().saveingpot_history.Count - 1];
InitData();
InitView();
}
protected override void OnOpen(object args)
{
openTime = GameHelper.GetNowTime();
CommonHelper.FadeIn(ui);
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
HallManager.Instance.AddChangeGiftSwitch(InitView);
GameDispatcher.Instance.AddListener(GameMsg.RefreshMakeupData, OnRefreshMakeupData);
GameDispatcher.Instance.AddListener(GameMsg.resetH5progress, ResetTime);
}
protected override void RemoveListener()
{
HallManager.Instance.RemoveChangeGiftSwitch(InitView);
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshMakeupData, OnRefreshMakeupData);
GameDispatcher.Instance.RemoveListener(GameMsg.resetH5progress, ResetTime);
}
#endregion
void ResetTime(object a = null)
{
iconTime = 0;
SetMakeup();
}
#region
private void CheckShowFly()
{
var nowTime = GameHelper.GetNowTime();
var leftTime = (int)(PreferencesMgr.Instance.AdCashFlyShowTime - nowTime);
ui.com_fly.visible = false;
if (!_flySwitch) return;
// ui.com_fly.visible = leftTime <= 0;
if (leftTime > 0)
{
SdkManager.Instance.ShowFlyBtn(false);
isFlyShow = false;
StopFlyCountdown();
StartFlyCountdown(leftTime);
}
else
{
if (!isFlyShow) SdkManager.Instance.ShowFlyBtn(true);
isFlyShow = true;
StartFly();
StopFlyCountdown();
}
}
private void StartFly()
{
StopFly();
SetFlyPoints();
var bubbleGo = ui.com_fly.displayObject.gameObject;
bubbleMoveTween = bubbleGo.transform
.DOLocalPath(movePointList.ToArray(), 20)
.SetEase(Ease.Linear)
.OnComplete(StartFly)
.SetAutoKill(true)
.OnUpdate(() =>
{
// WebThroughUtil.WebThroughCreate(H5WebThroughType.Fly, ui.com_fly);
});
}
private void SetFlyPoints()
{
movePointList.Clear();
var w = ui.fly_area.width;
var h = ui.fly_area.height - 173;
var startPos = ui.fly_area.position;
w -= ui.com_fly.width;
var pos1 = new Vector3(startPos.x + w - CommonHelper.RandomRange(30, 100), startPos.y);
ui.com_fly.position = pos1;
movePointList.Add(GameHelper.FguiPotToUnityTrfLocalPot(pos1));
var pos2 = new Vector3(startPos.x, startPos.y + CommonHelper.RandomRange((int)(h / 4f), (int)(h / 2 - h / 8)));
movePointList.Add(GameHelper.FguiPotToUnityTrfLocalPot(pos2));
var pos3 = new Vector3(startPos.x + w, startPos.y + h / 2 + CommonHelper.RandomRange((int)(h / 8), (int)(h / 4)));
movePointList.Add(GameHelper.FguiPotToUnityTrfLocalPot(pos3));
var pos4 = new Vector3(startPos.x + CommonHelper.RandomRange(0, 20),
startPos.y + h + CommonHelper.RandomRange(-20, 20));
movePointList.Add(GameHelper.FguiPotToUnityTrfLocalPot(pos4));
}
private void StopFly()
{
bubbleMoveTween?.Kill();
}
private void StartFlyCountdown(int leftTime)
{
countDownKit = new CountDownKit();
countDownKit.SetTime(leftTime)
.SetCountDownType(CountDownType.Second)
.SetCompletedEvent(CheckShowFly);
countDownKit.Start();
}
private void StopFlyCountdown()
{
countDownKit?.Stop();
countDownKit = null;
}
private void CheckShowFlyVideo(int times)
{
var configTimes = ConfigSystem.GetConfig<CommonModel>().flytimes;
Debug.Log($"CheckShowFlyVideo times=== {times} configTimes=== {configTimes}");
if (times != 0 && configTimes != 0 && times % configTimes == 0)
{
PlayerPrefs.SetInt($"ShowFlyVideo", 0);
GameHelper.AddInterAdNumber();
}
}
private long _lastClickFlyCash;
private void OnClickFlyCash()
{
// var nowTime = GameHelper.GetNowTime();
// if (_lastClickFlyCash == nowTime)
// {
// return;
// }
// _lastClickFlyCash = nowTime;
//
// var times = PlayerPrefs.GetInt($"ShowFlyVideo", 0);
// int localTimes = times + 1;
//
// PlayerPrefs.SetInt($"ShowFlyVideo", localTimes);
// CheckShowFlyVideo(localTimes);
PreferencesMgr.Instance.AdCashFlyShowTime =
GameHelper.GetNowTime() + ConfigSystem.GetConfig<CommonModel>().flyCD;
var rewardData = new RewardData();
// WebThroughUtil.WebThroughClick(H5WebThroughType.Fly, ui.com_fly);
var singleValue =
(decimal)Math.Round(
Random.Range(ConfigSystem.GetConfig<CommonModel>().flyReward[0],
ConfigSystem.GetConfig<CommonModel>().flyReward[1]), 2);
decimal rewardValue;
if (flyClickCount >= flyNeedClickCount)
{
flyClickCount = 0;
rewardValue = singleValue;
GameHelper.ShowVideoAd("reward_fly", isCompleted =>
{
if (isCompleted)
{
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
}
});
}
else
{
rewardValue = singleValue;
}
var rewardSingleData = new RewardSingleData(102, rewardValue, RewardOrigin.H5Fly101)
{
startPosition = GameHelper.GetUICenterPosition(ui.com_fly),
endPosition = GameHelper.GetUICenterPosition(ui.com_top.icon_101)
};
rewardData.AddReward(rewardSingleData);
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
rewardData.AddCompleted(isSuccess =>
{
if (isSuccess) flyClickCount++;
SetMakeup();
});
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
CheckShowFly();
}
#endregion
public void ClickBtn(string name)
{
// // Debug.Log("[UNITY] Click btn: " + name);
// FGUIHelper.PlayClickSound();
if (name == "flyBtn")
{
OnClickFlyCash();
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.collect_fly_number, 1);
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.collect_fly_people,1);
}
else if (name == "rewardBtn")
{
OnClickIcon();
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: eeb18ea73919462d93e684426ccc498e
timeCreated: 1671094546
@@ -0,0 +1,132 @@
namespace ScrewsMaster
{
public class H5UICtrl : BaseUICtrl
{
private readonly uint closeUIMsg ;
private H5Model model;
private readonly uint openUIMsg ;
private H5UI ui;
private void OnUpdateDollar(object obj)
{
if (obj == null) return;
var changeValue = (decimal)obj;
if (model != null)
{
model.show102 += changeValue;
ui?.SetCash(model.show102.ToString("N"));
}
}
private void OnUpdateCompletedDollar(object obj = null)
{
if (PreferencesMgr.Instance.IsShowRewardFly101) return;
var value = GameHelper.Get102();
if (model != null) model.show102 = value;
ui?.SetCash();
}
private void OnDollarChange(object data)
{
}
private void OnWebviewFinish(object obj)
{
ui?.OnLoadFinish();
}
private void OnMakeupSuccess(object obj)
{
}
private void OnWebview_PageState(object args)
{
}
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.H5Model) as H5Model;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new H5UI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui is { isClose: false }) 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);
gameDispatcher.AddListener(GameMsg.H5ViewClickBtn, OnH5ClickBtn);
GameDispatcher.Instance.AddListener(GameMsg.Update101, OnUpdateDollar);
GameDispatcher.Instance.AddListener(GameMsg.Update102Completed, OnUpdateCompletedDollar);
gameDispatcher.AddListener(GameMsg.MakeupSuccess, OnMakeupSuccess);
CtrlDispatcher.Instance.AddListener(CtrlMsg.Webview_PageState, OnWebview_PageState);
CtrlDispatcher.Instance.AddListener(CtrlMsg.Webview_PageFinish, OnWebviewFinish);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
gameDispatcher.RemoveListener(GameMsg.H5ViewClickBtn, OnH5ClickBtn);
GameDispatcher.Instance.RemoveListener(GameMsg.Update101, OnUpdateDollar);
GameDispatcher.Instance.RemoveListener(GameMsg.Update102Completed, OnUpdateCompletedDollar);
gameDispatcher.RemoveListener(GameMsg.MakeupSuccess, OnMakeupSuccess);
CtrlDispatcher.Instance.RemoveListener(CtrlMsg.Webview_PageState, OnWebview_PageState);
CtrlDispatcher.Instance.RemoveListener(CtrlMsg.Webview_PageFinish, OnWebviewFinish);
}
void OnH5ClickBtn(object arg)
{
ui?.ClickBtn((string)arg);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 57c18de9257c442c8f2d51357abf14ad
timeCreated: 1671094546

Some files were not shown because too many files have changed in this diff Show More