94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
|
|
|
|
|
public class BattleRecordInfo
|
|
{
|
|
public int isSucess;
|
|
public int carrer;
|
|
public string name;
|
|
public int rank;
|
|
public int rankChange;
|
|
public int endTime;
|
|
public int attackOrDefend;
|
|
public BattleRecordInfo(int IsSucess, int Carrer, string Name, int Rank, int RankChange, int EndTime, int AttackOrDefend)
|
|
{
|
|
isSucess = IsSucess;
|
|
carrer = Carrer;
|
|
name = Name;
|
|
rank = Rank;
|
|
rankChange = RankChange;
|
|
endTime = EndTime;
|
|
attackOrDefend = AttackOrDefend;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public class BattleInfoRecordPanelCtr : MonoBehaviour {
|
|
|
|
public static BattleInfoRecordPanelCtr Instance;
|
|
void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
#region
|
|
//对手信息预设体
|
|
public GameObject enemyInfoItemPrefab;
|
|
public Transform prefabParent;
|
|
#endregion
|
|
|
|
private List<EnemyInfoItem> enemyInfoitemList = new List<EnemyInfoItem>();
|
|
|
|
private List<GameObject> prefabList = new List<GameObject>();
|
|
//初始化对战记录中对手的信息
|
|
public void InitEnemyInfoItem(GC_RET_USER_CHALLENGE_LOG packet)
|
|
{
|
|
ClearAllPrefab();
|
|
for (int index = 0; index < packet.challengeLogCount; index++)
|
|
{
|
|
BattleRecordInfo info = new BattleRecordInfo(packet.GetChallengeLog(index).SuccessFailFlag,
|
|
packet.GetChallengeLog(index).Career,
|
|
packet.GetChallengeLog(index).Name,
|
|
packet.GetChallengeLog(index).Rank +1,
|
|
packet.GetChallengeLog(index).RankChange,
|
|
packet.GetChallengeLog(index).EndTm,
|
|
packet.GetChallengeLog(index).AttackDefenceFlag);
|
|
|
|
//初始化挑战记录Item
|
|
GameObject enemyInfoPrefab = GameObject.Instantiate(enemyInfoItemPrefab);
|
|
|
|
enemyInfoPrefab.transform.SetParent(prefabParent);
|
|
enemyInfoPrefab.transform.localPosition = Vector3.zero;
|
|
enemyInfoPrefab.transform.localScale = Vector3.one;
|
|
enemyInfoPrefab.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|
|
|
prefabList.Add(enemyInfoPrefab);
|
|
enemyInfoPrefab.GetComponent<EnemyInfoItem>().InitEnemyRankInfo(info);
|
|
}
|
|
}
|
|
|
|
void ClearAllPrefab()
|
|
{
|
|
for(int index = 0; index < prefabList.Count; index++)
|
|
{
|
|
GameObject.Destroy(prefabList[index].gameObject);
|
|
}
|
|
prefabList.Clear();
|
|
}
|
|
|
|
public void CloseBtnClick()
|
|
{
|
|
UIManager.CloseUI(UIInfo.BattleInfoRecordPanel);
|
|
}
|
|
|
|
|
|
}
|