yyl
7 小时以前 5d3366f2e0f687995eb7ad2107c4379fe7acd4e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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);
    }
}