Ejemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="obj"></param>
    private void SetSenderInfo(GetPlayerProfileResult obj)
    {
        if (!String.IsNullOrEmpty(obj.PlayerProfile.DisplayName))
        {
            InvitationSender.text = obj.PlayerProfile.DisplayName;
        }

        if (obj.PlayerProfile.ContactEmailAddresses.Count > 0)
        {
            Debug.Log("000 Contact email > 0");
            var _str = obj.PlayerProfile.ContactEmailAddresses[0].EmailAddress;

            Debug.Log("000 Email Address :" + obj.PlayerProfile.ContactEmailAddresses[0].EmailAddress);

            if (!String.IsNullOrEmpty(_str))
            {
                var _str1 = PlayfabPlayerProfile.StringSplitter(_str);

                Debug.Log("000 not null");

                if (_str1 != null && _str.Length >= 7)
                {
                    int _avatarIndex = Int32.Parse(_str1[0]);
                    Debug.Log("000 Avatar Index" + _avatarIndex);

                    if (_avatarIndex != 0)
                    {
                        InvitationSendersAvatar.sprite = HazariPlayersCountryFlag.Instance.GetAvatarSprite(_avatarIndex);
                    }
                    else
                    {
                        Debug.Log("000 Facebook Image");
                        if (!String.IsNullOrEmpty(obj.PlayerProfile.AvatarUrl))
                        {
                            Debug.Log("000 Avatar Url :" + obj.PlayerProfile.AvatarUrl);
                            Davinci.get().load(obj.PlayerProfile.AvatarUrl).setFadeTime(0f).into(InvitationSendersAvatar).start();
                        }
                        else
                        {
                            InvitationSendersAvatar.sprite = HazariPlayersCountryFlag.Instance.GetAvatarSprite(1);
                        }
                    }
                }

                else
                {
                    InvitationSendersAvatar.sprite = HazariPlayersCountryFlag.Instance.GetAvatarSprite(1);
                }
            }

            else
            {
                InvitationSendersAvatar.sprite = HazariPlayersCountryFlag.Instance.GetAvatarSprite(1);
            }
        }
        else
        {
            InvitationSendersAvatar.sprite = HazariPlayersCountryFlag.Instance.GetAvatarSprite(1);
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        //Use setFadeTime to set fading animation time. Set 0 for disable fading.

        Davinci.get()
        .load(url)
        .setLoadingPlaceholder(loadingSpr)
        .setErrorPlaceholder(errorSpr)
        .into(image_1)
        .setFadeTime(2)
        .start();

        Davinci.get()
        .load(url)
        .setLoadingPlaceholder(loadingSpr)
        .setErrorPlaceholder(errorSpr)
        .into(image_2)
        .setFadeTime(5)
        .start();

        Davinci.get()
        .load(url)
        .setFadeTime(0)    //disable fading
        .setLoadingPlaceholder(loadingSpr)
        .setErrorPlaceholder(errorSpr)
        .into(image_3)
        .start();
    }
Ejemplo n.º 3
0
 public void Init(ImmersiveItemsResultData data)
 {
     itemsData = data;
     btnAction.onClick.AddListener(OnClickItems);
     Davinci.get()
     .load(itemsData.image)
     .setLoadingPlaceholder(imgPlaceholder)
     .setCached(true)
     .into(imgThumbnails)
     .start();
 }
Ejemplo n.º 4
0
 private void Start()
 {
     Davinci.get()
     .load(imgUrl)
     .into(sprite)
     .setLoadingPlaceholder(loadingSpr)
     .setErrorPlaceholder(errorSpr)
     .setFadeTime(2f)
     .setCached(false)
     .start();
 }
Ejemplo n.º 5
0
        public void SetSponsorButton(ImmersiveItemsResultData contentData)
        {
            m_sponsorButton[0].onClick.RemoveAllListeners();
            if (!string.IsNullOrWhiteSpace(contentData.sponsor.sponsor_1_image))
            {
                Davinci.get()
                .load(contentData.sponsor.sponsor_1_image)
                .setCached(true)
                .into(m_sponsorButton[0].GetComponentInChildren <Image>())
                .start();

                if (!string.IsNullOrWhiteSpace(contentData.sponsor.sponsor_1_link))
                {
                    m_sponsorButton[0].onClick.AddListener(delegate
                    {
                        OpenSponsorLink(contentData.sponsor.sponsor_1_link);
                    });
                }
                m_sponsorButton[0].gameObject.SetActive(true);
            }
            else
            {
                m_sponsorButton[0].gameObject.SetActive(false);
            }

            m_sponsorButton[1].onClick.RemoveAllListeners();
            if (!string.IsNullOrWhiteSpace(contentData.sponsor.sponsor_2_image))
            {
                Davinci.get()
                .load(contentData.sponsor.sponsor_2_image)
                .setCached(true)
                .into(m_sponsorButton[1].GetComponentInChildren <Image>())
                .start();

                if (!string.IsNullOrWhiteSpace(contentData.sponsor.sponsor_2_link))
                {
                    m_sponsorButton[1].onClick.AddListener(delegate
                    {
                        OpenSponsorLink(contentData.sponsor.sponsor_2_link);
                    });
                }
                m_sponsorButton[1].gameObject.SetActive(true);
            }
            else
            {
                m_sponsorButton[1].gameObject.SetActive(false);
            }
        }
Ejemplo n.º 6
0
    private void Start()
    {
        //use setLoadingSprite and setError sprite to set placeholders

        Davinci.get()
        .load(correctUrl)
        .setLoadingPlaceholder(loadingSpr)
        .setErrorPlaceholder(errorSpr)
        .setCached(false)
        .into(image_1)
        .start();

        Davinci.get()
        .load(wrongUrl)
        .setLoadingPlaceholder(loadingSpr)
        .setErrorPlaceholder(errorSpr)
        .setCached(false)
        .into(image_2)
        .start();
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Downloads the image with the given url (if it has been already downloaded then it is instead loaded from the cached file).
    /// </summary>
    public void DownloadImage()
    {
        Debug.LogFormat("Getting image: ", updatingImageTime.imageURL);
        imageDownloaded = false;

        Davinci.get()
        .load(updatingImageTime.imageURL)
        .into(spriteRenderer)
        .setLoadingPlaceholder(loadingTexture)
        .withDownloadProgressChangedAction((progress) =>
        {
            OnImageDowladingProgress?.Invoke(progress);
        })
        .withDownloadedAction(() =>
        {
            OnImageDownloaded?.Invoke();
        })
        .withLoadedAction(() =>
        {
            OnImageLoaded?.Invoke();
        })
        .withErrorAction((error) =>
        {
            OnImagedUpdatingError?.Invoke(error);
        })
        .withEndAction(() =>
        {
            OnImagedUpdatedSuccessfully?.Invoke();
            updatingImageTime.SetUpdatingTime();
            SaveUpdatingImageTime();

            imageDownloaded = true;
        })
        .setCached(true)
        .setFadeTime(0)
        .start();
    }
 private void Start()
 {
     //Use with... to add callbacks
     Davinci.get()
     .load(imageUrl)
     .into(image)
     .withStartAction(() =>
     {
         statusTxt.text = "Download has been started.";
     })
     .withDownloadProgressChangedAction((progress) =>
     {
         statusTxt.text = "Download progress: " + progress;
     })
     .withDownloadedAction(() =>
     {
         statusTxt.text = "Download has been completed.";
     })
     .withLoadedAction(() =>
     {
         statusTxt.text = "Image has been loaded.";
     })
     .withErrorAction((error) =>
     {
         statusTxt.text = "Got error : " + error;
     })
     .withEndAction(() =>
     {
         print("Operation has been finished.");
     })
     .setLoadingPlaceholder(loadingSpr)
     .setErrorPlaceholder(errorSpr)
     .setFadeTime(0.8f)
     .setCached(false)
     .start();
 }
Ejemplo n.º 9
0
    public void SetPlayerInfo(PlayerProfileModel profile)
    {
        if (profile == null)
        {
            Destroy(gameObject);
        }

        if (profile.ContactEmailAddresses.Count > 0 && !string.IsNullOrEmpty(profile.ContactEmailAddresses[0].EmailAddress))
        {
            var _str = PlayfabConstants.Instance.StringSplitter(profile.ContactEmailAddresses[0].EmailAddress);


            //  if (string.IsNullOrEmpty(profile.DisplayName))
            //      playerDisplayName.text = profile.DisplayName;

            int _avatarIndex = Int32.Parse(_str[0]);

            if (_avatarIndex != 0)
            {
                playerProfilePic.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[_avatarIndex - 1];
            }
            else
            {
                if (String.IsNullOrEmpty(profile.AvatarUrl))
                {
                    playerProfilePic.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[0];
                }
                else
                {
                    Davinci.get().load(profile.AvatarUrl).setFadeTime(0f).into(playerProfilePic).start();
                }
            }
        }

        CountryFlag.sprite = HazariPlayersCountryFlag.Instance.GetCountryFlag((int)profile.Locations[0].CountryCode);
    }
Ejemplo n.º 10
0
        public void SetPlayerInfo(PlayerProfileModel profile)
        {
            if (profile == null)
            {
                Destroy(gameObject);
            }

            ChallengeButtonText.text = IsOnline ? "Challenge" : "Invite";

            if (PlayfabConstants.Instance.MyPlayfabID != null && PlayfabID == PlayfabConstants.Instance.MyPlayfabID)
            {
                Destroy(gameObject);
            }


            if (profile.ContactEmailAddresses.Count <= 0)
            {
                Destroy(gameObject);
            }

            else
            {
                if (string.IsNullOrEmpty(profile.ContactEmailAddresses[0].EmailAddress))
                {
                    Destroy(gameObject);
                }

                else
                {
                    var _str = PlayfabConstants.Instance.StringSplitter(profile.ContactEmailAddresses[0].EmailAddress);

                    //  if (!(_str[6] == "0" || _str[6] == "4" || _str[6] == "5")) { }// Destroy(gameObject);
                    //else
                    if (true)
                    {
                        //if (IsOnline && !(_str[6] == "0" || _str[6] == "4" || _str[6] == "5")) { ChallengeButton.gameObject.SetActive(false); }
                        PlayerName.text = profile.DisplayName;

                        int _avatarIndex = Int32.Parse(_str[0]);

                        if (_avatarIndex != 0)
                        {
                            PlayerAvatar.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[_avatarIndex - 1];
                        }
                        else
                        {
                            if (String.IsNullOrEmpty(profile.AvatarUrl))
                            {
                                PlayerAvatar.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[0];
                            }
                            else
                            {
                                Davinci.get().load(profile.AvatarUrl).setFadeTime(0f).into(PlayerAvatar).start();
                            }
                        }

                        PlayerCountryFlag.sprite = HazariPlayersCountryFlag.Instance.GetCountryFlag((int)profile.Locations[0].CountryCode);
                        No.text = PlayfabConstants.Instance.OnlineFriendCounter.ToString();
                        PlayfabConstants.Instance.OnlineFriendCounter++;

                        if (IsOnline && _str.Length >= 7)
                        {
                            SetCurrentOnlineState(_str[6]);
                        }
                        else
                        {
                            string   _lastLogin         = _str[2] + "/" + _str[3] + "/" + _str[1] + " " + _str[4] + ":" + _str[5];
                            DateTime _lastLoginDateTime = DateTime.ParseExact(_lastLogin, "MM/dd/yyyy HH:mm", null);

                            if ((ServerTime - _lastLoginDateTime).TotalMinutes < 60)
                            {
                                PlayerActivityStatus.text = Convert.ToInt32((ServerTime - _lastLoginDateTime).TotalMinutes) + " Minutes Ago";
                                ChallengeButton.gameObject.SetActive(true);
                            }
                            else if ((ServerTime - _lastLoginDateTime).TotalHours < 24)
                            {
                                PlayerActivityStatus.text = Convert.ToInt32((ServerTime - _lastLoginDateTime).TotalHours) + " Hours Ago";
                                ChallengeButton.gameObject.SetActive(true);
                            }
                            else
                            {
                                PlayerActivityStatus.text = "A While Ago";
                                ChallengeButton.gameObject.SetActive(true);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void SetPlayerInfo(PlayerProfileModel profile)
        {
            if (profile == null)
            {
                Destroy(gameObject);
            }

            if (PlayfabConstants.Instance.MyPlayfabID != null && PlayfabID == PlayfabConstants.Instance.MyPlayfabID)
            {
                Destroy(gameObject);
            }


            if (profile.ContactEmailAddresses.Count <= 0)
            {
                Destroy(gameObject);
            }

            else
            {
                if (string.IsNullOrEmpty(profile.ContactEmailAddresses[0].EmailAddress))
                {
                    Destroy(gameObject);
                }

                else
                {
                    bool _isOnline = IsOnline(profile);
                    ActivityIcon.color = _isOnline ? onlineColor : offlineColor;

                    var _str = PlayfabConstants.Instance.StringSplitter(profile.ContactEmailAddresses[0].EmailAddress);

                    if (_str.Length < 7)
                    {
                        Destroy(gameObject);
                    }

                    if (_isOnline)
                    {
                        SetCurrentOnlineState(_str[6]);
                    }

                    PlayerName.text = profile.DisplayName;

                    int _avatarIndex = Int32.Parse(_str[0]);

                    if (_avatarIndex != 0)
                    {
                        PlayerAvatar.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[_avatarIndex - 1];
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(profile.AvatarUrl))
                        {
                            PlayerAvatar.sprite = HazariPlayersCountryFlag.Instance.LocalAvatars[0];
                        }
                        else
                        {
                            Davinci.get().load(profile.AvatarUrl).setFadeTime(0f).into(PlayerAvatar).start();
                        }
                    }

                    PlayerCountryFlag.sprite = HazariPlayersCountryFlag.Instance.GetCountryFlag((int)profile.Locations[0].CountryCode);
                    //No.text = PlayfabConstants.Instance.OnlineFriendCounter.ToString();
                }
            }
        }
    private void ShowForumList(JsonData data)
    {
        for (int i = 0; i < container.childCount; i++)
        {
            Destroy(container.GetChild(i).gameObject);
        }

        for (int i = 0; i < data["getData"][0]["TopPlayers"].Count; i++)
        {
            GameObject gm1 = Instantiate(TopPlayerContentPrefab, container) as GameObject;


            switch (i)
            {
            case 0:
                gm1.GetComponent <TopPlayerUIContent>().rankTxt.text = (i + 1).ToString();
                GameObject g = Instantiate(gm1.GetComponent <TopPlayerUIContent>().topRankImagePrefabs[0], gm1.GetComponent <TopPlayerUIContent>().rankTxt.transform) as GameObject;
                break;

            case 1:
                gm1.GetComponent <TopPlayerUIContent>().rankTxt.text = (i + 1).ToString();
                GameObject g1 = Instantiate(gm1.GetComponent <TopPlayerUIContent>().topRankImagePrefabs[1], gm1.GetComponent <TopPlayerUIContent>().rankTxt.transform) as GameObject;

                break;

            case 2:
                gm1.GetComponent <TopPlayerUIContent>().rankTxt.text = (i + 1).ToString();
                GameObject g2 = Instantiate(gm1.GetComponent <TopPlayerUIContent>().topRankImagePrefabs[2], gm1.GetComponent <TopPlayerUIContent>().rankTxt.transform) as GameObject;

                break;

            default:
                gm1.GetComponent <TopPlayerUIContent>().rankTxt.text = (i + 1).ToString();
                break;
            }
            gm1.GetComponent <TopPlayerUIContent>().nameTxt.text = data["getData"][0]["TopPlayers"][i]["userName"].ToString();


            if (data["getData"][0]["TopPlayers"][i]["frameURL"] != null)
            {
                Debug.Log("Here IMAGE is COME   " + data["getData"][0]["TopPlayers"][i]["frameURL"].ToString());
                Davinci.get()
                .load(data["getData"][0]["TopPlayers"][i]["frameURL"].ToString())
                .setLoadingPlaceholder(loadingSpr)
                .setErrorPlaceholder(errorSpr)
                .setCached(false)
                .into(gm1.GetComponent <TopPlayerUIContent>().nameImage)
                .start();
            }

            switch (playerTypeVal)
            {
            case "LOBBY":
                gm1.GetComponent <TopPlayerUIContent>().goldTxt.text = data["getData"][0]["TopPlayers"][i]["TotalWinnings"].ToString();

                break;

            case "MTT":
                gm1.GetComponent <TopPlayerUIContent>().goldTxt.text = data["getData"][0]["TopPlayers"][i]["TotalScore"].ToString();

                break;

            case "CLUB":
                gm1.GetComponent <TopPlayerUIContent>().goldTxt.text = data["getData"][0]["TopPlayers"][i]["TotalWinnings"].ToString();

                break;

            case "BANKROLL":
                gm1.GetComponent <TopPlayerUIContent>().goldTxt.text = data["getData"][0]["TopPlayers"][i]["TotalCoins"].ToString();

                break;
            }
            Debug.Log("Here the Count of value  ----   " + data["getData"][1]["MyRank"].ToString());

            myRankTxt.text   = "My Rank " + data["getData"][1]["MyRank"].ToString();
            usernameTxt.text = PlayerManager.instance.GetPlayerGameData().userName;
        }
    }
Ejemplo n.º 13
0
 private void Start()
 {
     //Simple usage - Single line of code and ready to go!
     Davinci.get().load(imageUrl).into(image).start();
 }