1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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<BattleInviteManager>
- {
- // 收到向自己发起对战的玩家
- private HashSet<int> _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<ResponseSuccessData> action,Action<int,string> 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<PreparePageComp>().init(battleSession, enemyId);
- }
- public void ClosePreparePage()
- {
- _isPrepareOpening = false;
- }
- }
- }
|