Exemple #1
0
 /// <summary>
 /// 通过后台数据来修正,已有
 /// </summary>
 /// <param name="_msg"></param>
 public void Update(magic_weapons_state _data)
 {
     if (serverData == null)
     {
         serverData = _data;
     }
     else
     {
         serverData.id           = _data.id;
         serverData.active_state = _data.active_state;
         serverData.equ_state    = _data.equ_state;
         serverData.strenth_star = _data.strenth_star;
         serverData.strenth_exp  = _data.strenth_exp;
         serverData.strenth_lev  = _data.strenth_lev;
         serverData.zhuling_exp  = _data.zhuling_exp;
         serverData.zhuling_lev  = _data.zhuling_lev;
         serverData.zhuling_star = _data.zhuling_star;
     }
 }
Exemple #2
0
    protected void S2C_GetMagicData(Pt _msg)
    {
        //Debug.logger.Log("接收pt_magic_weapons_state_d309 协议");
        pt_magic_weapons_state_d309 msg = _msg as pt_magic_weapons_state_d309;

        if (msg != null)
        {
            for (int i = 0, max = msg.magic_weapons.Count; i < max; i++)
            {
                magic_weapons_state data = msg.magic_weapons[i];
                //Debug.Log("类型 " + data.type + "激活 " + data.active_state + "佩戴 " + data.equ_state + "等级 " + data.strenth_lev + "星级 " + data.strenth_star);
                //保存最新的等级
                newRefineLev   = data.strenth_lev;
                newAddSoulLev  = data.zhuling_lev;
                newRefineStar  = data.strenth_star;
                newAddSoulStar = data.zhuling_star;
                if (magicInfoDic.ContainsKey(data.type))
                {
                    MagicWeaponInfo info = magicInfoDic[data.type] as MagicWeaponInfo;
                    if (info != null)
                    {
                        info.Update(data);
                        if (info.EquState)
                        {
                            CurMagicWeaponInfo = info;
                        }
                        else if (CurMagicWeaponInfo != null && !CurMagicWeaponInfo.EquState)
                        {
                            CurMagicWeaponInfo = null;
                        }
                    }
                    else
                    {
                        Debug.Log("法宝信息为空!");
                    }
                }
                else
                {
                    //如果原列表中没有这个数据,直接以服务端数据构造,添加到列表中去
                    MagicWeaponInfo info = new MagicWeaponInfo(data);
                    if (info.EquState)
                    {
                        CurMagicWeaponInfo = info;
                    }
                    magicInfoDic[info.Type] = info;
                }
            }
            if (isFirst)
            {
                maxLev  = MaxMagicLev();
                maxStar = MaxMagicStar();
                SetMagicRedPoint();
                isFirst = false;
            }
        }
        //进度变化事件
        if (isAddExp && OnProgressChange != null)
        {
            OnProgressChange();
            isAddExp = false;
        }
        //抛出法宝属性变化的事件
        if (OnMagicTypeUpdate != null)
        {
            OnMagicTypeUpdate();
        }
    }
Exemple #3
0
 /// <summary>
 /// 通过后台数据来构造,从无到有
 /// </summary>
 /// <param name="_msg"></param>
 public MagicWeaponInfo(magic_weapons_state _data)
 {
     serverData = _data;
 }