基础生成跟排序,开始处理遮罩图
This commit is contained in:
parent
65507bbb4c
commit
11e94dd99b
File diff suppressed because one or more lines are too long
@ -1311,8 +1311,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: -54.83155}
|
||||
m_SizeDelta: {x: 1080, y: 109.6631}
|
||||
m_AnchoredPosition: {x: 540, y: -54.5}
|
||||
m_SizeDelta: {x: 1080, y: 109}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &3182275938344351334
|
||||
GameObject:
|
||||
|
@ -7,9 +7,26 @@ namespace GameLogic
|
||||
{
|
||||
public class ActorHItem : UIWidget
|
||||
{
|
||||
|
||||
|
||||
public int m_Index;
|
||||
|
||||
private long m_AllScore;
|
||||
|
||||
protected override void OnCreate()
|
||||
{
|
||||
base.OnCreate();
|
||||
}
|
||||
|
||||
|
||||
public void OnInit(int i)
|
||||
{
|
||||
m_Index = i;
|
||||
m_AllScore = 100 * i;
|
||||
}
|
||||
public long GetAllPower()
|
||||
{
|
||||
return m_AllScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,6 @@ namespace GameLogic
|
||||
Dictionary<string, string> dis = new Dictionary<string, string>();
|
||||
dis.Add("type", "hb");
|
||||
dis.Add("data", "ping");
|
||||
Log.Debug("心跳包{0}", dis.ToJson());
|
||||
m_WebSocket.SendAsync(dis.ToJson());
|
||||
}
|
||||
}, 5, true);
|
||||
|
@ -62,23 +62,22 @@ namespace GameLogic
|
||||
|
||||
DataGameSceneManager.Instance.SetGameState(true);
|
||||
|
||||
//// 设置顶部条
|
||||
////m_img_topTitle.sprite = EventConts.gameStateType == GameStateType.个人赛 ? GameModule.Resource.LoadAsset<Sprite>("Z_jfc_box") :
|
||||
//// GameModule.Resource.LoadAsset<Sprite>("Z_jfc_box_2");
|
||||
//m_text_TopTitle.text = EventConts.gameStateType == GameStateType.个人赛 ? "发送加入即可参与" : "发送加入+数字或者加入+姓氏即可参与";
|
||||
|
||||
//// 设置礼物UI(不同平台)
|
||||
//m_img_GiftImg.sprite = GameModule.Resource.LoadAsset<Sprite>("Z_LW_gift_" + (int)EventConts.PlatformType);
|
||||
|
||||
//// 刷新
|
||||
//UpdateGameTiemr();
|
||||
//UpdateGameScoreValue();
|
||||
// 刷新
|
||||
UpdateGameTiemr();
|
||||
UpdateGameScoreValue();
|
||||
//RestHItemFunc();
|
||||
|
||||
// 创建横板列表
|
||||
for (int i = 0; i < DataGameSceneManager.Instance.m_Strs.Count; i++)
|
||||
{
|
||||
ActorHItem actorHItem = CreateWidgetByPrefab<ActorHItem>(m_itemActorHItem, m_rectHPanel);
|
||||
var r = actorHItem.gameObject.GetComponent<RectTransform>();
|
||||
// 计算位置
|
||||
r.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
r.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
r.anchoredPosition = new Vector2(0, 478 - i * (109 - 5f));
|
||||
r.localPosition = new Vector3(r.localPosition.x, r.localPosition.y, 0);
|
||||
actorHItem.OnInit(i);
|
||||
DataGameSceneManager.Instance.m_TeamSortList.Add(actorHItem);
|
||||
}
|
||||
|
||||
@ -267,42 +266,51 @@ namespace GameLogic
|
||||
/// </summary>
|
||||
private void UpdateHItem()
|
||||
{
|
||||
//// Create a list to hold the HItemActors and their scores
|
||||
//List<(HItemActor actor, long score)> hItemActors = new List<(HItemActor, long)>();
|
||||
// Create a list to hold the HItemActors and their scores
|
||||
List<(ActorHItem actor, long score)> hItemActors = new List<(ActorHItem, long)>();
|
||||
|
||||
//// Populate the list with HItemActors and their scores
|
||||
//for (int i = 0; i < m_rect_List.childCount; i++)
|
||||
//{
|
||||
// var child = m_rect_List.GetChild(i);
|
||||
// if (child != null)
|
||||
// {
|
||||
// var hItemActor = child.GetComponent<HItemActor>();
|
||||
// long score = hItemActor.GetAllPower(); // Assume GetScore() returns the score of the actor
|
||||
// hItemActors.Add((hItemActor, score));
|
||||
// }
|
||||
//}
|
||||
// Populate the list with HItemActors and their scores
|
||||
for (int i = 0; i < m_rectHPanel.childCount; i++)
|
||||
{
|
||||
// var child = m_rectHPanel.GetChild(i);
|
||||
// if (child != null)
|
||||
// {
|
||||
// var hItemActor = child.GetComponent<ActorHItem>();
|
||||
// long score = hItemActor.GetAllPower(); // Assume GetScore() returns the score of the actor
|
||||
// hItemActors.Add((hItemActor, score));
|
||||
// }
|
||||
|
||||
//// Sort the list based on scores in descending order
|
||||
//hItemActors.Sort((a, b) => b.score.CompareTo(a.score));
|
||||
if (i < DataGameSceneManager.Instance.m_TeamSortList.Count)
|
||||
{
|
||||
var hItemActor = DataGameSceneManager.Instance.m_TeamSortList[i];
|
||||
long score = hItemActor.GetAllPower(); // Assume GetScore() returns the score of the actor
|
||||
hItemActors.Add((hItemActor, score));
|
||||
}
|
||||
|
||||
//// Set the target positions for the HItemActors based on their new order
|
||||
//for (int i = 0; i < hItemActors.Count; i++)
|
||||
//{
|
||||
// var hItemActor = hItemActors[i].actor;
|
||||
// hItemActor.m_Index = i + 1;
|
||||
// var rectTransform = hItemActor.GetComponent<RectTransform>();
|
||||
// Vector2 targetPosition = new Vector2(0, 151 - i * 50.5945f);
|
||||
// targetPositions[rectTransform] = targetPosition;
|
||||
//}
|
||||
|
||||
//if (hItemActors.Count > 0)
|
||||
//{
|
||||
// UpdateTopActorTest(hItemActors[0].actor.m_Actor);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// UpdateTopActorTest(null);
|
||||
//}
|
||||
}
|
||||
|
||||
// Sort the list based on scores in descending order
|
||||
hItemActors.Sort((a, b) => b.score.CompareTo(a.score));
|
||||
|
||||
// Set the target positions for the HItemActors based on their new order
|
||||
for (int i = 0; i < hItemActors.Count; i++)
|
||||
{
|
||||
var hItemActor = hItemActors[i].actor;
|
||||
hItemActor.m_Index = i + 1;
|
||||
var rectTransform = hItemActor.gameObject.GetComponent<RectTransform>();
|
||||
Vector2 targetPosition = new Vector2(0, 478 - i * (109 - 5f));
|
||||
targetPositions[rectTransform] = targetPosition;
|
||||
}
|
||||
|
||||
// if (hItemActors.Count > 0)
|
||||
// {
|
||||
// UpdateTopActorTest(hItemActors[0].actor.m_Actor);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UpdateTopActorTest(null);
|
||||
// }
|
||||
}
|
||||
|
||||
private void CreateHItem(string oid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user