104 lines
2.8 KiB
C#
104 lines
2.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
public class PvpResultPanel : MonoBehaviour {
|
|
|
|
public static PvpResultPanel Instance;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
ResetRemainTime();
|
|
}
|
|
|
|
private float _RemainTime = 0.0f;
|
|
void ResetRemainTime()
|
|
{
|
|
_RemainTime = int.Parse(TableManager.GetSystemParamByID(46, 0).StringValue);
|
|
_RemainTimeText.text = _RemainTime.ToString();
|
|
|
|
StartCoroutine(CountRemainTime());
|
|
}
|
|
|
|
IEnumerator CountRemainTime()
|
|
{
|
|
while (true)
|
|
{
|
|
yield return new WaitForSeconds(1.0f);
|
|
_RemainTime--;
|
|
_RemainTimeText.text = _RemainTime.ToString();
|
|
if (_RemainTime <= 0)
|
|
{
|
|
yield break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private List<HonorBattlefieldFightFinishPlayerInfo> _WinInfoList;
|
|
private List<HonorBattlefieldFightFinishPlayerInfo> _DefeatInfoList;
|
|
public void OnPacket(RespHonorBattlefieldFightFinishInfo packet)
|
|
{
|
|
_WinItemContainer.gameObject.SetActive(false);
|
|
_DefeatItemContainer.gameObject.SetActive(false);
|
|
_WinInfoList = new List<HonorBattlefieldFightFinishPlayerInfo>();
|
|
_DefeatInfoList = new List<HonorBattlefieldFightFinishPlayerInfo>();
|
|
var _IsWin = false;
|
|
for (int index = 0; index < packet.UserList.Count; index++)
|
|
{
|
|
if((ulong)packet.UserList[index].Guid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid)
|
|
{
|
|
_IsWin = packet.UserList[index].IsWin == 1;
|
|
}
|
|
|
|
if(packet.UserList[index].IsWin == 1)
|
|
{
|
|
_WinInfoList.Add(packet.UserList[index]);
|
|
}else
|
|
{
|
|
_DefeatInfoList.Add(packet.UserList[index]);
|
|
}
|
|
}
|
|
|
|
if(_IsWin)
|
|
{
|
|
_WinItemContainer.gameObject.SetActive(true);
|
|
_DefeatItemContainer.gameObject.SetActive(false);
|
|
_WinItemContainer.InitContentItem(_WinInfoList);
|
|
}
|
|
else
|
|
{
|
|
_WinItemContainer.gameObject.SetActive(false);
|
|
_DefeatItemContainer.gameObject.SetActive(true);
|
|
_DefeatItemContainer.InitContentItem(_DefeatInfoList);
|
|
}
|
|
|
|
_ScoreVal.text = "+" + packet.ScoreBase;
|
|
_ExtraScoreVal.text = "+" + packet.ScoreWins;
|
|
}
|
|
|
|
public Text _ScoreVal;
|
|
public Text _ExtraScoreVal;
|
|
|
|
public UIContainerBase _WinItemContainer;
|
|
public UIContainerBase _DefeatItemContainer;
|
|
public Text _RemainTimeText;
|
|
public void OnCloseBtn()
|
|
{
|
|
UIManager.CloseUI(UIInfo.PvpResultPanel);
|
|
}
|
|
|
|
|
|
}
|