using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using DG.Tweening;
|
using Cysharp.Threading.Tasks;
|
|
public class BattleWin : UIBase
|
{
|
// 组件引用
|
public Transform mountPoint;
|
|
private BattleRootNode battleRootNode = null;
|
|
public Button btnStop;
|
|
private BattleField battleField;
|
|
// 生命周期
|
protected override void InitComponent()
|
{
|
base.InitComponent();
|
// 初始化组件引用 绑定按钮等UI组件事件
|
|
btnStop.AddListener(PauseGame);
|
}
|
|
private void PauseGame()
|
{
|
Debug.LogError("PauseeGame");
|
if (null == battleField)
|
return;
|
|
battleField.IsPause = !battleField.IsPause;
|
|
Debug.LogError(" is pause " + battleField.IsPause.ToString());
|
}
|
|
protected override void OnPreOpen()
|
{
|
base.OnPreOpen();
|
|
SetBattleField(BattleManager.Instance.storyBattleField);
|
|
|
}
|
|
protected override void OnPreClose()
|
{
|
base.OnPreClose();
|
UIManager.Instance.CloseWindow<BattleHUDWin>();
|
}
|
|
protected override void OnOpen()
|
{
|
base.OnOpen();
|
}
|
|
protected override void OnClose()
|
{
|
base.OnClose();
|
|
if (battleRootNode != null)
|
{
|
battleRootNode.transform.SetParent(null);
|
}
|
|
battleField = null;
|
}
|
|
protected override void NextFrameAfterOpen()
|
{
|
base.NextFrameAfterOpen();
|
}
|
|
protected override void CompleteClose()
|
{
|
base.CompleteClose();
|
}
|
|
public void SetBattleField(BattleField _battleField)
|
{
|
battleField = _battleField;
|
if (battleRootNode != null)
|
{
|
battleRootNode.transform.SetParent(Launch.Instance.transform);
|
}
|
|
battleRootNode = battleField.battleRootNode;
|
|
battleRootNode.transform.SetParent(mountPoint);
|
battleRootNode.transform.localPosition = Vector3.zero;
|
battleRootNode.transform.localScale = Vector3.one;
|
|
BattleHUDWin ui = UIManager.Instance.GetUI<BattleHUDWin>();
|
|
if (null == ui)
|
{
|
ui = UIManager.Instance.OpenWindow<BattleHUDWin>();
|
}
|
|
ui.SetBattleField(battleField);
|
}
|
}
|