Exemplo n.º 1
0
        public async void init()
        {
            if (EventsController.advFound)
            {
                CancelInvoke();
                Texture2D txt = new Texture2D(1, 1);
                Sprite    newSprite;
                PanelLookingForPlayer.SetActive(false);
                PanelPlayerFound.SetActive(true);
                opponent_username.text = adversaireName;
                opponent_avatar.sprite = await UserManager.Get.getAvatar(Avatar);

                try
                {
                    var mTexture = await UserManager.Get.GetFlagBytes(AdvCountryCode);

                    newSprite            = Sprite.Create(mTexture, new Rect(0f, 0f, mTexture.width, mTexture.height), Vector2.zero);
                    opponent_flag.sprite = newSprite;
                }
                catch (NullReferenceException)
                {
                }
                Versus_background.SetBool("StopBG", true);
                Versus_container.SetActive(true);
            }
        }
Exemplo n.º 2
0
 public void ResetOpponent()
 {
     PanelLookingForPlayer.SetActive(true);
     PanelPlayerFound.SetActive(false);
     Versus_container.SetActive(false);
     opponent_username.text = string.Empty;
     opponent_flag.sprite   = null;
     opponent_avatar.sprite = null;
 }
Exemplo n.º 3
0
    public void init()
    {
        UserManager um      = new UserManager();
        UserManager manager = new UserManager();

        UnityThreadHelper.CreateThread(() =>
        {
            if (EventsController.advFound == true)
            {
                Byte[] lnByte = manager.getAvatar(Avatar);
                UnityThreadHelper.Dispatcher.Dispatch(() =>
                {
                    CancelInvoke();
                    Texture2D txt = new Texture2D(1, 1);
                    Sprite newSprite;
                    PanelLookingForPlayer.SetActive(false);
                    PanelPlayerFound.transform.localScale = Vector3.one;
                    challengeManager       = new ChallengeManager();
                    opponent_username.text = adversaireName;
                    Byte[] img;
                    opponent_avatar.sprite = ImagesManager.getSpriteFromBytes(lnByte);
                    try
                    {
                        img = Convert.FromBase64String(manager.GetFlagByte(AdvCountryCode));
                        txt.LoadImage(img);
                        newSprite            = Sprite.Create(txt as Texture2D, new Rect(0f, 0f, txt.width, txt.height), Vector2.zero);
                        opponent_flag.sprite = newSprite;
                    }
                    catch (NullReferenceException ex)
                    {
                    }
                    Versus_background.SetBool("StopBG", true);
                    Versus_container.SetActive(true);
                });
            }
        });
    }