예제 #1
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="_data"></param>
 public void Update(achievement_reward _data)
 {
     serverData.id         = _data.id;
     serverData.num        = _data.num;
     serverData.state      = _data.state;
     serverData.new_or_old = _data.new_or_old;
 }
예제 #2
0
 /// <summary>
 /// 通过服务端数据构造
 /// </summary>
 /// <param name="_data"></param>
 public AchievementData(achievement_reward _data)
 {
     serverData = _data;
     ID         = serverData.id;
 }
예제 #3
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();
        }
    }