コード例 #1
0
ファイル: BlockingPanel.cs プロジェクト: xAdamQ/Basra
    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);
    }
コード例 #2
0
ファイル: SignInPanel.cs プロジェクト: xAdamQ/Basra
    public void HuaweiSignIn()
    {
#if HMS
        BlockingPanel.Show("getting huawei info")
        .Forget(e => throw e);

        HMSAccountManager.Instance.SignIn();
#endif
    }
コード例 #3
0
 private void Awake()
 {
     if (instance == null || instance == this)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
     gameObject.SetActive(false);
 }
コード例 #4
0
ファイル: LobbyController.cs プロジェクト: xAdamQ/Basra
 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"));
     }
 }
コード例 #5
0
    /// <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;
        }
    }
コード例 #6
0
    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
    }
コード例 #7
0
ファイル: FullUserView.cs プロジェクト: xAdamQ/Basra
    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());
            }
        });
    }
コード例 #8
0
    public void StartRoomRpc(List <int> handCardIds, List <int> groundCardIds)
    {
        CoreGameplay.I.BeginGame(handCardIds, groundCardIds);

        BlockingPanel.Hide();
    }
コード例 #9
0
ファイル: SignInPanel.cs プロジェクト: xAdamQ/Basra
 private void OnHuaweiLoginFailure(HMSException exc)
 {
     BlockingPanel.Done("failed huawei login with exception: " + exc);
 }