调整编队页面UI组件结构,完善更新ui视图方法
This commit is contained in:
@@ -1,20 +1,37 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
//适用于编队 列表
|
||||
public class teamCharacterView : MonoBehaviour
|
||||
{
|
||||
public GameObject character;
|
||||
public GameObject controlButton;
|
||||
public Image levelIcon;
|
||||
public Image charcterImg;
|
||||
public Image leaderStatusIcon;
|
||||
public TMP_Text skillName;
|
||||
|
||||
public GameObject isLeader;
|
||||
public GameObject notLeader;
|
||||
|
||||
public bool isSelected =false;
|
||||
public int listIndex;
|
||||
// private TeamManager teamManager= TeamManager.Instance;
|
||||
|
||||
void Start()
|
||||
{
|
||||
{
|
||||
character = gameObject;
|
||||
controlButton = transform.Find("move").gameObject;
|
||||
levelIcon = transform.Find("Level").GetComponent<Image>();
|
||||
charcterImg = transform.Find("Character").GetComponent<Image>();
|
||||
skillName = transform.Find("SkillName").GetComponent<TMP_Text>();
|
||||
isLeader = transform.Find("isLeader").gameObject;
|
||||
notLeader = transform.Find("notLeader").gameObject;
|
||||
controlButton.SetActive(isSelected);
|
||||
Debug.Log("teamCharacterView Start,"+isSelected+","+listIndex);
|
||||
//Debug.Log("teamCharacterView Start,"+isSelected+","+listIndex);
|
||||
}
|
||||
/// <summary>
|
||||
/// 单机team列表内对象时触发选定
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using utils;
|
||||
|
||||
public class teamSettingPanel : MonoBehaviour
|
||||
{
|
||||
@@ -13,6 +14,7 @@ public class teamSettingPanel : MonoBehaviour
|
||||
|
||||
private TeamManager teamManager;
|
||||
|
||||
|
||||
public static teamSettingPanel Instance{get;private set;}
|
||||
|
||||
void Awake()
|
||||
@@ -54,11 +56,21 @@ public class teamSettingPanel : MonoBehaviour
|
||||
public void updateTeamSettingElements()
|
||||
{
|
||||
//todo:向保存编队信息的类获取编队信息,然后重新处理teamElementsObj的信息
|
||||
List<Character> currentTeam = teamManager.getCurrentTeam();
|
||||
// foreach (Character character in currentTeam)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
List<Character> currentTeam = teamManager.getCurrentSelectedTeam();
|
||||
for (int i = 0; i < teamElementsObj.Length && i < currentTeam.Count; i++)
|
||||
{
|
||||
if(teamElementsObj[i]!=null && currentTeam[i]!=null)
|
||||
{
|
||||
teamCharacterView t = teamElementsObj[i].GetComponent<teamCharacterView>();
|
||||
if(t!=null)
|
||||
{
|
||||
t.charcterImg.sprite = FileUtils.getImage("TeamCharacters/TeamCharacterImg/" + currentTeam[i].name);
|
||||
t.levelIcon.sprite = FileUtils.getImage("TeamCharacters/levelIcon/level" + currentTeam[i].boundaryLevel);
|
||||
t.isLeader.SetActive(currentTeam[i].isLeader);
|
||||
t.notLeader.SetActive(!currentTeam[i].isLeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user