处理部分闭环逻辑
This commit is contained in:
parent
26832b730a
commit
77058ba582
@ -602,7 +602,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0.004945713, y: -0.00032158243}
|
m_AnchoredPosition: {x: 0.00038004026, y: -0.00032158243}
|
||||||
m_SizeDelta: {x: 0, y: 1292.4}
|
m_SizeDelta: {x: 0, y: 1292.4}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!114 &6944785608262845692
|
--- !u!114 &6944785608262845692
|
||||||
@ -764,6 +764,13 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 3a61ef7d593880141b038ffc2c45e67d, type: 3}
|
m_Script: {fileID: 11500000, guid: 3a61ef7d593880141b038ffc2c45e67d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
m_HeadIcon: {fileID: 4392786442847295306}
|
||||||
|
m_RankImg: {fileID: 3886915729302914564}
|
||||||
|
m_Name: {fileID: 7363701821129859374}
|
||||||
|
m_Score: {fileID: 6758929203519133182}
|
||||||
|
m_LoaclScore: {fileID: 6795924212604387844}
|
||||||
|
m_WinCount: {fileID: 8169080446283399744}
|
||||||
|
m_RankIndex: {fileID: 7943501947076435089}
|
||||||
--- !u!114 &4487970101200929661
|
--- !u!114 &4487970101200929661
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -2,6 +2,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TEngine;
|
using TEngine;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
@ -42,14 +43,67 @@ namespace GameLogic
|
|||||||
#region 事件
|
#region 事件
|
||||||
private void OnClick_RankBtn()
|
private void OnClick_RankBtn()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
private void OnClick_CloseBtn()
|
private void OnClick_CloseBtn()
|
||||||
{
|
{
|
||||||
|
// 返回主界面
|
||||||
}
|
}
|
||||||
private void OnClick_RestBtn()
|
private void OnClick_RestBtn()
|
||||||
{
|
{
|
||||||
|
// 重新开始
|
||||||
|
GameModule.UI.CloseUI<UIGameRankForm>();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
List<PlayRankData> m_PlayRankDatas;
|
||||||
|
|
||||||
|
protected override void OnCreate()
|
||||||
|
{
|
||||||
|
base.OnCreate();
|
||||||
|
|
||||||
|
m_PlayRankDatas = UserData as List<PlayRankData>;
|
||||||
|
|
||||||
|
m_loopListView_View.InitListView(m_PlayRankDatas.Count, OnGetItemByIndex);
|
||||||
|
m_loopListView_View.SetListItemCount(m_PlayRankDatas.Count);
|
||||||
|
m_loopListView_View.RefreshAllShownItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Close()
|
||||||
|
{
|
||||||
|
base.Close();
|
||||||
|
|
||||||
|
|
||||||
|
Log.Debug("UIGameRankForm Close");
|
||||||
|
DataGameSceneManager.Instance.OnRestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LoopListViewItem OnGetItemByIndex(LoopListView listView, int index)
|
||||||
|
{
|
||||||
|
if (index >= m_PlayRankDatas.Count)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (m_PlayRankDatas[index] == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnitPlayerData unitData = DataGameSceneManager.Instance.GetUnitPlayerData(m_PlayRankDatas[index].uid);
|
||||||
|
|
||||||
|
if (unitData == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoopListViewItem item = listView.AllocOrNewListViewItem("RankItem");
|
||||||
|
UIGameRankItem itemScript = item.GetComponent<UIGameRankItem>();
|
||||||
|
|
||||||
|
itemScript.OnInit(index, m_PlayRankDatas[index], unitData);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TEngine;
|
using TEngine;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -9,21 +10,15 @@ namespace GameLogic
|
|||||||
public class UIGameRankItem : MonoBehaviour
|
public class UIGameRankItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
private RawImage m_HeadIcon;
|
public RawImage m_HeadIcon;
|
||||||
private Text m_Name;
|
public Image m_RankImg;
|
||||||
private Text m_Score;
|
public TextMeshProUGUI m_Name;
|
||||||
private Text m_WinCount;
|
public TextMeshProUGUI m_Score;
|
||||||
private Text m_RankIndex;
|
public TextMeshProUGUI m_LoaclScore;
|
||||||
void Awake()
|
public TextMeshProUGUI m_WinCount;
|
||||||
{
|
public TextMeshProUGUI m_RankIndex;
|
||||||
m_HeadIcon = transform.Find("Mask/HeadImg").GetComponent<RawImage>();
|
|
||||||
m_Name = transform.Find("Name").GetComponent<Text>();
|
|
||||||
m_Score = transform.Find("Score").GetComponent<Text>();
|
|
||||||
m_WinCount = transform.Find("WinCount").GetComponent<Text>();
|
|
||||||
m_RankIndex = transform.Find("Rank").GetComponent<Text>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnInit(int i, PlayRankData playRankData, GameRankType gameRankType, UnitPlayerData unitPlayer)
|
public void OnInit(int i, PlayRankData playRankData, UnitPlayerData unitPlayer)
|
||||||
{
|
{
|
||||||
m_Name.text = playRankData.name;
|
m_Name.text = playRankData.name;
|
||||||
|
|
||||||
@ -38,21 +33,8 @@ namespace GameLogic
|
|||||||
m_WinCount.text = UITool.ConvertToString(playRankData.winCount).ToString();
|
m_WinCount.text = UITool.ConvertToString(playRankData.winCount).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (gameRankType)
|
|
||||||
{
|
|
||||||
case GameRankType.当局排行榜:
|
|
||||||
m_RankIndex.text = (i + 1).ToString();
|
m_RankIndex.text = (i + 1).ToString();
|
||||||
m_Score.text = UITool.ConvertToString(unitPlayer.m_Score);
|
m_Score.text = UITool.ConvertToString(unitPlayer.m_Score);
|
||||||
break;
|
|
||||||
case GameRankType.本周排行榜:
|
|
||||||
m_RankIndex.text = playRankData.rank.ToString(); // 请求排行榜数据的时候已经划分了
|
|
||||||
m_Score.text = UITool.ConvertToString(playRankData.score).ToString();
|
|
||||||
break;
|
|
||||||
case GameRankType.本月排行榜:
|
|
||||||
m_Score.text = UITool.ConvertToString(playRankData.score).ToString();
|
|
||||||
m_RankIndex.text = playRankData.rank.ToString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置头像
|
// 设置头像
|
||||||
AsyncImageDownload.Instance.SetAsyncImage(playRankData.avatar, m_HeadIcon);
|
AsyncImageDownload.Instance.SetAsyncImage(playRankData.avatar, m_HeadIcon);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user