fix:1、结算优化

This commit is contained in:
barry
2026-06-14 19:25:04 +08:00
parent 3391a053d3
commit 29f9aec06d
13 changed files with 772 additions and 102 deletions
@@ -12,7 +12,6 @@ namespace FGUI.GameResult_08
UIObjectFactory.SetPackageItemExtension(cash_broad.URL, typeof(cash_broad)); UIObjectFactory.SetPackageItemExtension(cash_broad.URL, typeof(cash_broad));
UIObjectFactory.SetPackageItemExtension(com_arrow_end.URL, typeof(com_arrow_end)); UIObjectFactory.SetPackageItemExtension(com_arrow_end.URL, typeof(com_arrow_end));
UIObjectFactory.SetPackageItemExtension(com_arrow_end_again.URL, typeof(com_arrow_end_again)); UIObjectFactory.SetPackageItemExtension(com_arrow_end_again.URL, typeof(com_arrow_end_again));
UIObjectFactory.SetPackageItemExtension(btn_claim.URL, typeof(btn_claim));
UIObjectFactory.SetPackageItemExtension(com_end.URL, typeof(com_end)); UIObjectFactory.SetPackageItemExtension(com_end.URL, typeof(com_end));
} }
} }
@@ -1,29 +0,0 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using FairyGUI.Utils;
namespace FGUI.GameResult_08
{
public partial class btn_claim : GButton
{
public Controller state;
public GImage ad_icon;
public GImage img_saveingpot;
public const string URL = "ui://8sjqw0q3rsd42i";
public static btn_claim CreateInstance()
{
return (btn_claim)UIPackage.CreateObject("GameResult_08", "btn_claim");
}
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
state = GetControllerAt(0);
ad_icon = (GImage)GetChildAt(1);
img_saveingpot = (GImage)GetChildAt(2);
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e0993c012a030ad4391f9c97f177470c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -8,9 +8,9 @@ namespace FGUI.GameResult_08
public partial class com_arrow_end : GComponent public partial class com_arrow_end : GComponent
{ {
public GTextField title; public GTextField title;
public GButton btn_back;
public GButton btn_watchAd; public GButton btn_watchAd;
public GButton btn_restart; public GButton btn_restart;
public GButton btn_back;
public const string URL = "ui://8sjqw0q3rsd42f"; public const string URL = "ui://8sjqw0q3rsd42f";
public static com_arrow_end CreateInstance() public static com_arrow_end CreateInstance()
@@ -23,9 +23,9 @@ namespace FGUI.GameResult_08
base.ConstructFromXML(xml); base.ConstructFromXML(xml);
title = (GTextField)GetChildAt(3); title = (GTextField)GetChildAt(3);
btn_back = (GButton)GetChildAt(4); btn_watchAd = (GButton)GetChildAt(8);
btn_watchAd = (GButton)GetChildAt(9); btn_restart = (GButton)GetChildAt(9);
btn_restart = (GButton)GetChildAt(10); btn_back = (GButton)GetChildAt(10);
} }
} }
} }
@@ -25,6 +25,7 @@ namespace FGUI.GameResult_08
public GButton btn_claim; public GButton btn_claim;
public GRichTextField text_award_2; public GRichTextField text_award_2;
public GRichTextField text_award_3; public GRichTextField text_award_3;
public com_arrow_end com_arrow_end;
public Transition t0; public Transition t0;
public Transition t2; public Transition t2;
public const string URL = "ui://8sjqw0q3sebxk"; public const string URL = "ui://8sjqw0q3sebxk";
@@ -56,6 +57,7 @@ namespace FGUI.GameResult_08
btn_claim = (GButton)GetChildAt(23); btn_claim = (GButton)GetChildAt(23);
text_award_2 = (GRichTextField)GetChildAt(24); text_award_2 = (GRichTextField)GetChildAt(24);
text_award_3 = (GRichTextField)GetChildAt(25); text_award_3 = (GRichTextField)GetChildAt(25);
com_arrow_end = (com_arrow_end)GetChildAt(26);
t0 = GetTransitionAt(0); t0 = GetTransitionAt(0);
t2 = GetTransitionAt(1); t2 = GetTransitionAt(1);
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 KiB

