Esempio n. 1
0
    public void SetIcon(AchievementTypeEnum type, string iconKey, string iconKeyRemark, Material material)
    {
        if (ivIcon == null)
        {
            return;
        }
        Sprite spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(iconKey);

        if (spIcon != null)
        {
            ivIcon.sprite = spIcon;
        }
        else
        {
            ivIcon.sprite = spIconUnknow;
        }
        ivIcon.material = material;
        //设置备用图标
        if (!CheckUtil.StringIsNull(iconKeyRemark))
        {
            Sprite spIconRemark = IconDataHandler.Instance.manager.GetIconSpriteByName(iconKeyRemark);
            if (spIconRemark != null)
            {
                ivIconRemark.sprite = spIconRemark;
            }
            ivIconRemark.gameObject.SetActive(true);
            ivIconRemark.material = material;
        }
        else
        {
            ivIconRemark.gameObject.SetActive(false);
        }
    }
Esempio n. 2
0
        public static string GetDescription(this AchievementTypeEnum achievementType)
        {
            var type       = typeof(AchievementTypeEnum);
            var memInfo    = type.GetMember(achievementType.ToString());
            var attributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);

            return(((DescriptionAttribute)attributes[0]).Description);
        }
Esempio n. 3
0
        public void TryToGiveAchievement(string userID, AchievementTypeEnum achievementType)
        {
            if (achievementRepository.Exists(userID, achievementType))
            {
                return;
            }

            achievementRepository.Add(new Entities.Achievement()
            {
                UserID            = userID,
                AchievementTypeID = (int)achievementType,
                AddDate           = DateTime.Now
            });
            achievementRepository.SaveChanges();
        }
Esempio n. 4
0
    public void SetIcon(AchievementTypeEnum type, string iconKey, string iconKeyRemark)
    {
        Sprite spIcon;

        spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(iconKey);

        if (spIcon != null && ivIcon != null && ivRemark != null)
        {
            ivIcon.sprite = spIcon;
            switch (status)
            {
            case AchievementStatusEnum.Completed:
                ivIcon.material   = null;
                ivRemark.material = null;
                break;

            case AchievementStatusEnum.Processing:
            case AchievementStatusEnum.ToBeConfirmed:
                ivIcon.material   = materialGray;
                ivRemark.material = materialGray;
                break;
            }
        }

        //设置备用图标
        if (ivRemark != null && !CheckUtil.StringIsNull(iconKeyRemark))
        {
            ivRemark.gameObject.SetActive(true);
            Sprite spIconRemark = IconDataHandler.Instance.manager.GetIconSpriteByName(iconKey);
            if (spIconRemark != null)
            {
                ivRemark.sprite = spIconRemark;
            }
        }
        else
        {
            ivRemark.gameObject.SetActive(false);
        }
    }
Esempio n. 5
0
 public bool Exists(string userID, AchievementTypeEnum achievementType)
 {
     return(Any(a => a.UserID == userID && a.AchievementTypeID == (int)achievementType));
 }