Example #1
0
    public override void Init()
    {
        DelayUnloadAtlas = 0.2f;

        GuideManager.RegisterModule(this);

        new AssetLoader().LoadAudio(AssetLoader.GetBackgrounMusicById("battleBgm"),
                                    (clip, loader) => { AudioManager.Instance.PlayBackgroundMusic(clip); });

        AutoUnloadAtlas = false;

        _battlePanel = new BattlePanel();
        _battlePanel.Init(this);
        _battlePanel.Show(0);

        _battleCommon = InstantiateView("Battle/Prefabs/Panels/BattleCommon");
        _battleCommon.transform.SetParent(Parent.transform, false);

        _battleFinalBg = InstantiateView("Battle/FinalEstimate/FinalEstimateViewBg");
        _battleFinalBg.transform.SetParent(Parent.transform, false);
        _battleFinalBg.transform.SetSiblingIndex(0);
        _battleFinalBg.Hide();

        SetProgress(0, MaxPower);
    }
    public void ChangePanels(BattlePanel targetPanel)
    {
        //Hide the old panel
        if (currentPanel != null)
        {
            currentPanel.Hide();
        }

        //Show the new panel
        currentPanel = targetPanel;

        if (currentPanel != null)
        {
            currentPanel.Show();
        }
    }