ball 项目提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
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,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43cf0cd292124f14186365ccfd627260
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class H5Model : BaseModel
|
||||
{
|
||||
public decimal show102;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46ac5145624b7c547b6b99f003bfe1bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using FGUI.G016_WB;
|
||||
using SGModule.NetKit;
|
||||
using UnityEngine;
|
||||
using UNSDK;
|
||||
|
||||
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class H5UI : BaseUI
|
||||
{
|
||||
private Tween bubbleMoveTween;
|
||||
|
||||
private Action closeCallBack;
|
||||
private CountDownKit countDownKit;
|
||||
private H5UICtrl ctrl;
|
||||
|
||||
private int currentTabIndex;
|
||||
|
||||
private int flyClickCount = 1;
|
||||
|
||||
private int iconClickCount;
|
||||
|
||||
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 bool isHallEnter = false;
|
||||
|
||||
|
||||
private decimal scrollOutTime;
|
||||
public com_webview ui;
|
||||
|
||||
private decimal updateTime;
|
||||
|
||||
SaveingPotClass savePotMakeupTaskData = SaveData.GetSaveObject()
|
||||
.saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1];
|
||||
|
||||
public H5UI(H5UICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.H5UI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "G016_WB";
|
||||
uiInfo.assetName = "com_webview";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
uiInfo.isTickUpdate = false;
|
||||
}
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
updateTime += (decimal)Time.deltaTime;
|
||||
|
||||
if (updateTime >= 1)
|
||||
{
|
||||
if (makeupTaskH5NeedTime > 0 && DataMgr.MakeupTaskH5Time.Value < makeupTaskH5NeedTime)
|
||||
{
|
||||
DataMgr.MakeupTaskH5Time.Value += updateTime;
|
||||
}
|
||||
|
||||
if (savePotMakeupTaskData.status == SaveingPotTaskStatus.None)
|
||||
{
|
||||
savePotMakeupTaskData.H5Time += (float)updateTime;
|
||||
}
|
||||
|
||||
updateTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
// HallManager.Instance.SetInH5(true);
|
||||
model.show102 = DataMgr.Ticket.Value;
|
||||
|
||||
if (DataMgr.MakeupTaskHistory.Value.Count > 0)
|
||||
{
|
||||
var taskData = DataMgr.MakeupTaskHistory.Value.Last();
|
||||
if (taskData != null)
|
||||
{
|
||||
var cardRdModel = ConfigSystem.GetConfig<Makeup>();
|
||||
var makeupVo = cardRdModel.FirstOrDefault(Rd => Rd.id == taskData.tableId);
|
||||
if (makeupVo != null) makeupTaskH5NeedTime = makeupVo.task_need;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
isLoadFinish = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
Set102();
|
||||
|
||||
ui.btn_back.SetClick(CloseCallBack);
|
||||
DOVirtual.Float(0, (float)DataMgr.Ticket.Value, 1,
|
||||
value => { ui.com_top.text_num.text = GameHelper.Get102Str((decimal)value); });
|
||||
SetMakeup();
|
||||
}
|
||||
|
||||
private void CloseCallBack()
|
||||
{
|
||||
Debug.Log("h5ui CloseCallBack");
|
||||
if (isHallEnter) {
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Open);
|
||||
CreatAnimalCard.instance.SetCameraVisible(true);
|
||||
}
|
||||
else {
|
||||
CreatAnimalCard.instance.SetCameraVisible(true);
|
||||
}
|
||||
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.H5UI_Close);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.showBroadCast);
|
||||
|
||||
if (GameHelper.is_first_login)
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.RefreshGame);
|
||||
}
|
||||
|
||||
CtrlCloseUI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OnRefreshMakeupData(object obj)
|
||||
{
|
||||
SetMakeup();
|
||||
}
|
||||
|
||||
private void OnClickIcon()
|
||||
{
|
||||
float[] ch_array = GameHelper.GetRewardValue(2);
|
||||
|
||||
SuccessData temp = new SuccessData();
|
||||
temp.IsWin = true;
|
||||
temp.ch_number = ch_array[0];
|
||||
temp.rate = (int)ch_array[1];
|
||||
temp.IsLevelSuccess = false;
|
||||
temp.IsH5Reward = true;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Set102(decimal ch = -1)
|
||||
{
|
||||
if (ch < 0) ch = DataMgr.Ticket.Value;
|
||||
|
||||
var chNumt = GameHelper.Get102Str(ch);
|
||||
ui.com_top.text_num.text = $"{chNumt}";
|
||||
}
|
||||
|
||||
public void OnLoadFinish()
|
||||
{
|
||||
isLoadFinish = true;
|
||||
}
|
||||
|
||||
private void SetMakeup()
|
||||
{
|
||||
var comBox = ui.com_top;
|
||||
comBox.text_num.text = $"{GameHelper.Get102Str(DataMgr.Ticket.Value)}";
|
||||
if (!GameHelper.IsGiftSwitch()) return;
|
||||
if (DataMgr.MakeupTaskHistory.Value.Count == 0) return;
|
||||
|
||||
var makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last();
|
||||
var vo = ConfigSystem.GetConfig<Makeup>().FirstOrDefault(Rd => Rd.id == makeupTaskData.tableId);
|
||||
if (vo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var leftCh = (double)Math.Max(vo.item_need - DataMgr.Ticket.Value, 0);
|
||||
comBox.text_more.text = $"{GameHelper.Get102Str((decimal)leftCh)}";
|
||||
comBox.pb_num.max = vo.item_need;
|
||||
comBox.pb_num.TweenValue(vo.item_need - leftCh, 0.1f);
|
||||
comBox.pb_num.GetChild("title").text =
|
||||
$"{GameHelper.Get102Str((decimal)(vo.item_need - leftCh))}/{GameHelper.Get102Str((decimal)comBox.pb_num.max)}";
|
||||
|
||||
ui.com_top.visible = false;
|
||||
ui.com_top.btn_out.SetClick(() =>
|
||||
{
|
||||
// uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
||||
CloseCallBack();
|
||||
});
|
||||
}
|
||||
|
||||
public void SetCh(string str102 = null)
|
||||
{
|
||||
if (str102 == null)
|
||||
str102 = DataMgr.Ticket.Value == -1
|
||||
? GameHelper.GetCommonModel().InitialNum.ToString("N")
|
||||
: DataMgr.Ticket.Value.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()
|
||||
{
|
||||
SdkConfigMgr.Instance.Close();
|
||||
GameHelper.showGameUI = true;
|
||||
|
||||
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)
|
||||
{
|
||||
isHallEnter = (bool)args;
|
||||
Debug.Log("H5UI OnOpenBefore");
|
||||
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)
|
||||
{
|
||||
SetMakeup();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad24594c8d4ef004b80ba1dc807439d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class H5UICtrl : BaseUICtrl
|
||||
{
|
||||
private readonly uint closeUIMsg = UICtrlMsg.H5UI_Close;
|
||||
private H5Model model;
|
||||
|
||||
private readonly uint openUIMsg = UICtrlMsg.H5UI_Open;
|
||||
private H5UI ui;
|
||||
|
||||
private void OnUpdateDollar(object obj)
|
||||
{
|
||||
if (obj == null) return;
|
||||
var changeValue = (decimal)obj;
|
||||
if (model != null)
|
||||
{
|
||||
model.show102 += changeValue;
|
||||
ui?.SetCh(model.show102.ToString("N"));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdateCompletedDollar(object obj = null)
|
||||
{
|
||||
if ( DataMgr.IsShowRewardFly102.Value) return;
|
||||
var value = DataMgr.Ticket.Value;
|
||||
if (model != null) model.show102 = value;
|
||||
|
||||
ui?.SetCh();
|
||||
}
|
||||
|
||||
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.Instance.AddListener(GameMsg.Update102, 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.Instance.RemoveListener(GameMsg.Update102, 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);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3dedf5472daa9b148aa10e439406185b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user