fix:1、添加项目。2、基本箭头生成
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RecordViewCtrl : BaseCtrl
|
||||
{
|
||||
public static RecordViewCtrl Instance { get; private set; }
|
||||
|
||||
private BroadcastModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 309a1f9ae9b5e4806a88119483aae60b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
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: 08862663f3fc44a2699dfee1d4457363
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using FairyGUI;
|
||||
using FGUI.bkg_jilu;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class RecordViewUI : BaseUI
|
||||
{
|
||||
private RecordViewUICtrl ctrl;
|
||||
private RecordViewModel model;
|
||||
private 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 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;
|
||||
|
||||
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;
|
||||
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.getChString(decimal.Parse(values[1]));
|
||||
string[] parts = values[2].Split(" ");
|
||||
item.time.text = parts[0];
|
||||
item.lab_claim.text = GameHelper.getDesByKey("ww");
|
||||
}
|
||||
|
||||
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 - 110;
|
||||
list_panel[i].MoveTween(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 = 890;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f261e91a349934363a83ea2d8b646270
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChillConnect
|
||||
|
||||
{
|
||||
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: fe9dfaba5759b45d682ba26f2079da06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user