ball 项目提交

This commit is contained in:
2026-04-20 12:06:34 +08:00
parent 4331ebba60
commit 99145facbd
6052 changed files with 576445 additions and 0 deletions
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
namespace BallKingdomCrush
{
public class RecordViewCtrl : BaseCtrl
{
public static RecordViewCtrl Instance { get; private set; }
private RecordViewModel model;
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5c219c03fd1474d73bd17b07c7df43c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace BallKingdomCrush
{
public class RecordViewModel : BaseModel
{
public List<string> recordList = new List<string>();
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8267bf1de4e9949828f446ca83bcacfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,184 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FutureCore;
using FairyGUI;
using FGUI.ZM_Common_01;
using System;
using DG.Tweening;
using FGUI.bkg_jilu;
using SGModule.Common.Extensions;
using Unity.VisualScripting;
namespace BallKingdomCrush
{
public class RecordViewUI : BaseUI
{
private RecordViewUICtrl ctrl;
private RecordViewModel model;
private FGUI.bkg_jilu.com_jilu ui;
public RecordViewUI(RecordViewUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.RecordViewUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "bkg_jilu";
uiInfo.assetName = "com_jilu";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
}
protected override void OnClose()
{
if (coroutine != null)
{
CrazyAsyKit.StopCoroutine(coroutine);
}
}
protected override void OnBind()
{
ui = baseUI as FGUI.bkg_jilu.com_jilu;
}
protected override void OnOpenBefore(object args)
{
InitView();
ui.btn_close.onClick.Add(() =>
{
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 bool isroll = false;
private List<GObject> list_panel = new List<GObject>();
// 初始化页面逻辑
private void InitView()
{
for (int i = 0; i < 9; i++)
{
GObject item = ui.panel.GetChild("item" + i);
list_panel.Add(item);
}
UpdateRecord();
}
private Coroutine coroutine = null;
public void UpdateRecord()
{
if (ctrl.model == null || ctrl.model.recordList.Count == 0) return;
for (int i = 0; i < ctrl.model.recordList.Count; i++)
{
if (i < list_panel.Count)
{
setRecord(i, list_panel[i]);
list_panel[i].visible = true;
}
}
if (ctrl.model.recordList.Count >= 9 && !isroll) // 注意这里应该是 9,因为 list_panel 只有 9 个元素
{
isroll = true;
coroutine = CrazyAsyKit.StartCoroutine(ScrollRoutine());
}
}
private void setRecord(int index, GObject obj)
{
com_record_item item = (com_record_item)obj;
string[] values = ctrl.model.recordList[index].Split('-');
item.name.text = values[0];
item.num.text = GameHelper.ChooseCurrency() + values[1]; // 假设 money 是显示金额的字段
string[] parts = values[2].Split(" ");
item.time.text = parts[0];
}
private IEnumerator ScrollRoutine()
{
while (true)
{
int panelCount = list_panel.Count; // 缓存 list_panel 的长度
for (int i = 0; i < panelCount; i++)
{
if (i < list_panel.Count) // 再次检查索引是否有效
{
float targetY = list_panel[i].y - 129;
GObjectMoveFunc.MoveTween(list_panel[i], targetY);
}
}
yield return new WaitForSeconds(1f); // 每隔1秒滚动一次
}
}
private void hideEvent(object sender = null)
{
}
private void showEvent(object sender = null)
{
}
}
// 定义一个非泛型静态类来包含扩展方法
public static class GObjectMoveFunc
{
public static void MoveTween(this GObject obj, float targetY, Action action = null)
{
obj.TweenMove(new Vector2(obj.x, targetY), 0.5f)
.SetEase((EaseType)Ease.Linear)
.OnComplete(() =>
{
if (targetY <= -16)
{
// 第一个 item 放到最后一个位置
obj.y = 1048;
}
});
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ead525ed41bd47bb87703021c40c757
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,97 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BallKingdomCrush
{
public class RecordViewUICtrl : BaseUICtrl
{
private RecordViewUI ui;
public RecordViewModel model;
private uint openUIMsg = UICtrlMsg.RecordViewUI_Open;
private uint closeUIMsg = UICtrlMsg.RecordViewUI_Close;
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.RecordViewModel) as RecordViewModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new RecordViewUI(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);
GameDispatcher.Instance.AddListener(GameMsg.updateRecordList, RefreshList);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
GameDispatcher.Instance.RemoveListener(GameMsg.updateRecordList, RefreshList);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
void RefreshList(object args = null)
{
if (args == null || model.recordList == null) return;
// Debug.Log($" barry refresh args == {args}");
// Debug.Log($" barry refresh list == {model.recordList.Count}");
if (model.recordList.Count >= 9)
{
model.recordList.RemoveAt(0);
}
model.recordList.Add(args.ToString());
ui?.UpdateRecord();
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4b262c4e5a954831be8cf5baf8aff72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: