public static async UniTask Show(string message = null, Action dismissButtonAction = null) { if (i) { Destroy(i.gameObject); } //you can remove this to support multiple panels //but the new should draw over the old i = (await Addressables.InstantiateAsync("blockingPanel", ProjectReferences.I.Canvas)) .GetComponent <BlockingPanel>(); if (dismissButtonAction != null) { i.dismissButton.onClick.AddListener(() => dismissButtonAction()); //if you want to reuse the same object make sure to save and remove this i.dismissButton.gameObject.SetActive(true); } else { i.dismissButton.gameObject.SetActive(false); } i.messageText.text = message ?? ""; animTween = i.waitImage.transform.DORotate(Vector3.forward * 180, 2f) .SetLoops(9999, LoopType.Yoyo); }
public void HuaweiSignIn() { #if HMS BlockingPanel.Show("getting huawei info") .Forget(e => throw e); HMSAccountManager.Instance.SignIn(); #endif }
private void Awake() { if (instance == null || instance == this) { instance = this; } else { Destroy(this); } gameObject.SetActive(false); }
public void RespondChallenge(bool response) { if (!response) { BlockingPanel.Hide(); Toast.I.Show(Translatable.GetText("player_rejected")); } else { BlockingPanel.HideDismiss(); //panel is removed at start Toast.I.Show(Translatable.GetText("creating_room")); } }
/// <summary> /// uses BlockingPanel /// </summary> public async UniTask Start(UniTask operation) { await BlockingPanel.Show(); try { await operation; BlockingPanel.Hide(); } catch (BadUserInputException) //todo test if you can get bad user input exc here { BlockingPanel.Done("operation is not allowed"); throw; } }
public async void RequestRandomRoom(int betChoice) { if (Repository.I.PersonalFullInfo.Money < RoomSettings.Bets[betChoice]) { Toast.I.Show(Translatable.GetText("no_money")); return; } await BlockingOperationManager.I.Start( Controller.I.RequestRandomRoom(betChoice, capacityChoiceButton.CurrentChoice)); BlockingPanel.Show("finding players") .Forget(e => throw e); //this is shown even if the room is started, it's removed before game start directly }
public void Challenge() { if (Repository.I.PersonalFullInfo.Money < RoomSettings.MinBet) { Toast.I.Show(Translatable.GetText("no_money")); } UniTask.Create(async() => { var res = await Controller.I.InvokeAsync <MatchRequestResult>("RequestMatch", Id); if (res == MatchRequestResult.Available) { BlockingPanel.Show("a challenge request is sent to the player", () => Controller.I.Send("CancelChallengeRequest")) .Forget(e => throw e); } else { Toast.I.Show(res.ToString()); } }); }
public void StartRoomRpc(List <int> handCardIds, List <int> groundCardIds) { CoreGameplay.I.BeginGame(handCardIds, groundCardIds); BlockingPanel.Hide(); }
private void OnHuaweiLoginFailure(HMSException exc) { BlockingPanel.Done("failed huawei login with exception: " + exc); }