Exemplo n.º 1
0
    /// <summary>
    /// 对宠物使用物品加寿命
    /// </summary>
    /// <param name="cmd"></param>

    public void OnAddPetLife(stLifePetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            string str     = "";
            int    curLife = pet.GetProp((int)PetProp.Life);
            if (curLife < cmd.life)
            {
                int life = cmd.life - curLife;
                str = "+" + life.ToString();
            }
            else
            {
                int life = curLife - cmd.life;
                str = ColorManager.GetColorString(ColorType.Red, (-life).ToString());
            }
            ShowTipsEnum(LocalTextType.Pet_Age_zhanhunshoumingzengjianleX, pet.GetName(), str);
            pet.SetProp((int)PetProp.Life, cmd.life);
        }
        DispatchValueUpdateEvent(new ValueUpdateEventArgs()
        {
            key = PetDispatchEventString.PetRefreshProp.ToString()
        });
    }
Exemplo n.º 2
0
 public void OnAddPetLife(stLifePetUserCmd_S cmd)
 {
     DataManager.Manager <PetDataManager>().OnAddPetLife(cmd);
 }