using System; using System.Collections.Generic; using Api; using Plugins.CxShine.page; using Plugins.CxShine.Singleton; using UnityEngine; namespace UI.BattleRequest { public class BattleInviteManager : ScriptSingleton { // 收到向自己发起对战的玩家 private HashSet _invitePlayerIds = new(); public bool isAlreayHasPeople(int id) { return (_invitePlayerIds.Contains(id)); } public void RemoveInvitePlayerId(int id) { _invitePlayerIds.Remove(id); } private bool _isPrepareOpening; public void InviteBattle(int player,Action action,Action errrAction) { ApiComp.Instance.InviteBattleToPlayer(player,action,errrAction); } public void AddPlayerId(int invitePlayerPlayerId) { _invitePlayerIds.Add(invitePlayerPlayerId); } public bool isPrepareOpening() { return _isPrepareOpening; } public void Open(GameObject PreparePagePrefab, string battleSession, int enemyId) { _isPrepareOpening = true; _invitePlayerIds.Clear(); var p = PageManagerComp.singleton.OpenPage(PreparePagePrefab); p.GetComponent().init(battleSession, enemyId); } public void ClosePreparePage() { _isPrepareOpening = false; } } }