示例#1
0
    /// <summary>
    /// 获得成就达到的奖励领取状态
    /// </summary>
    protected void S2C_AchievementRewardState(Pt _msg)
    {
        pt_update_achievement_reward_d767 msg = _msg as pt_update_achievement_reward_d767;

        if (msg != null)
        {
            isGetAchieve = true;
            for (int i = 0; i < msg.achievement_reward.Count; i++)
            {
                achievement_reward data = msg.achievement_reward[i];
                if (achievementTogRed.ContainsKey(data.id) && data.state == 1)
                {
                    achievementTogRed.Remove(data.id);
                }
                AchievementRef achievementRef = ConfigMng.Instance.GetAchievementRef(data.id);
                currentAchievementNum = data.num;
                if (curhaveAchieve.ContainsKey(msg.achievement_reward[i].id))
                {
                    AchievementData info = curhaveAchieve[data.id] as AchievementData;
                    if (info != null)
                    {
                        info.Update(data);
                    }
                    //SetRedPoint();
                }
                else if (data.new_or_old == 1)//新达成成就
                {
                    AchievementData info = new AchievementData(data);
                    curhaveAchieve[info.AchieveId] = info;
                    if (OnGetNewAchievement != null)
                    {
                        OnGetNewAchievement(info);
                    }
                    SetRedPoint();
                }
                else if (data.state == 1)//退出游戏重进已领取的成就
                {
                    AchievementData info = new AchievementData(data);
                    curhaveAchieve[info.AchieveId] = info;
                }
                else if (data.id >= 41 && data.id <= 55)//退出游戏重进,已达成的成就,但是没有领取
                {
                    if (data.num >= 1)
                    {
                        AchievementData info = new AchievementData(data);
                        curhaveAchieve[info.AchieveId] = info;
                    }
                }
                else if (achievementRef != null && achievementRef.judgeNum2 != 0)
                {
                    if (data.num >= achievementRef.judgeNum2)
                    {
                        AchievementData info = new AchievementData(data);
                        curhaveAchieve[info.AchieveId] = info;
                    }
                }
                else if (achievementRef != null && data.num >= achievementRef.judgeNum1)
                {
                    AchievementData info = new AchievementData(data);
                    curhaveAchieve[info.AchieveId] = info;
                }
            }
        }
        if (OnAchievementUpdate != null)
        {
            OnAchievementUpdate();
        }
    }