Пример #1
0
    void OnFightClick(GameObject go)
    {
        if (m_petID == 0)
        {
            return;
        }
        IPet pet = m_petData.GetPetByThisID(m_petID);

        if (pet != null)
        {
            int life = pet.GetProp((int)PetProp.Life);
            if (life <= 0)
            {
                TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Pet_Age_zhanhunshoumingbuzuwufachuzhan);
                //ShowTips(108017);
                return;
            }
            int cd = m_petData.GetPetFightCDTime(pet.GetID());
            if (cd > 0)
            {
                TipsManager.Instance.ShowTipsById(108020, cd);
                return;
            }
            stUseFightPetUserCmd_CS cmd = new stUseFightPetUserCmd_CS();
            cmd.id = pet.GetID();
            NetService.Instance.Send(cmd);
        }
    }
Пример #2
0
    void OnChuZhanClick(GameObject go)
    {
        Transform parent = go.transform.parent;

        if (parent != null)
        {
            string name = parent.name;
            if (!string.IsNullOrEmpty(name))
            {
                char indexStr = name[name.Length - 1];
                int  index    = -1;
                if (int.TryParse(indexStr.ToString(), out index))
                {
                    index -= 1;
                    if (index != -1)
                    {
                        List <uint> petList = m_petData.GetUserQuicSettingList();
                        if (petList != null)
                        {
                            uint petid = petList[index];
                            if (petid == 0)
                            {
                                OnPetClick(null);
                                //TipsManager.Instance.ShowTips( "没有设置" );
                                return;
                            }
                            IPet pet = m_petData.GetPetByThisID(petid);
                            if (pet != null)
                            {
                                int life = pet.GetProp((int)PetProp.Life);
                                if (life <= 0)
                                {
                                    TipsManager.Instance.ShowTips(LocalTextType.Pet_Age_zhanhunshoumingbuzuwufachuzhan);
                                    //m_petData.ShowTips(108017);
                                    return;
                                }
                                if (petid == m_petData.CurFightingPet)
                                {
                                    //Local_TXT_Notice_Pet_HasChuzhan
                                    TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Notice_Pet_HasChuzhan);
                                    //TipsManager.Instance.ShowTips("已经出战");
                                    return;
                                }
                                stUseFightPetUserCmd_CS cmd = new stUseFightPetUserCmd_CS();
                                cmd.id = pet.GetID();
                                NetService.Instance.Send(cmd);
                            }
                        }
                    }
                }
            }
        }
    }
Пример #3
0
    public void OnAddFightPet(stUseFightPetUserCmd_CS cmd)
    {
        AddFightPet(cmd.id);
        IsHasPetFight = true;
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            uint        petID = pet.PetBaseID;
            PetDataBase pdb   = GameTableManager.Instance.GetTableItem <PetDataBase>(petID);
            if (pdb != null)
            {
                //PlayCreateAudio(pdb.fightAudio);
            }
        }
    }
Пример #4
0
 void onClick_Chuzhan_Btn(GameObject caster)
 {
     if (CurPet != null)
     {
         int life = CurPet.GetProp((int)PetProp.Life);
         if (life <= 0)
         {
             ShowTipsEnum(LocalTextType.Pet_Age_zhanhunshoumingbuzuwufachuzhan);
             //ShowTips(108017);
             return;
         }
         int cd = petDataManager.GetPetFightCDTime(CurPet.GetID());
         if (cd > 0)
         {
             TipsManager.Instance.ShowTipsById(108020, cd);
             return;
         }
         stUseFightPetUserCmd_CS cmd = new stUseFightPetUserCmd_CS();
         cmd.id = CurPet.GetID();
         NetService.Instance.Send(cmd);
     }
 }
Пример #5
0
 public void OnAddFightPet(stUseFightPetUserCmd_CS cmd)
 {
     DataManager.Manager <PetDataManager>().OnAddFightPet(cmd);
 }