fix:1、玩法创建,移动,碰撞检测基本完成 2、添加结算复活界面逻辑

This commit is contained in:
2026-06-13 15:34:00 +08:00
parent 2d5012e37e
commit 9b468b835f
38 changed files with 1208 additions and 752 deletions
+2
View File
@@ -2,8 +2,10 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AApplication_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003F1a_003Fb93f31c4_003FApplication_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColorUtility_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003Fc7_003Fbf270f3f_003FColorUtility_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADictionary_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5a41d6b7189842eca409fd0b1c3e3dcf17bf78_003F0b_003F65960d28_003FDictionary_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEditorGUILayout_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4b8f645257c94d1296f440a10c6f388e961000_003Fa2_003F73a0821f_003FEditorGUILayout_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003F25_003Fe0bd2277_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScriptableObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003F45_003F06fae3db_003FScriptableObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AShortcutExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F2348fb5ecc9e4e689f37f7d7fadaea9a27a00_003F77_003F364dbea6_003FShortcutExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASystem_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3ea01e77be99618395f448b16bd7cc2bd4248bd9e5d8474964b2d97f39c5d74_003FSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1071a2cb0cb3433aae80a793c277a04846ac00_003Fb8_003Fdebf208b_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVector2_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003Fab_003F9e3ea355_003FVector2_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
@@ -134,6 +134,8 @@ namespace ChillConnect
public static uint PettyAwardUI_Close = ++cursor_OpenClose;
public static uint StatementViewUI_Open = ++cursor_OpenClose;
public static uint StatementViewUI_Close = ++cursor_OpenClose;
public static uint StatementViewUI_Close = ++cursor_OpenClose;
public static uint GameAgainUI_Open = ++cursor_OpenClose;
public static uint GameAgainUI_Close = ++cursor_OpenClose;
}
}
@@ -12,6 +12,7 @@ namespace FGUI.Arrow_game
UIObjectFactory.SetPackageItemExtension(ArrowEnd.URL, typeof(ArrowEnd));
UIObjectFactory.SetPackageItemExtension(LineTile.URL, typeof(LineTile));
UIObjectFactory.SetPackageItemExtension(ArrorPoint.URL, typeof(ArrorPoint));
UIObjectFactory.SetPackageItemExtension(HeartsPanel.URL, typeof(HeartsPanel));
}
}
}
@@ -0,0 +1,29 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using FairyGUI.Utils;
namespace FGUI.Arrow_game
{
public partial class HeartsPanel : GComponent
{
public GImage xin_1;
public GImage xin_2;
public GImage xin_3;
public const string URL = "ui://sjl9teijrsd4b";
public static HeartsPanel CreateInstance()
{
return (HeartsPanel)UIPackage.CreateObject("Arrow_game", "HeartsPanel");
}
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
xin_1 = (GImage)GetChildAt(0);
xin_2 = (GImage)GetChildAt(1);
xin_3 = (GImage)GetChildAt(2);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f0b296ed39adcc429682e3f5f403e9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -13,6 +13,7 @@ namespace FGUI.Arrow_game
public ArrowEnd ArrowEnd;
public ArrorPoint point;
public GButton btn_close;
public HeartsPanel HeartsPanel;
public const string URL = "ui://sjl9teijrsd40";
public static com_arrow_game CreateInstance()
@@ -30,6 +31,7 @@ namespace FGUI.Arrow_game
ArrowEnd = (ArrowEnd)GetChildAt(3);
point = (ArrorPoint)GetChildAt(4);
btn_close = (GButton)GetChildAt(6);
HeartsPanel = (HeartsPanel)GetChildAt(7);
}
}
}
@@ -10,6 +10,9 @@ namespace FGUI.GameResult_08
{
UIObjectFactory.SetPackageItemExtension(com_success_cash.URL, typeof(com_success_cash));
UIObjectFactory.SetPackageItemExtension(cash_broad.URL, typeof(cash_broad));
UIObjectFactory.SetPackageItemExtension(com_arrow_end.URL, typeof(com_arrow_end));
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));
}
}
@@ -0,0 +1,29 @@
/** 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);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e0993c012a030ad4391f9c97f177470c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
/** 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 com_arrow_end : GComponent
{
public GTextField title;
public GButton btn_back;
public GButton btn_watchAd;
public GButton btn_restart;
public const string URL = "ui://8sjqw0q3rsd42f";
public static com_arrow_end CreateInstance()
{
return (com_arrow_end)UIPackage.CreateObject("GameResult_08", "com_arrow_end");
}
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
title = (GTextField)GetChildAt(3);
btn_back = (GButton)GetChildAt(4);
btn_watchAd = (GButton)GetChildAt(9);
btn_restart = (GButton)GetChildAt(10);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3e949870cc7cc39479c7f54ea7420224
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
/** 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 com_arrow_end_again : GComponent
{
public GTextField title;
public GButton btn_back;
public GButton btn_revive;
public GButton btn_restart;
public const string URL = "ui://8sjqw0q3rsd42h";
public static com_arrow_end_again CreateInstance()
{
return (com_arrow_end_again)UIPackage.CreateObject("GameResult_08", "com_arrow_end_again");
}
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
title = (GTextField)GetChildAt(3);
btn_back = (GButton)GetChildAt(4);
btn_revive = (GButton)GetChildAt(6);
btn_restart = (GButton)GetChildAt(7);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d91521286530f847abe3aa5d63ae289
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 KiB

After

Width:  |  Height:  |  Size: 599 KiB

+1
View File
@@ -37,4 +37,5 @@ public static partial class DataKeys
public const string RankData = "RankData";
public const string ApplePayTransactionID = "ApplePayTransactionID"; //ios购买后的非消耗性订单id
public const string NewWatchCd = "NewWatchCd";
public const string ArrowResultLevel = "ArrowResultLevel"; //箭头游戏的结算等级(1:免费,0:看广告)
}
+2
View File
@@ -73,6 +73,8 @@ public static partial class DataMgr
public static DataStorage<int> ChLevel = BindDataStorage<int>(DataKeys.ch_level);
public static DataStorage<string> LevelData = new(DataKeys.LevelData, cloudSave: false);
public static DataStorage<int> AvailableDiceRolls = BindDataStorage<int>(DataKeys.AvailableDiceRolls);
public static DataStorage<int> ArrowResultLevel = BindDataStorage<int>(DataKeys.ArrowResultLevel,@default: 1);
#endregion
@@ -56,6 +56,7 @@ namespace ChillConnect
public const string PettyAwardCtrl = "PettyAwardCtrl";
public const string StatementViewCtrl = "StatementViewCtrl";
public const string ArrowGameCtrl = "ArrowGameCtrl";
public const string GameAgainCtrl = "GameAgainCtrl";
}
}
@@ -56,6 +56,7 @@ namespace ChillConnect
public const string StatementViewModel = "StatementViewModel";
public const string H5Model = "H5Model";
public const string ArrowGameModel = "ArrowGameModel";
public const string GameAgainModel = "GameAgainModel";
}
}
@@ -59,6 +59,8 @@ namespace ChillConnect
moduleManager.AddModel(ModelConst.StatementViewModel, new StatementViewModel());
moduleManager.AddModel(ModelConst.H5Model, new H5Model());
moduleManager.AddModel(ModelConst.ArrowGameModel, new ArrowGameModel());
moduleManager.AddModel(ModelConst.GameAgainModel, new GameAgainModel());
}
public static void AutoRegisterUICtrl()
@@ -115,6 +117,8 @@ namespace ChillConnect
moduleManager.AddUICtrl(UICtrlConst.StatementViewUICtrl, new StatementViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.H5UICtrl, new H5UICtrl());
moduleManager.AddUICtrl(UICtrlConst.ArrowGameUICtrl, new ArrowGameUICtrl());
moduleManager.AddUICtrl(UICtrlConst.GameAgainUICtrl, new GameAgainUICtrl());
}
@@ -174,6 +178,7 @@ namespace ChillConnect
moduleManager.AddCtrl(CtrlConst.StatementViewCtrl, new StatementViewCtrl());
moduleManager.AddCtrl(CtrlConst.H5Ctrl, new H5Ctrl());
moduleManager.AddCtrl(CtrlConst.ArrowGameCtrl, new ArrowGameCtrl());
moduleManager.AddCtrl(CtrlConst.GameAgainCtrl, new GameAgainCtrl());
}
@@ -232,6 +237,7 @@ namespace ChillConnect
moduleManager.AddUIType(UIConst.StatementViewUI, typeof(StatementViewUI));
moduleManager.AddUIType(UIConst.H5UI, typeof(H5UI));
moduleManager.AddUIType(UIConst.ArrowGameUI, typeof(ArrowGameUI));
moduleManager.AddUIType(UIConst.GameAgainUI, typeof(GameAgainUI));
}
}
+2 -1
View File
@@ -54,7 +54,8 @@ namespace ChillConnect
public const string NewTaskUI = "NewTaskUI";
public const string PettyAwardUI = "PettyAwardUI";
public const string StatementViewUI = "StatementViewUI";
public const string ArrowGameUI = "ArrowGameUI";
public const string ArrowGameUI = "ArrowGameUI";
public const string GameAgainUI = "GameAgainUI";
}
}
@@ -56,6 +56,7 @@ namespace ChillConnect
public const string PettyAwardUICtrl = "PettyAwardUICtrl";
public const string StatementViewUICtrl = "StatementViewUICtrl";
public const string ArrowGameUICtrl = "ArrowGameUICtrl";
public const string GameAgainUICtrl = "GameAgainUICtrl";
}
}
+642 -102
View File
@@ -1,3 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using FairyGUI;
@@ -24,9 +25,38 @@ namespace ChillConnect
private LevelConfig _levelConfig;
// 全局固定参数
private const float _pointSpacing = 60f; // 点位间距 60px
private const float _moveSpeed = 120f; // 移动速度
private const float _pointSpacing = 60f; // 点位间距 60px
private const float _moveSpeed = 120f; // 移动速度
private List<ArrowConfig> allArrowList = new List<ArrowConfig>();
// 网格基础参数
private readonly int gridColNum = 10;
private readonly float pointSpace = 60f;
private readonly float outOffset = 200f;
// 网格边界
private float gridLeft;
private float gridRight;
private readonly int gridRowNum = 10;
private float gridTop;
private float gridBottom;
// 网格占用标记:true=该点位被占用,false=空闲
private bool[,] _gridOccupied;
// 记录每个箭头占用的所有网格点位(行,列)
private Dictionary<ArrowConfig, List<(int row, int col)>> _arrowOccupiedCells = new Dictionary<ArrowConfig, List<(int row, int col)>>();
// 爱心数量
private int _heartCount = 3;
// 记录已经发生过碰撞的箭头对象(去重:同个箭头多次碰撞只扣一次血)
private HashSet<ArrowConfig> _collidedArrows = new HashSet<ArrowConfig>();
// 统计场上还存在的箭头总数(用于判断全部移除=通关)
private int _remainArrowCount = 0;
// 结算界面UI引用(根据你FGUI包名/组件名自行修改)
// private ResultPanel _resultPanel;
public ArrowGameUI(ArrowGameUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ArrowGameUI;
@@ -46,7 +76,6 @@ namespace ChillConnect
#region
protected override void OnInit()
{
}
protected override void OnClose()
@@ -63,6 +92,10 @@ namespace ChillConnect
_arrowTemplate = null;
_lineUnitTemplate = null;
_levelConfig = null;
// 清空网格占用数据
_gridOccupied = null;
_arrowOccupiedCells.Clear();
}
protected override void OnBind()
@@ -87,45 +120,138 @@ namespace ChillConnect
_arrowTemplate = (ArrowEnd)UIPackage.CreateObject("Arrow_game", "ArrowEnd");
_lineUnitTemplate = (LineTile)UIPackage.CreateObject("Arrow_game", "LineTile");
LoadLevelConfig();
InitGridBounds();
// 初始化网格占用数组
InitGridOccupied();
// ========== 新增:对局状态重置 ==========
_heartCount = 3;
_collidedArrows.Clear();
if(_levelConfig != null)
_remainArrowCount = _levelConfig.arrows.Count;
InitView();
}
protected override void OnOpen(object args) { }
protected override void OnHide() { }
protected override void OnDisplay(object args) { }
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region &
private void InitView()
{
// 关闭按钮
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
ui.btn_close.SetClick(() => { CtrlCloseUI(); });
if (_levelConfig == null) return;
// 1. 以 ui.point 为原点生成整张网格圆点
// 1. 绘制网格圆点
DrawGridDots(_levelConfig);
// 2. 初始化所有箭头 + 路径线条
allArrowList = _levelConfig.arrows;
// 2. 初始化所有箭头 + 路径线条 + 标记网格占用
foreach (var arrow in _levelConfig.arrows)
{
BuildArrowPath(arrow, _levelConfig);
CreateArrowAndLines(arrow, _levelConfig);
MarkArrowOccupiedCells(arrow, _levelConfig);
}
}
#endregion
private void InitGridBounds()
{
gridLeft = ui.point.x;
gridRight = ui.point.x + gridColNum * pointSpace;
gridTop = ui.point.y;
gridBottom = ui.point.y + gridRowNum * pointSpace;
}
/// <summary>初始化网格占用二维数组</summary>
private void InitGridOccupied()
{
int rows = _levelConfig.gridRows;
int cols = _levelConfig.gridCols;
_gridOccupied = new bool[rows, cols];
// 初始全部置为空闲
for (int r = 0; r < rows; r++)
for (int c = 0; c < cols; c++)
_gridOccupied[r, c] = false;
_arrowOccupiedCells.Clear();
}
/// <summary>标记单个箭头占用的所有网格点</summary>
private void MarkArrowOccupiedCells(ArrowConfig arrow, LevelConfig cfg)
{
List<(int row, int col)> cellList = new List<(int row, int col)>();
int totalCol = cfg.gridCols;
// 遍历箭头整条路径的所有网格点位
foreach (var pos in arrow.pathPointList)
{
int pointId = GetPointIdByPos(pos, cfg);
PointIdToRowCol(pointId, totalCol, out int r, out int c);
// 边界保护
if (r >= 0 && r < cfg.gridRows && c >= 0 && c < cfg.gridCols)
{
_gridOccupied[r, c] = true;
cellList.Add((r, c));
}
}
_arrowOccupiedCells[arrow] = cellList;
}
/// <summary>释放单个箭头占用的网格(箭头消失时调用)</summary>
private void ReleaseArrowOccupied(ArrowConfig arrow)
{
if (!_arrowOccupiedCells.TryGetValue(arrow, out var cellList))
return;
foreach (var (r, c) in cellList)
{
if (r >= 0 && r < _levelConfig.gridRows && c >= 0 && c < _levelConfig.gridCols)
{
_gridOccupied[r, c] = false;
}
}
// 移除字典记录,避免冗余
_arrowOccupiedCells.Remove(arrow);
}
#region
private void LoadLevelConfig()
{
_levelConfig = JsonHelper.LoadLevel("level_1001.json");
// 给 path 为空的箭头,设置默认方向
foreach (var arrow in _levelConfig.arrows)
{
if (arrow.path == null || arrow.path.Count == 0)
{
arrow.defaultDir = "up";
}
else
{
arrow.defaultDir = null;
}
}
}
#endregion
#region ui.point
#region
/// <summary>点位ID 转 行列索引</summary>
private void PointIdToRowCol(int pointId, int totalCol, out int row, out int col)
{
@@ -133,16 +259,11 @@ namespace ChillConnect
col = pointId % totalCol;
}
/// <summary>
/// 行列 → 实际像素坐标
/// 原点 = ui.point 组件坐标,向右+X,向下+Y,间距固定60
/// </summary>
/// <summary>行列 → 实际像素坐标</summary>
private Vector2 RowColToPos(int row, int col)
{
// 取UI上point组件的坐标作为网格原点
float originX = ui.point.x;
float originY = ui.point.y;
float x = originX + col * _levelConfig.pointSpacing;
float y = originY + row * _levelConfig.pointSpacing;
return new Vector2(x, y);
@@ -155,6 +276,29 @@ namespace ChillConnect
return RowColToPos(r, c);
}
/// <summary>像素坐标反向计算点位ID</summary>
private int GetPointIdByPos(Vector2 pos, LevelConfig cfg)
{
float originX = ui.point.x;
float originY = ui.point.y;
int col = Mathf.RoundToInt((pos.x - originX) / cfg.pointSpacing);
int row = Mathf.RoundToInt((pos.y - originY) / cfg.pointSpacing);
return row * cfg.gridCols + col;
}
/// <summary> 根据FGUI旋转角度获取方向 </summary>
private string GetDirByRotation(float rot)
{
rot = Mathf.Round(rot);
if (rot == 0) return "right";
if (rot == 90) return "down";
if (rot == 180) return "left";
if (rot == 270) return "up";
return "right";
}
/// <summary>方向转旋转角度(箭头默认朝上)</summary>
private float DirToRotation(string dir)
{
@@ -169,7 +313,7 @@ namespace ChillConnect
}
#endregion
#region ui.point
#region
private void DrawGridDots(LevelConfig cfg)
{
if (_dotTemplate == null || _viewContainer == null) return;
@@ -184,7 +328,7 @@ namespace ChillConnect
{
var dot = ArrorPoint.CreateInstance();
var pos = RowColToPos(r, c);
dot.SetPosition(pos.x, pos.y,0);
dot.SetPosition(pos.x, pos.y, 0);
_viewContainer.AddChild(dot);
}
}
@@ -211,6 +355,7 @@ namespace ChillConnect
case "left": c--; break;
case "right": c++; break;
}
curPointId = r * totalCol + c;
curPos = PointIdToPos(curPointId, totalCol);
arrow.pathPointList.Add(curPos);
@@ -222,125 +367,470 @@ namespace ChillConnect
private void CreateArrowAndLines(ArrowConfig arrow, LevelConfig cfg)
{
arrow.lineUnits = new List<GComponent>();
List<Vector2> path = arrow.pathPointList;
arrow.originalLinePos = new List<Vector2>();
arrow.lineTrackIndex = new List<int>();
arrow.totalTrack = new List<Vector2>();
List<Vector2> pathPoints = arrow.pathPointList;
if (path.Count < 2)
// 生成整条连续行走轨迹
if (pathPoints.Count >= 2)
{
CreateArrowOnly(arrow, path[0]);
for (int i = 0; i < pathPoints.Count - 1; i++)
{
Vector2 segStart = pathPoints[i];
string dir = arrow.path[i];
float offX = 0, offY = 0;
switch (dir)
{
case "right": offX = 10; break;
case "left": offX = -10; break;
case "down": offY = 10; break;
case "up": offY = -10; break;
}
Vector2 cur = segStart;
for (int k = 0; k < 6; k++)
{
arrow.totalTrack.Add(cur);
cur.x += offX;
cur.y += offY;
}
}
if (arrow.path.Count > 0)
arrow.finalMoveDir = arrow.path[arrow.path.Count - 1];
}
// 路径只有单个点(纯箭头)
if (pathPoints.Count < 2)
{
CreateArrowOnly(arrow, pathPoints[0]);
// ========= 修复1:单点箭头也初始化轨迹索引 =========
arrow.arrowTrackIndex = 0;
arrow.finalMoveDir = GetDirByRotation(arrow.arrowObj.rotation);
// ========= 修复2:强制记录原始坐标(关键!)=========
arrow.originalArrowPos = new Vector2(arrow.arrowObj.x, arrow.arrowObj.y);
return;
}
ColorUtility.TryParseHtmlString(arrow.color, out Color lineColor);
List<Vector2> allTilePositions = new List<Vector2>();
// 关键:直接用 path 数组判断方向,和配置表完全一致
for (int i = 0; i < path.Count - 1; i++)
// 生成线条图块
List<Vector2> tilePositions = new List<Vector2>();
for (int i = 0; i < pathPoints.Count - 1; i++)
{
Vector2 pStart = path[i];
Vector2 pEnd = path[i + 1];
string dir = arrow.path[i]; // 直接从配置里取方向
float offsetX = 0f;
float offsetY = 0f;
// 严格按 path 方向设置步长
Vector2 segStart = pathPoints[i];
string dir = arrow.path[i];
float offX = 0, offY = 0;
switch (dir)
{
case "right":
offsetX = 10f;
break;
case "left":
offsetX = -10f;
break;
case "down":
offsetY = 10f;
break;
case "up":
offsetY = -10f;
break;
case "right": offX = 10; break;
case "left": offX = -10; break;
case "down": offY = 10; break;
case "up": offY = -10; break;
}
Vector2 curPos = pStart;
// 生成6个方块,从pStart一直覆盖到pEnd
Vector2 cur = segStart;
for (int k = 0; k < 6; k++)
{
allTilePositions.Add(curPos);
curPos.x += offsetX;
curPos.y += offsetY;
tilePositions.Add(cur);
cur.x += offX;
cur.y += offY;
}
}
// 移除最后一个点(终点位置的方块,避免挡住箭头)
if (allTilePositions.Count > 0)
{
allTilePositions.RemoveAt(allTilePositions.Count - 1);
}
if (tilePositions.Count > 0)
tilePositions.RemoveAt(tilePositions.Count - 1);
// 创建所有方块
foreach (var pos in allTilePositions)
ColorUtility.TryParseHtmlString(arrow.color, out Color lineColor);
for (int i = 0; i < tilePositions.Count; i++)
{
Vector2 pos = tilePositions[i];
LineTile unit = LineTile.CreateInstance();
unit.SetPosition(pos.x, pos.y, 0);
unit.GetChild("line").asGraph.color = lineColor;
unit.visible = true;
unit.touchable = true;
unit.onClick.Add(() => OnPathClick(arrow));
_viewContainer.AddChild(unit);
arrow.lineUnits.Add(unit);
arrow.originalLinePos.Add(pos);
arrow.lineTrackIndex.Add(i);
}
// 创建箭头
CreateArrowOnly(arrow, path[path.Count - 1]);
CreateArrowOnly(arrow, pathPoints[pathPoints.Count - 1]);
arrow.originalArrowPos = new Vector2(arrow.arrowObj.x, arrow.arrowObj.y);
arrow.arrowTrackIndex = arrow.totalTrack.Count - 1;
}
// 线条/箭头 统一点击回调
private void OnPathClick(ArrowConfig clickArrow)
{
if (clickArrow.isMoving)
return;
clickArrow.isMoving = true;
bool hasBlock = CheckBlockByGrid(clickArrow);
if (hasBlock)
{
MoveThenReset(clickArrow);
}
else
{
MoveToDisappear(clickArrow);
}
}
// 基于网格行列的阻挡检测
private bool CheckBlockByGrid(ArrowConfig curArrow)
{
if (_gridOccupied == null || _levelConfig == null) return false;
// 当前箭头网格行列
Vector2 arrowPos = new Vector2(curArrow.arrowObj.x, curArrow.arrowObj.y);
int curPointId = GetPointIdByPos(arrowPos, _levelConfig);
PointIdToRowCol(curPointId, _levelConfig.gridCols, out int curRow, out int curCol);
// 超出网格直接判定无阻挡
if (curRow < 0 || curRow >= _levelConfig.gridRows || curCol < 0 || curCol >= _levelConfig.gridCols)
return false;
// 获取移动方向
string moveDir;
if (curArrow.path != null && curArrow.path.Count > 0)
{
moveDir = curArrow.path[curArrow.path.Count - 1];
}
else if (!string.IsNullOrEmpty(curArrow.defaultDir))
{
moveDir = curArrow.defaultDir;
}
else
{
moveDir = "up";
}
bool isCollide = false;
// 沿方向遍历前方网格
switch (moveDir)
{
case "up":
for (int r = curRow - 1; r >= 0; r--)
{
if (_gridOccupied[r, curCol])
{
isCollide = true;
break;
}
}
break;
case "down":
for (int r = curRow + 1; r < _levelConfig.gridRows; r++)
{
if (_gridOccupied[r, curCol])
{
isCollide = true;
break;
}
}
break;
case "left":
for (int c = curCol - 1; c >= 0; c--)
{
if (_gridOccupied[curRow, c])
{
isCollide = true;
break;
}
}
break;
case "right":
for (int c = curCol + 1; c < _levelConfig.gridCols; c++)
{
if (_gridOccupied[curRow, c])
{
isCollide = true;
break;
}
}
break;
}
// ========== 新增:碰撞判重 + 扣爱心 ==========
if (isCollide)
{
// 这条线第一次碰撞,才扣血
if (!_collidedArrows.Contains(curArrow))
{
_collidedArrows.Add(curArrow);
_heartCount--;
if (_heartCount > 0) ui.HeartsPanel.GetChild($"xin_{_heartCount+1}").visible = false;
// 爱心归零 → 失败结算
if (_heartCount <= 0)
{
ShowResult(false);
}
}
}
return isCollide;
}
// 创建箭头 + 绑定点击
private void CreateArrowOnly(ArrowConfig arrow, Vector2 arrowPos)
{
ArrowEnd arrowIns = ArrowEnd.CreateInstance();
arrowIns.SetPosition(arrowPos.x, arrowPos.y, 0);
arrowIns.touchable = true;
if (arrow.path.Count > 0)
if (arrow.path != null && arrow.path.Count > 0)
{
string lastDir = arrow.path[arrow.path.Count - 1];
arrowIns.rotation = DirToRotation(lastDir);
}
if (ColorUtility.TryParseHtmlString(arrow.color, out Color arrowColor))
else if (!string.IsNullOrEmpty(arrow.defaultDir))
{
GImage icon = arrowIns.GetChild("icon").asImage;
if (icon != null) icon.color = arrowColor;
// 纯单点箭头 使用默认方向旋转
arrowIns.rotation = DirToRotation(arrow.defaultDir);
}
arrowIns.visible = true;
_viewContainer.AddChild(arrowIns);
arrowIns.onClick.Add(() => OnArrowClick(arrow));
arrow.arrowObj = arrowIns;
ColorUtility.TryParseHtmlString(arrow.color, out Color arrowColor);
GImage icon = arrowIns.GetChild("icon").asImage;
if (icon != null) icon.color = arrowColor;
arrowIns.visible = true;
arrowIns.onClick.Add(() => OnPathClick(arrow));
_viewContainer.AddChild(arrowIns);
arrow.arrowObj = arrowIns;
arrow.isMoving = false;
arrow.targetIndex = arrow.pathPointList.Count - 1;
}
/// <summary>
/// 两点间距60px,使用10x10方块,生成6个,完整铺满从pStart到pEnd的线段。
/// 关键:覆盖完整区间,保证拐点无缝衔接。
/// </summary>
private void CreateLineUnitBetweenTwoPoint(Vector2 pStart, Vector2 pEnd, Color lineColor, List<GComponent> lineList)
// 移动后复位动画(回弹,不释放占用)
private void MoveThenReset(ArrowConfig arrow)
{
if (_lineUnitTemplate == null) return;
CrazyAsyKit.StartCoroutine(MoveAndResetCoroutine(arrow));
}
float offsetX = 0f;
float offsetY = 0f;
private IEnumerator MoveAndResetCoroutine(ArrowConfig arrow)
{
float frameDelay = 0.01f;
int stepCount = 2;
int moved = 0;
int trackMaxIndex = arrow.totalTrack.Count - 1;
// 判断方向
if (Mathf.Abs(pEnd.x - pStart.x) > 1f)
string dir;
if (arrow.path != null && arrow.path.Count > 0)
{
offsetX = 10f;
dir = arrow.path[arrow.path.Count - 1];
}
else if (!string.IsNullOrEmpty(arrow.defaultDir))
{
dir = arrow.defaultDir;
}
else
{
offsetY = 10f;
dir = "up";
}
arrow.finalMoveDir = dir;
while (moved < stepCount)
{
for (int i = 0; i < arrow.lineUnits.Count; i++)
{
int curIdx = arrow.lineTrackIndex[i];
if (curIdx < trackMaxIndex)
{
curIdx++;
arrow.lineUnits[i].SetPosition(arrow.totalTrack[curIdx].x, arrow.totalTrack[curIdx].y, 0);
arrow.lineTrackIndex[i] = curIdx;
}
else
{
float dx = 0, dy = 0;
switch (arrow.finalMoveDir)
{
case "right": dx = 10; break;
case "left": dx = -10; break;
case "down": dy = 10; break;
case "up": dy = -10; break;
}
arrow.lineUnits[i].x += dx;
arrow.lineUnits[i].y += dy;
}
}
int arrowIdx = arrow.arrowTrackIndex;
if (arrowIdx < trackMaxIndex)
{
arrowIdx++;
arrow.arrowObj.SetPosition(arrow.totalTrack[arrowIdx].x, arrow.totalTrack[arrowIdx].y, 0);
arrow.arrowTrackIndex = arrowIdx;
}
else
{
float dx = 0, dy = 0;
switch (arrow.finalMoveDir)
{
case "right": dx = 10; break;
case "left": dx = -10; break;
case "down": dy = 10; break;
case "up": dy = -10; break;
}
arrow.arrowObj.x += dx;
arrow.arrowObj.y += dy;
}
moved++;
yield return new WaitForSeconds(frameDelay);
}
// 复位位置
for (int i = 0; i < arrow.lineUnits.Count; i++)
{
arrow.lineUnits[i].SetPosition(arrow.originalLinePos[i].x, arrow.originalLinePos[i].y, 0);
arrow.lineTrackIndex[i] = i;
}
// 单点/多点箭头统一读取原始坐标复位
arrow.arrowObj.SetPosition(arrow.originalArrowPos.x, arrow.originalArrowPos.y, 0);
arrow.arrowTrackIndex = arrow.totalTrack.Count - 1;
arrow.isMoving = false;
}
private void MoveToDisappear(ArrowConfig arrow)
{
CrazyAsyKit.StartCoroutine(MoveAndDisappearCoroutine(arrow));
}
private IEnumerator MoveAndDisappearCoroutine(ArrowConfig arrow)
{
float frameDelay = 0.01f;
int trackMaxIndex = arrow.totalTrack.Count - 1;
string dir;
if (arrow.path != null && arrow.path.Count > 0)
{
dir = arrow.path[arrow.path.Count - 1];
}
else if (!string.IsNullOrEmpty(arrow.defaultDir))
{
dir = arrow.defaultDir;
}
else
{
dir = "up";
}
arrow.finalMoveDir = dir;
while (true)
{
// 线条移动
for (int i = 0; i < arrow.lineUnits.Count; i++)
{
int curIdx = arrow.lineTrackIndex[i];
if (curIdx < trackMaxIndex)
{
curIdx++;
arrow.lineUnits[i].SetPosition(arrow.totalTrack[curIdx].x, arrow.totalTrack[curIdx].y, 0);
arrow.lineTrackIndex[i] = curIdx;
}
else
{
float dx = 0, dy = 0;
switch (arrow.finalMoveDir)
{
case "right": dx = 10; break;
case "left": dx = -10; break;
case "down": dy = 10; break;
case "up": dy = -10; break;
}
arrow.lineUnits[i].x += dx;
arrow.lineUnits[i].y += dy;
}
}
// 箭头移动
int arrowIdx = arrow.arrowTrackIndex;
if (arrowIdx < trackMaxIndex)
{
arrowIdx++;
arrow.arrowObj.SetPosition(arrow.totalTrack[arrowIdx].x, arrow.totalTrack[arrowIdx].y, 0);
arrow.arrowTrackIndex = arrowIdx;
}
else
{
float dx = 0, dy = 0;
switch (arrow.finalMoveDir)
{
case "right": dx = 10; break;
case "left": dx = -10; break;
case "down": dy = 10; break;
case "up": dy = -10; break;
}
arrow.arrowObj.x += dx;
arrow.arrowObj.y += dy;
}
// 边界判断
float curX = arrow.arrowObj.x;
float curY = arrow.arrowObj.y;
bool isOut = false;
switch (arrow.finalMoveDir)
{
case "right":
if (curX > gridRight + outOffset) isOut = true;
break;
case "left":
if (curX < gridLeft - outOffset) isOut = true;
break;
case "down":
if (curY > gridBottom + outOffset) isOut = true;
break;
case "up":
if (curY < gridTop - outOffset) isOut = true;
break;
}
if (isOut)
{
// 箭头移出屏幕,释放网格占用
ReleaseArrowOccupied(arrow);
// 隐藏视图
foreach (var line in arrow.lineUnits)
line.visible = false;
arrow.arrowObj.visible = false;
arrow.isMoving = false;
// ========== 新增:存活箭头-1,判断全部移除 ==========
_remainArrowCount--;
if (_remainArrowCount <= 0)
{
ShowResult(true);
}
yield break;
}
yield return new WaitForSeconds(frameDelay);
}
}
private void CreateLineUnitBetweenTwoPoint(Vector2 pStart, Vector2 pEnd, Color lineColor, List<GComponent> lineList)
{
if (_lineUnitTemplate == null) return;
float offsetX = 0f;
float offsetY = 0f;
if (Mathf.Abs(pEnd.x - pStart.x) > 1f)
offsetX = 10f;
else
offsetY = 10f;
Vector2 curPos = pStart;
// 循环6次,生成6个方块,从pStart一直覆盖到pEnd
for (int i = 0; i < 6; i++)
{
LineTile unit = LineTile.CreateInstance();
@@ -369,7 +859,6 @@ namespace ChillConnect
if (!arrow.isMoving) return;
List<Vector2> path = arrow.pathPointList;
// 全部走完,隐藏对象
if (arrow.targetIndex < 0)
{
arrow.isMoving = false;
@@ -382,24 +871,20 @@ namespace ChillConnect
Vector2 curPos = new Vector2(arrow.arrowObj.x, arrow.arrowObj.y);
float distance = Vector2.Distance(curPos, targetPos);
// 到达当前点位,切换下一个目标
if (distance < 2f)
{
arrow.targetIndex--;
}
else
{
// 向目标移动
Vector2 dir = (targetPos - curPos).normalized;
Vector2 newPos = curPos + dir * _moveSpeed * Time.deltaTime;
arrow.arrowObj.SetPosition(newPos.x, newPos.y,0);
arrow.arrowObj.SetPosition(newPos.x, newPos.y, 0);
}
// 刷新线条显隐
RefreshLineVisible(arrow);
}
/// <summary>逐段控制显隐,每段固定6个方块</summary>
private void RefreshLineVisible(ArrowConfig arrow)
{
int segIndex = 0;
@@ -439,14 +924,63 @@ namespace ChillConnect
}
}
#endregion
/// <summary>
/// 弹出结算
/// isSuccess: true=成功,false=失败
/// </summary>
private void ShowResult(bool isSuccess)
{
// 暂停所有交互/移动(可选)
foreach (var arrow in _levelConfig.arrows)
{
arrow.isMoving = false;
}
uiCtrlDispatcher.Dispatch(UICtrlMsg.LevelSuccessUI_Open, isSuccess);
}
// 重新开始本局
private void OnRestartGame(object a = null)
{
if (a!=null && (bool)a)
{
_heartCount = 3;
for (int i = _heartCount; i > 0; i--)
{
ui.HeartsPanel.GetChild($"xin_{i}").visible = true;
}
return;
}
// 先清空当前所有动态物体
ClearAllDynamicObj();
// 重新走初始化流程
InitGridBounds();
InitGridOccupied();
_heartCount = 3;
_collidedArrows.Clear();
_remainArrowCount = _levelConfig.arrows.Count;
DataMgr.ArrowResultLevel.Value = 1;
InitView();
}
#region
protected override void AddListener() { }
protected override void RemoveListener() { }
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.reset_game, OnRestartGame);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.reset_game, OnRestartGame);
}
#endregion
}
#region &
#region &
public static class JsonHelper
{
public static LevelConfig LoadLevel(string fileName)
@@ -455,9 +989,7 @@ namespace ChillConnect
return JsonUtility.FromJson<LevelConfig>(File.ReadAllText(path));
}
}
#endregion
#region &
[System.Serializable]
public class LevelConfig
{
@@ -465,7 +997,7 @@ namespace ChillConnect
public string levelName;
public int gridRows;
public int gridCols;
public int pointSpacing; // 配置内此字段仅保留兼容,实际间距以代码 60px 为准
public int pointSpacing;
public List<ArrowConfig> arrows;
}
@@ -478,12 +1010,20 @@ namespace ChillConnect
public string color;
public List<string> path;
// 运行时数据
public List<Vector2> pathPointList; // 整条路径所有点位坐标
public string defaultDir;
public List<Vector2> pathPointList;
public List<GComponent> lineUnits;
public GComponent arrowObj;
public List<GComponent> lineUnits; // 所有线条方块预制体
public bool isMoving;
public List<Vector2> originalLinePos;
public Vector2 originalArrowPos;
public int targetIndex;
public List<Vector2> totalTrack;
public List<int> lineTrackIndex;
public int arrowTrackIndex;
public string finalMoveDir;
}
#endregion
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2b9195d2166c47ca81e3c38917b2729a
timeCreated: 1781331027
@@ -0,0 +1,41 @@
namespace ChillConnect
{
public class GameAgainCtrl : BaseCtrl
{
public static GameAgainCtrl Instance { get; private set; }
private GameAgainModel model;
#region
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
#region
protected override void RemoveListener()
{
}
protected override void AddServerListener()
{
}
protected override void AddListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cee917424e204aeeb572fbd21d9a216a
timeCreated: 1781331027
@@ -0,0 +1,43 @@
namespace ChillConnect
{
public class GameAgainModel : 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,3 @@
fileFormatVersion: 2
guid: ba9f90a8f17245beb5fb93275fb663af
timeCreated: 1781331027
@@ -0,0 +1,91 @@
using System;
using FGUI.GameResult_08;
using UnityEngine;
namespace ChillConnect
{
public class GameAgainUI : BaseUI
{
private GameAgainUICtrl ctrl;
private GameAgainModel model;
private com_arrow_end_again ui;
private Action closeCallback;
public GameAgainUI(GameAgainUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.GameAgainUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "GameResult_08";
uiInfo.assetName = "com_arrow_end_again";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel;
}
protected override void OnClose()
{
}
//
protected override void OnBind()
{
ui = baseUI as com_arrow_end_again;
}
private SuccessData successData_;
protected override void OnOpenBefore(object args)
{
ui.btn_restart.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open);
CtrlCloseUI();
});
ui.btn_back.SetClick(() =>
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false);
CtrlCloseUI();
});
}
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;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cb749d47d61d49feb70387124d69b69f
timeCreated: 1781331027
@@ -0,0 +1,87 @@
using DG.Tweening;
namespace ChillConnect
{
public class GameAgainUICtrl : BaseUICtrl
{
private GameAgainUI ui;
private GameAgainModel model;
private uint openUIMsg = UICtrlMsg.GameAgainUI_Open;
private uint closeUIMsg = UICtrlMsg.GameAgainUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel;
}
protected override void OnDispose()
{
}
private object m_data;
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new GameAgainUI(this);
ui.Open(args);
}
else
{
m_data ??= args;
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
if (m_data != null)
{
DOVirtual.DelayedCall(0.2f, () =>
{
OpenUI(m_data);
m_data = 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,3 @@
fileFormatVersion: 2
guid: b83d7c197169420da4fb3e79d330a74d
timeCreated: 1781331027
@@ -10,6 +10,7 @@ using IgnoreOPS;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
using btn_claim = FGUI.Common_01.btn_claim;
using Random = UnityEngine.Random;
namespace ChillConnect
@@ -18,15 +19,10 @@ namespace ChillConnect
{
private GameResultUICtrl ctrl;
private GameResultModel model;
private com_end ui;
private bool IsWin;
private bool IsLevelSuccess;
private bool IsH5Reward;
private float AwardNum = 20;
private com_arrow_end ui;
private Action closeCallback;
private int AwardRate = 10;
public GameResultUI(GameResultUICtrl ctrl) : base(ctrl)
{
@@ -37,10 +33,10 @@ namespace ChillConnect
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "GameResult_08";
uiInfo.assetName = "com_end";
uiInfo.assetName = "com_arrow_end";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
@@ -53,282 +49,48 @@ namespace ChillConnect
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()
{
ui = baseUI as com_end;
ui = baseUI as com_arrow_end;
}
private SuccessData successData_;
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{//刘海屏
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, () =>
((btn_claim)ui.btn_watchAd).state.selectedIndex = DataMgr.ArrowResultLevel.Value == 1 ? 1 : 0;
((btn_claim)ui.btn_watchAd).title = DataMgr.ArrowResultLevel.Value == 1 ? "Free Revive" : "Revive";
ui.btn_watchAd.SetClick(() =>
{
if (DataMgr.ArrowResultLevel.Value == 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)
DataMgr.ArrowResultLevel.Value = 0;
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
}
else if (DataMgr.ArrowResultLevel.Value == 0)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.Victoriously);
GameHelper.ShowVideoAd("gameResult", success =>
{
if (success)
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
}
});
}
}
if (IsWin)
{
ui.win_lose.selectedIndex = ui._Win_lose_win;
}
else
{
ui.win_lose.selectedIndex = ui._Win_lose_lose;
ui.lab_lose_des.text = GameHelper.getDesByKey("game_resulte_1");
}
CtrlCloseUI();
});
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_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"); });
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameAgainUI_Open);
CtrlCloseUI();
});
}
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)
{
}
@@ -345,357 +107,12 @@ namespace ChillConnect
#region
protected override void AddListener()
{
HallManager.Instance.UpdateSecondEvent += timeEvent;
}
protected override void RemoveListener()
{
HallManager.Instance.UpdateSecondEvent -= timeEvent;
}
#endregion
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;
}
}
}
}
+66 -31
View File
@@ -8,53 +8,88 @@
{
"id": 1,
"startPoint": 0,
"endPoint": 30,
"endPoint": 25,
"color": "#FFFFFF",
"path": [
"right",
"right",
"down",
"down",
"left",
"down",
"left"
]
},
{
"id": 2,
"startPoint": 59,
"endPoint": 66,
"color": "#CCFF66",
"path": [
"left",
"left",
"up",
"left",
"right",
"right",
"right",
"down",
"down"
]
},
{
"id": 2,
"startPoint": 30,
"endPoint": 37,
"color": "#FFFFFF",
"path": [
"right",
"right",
"right",
"right",
"right",
"right",
"right"
]
},
{
"id": 3,
"startPoint": 78,
"endPoint": 0,
"color": "#FFFF00",
"path": []
"startPoint": 50,
"endPoint": 46,
"color": "#FFFFFF",
"path": [
"right",
"right",
"right",
"right",
"right",
"right",
"up"
]
},
{
"id": 4,
"startPoint": 62,
"endPoint": 53,
"color": "#0000FF",
"startPoint": 60,
"endPoint": 66,
"color": "#FFFFFF",
"path": [
"right",
"right",
"right",
"right",
"right",
"right"
]
},
{
"id": 5,
"startPoint": 93,
"endPoint": 73,
"color": "#FFFFFF",
"path": [
"up",
"up"
]
},
{
"id": 6,
"startPoint": 9,
"endPoint": 89,
"color": "#FFFFFF",
"path": [
"down",
"right",
"right",
"up",
"left",
"up",
"down",
"up"
"down",
"down",
"down",
"left",
"down",
"down",
"right",
"down"
]
}
]