After

Width:  |  Height:  |  Size: 435 KiB

+13
View File
@@ -1099,6 +1099,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1361344199} - component: {fileID: 1361344199}
- component: {fileID: 1361344200}
m_Layer: 0 m_Layer: 0
m_Name: GameObject m_Name: GameObject
m_TagString: Untagged m_TagString: Untagged
@@ -1121,6 +1122,18 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1361344200
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1361344198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 36de1e54129c45dc8fc672793fee00fe, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1442936684 --- !u!1 &1442936684
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+21
View File
@@ -0,0 +1,21 @@
using UnityEngine;
public class InputHelper : MonoBehaviour
{
public static InputHelper Instance;
private void Awake()
{
if (Instance == null) Instance = this;
else Destroy(gameObject);
}
// 提供输入状态给UI层调用
public int TouchCount => Input.touchCount;
public Touch GetTouch(int index) => Input.GetTouch(index);
public bool GetMouseButtonDown(int button) => Input.GetMouseButtonDown(button);
public bool GetMouseButton(int button) => Input.GetMouseButton(button);
public bool GetMouseButtonUp(int button) => Input.GetMouseButtonUp(button);
public Vector3 MousePosition => Input.mousePosition;
// public float GetMouseWheelDelta() => Input.GetMouseWheelDelta();
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 36de1e54129c45dc8fc672793fee00fe
timeCreated: 1781427648
@@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using DG.Tweening;
using FairyGUI; using FairyGUI;
using FGUI.Arrow_game; using FGUI.Arrow_game;
using UnityEngine; using UnityEngine;
@@ -160,6 +161,14 @@ namespace ChillConnect
{ {
ui = baseUI as com_arrow_game; ui = baseUI as com_arrow_game;
} }
// 新增坐标转换方法
private Vector2 UnityMouseToFGUIPos(Vector2 unityPos)
{
float x = unityPos.x;
float y = Screen.height - unityPos.y;
return new Vector2(x, y);
}
public override void OnUpdate() public override void OnUpdate()
{ {
@@ -170,46 +179,52 @@ namespace ChillConnect
// } // }
// //
// ========= 编辑器模拟触摸(仅编辑模式生效) ========= // ========= 编辑器模拟触摸(仅编辑模式生效) =========
// ========== 编辑器鼠标拖拽 ==========
#if UNITY_EDITOR #if UNITY_EDITOR
//1. 鼠标左键 = 单指拖拽 float moveThreshold = 1f; // 移动阈值,大于这个值才算有效拖动
// Debug.Log($"Input.GetMouseButtonDown======={Input.GetMouseButtonDown(0)}");
if (Input.GetMouseButtonDown(0)) // 鼠标按下:仅初始化状态和起点
if (InputHelper.Instance.GetMouseButtonDown(0))
{ {
_lastTouchPos = Input.mousePosition; Vector2 unityPos = InputHelper.Instance.MousePosition;
_lastTouchPos = UnityMouseToFGUIPos(unityPos);
_isDraging = true; _isDraging = true;
} Debug.Log("鼠标按下,开始拖拽");
if (Input.GetMouseButton(0) && _isDraging) return; // 本帧直接返回,不执行拖动逻辑
{
Vector2 curMousePos = Input.mousePosition;
Vector2 offset = curMousePos - _lastTouchPos;
MoveContainer(offset);
_lastTouchPos = curMousePos;
}
if (Input.GetMouseButtonUp(0))
{
_isDraging = false;
} }
// 2. 鼠标滚轮 = 双指缩放 // 拖拽中:按住左键 + 拖拽标记为true
// float scrollDelta = Input.GetMouseWheelDelta(); if (_isDraging && InputHelper.Instance.GetMouseButton(0))
// if (Mathf.Abs(scrollDelta) > 0) {
// { Vector2 unityPos = InputHelper.Instance.MousePosition;
// float curScale = _viewContainer.scaleX; Vector2 curMousePos = UnityMouseToFGUIPos(unityPos);
// curScale += scrollDelta * 0.1f; Vector2 offset = curMousePos - _lastTouchPos;
// curScale = Mathf.Clamp(curScale, _minScale, _maxScale);
// Debug.Log($"curMousePos=={curMousePos} _lastTouchPos=={_lastTouchPos} offset=={offset}");
// _viewContainer.scaleX = curScale;
// _viewContainer.scaleY = curScale; // 只有偏移超过阈值才移动 & 更新基准点
// _zoomSlider.value = GetSliderValueByScale(curScale); if (offset.magnitude > moveThreshold)
// } {
MoveContainer(offset);
_lastTouchPos = curMousePos; // 移动后再刷新起点
}
}
// 鼠标抬起,结束拖拽
if (InputHelper.Instance.GetMouseButtonUp(0))
{
_isDraging = false;
Debug.Log("鼠标抬起,结束拖拽");
}
#endif #endif
// ========= 双指 = 缩放(优先级最高) ========= // ========= 双指 = 缩放(优先级最高) =========
if (Input.touchCount == 2) if (InputHelper.Instance.TouchCount == 2)
{ {
_isDraging = false; _isDraging = false;
Touch t0 = Input.GetTouch(0); Touch t0 = InputHelper.Instance.GetTouch(0);
Touch t1 = Input.GetTouch(1); Touch t1 = InputHelper.Instance.GetTouch(1);
float currentDis = Vector2.Distance(t0.position, t1.position); float currentDis = Vector2.Distance(t0.position, t1.position);
if (!_isTwoFingerTouch) if (!_isTwoFingerTouch)
@@ -236,9 +251,9 @@ namespace ChillConnect
} }
} }
// ========= 单指 = 拖拽平移 ========= // ========= 单指 = 拖拽平移 =========
else if (Input.touchCount == 1) else if (InputHelper.Instance.TouchCount == 1)
{ {
Touch touch = Input.GetTouch(0); Touch touch = InputHelper.Instance.GetTouch(0);
Vector2 curTouchPos = touch.position; Vector2 curTouchPos = touch.position;
if (touch.phase == TouchPhase.Began) if (touch.phase == TouchPhase.Began)
@@ -820,6 +835,7 @@ namespace ChillConnect
/// <summary>移动容器 + 边界限制,防止完全拖出屏幕</summary> /// <summary>移动容器 + 边界限制,防止完全拖出屏幕</summary>
private void MoveContainer(Vector2 offset) private void MoveContainer(Vector2 offset)
{ {
Debug.Log($"[arrow] 移动容器:{offset}");
float newX = _viewContainer.x + offset.x; float newX = _viewContainer.x + offset.x;
float newY = _viewContainer.y + offset.y; float newY = _viewContainer.y + offset.y;
@@ -1400,7 +1416,42 @@ namespace ChillConnect
arrow.isMoving = false; arrow.isMoving = false;
} }
uiCtrlDispatcher.Dispatch(UICtrlMsg.LevelSuccessUI_Open, isSuccess); // uiCtrlDispatcher.Dispatch(UICtrlMsg.LevelSuccessUI_Open, isSuccess);
if (isSuccess)
{
GameHelper.SetLevel(GameHelper.GetLevel() + 1);
//通关成功
float[] cash_array = GameHelper.GetRewardValue(2);
var temp = new SuccessData();
temp.IsWin = true;
temp.cash_number = cash_array[0];
temp.rate = (int)cash_array[1];
temp.IsLevelSuccess = true;
temp.IsH5Reward = false;
temp.boost_array = GameHelper.GetRewardBoost(2);
DOVirtual.DelayedCall(0.5f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
});
}
else
{
//通关失败
float[] cash_array = GameHelper.GetRewardValue(2);
var temp = new SuccessData();
temp.IsWin = false;
temp.cash_number = cash_array[0];
temp.IsLevelSuccess = true;
temp.IsH5Reward = false;
temp.boost_array = GameHelper.GetRewardBoost(2);
DOVirtual.DelayedCall(0.5f, () =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp);
});
}
} }
// 重新开始本局 // 重新开始本局
@@ -51,7 +51,7 @@ namespace ChillConnect
{ {
ui.btn_restart.SetClick(() => ui.btn_restart.SetClick(() =>
{ {
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open); UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, args);
CtrlCloseUI(); CtrlCloseUI();
}); });
@@ -10,7 +10,6 @@ using IgnoreOPS;
using Newtonsoft.Json; using Newtonsoft.Json;
using Spine.Unity; using Spine.Unity;
using UnityEngine; using UnityEngine;
using btn_claim = FGUI.Common_01.btn_claim;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace ChillConnect namespace ChillConnect
@@ -19,10 +18,15 @@ namespace ChillConnect
{ {
private GameResultUICtrl ctrl; private GameResultUICtrl ctrl;
private GameResultModel model; private GameResultModel model;
private com_arrow_end ui; private com_end ui;
private bool IsWin;
private bool IsLevelSuccess;
private bool IsH5Reward;
private float AwardNum = 20;
private Action closeCallback; private Action closeCallback;
private int AwardRate = 10;
public GameResultUI(GameResultUICtrl ctrl) : base(ctrl) public GameResultUI(GameResultUICtrl ctrl) : base(ctrl)
{ {
@@ -33,10 +37,10 @@ namespace ChillConnect
protected override void SetUIInfo(UIInfo uiInfo) protected override void SetUIInfo(UIInfo uiInfo)
{ {
uiInfo.packageName = "GameResult_08"; uiInfo.packageName = "GameResult_08";
uiInfo.assetName = "com_arrow_end"; uiInfo.assetName = "com_end";
uiInfo.layerType = UILayerType.Popup; uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = true; uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = true; uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true; uiInfo.isNeedUIMask = true;
} }
@@ -49,21 +53,106 @@ namespace ChillConnect
protected override void OnClose() protected override void OnClose()
{ {
// GameHelper.SetCloseResult(false);
closeCallback?.Invoke();
// if (IsLevelSuccess && !GameHelper.is_first_login)
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
} }
// //
protected override void OnBind() protected override void OnBind()
{ {
ui = baseUI as com_arrow_end; ui = baseUI as com_end;
} }
private SuccessData successData_; private SuccessData successData_;
protected override void OnOpenBefore(object args) protected override void OnOpenBefore(object args)
{ {
((btn_claim)ui.btn_watchAd).state.selectedIndex = DataMgr.ArrowResultLevel.Value == 1 ? 1 : 0; if (Screen.safeArea.y != 0)
((btn_claim)ui.btn_watchAd).title = DataMgr.ArrowResultLevel.Value == 1 ? "Free Revive" : "Revive"; {//刘海屏
ui.btn_gold.y += 68;
}
var anim_paly = FXManager.Instance.SetFx<SkeletonAnimation>(ui.btn_gold.GetChild("gold_anim") as GGraph, Fx_Type.fx_coin, ref closeCallback);
anim_paly.state.SetAnimation(0, "animation", true);
(ui.top_money as com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
if (GameHelper.IsGiftSwitch())
ui.switchgift.selectedIndex = 1;
ui.tips_text.text = GameHelper.getDesByKey("ww_condition_lv");
SuccessData SuccessDatas = args as SuccessData;
AwardNum = SuccessDatas.cash_number;
AwardRate = SuccessDatas.rate;
IsWin = SuccessDatas.IsWin;
IsLevelSuccess = SuccessDatas.IsLevelSuccess;
IsH5Reward = SuccessDatas.IsH5Reward;
successData_ = SuccessDatas;
if (!GameHelper.IsGiftSwitch())
{
successData_.cash_number = (int)successData_.cash_number;
successData_.rate = 2;
}
// if (IsLevelSuccess && !IsH5Reward)
// {
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
//
// GameHelper.PlayGameTimeEvent(1, () =>
// {
// GameHelper.RequestGameConfig();
// });
// }
// else
// {
// GameHelper.SetCloseResult(true);
// }
if (!GameHelper.IsGiftSwitch())
{
AwardNum = 20;
AwardRate = 2;
ui.btn_claim.title = "Claim(" + AwardNum + ")";
}
else ui.btn_claim.title = "Claim(" + GameHelper.getChString((decimal)AwardNum) + ")";
if (IsWin)
{
if (PlayerPrefs.GetFloat("soundVolume", 1.0f) > 0f)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.Victoriously);
}
}
if (IsWin)
{
ui.win_lose.selectedIndex = 1;
}
else
{
// ui.win_lose.selectedIndex = 0;
ui.win_lose.selectedIndex = 2;
ui.lab_lose_des.text = GameHelper.getDesByKey("game_resulte_1");
}
ui.btn_restart.SetClick(() =>
{
if (!GameHelper.GetCloseResult())
return;
GameHelper.addInterAdnumber();
if (!IsWin)
{
GameHelper.SetLevelstate(3);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
GameDispatcher.Instance.Dispatch(GameMsg.sendLog, false);
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false);
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
});
ui.btn_watchAd.SetClick(() =>
((btn_claim)ui.com_arrow_end.btn_watchAd).state.selectedIndex = DataMgr.ArrowResultLevel.Value == 1 ? 1 : 0;
((btn_claim)ui.com_arrow_end.btn_watchAd).title = DataMgr.ArrowResultLevel.Value == 1 ? "Free Revive" : "Revive";
ui.com_arrow_end.btn_watchAd.SetClick(() =>
{ {
if (DataMgr.ArrowResultLevel.Value == 1) if (DataMgr.ArrowResultLevel.Value == 1)
{ {
@@ -72,25 +161,212 @@ namespace ChillConnect
} }
else if (DataMgr.ArrowResultLevel.Value == 0) else if (DataMgr.ArrowResultLevel.Value == 0)
{ {
GameHelper.ShowVideoAd("gameResult", success => GameHelper.ShowVideoAd("gameResult", success =>
{ {
if (success) if (success)
{ {
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true); GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
} }
}); });
} }
CtrlCloseUI(); CtrlCloseUI();
}); });
ui.com_arrow_end.btn_restart.SetClick(() =>
ui.btn_restart.SetClick(() =>
{ {
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameAgainUI_Open); UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameAgainUI_Open);
CtrlCloseUI(); CtrlCloseUI();
}); });
ui.com_arrow_end.btn_back.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameAgainUI_Open);
CtrlCloseUI();
});
ui.btn_mult.GetChild("title").text = "Claim X" + AwardRate;
if (SuccessDatas.IsH5Reward)
ui.com_ch.visible = false;
InitView();
if (IsWin)
{
if (GameHelper.IsGiftSwitch())
ui.text_award.text = GameHelper.Get102Str((decimal)AwardNum);
else
ui.text_award.text = ((int)AwardNum).ToString();
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_win, ref closeCallback);
sk.state.SetAnimation(0, "out", true);
var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_title, Fx_Type.fx_winstar, ref closeCallback);
sk1.state.SetAnimation(0, "animation", false);
}
else
{
// var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_fail, Fx_Type.fx_fail, ref closeCallback);
// sk1.state.SetAnimation(0, "animation", true);
if (GameHelper.IsGiftSwitch())
ui.text_award.text = GameHelper.Get102Str(DataMgr.Ticket.Value);
else
ui.text_award.text = DataMgr.Coin.Value.ToString();
}
ui.com_ch.btn_cash.title = GameHelper.getDesByKey("ch_out_1");
// if (IsWin)
// {
// if (GameHelper.IsGiftSwitch()) ui.text_award.text = GameHelper.Get102Str((decimal)AwardNum);
// else ui.text_award.text = ((int)AwardNum).ToString();
// var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_win, ref closeCallback);
// sk.state.SetAnimation(0, "out", true);
// var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_title, Fx_Type.fx_win_title, ref closeCallback);
// sk1.state.SetAnimation(0, "animation", false);
// }
// else
// {
// if (GameHelper.IsGiftSwitch()) ui.text_award.text = GameHelper.Get102Str(DataMgr.Ticket.Value);
// else ui.text_award.text = DataMgr.Coin.Value.ToString();
// }
if (GameHelper.IsGiftSwitch())
{
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims)
{
(ui.btn_mult as btn_claim3).state.selectedIndex = 1;
}
else if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
{
(ui.btn_mult.GetChild("img_saveingpot") as GImage).visible = true;
}
}
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
ui.top_money.GetChild("text_gold").text = DataMgr.Ticket.Value.ToString();
ui.btn_mult.SetClick(() =>
{
if (!GameHelper.GetCloseResult())
return;
if (GameHelper.IsGiftSwitch())
{
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims)
{
ui.com_ch.btn_cash.SetClick(() => { });
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
StartScroll();
}
else
{
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
{
if (isSuccess)
{
ui.com_ch.btn_cash.SetClick(() => { });
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
StartScroll();
}
});
}
}
else
{
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
{
if (isSuccess)
{
ui.com_ch.btn_cash.SetClick(() => { });
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
GetReward(AwardNum * 2);
}
});
}
});
ui.btn_claim.SetClick(() =>
{
if (!GameHelper.GetCloseResult())
return;
ui.com_ch.btn_cash.SetClick(() => { });
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
GetReward(AwardNum);
DOVirtual.DelayedCall(2f, () =>
{
GameHelper.addInterAdnumber();
});
});
//}
}
private bool isget;
private void GetReward(float awardNum)
{
if (isget)
return;
isget = true;
var rewardData = new RewardData();
int curr_type = 101;
Vector2 end_ = GameHelper.GetUICenterPosition(ui.btn_gold, true);
if (GameHelper.IsGiftSwitch())
{
curr_type = 102;
end_ = GameHelper.GetUICenterPosition(ui.top_money, true);
}
var rewardSingleData = new RewardSingleData(curr_type, (decimal)awardNum, RewardOrigin.Play)
{
startPosition = GameHelper.GetUICenterPosition(ui.btn_mult, true),
endPosition = new Vector2(end_.x - 110, end_.y - 110),
};
rewardData.AddReward(rewardSingleData);
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
rewardData.AddCompleted(success =>
{
if (success)
{
// RefreshGold((decimal)awardNum);
DOVirtual.DelayedCall(0.7f, () =>
{
CtrlCloseUI();
// if (IsLevelSuccess) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
});
}
});
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
DOVirtual.DelayedCall(1, () =>
{
DOVirtual.Float(0, (float)DataMgr.Ticket.Value, 1,
value => { ui.top_money.GetChild("text_gold").text = ((decimal)value).ToString("0.00"); });
});
}
private void RefreshGold(decimal coin = -1)
{
if (coin < 0)
{
coin = DataMgr.Coin.Value;
}
var btnCoin = ui.btn_gold as com_gold;
CommonHelper.ShowNumAnim(btnCoin.text_gold, coin);
} }
protected override void OnOpen(object args) protected override void OnOpen(object args)
{ {
} }
@@ -107,12 +383,357 @@ namespace ChillConnect
#region #region
protected override void AddListener() protected override void AddListener()
{ {
HallManager.Instance.UpdateSecondEvent += timeEvent;
} }
protected override void RemoveListener() protected override void RemoveListener()
{ {
HallManager.Instance.UpdateSecondEvent -= timeEvent;
} }
#endregion #endregion
private int time_count; private int time_count;
void timeEvent()
{
time_count++;
if (time_count > 3)
{
time_count = 0;
ui.com_ch.broad.t0.Play(() =>
{
var name_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list.Count);
var money_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_money_list.Count);
DateTime oldtime = DateTime.Now.AddSeconds(-Random.Range(1 * 3600, 2 * 3600));
// ui.com_ch.broad.cast_text.text = string.Format("Congratulations, [color=#dfad42]{0}[/color] withdrew [color=#90c04e]{1} [/color]dollars", ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
// ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
string broad_text = String.Format(GameHelper.getDesByKey("makeup_5"), ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
ui.com_ch.broad.cast_text.text = broad_text;
//, oldtime.Hour + ":" + (oldtime.Minute > 10 ? oldtime.Minute : "0" + oldtime.Minute)
ui.com_ch.broad.t1.Play();
});
}
}
//初始化页面逻辑
private void InitView()
{
if (Screen.safeArea.y != 0)
{//刘海屏
ui.top_group.y += 68;
}
closeCallback = null;
if (!GameHelper.IsGiftSwitch())
return;
var name_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list.Count);
var money_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_money_list.Count);
// ui.com_ch.broad.cast_text.text = string.Format("Congratulations, [color=#dfad42]{0}[/color] withdrew [color=#90c04e]{1} [/color]dollars", ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
// ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
string broad_text = String.Format(GameHelper.getDesByKey("makeup_5"), ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
ui.com_ch.broad.cast_text.text = broad_text;
if (DataMgr.MakeupTaskHistory.Value.Count == 0)
{
return;
}
var makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last();
var vo = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId);
ui.com_ch.btn_cash.SetClick(() =>
{
if (!GameHelper.GetCloseResult())
return;
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
ui.com_ch.btn_cash.SetClick(() => { });
ui.top_money.GetChild("btn_ch").SetClick(() => { });
if (IsWin)
{
//ui.btn_claim.FireClick(false, true);
GetReward(AwardNum);
DOVirtual.DelayedCall(2f, () =>
{
GameHelper.addInterAdnumber();
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
});
}
else
{
GameHelper.addInterAdnumber();
if (!IsWin)
GameHelper.SetLevelstate(3);
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false);
}
// ui.btn_claim.enabled = false;
// ui.btn_mult.enabled = false;
});
ui.top_money.GetChild("btn_ch").SetClick(() =>
{
ui.btn_claim.SetClick(() => { });
ui.btn_mult.SetClick(() => { });
ui.com_ch.btn_cash.SetClick(() => { });
ui.top_money.GetChild("btn_ch").SetClick(() => { });
if (IsWin)
{
//ui.btn_claim.FireClick(false, true);
GetReward(AwardNum);
DOVirtual.DelayedCall(2f, () =>
{
GameHelper.addInterAdnumber();
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
});
}
else
{
GameHelper.addInterAdnumber();
if (!IsWin)
GameHelper.SetLevelstate(3);
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
}
});
if ((float)DataMgr.Ticket.Value < vo.item_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo.item_need);
ui.com_ch.ch_text.text = str;
if ((float)DataMgr.Ticket.Value > vo.item_need)
{
ui.com_ch.progress.width = 656;
ui.com_ch.progress_text.text = GameHelper.Get102Str(vo.item_need) + "/" + GameHelper.Get102Str(vo.item_need);
}
else
{
ui.com_ch.progress.width = 656 * ((float)DataMgr.Ticket.Value / vo.item_need);
ui.com_ch.progress_text.text = GameHelper.Get102Str(DataMgr.Ticket.Value) + "/" + GameHelper.Get102Str(vo.item_need);
}
Debug.Log((float)DataMgr.Ticket.Value);
}
// else if ((float)DataMgr.MakeupTaskH5Time < vo.task_need)
// {
// ui.com_ch.ch_text.text = "Cumulataive " + (vo.task_need / 60) + @" minutes in ""Game"" to cash out";
// if ((float)DataMgr.MakeupTaskH5Time > vo.task_need)
// {
// ui.com_ch.progress.width = 656;
// ui.com_ch.progress_text.text = (vo.task_need / 60) + "/" + (vo.task_need / 60);
// }
// else
// {
// ui.com_ch.progress.width = 656 * ((float)DataMgr.MakeupTaskH5Time / vo.task_need);
// ui.com_ch.progress_text.text = Math.Round(((float)(DataMgr.MakeupTaskH5Time / 60)), 2) + "/" + (vo.task_need / 60);
// }
//
// }
else if (makeupTaskData.videoCount < vo.ad_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_1"), vo.ad_need);
ui.com_ch.ch_text.text = str;
if (makeupTaskData.videoCount > vo.ad_need)
{
ui.com_ch.progress.width = 656;
ui.com_ch.progress_text.text = vo.ad_need + "/" + vo.ad_need;
}
else
{
ui.com_ch.progress.width = 656 * ((float)makeupTaskData.videoCount / vo.ad_need);
ui.com_ch.progress_text.text = makeupTaskData.videoCount + "/" + vo.ad_need;
}
}
else if (GameHelper.GetLevel() <= vo.levels_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo.levels_need);
ui.com_ch.ch_text.text = str;
ui.com_ch.progress.width = 656 * (GameHelper.GetLevel() - 1) / vo.levels_need;
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo.levels_need;
}
else
{
var vo1 = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId + 1);
if (vo1 == null)
vo1 = vo;
string str1 = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
ui.com_ch.ch_text.text = str1;
if ((float)(DataMgr.Ticket.Value - vo.item_need) < vo1.item_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
ui.com_ch.ch_text.text = str;
ui.com_ch.progress.width = 656f * ((float)(DataMgr.Ticket.Value - vo.item_need) / vo1.item_need);
ui.com_ch.progress_text.text = GameHelper.Get102Str((DataMgr.Ticket.Value - vo.item_need)) + "/" + GameHelper.Get102Str(vo1.item_need);
// Debug.Log((float)DataMgr.Ticket.Value);
}
else if (makeupTaskData.videoCount < vo1.ad_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_1"), vo1.ad_need);
ui.com_ch.ch_text.text = str;
if (makeupTaskData.videoCount > vo1.ad_need)
{
ui.com_ch.progress.width = 656f;
ui.com_ch.progress_text.text = vo1.ad_need + "/" + vo1.ad_need;
}
else
{
ui.com_ch.progress.width = 656f * ((float)makeupTaskData.videoCount / vo1.ad_need);
ui.com_ch.progress_text.text = makeupTaskData.videoCount + "/" + vo1.ad_need;
}
}
else if (GameHelper.GetLevel() <= vo1.levels_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo1.levels_need);
ui.com_ch.ch_text.text = str;
ui.com_ch.progress.width = 656f * (GameHelper.GetLevel() - 1) / vo1.levels_need;
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo1.levels_need;
}
else
{
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo1.levels_need);
ui.com_ch.ch_text.text = str;
ui.com_ch.progress.width = 656f * (GameHelper.GetLevel() - 1) / vo1.levels_need;
if (GameHelper.GetLevel() > vo1.levels_need)
{
ui.com_ch.progress.width = 656f;
ui.com_ch.progress_text.text = vo1.levels_need + "/" + vo1.levels_need;
}
else
{
ui.com_ch.progress.width = 590f * (GameHelper.GetLevel() - 1) / vo1.levels_need;
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo1.levels_need;
}
}
}
if (successData_.boost_array != null && GameHelper.IsGiftSwitch())
{
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % 5]) + ")";
});
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex]) + ")";
list_1 = new List<item_wheel>() { (ui.wheel.GetChild("wheel_") as wheel_).item_0, (ui.wheel.GetChild("wheel_") as wheel_).item_1, (ui.wheel.GetChild("wheel_") as wheel_).item_2, (ui.wheel.GetChild("wheel_") as wheel_).item_3, (ui.wheel.GetChild("wheel_") as wheel_).item_4, (ui.wheel.GetChild("wheel_") as wheel_).item_5, (ui.wheel.GetChild("wheel_") as wheel_).item_6, (ui.wheel.GetChild("wheel_") as wheel_).item_7, };
// list_1[2].img_light.visible = true;
for (int i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + successData_.boost_array[i % successData_.boost_array.Length];
}
}
}
List<item_wheel> list_1;
private int rate_idnex = 3;
private int scroll_number;
List<int> rate_list = new List<int>();
private int scroll_type = 1;
private void StartScroll()
{
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 5.0f;
scroll_type = 2;
}
private void Scroll()
{
if (scroll_type == 1)
{
scroll_number++;
rate_list.Clear();
for (int i = 0; i < 8; i++)
{
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
}
Debug.Log(JsonConvert.SerializeObject(rate_list));
for (int i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + rate_list[i];
}
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % successData_.boost_array.Length]) + ")";
});
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
}
else
{
scroll_number++;
rate_list.Clear();
for (int i = 0; i < 8; i++)
{
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
}
// bool need_return = false;
if (((ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale < 2.2f) && (list_1[4].text_rate.text == ("X" + successData_.rate)))
{
//开始领取
float reward = successData_.cash_number * successData_.rate;
if (GameHelper.IsGiftSwitch())
GetReward(reward);
else
GetReward(reward);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
SaveData.GetSaveObject().LargeRewardNum++;
SaveData.saveDataFunc();
return;
}
for (int i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + rate_list[i];
Debug.Log((ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale);
}
// if (need_return)
// {
// (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 0;
// return;
// }
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % successData_.boost_array.Length]) + ")";
});
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale - 0.3f;
}
}
} }
} }