Beispiel #1
0
 // Use this for initialization
 private void Start()
 {
     if (data == null)
     {
         data = Profile.Avatar.Current;
         UpdateVisual();
     }
 }
Beispiel #2
0
    public UiAvatar Setup(string json)
    {
        try
        {
            data = json.HasContent(3) ? JsonUtility.FromJson <ProfileData.AvatarData>(json) : new ProfileData.AvatarData();
        }
        catch { }

        return(Setup(data == null ? new ProfileData.AvatarData() : data));
    }
Beispiel #3
0
 public UiAvatar Setup(ProfileData.AvatarData avatar)
 {
     data = avatar;
     UpdateVisual();
     return(this);
 }
Beispiel #4
0
    public Popup_Rewards Setup(int ballId, int gems, int bombs, int hammers, int missiles, bool openChest = false, bool winClaim = false, System.Action onClose = null)
    {
        onCloseFunc = onClose;
        doOpenChest = openChest;

        if (ballId > 0)
        {
            var tmp = new ProfileData.AvatarData()
            {
                angle = Profile.Avatar.Angle
            };
            tmp.ballId = ballId;
            avatar.Setup(tmp);
        }
        else
        {
            avatar.gameObject.SetActive(false);
        }

        if (gems > 0)
        {
            rgems = gems;
        }
        else
        {
            gemsLabel.gameObject.SetActive(false);
        }
        if (bombs > 0)
        {
            rbombs = bombs;
        }
        else
        {
            bombsLabel.gameObject.SetActive(false);
        }
        if (hammers > 0)
        {
            rhammers = hammers;
        }
        else
        {
            hammersLabel.gameObject.SetActive(false);
        }
        if (missiles > 0)
        {
            rmissiles = missiles;
        }
        else
        {
            missilesLabel.gameObject.SetActive(false);
        }

        boosterContent.SetActive(bombs > 0 || hammers > 0 || missiles > 0);

        winClaimButton.gameObject.SetActive(winClaim && Online.Timer.GetRemainSeconds(GlobalConfig.Advertise.winClaim.timerId, GlobalConfig.Advertise.winClaim.interval) < 1);
        winClaimButton.onClick.AddListener(() =>
        {
            Game.Instance.OpenPopup <Popup_VideoAd>().Setup(GlobalConfig.Advertise.winClaim, "winclaim", success =>
            {
                if (success == false)
                {
                    return;
                }
                rtime = 0;
                winClaimButton.gameObject.SetActive(false);
                Online.Timer.Set(GlobalConfig.Advertise.winClaim.timerId, GlobalConfig.Advertise.winClaim.interval);
                rgems += GlobalConfig.Advertise.winClaim.rewardGems;
                Profile.EarnGems(GlobalConfig.Advertise.winClaim.rewardGems);
                GlobalAnalytics.SourceGem(GlobalConfig.Advertise.winClaim.rewardGems, "winclaim");
            });
        });

        return(this);
    }