提交小游戏项目

This commit is contained in:
2026-07-06 16:27:14 +08:00
commit 2a717c6a2f
7575 changed files with 710847 additions and 0 deletions
@@ -0,0 +1,25 @@
namespace TowerClimberChronicles
{
public class FlowerEndCtrl : BaseCtrl
{
public static FlowerEndCtrl Instance { get; private set; }
private FlowerEndModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.FlowerEndModel) as FlowerEndModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 055e23126ca424190977ebc99e800fb1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace TowerClimberChronicles
{
public class FlowerEndModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2b4fba0b005a448b792499de4643e49f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,477 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using Newtonsoft.Json;
using System.Collections.Generic;
using System;
using FGUI.LG_Common;
using DG.Tweening;
using SGModule.Common.Extensions;
using FGUI.Game_flower_end;
namespace TowerClimberChronicles
{
public class FlowerEndUI : BaseUI
{
private readonly List<GLoader> loader_list = new();
private readonly List<int> rate_list = new();
private Action closeCallback;
private List<item_wheel> list_1;
private int next_level;
private int rate_idnex = 3;
private int scroll_number;
private int scroll_type = 1;
private FlowerEndUICtrl ctrl;
private FlowerEndModel model;
private FGUI.Game_flower_end.com_flowerEnd ui;
public FlowerEndUI(FlowerEndUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.FlowerEndUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "Game_flower_end";
uiInfo.assetName = "com_flowerEnd";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
private void InitView()
{
ui.tetx_level.text = "level " + successData_.level;
ui.text_award.text = successData_.ch_number.ToString();
Debug.Log(JsonConvert.SerializeObject(successData_) + "/////////////////");
Debug.Log("/////////////////4");
// if (!successData_.IsWin) ui.text_award.text = DataMgr.Coin.Value.ToString();
Debug.Log(GetNextSpecialLevel());
next_level = GetNextSpecialLevel();
var levelUnlock_ = ConfigSystem.GetConfig<LevelUnlock>()[next_level];
if (levelUnlock_.LeveType == 1)
ui.text_levelType.text = "Special level";
else if (levelUnlock_.LeveType == 2) ui.text_levelType.text = "VIP level";
ui.progress_level.max = next_level;
ui.progress_level.value = successData_.level;
// if (successData_.IsLevelSuccess && successData_.level == next_level)
// //打开解锁界面
// ui.btn_continue.SetClick(() =>
// {
// uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, next_level);
// });
// else
ui.btn_continue.SetClick(() =>
{
if (GameHelper.GetLevel() >= GameHelper.GetCommonModel().MultiModal)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open);
is_unlock_level = true;
CtrlCloseUI();
}
else
{
CtrlCloseUI();
}
});
((btn_claim4)ui.btn_claim).title = $"{successData_.ch_number}";
var delayTime = successData_.IsLevelSuccess ? 1f : 0f;
if (!successData_.IsWin)
{
delayTime = 0f;
ui.win_lose.selectedIndex = 0;
}
else
{
ui.win_lose.selectedIndex = 1;
}
if (!GameHelper.IsGiftSwitch()) delayTime = 0;
ui.step.selectedIndex = !successData_.IsLevelSuccess || !successData_.IsWin ? 1 : 0;
Debug.Log("/////////////////5");
DOVirtual.DelayedCall(delayTime, () =>
{
Debug.Log(delayTime);
Debug.Log("/////////////////6");
ui.step.selectedIndex = 1;
if (successData_.IsWin)
{
// var anim_bg = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("bg_parent") as GGraph,
// Fx_Type.fx_gamwin, ref closeCallback);
// anim_bg.state.SetAnimation(0, "selamat", false);
// anim_bg.state.Complete += trackEntry => { anim_bg.state.SetAnimation(0, "selamat_idle", true); };
// var fireworks = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("congra_parent") as GGraph, Fx_Type.fx_win, ref closeCallback);
// fireworks.state.SetAnimation(0, "out", true);
// var coin = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("coin_parent") as GGraph, Fx_Type.fx_wins, ref closeCallback);
// coin.state.SetAnimation(0, "animation", true);
// coin.state.Complete += (trackEntry) =>
// {
// coin.state.SetAnimation(0, "animation2", true);
// };
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetCommonConf().FreeClaims)
((btn_claim3)ui.btn_mult).state.selectedIndex = 1;
else ((btn_claim3)ui.btn_mult).state.selectedIndex = 0;
ui.btn_mult.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetCommonConf().FreeClaims)
{
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
SaveData.SaveDataFunc();
StartScroll();
}
else
{
GameHelper.ShowVideoAd("GameEnd", isSuccess =>
{
if (isSuccess)
{
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
StartScroll();
}
});
}
});
ui.btn_claim.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
DOVirtual.DelayedCall(2f, () => { GameHelper.addInterAdnumber(); });
GetReward(successData_.ch_number);
});
// ui.win_lose.selectedIndex = 1;
AudioManager.Instance.PlayDynamicEffect(AudioConst.Victoriously);
}
else
{
// ui.win_lose.selectedIndex = 0;
ui.btn_restart.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
DOVirtual.DelayedCall(0.1f, () =>
{
GameHelper.addInterAdnumber();
GameDispatcher.Instance.Dispatch(GameMsg.FlowerReset);
CtrlCloseUI();
});
});
}
});
if (GameHelper.GetVipPrivilege(Subscription.DoubleLevelReward.As<int>())) ((wheel)ui.wheel).have_vip.selectedIndex = 1;
if (successData_.boost_array != null)
{
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title =
GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[rate_idnex % 5]);
});
ui.btn_mult.title =
GameHelper.Get101Str((decimal)successData_.ch_number * successData_.boost_array[rate_idnex]);
list_1 = new List<item_wheel>
{
((wheel_)ui.wheel.GetChild("wheel_")).item_0, ((wheel_)ui.wheel.GetChild("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 (var 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];
}
}
}
private void StartScroll()
{
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale =
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale = 5.0f;
scroll_type = 2;
}
private void Scroll()
{
if (scroll_type == 1)
{
scroll_number++;
rate_list.Clear();
for (var i = 0; i < 8; i++)
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
for (var 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];
}
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[
rate_idnex % successData_.boost_array.Length]);
});
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
}
else
{
scroll_number++;
rate_list.Clear();
for (var i = 0; i < 8; i++)
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
// bool need_return = false;
if (((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale < 2.2f &&
list_1[4].text_rate.text == "X" + successData_.rate)
{
//开始领取
var reward = successData_.ch_number * successData_.rate;
if (GameHelper.GetVipPrivilege(Subscription.DoubleLevelReward.As<int>())) reward *= 2;
GetReward(reward);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
SaveData.GetSaveObject().LargeRewardNum++;
SaveData.SaveDataFunc();
return;
}
for (var i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + rate_list[i];
}
// if (need_return)
// {
// (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 0;
// return;
// }
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[
rate_idnex % successData_.boost_array.Length]);
});
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale =
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale - 0.3f;
}
}
private void GetReward(float awardNum)
{
var startObj = ui.btn_mult;
var endObj = ui.btn_gold;
var pos = GameHelper.GetUICenterPosition(endObj);
var rewardData = new RewardData();
var rewardSingleData = new RewardSingleData(101, (decimal)awardNum, RewardOrigin.Play)
{
startPosition = GameHelper.GetUICenterPosition(startObj),
endPosition = new Vector2(pos.x, pos.y)
};
rewardData.AddReward(rewardSingleData);
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
rewardData.AddCompleted(success =>
{
if (success)
{
RefreshAwardNum((decimal)awardNum, 101);
if (successData_.IsLevelSuccess)
{
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open);
DOVirtual.DelayedCall(0.1f, () =>
{
CtrlCloseUI();
GameDispatcher.Instance.Dispatch(GameMsg.FlowerReset);
});
}
}
});
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
}
private void RefreshAwardNum(decimal num = -1, int id = 102)
{
if (num < 0) num = DataMgr.Coin.Value;
var btnCoin = ui.btn_gold as com_gold;
var gTextField = btnCoin.text_gold;
CommonHelper.ShowNumAnim(gTextField, num, id);
}
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.NewEndModel) as NewEndModel;
}
private bool is_unlock_level = false;
protected override void OnClose()
{
GameHelper.SetCloseResult(false);
closeCallback?.Invoke();
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, successData_.IsWin);
// if (!is_unlock_level)
// {
// if (successData_.IsLevelSuccess && !GameHelper.is_first_login)
// else
// GameDispatcher.Instance.Dispatch(GameMsg.CheckEnd);
// }
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
loader_list.Clear();
// MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_flowerEnd;
}
private LevelUnlock LevelData;
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0) ui.btn_gold.y += 68;
Debug.Log("//////////////////////0");
Debug.Log(JsonConvert.SerializeObject(args));
successData_ = (SuccessData)args;
successData_.ch_number = (int)successData_.ch_number;
// 修改后的代码
var levelDataList = ConfigSystem.GetConfig<LevelUnlock>();
var levelIndex = successData_.level - 1;
// 确保索引不超出范围,如果超出则使用最后一个元素
if (levelDataList is { Count: > 0 })
{
if (levelIndex >= 0 && levelIndex < levelDataList.Count)
LevelData = levelDataList[levelIndex];
else
// 超出范围后,使用最后一个元素
LevelData = levelDataList[^1];
}
else
{
Debug.LogError("LevelUnlockModel DataList is null or empty");
}
Debug.Log("//////////////////////1");
// var btnDownCoin = ((btn_unlock_1)ui.btn_download_coin);
// var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
// btnDownCoin.title = downloadCoinNum.ToString();
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
// if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
// {
// ((FGUI.LG_Common.btn_claim)ui.btn_download).have_vip.selectedIndex = 1;
// ui.is_vip.selectedIndex = 1;
// }
// else
// {
// ui.is_vip.selectedIndex = 0;
// btnDownCoin.down_load.selectedIndex = 1;
// }
Debug.Log("//////////////////////2");
if (GameHelper.IsGiftSwitch() && successData_.IsLevelSuccess)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
GameHelper.PlayGameTimeEvent(1, () => { GameHelper.RequestGameConfig(); });
}
else
{
GameHelper.SetCloseResult(true);
}
Debug.Log("//////////////////////3");
InitView();
}
private int GetNextSpecialLevel()
{
var now_level = successData_.level;
var list_ = ConfigSystem.GetConfig<LevelUnlock>();
for (var i = now_level; i < list_.Count; i++)
if (list_[i].LeveType != 0)
return i;
return 0;
}
private SuccessData successData_;
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
public void OnUpdate101(object a = null)
{
com_gold btn_gold = ui.btn_gold as com_gold;
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
}
protected override void AddListener()
{
// GameDispatcher.Instance.AddListener(GameMsg.UnlockLevelsuccess, UnlockLevelsuccess);
GameDispatcher.Instance.AddListener(GameMsg.Update101, OnUpdate101);
}
protected override void RemoveListener()
{
// GameDispatcher.Instance.RemoveListener(GameMsg.UnlockLevelsuccess, UnlockLevelsuccess);
GameDispatcher.Instance.RemoveListener(GameMsg.Update101, OnUpdate101);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28164f2eacef94bbca8711b3baf1149b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,73 @@
namespace TowerClimberChronicles
{
public class FlowerEndUICtrl : BaseUICtrl
{
private FlowerEndUI ui;
private FlowerEndModel model;
private uint openUIMsg = UICtrlMsg.FlowerEndUI_Open;
private uint closeUIMsg = UICtrlMsg.FlowerEndUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.FlowerEndModel) as FlowerEndModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new FlowerEndUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34a7d0f43e25448139fc5739870e45cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: