コード例 #1
0
        public void RefreshAchievementProgress(LogicClientAvatar avatar, LogicAchievementData data, int value)
        {
            if (this.m_level.GetState() != 5)
            {
                int currentValue = avatar.GetAchievementProgress(data);
                int newValue     = LogicMath.Min(value, 2000000000);

                if (currentValue < newValue)
                {
                    avatar.SetAchievementProgress(data, value);
                    avatar.GetChangeListener().CommodityCountChanged(0, data, newValue);
                }

                int tmp = LogicMath.Min(newValue, data.GetActionCount());

                if (currentValue < tmp)
                {
                    LogicClientAvatar playerAvatar = this.m_level.GetPlayerAvatar();

                    if (playerAvatar == avatar)
                    {
                        if (tmp == data.GetActionCount())
                        {
                            this.m_level.GetGameListener().AchievementCompleted(data);
                        }
                        else
                        {
                            this.m_level.GetGameListener().AchievementProgress(data);
                        }
                    }
                }
            }
        }