Files
ft/Client/Assets/Scripts/Event1v1Battle/Panel/MainPanel/Event1v1BattleSlapContainerPanel.cs
2026-06-29 21:18:33 +08:00

72 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using Event1v1Battle.Data;
using game;
using GameCore;
using UIExtend.Component;
using UnityEngine;
namespace Event1v1Battle.Panel.MainPanel
{
public class Event1v1BattleSlapContainerPanel:BasePanel
{
#region ui
private Event1v1BattleSlapPanel _battleSlapPanel;
private Event1v1BattleSlapMatchPanel _battleSlapMatchPanel;
//private Event1v1BattleSlapTvPopupPanel _battleSlapTvPopupPanel;
#endregion
private Event1v1BattleSlapManager _manager;
private Event1v1BattleSlapData Data => _manager.LoadData();
private void Awake()
{
_battleSlapPanel = GetComponentInChildren<Event1v1BattleSlapPanel>(true);
//_battleSlapTvPopupPanel = GetComponentInChildren<Event1v1BattleSlapTvPopupPanel>(true);
_battleSlapMatchPanel = GetComponentInChildren<Event1v1BattleSlapMatchPanel>(true);
}
private void HideAllPanel()
{
_battleSlapPanel?.SetActive(false);
_battleSlapMatchPanel?.SetActive(false);
}
public Event1v1BattleSlapContainerPanel SetData(Event1v1BattleSlapManager manager)
{
_manager = manager;
return this;
}
public void ShowBattleSlapMatchPanel()
{
_battleSlapMatchPanel.SetData(Data);
_battleSlapMatchPanel.SetActive(true);
}
public void ShowBattleSlapPanel()
{
HideAllPanel();
// 必须先激活再 SetDataOnSetData 里会同步 PlayChestOpenAni → PlayableDirector.Play
// 若子面板仍为 inactiveTimeline 不会推进、画面上看不到开箱动画。
_battleSlapPanel.SetActive(true);
_battleSlapPanel.SetData(_manager);
}
public async void PlayRandomRpcAni()
{
try
{
ShowBattleSlapMatchPanel();
await _battleSlapMatchPanel.PlayMatchAnimationAsync();
UIManager.Instance.DestroyUI(UITypes.Event1v1BattleSlapPanel);
_manager.ShowLoadingPanel(Data);
}
catch (Exception e)
{
Debug.LogError(e);
}
}
}
}