Beispiel #1
0
        //设置合成装备信息
        private void SetCombineEquipInfo(int pos ,int equipId,int num)
        {
            GameObject obj = hcList[pos];
            SysEquipVo equipVo = BaseDataMgr.instance.GetDataById<SysEquipVo>((uint)equipId);
            obj.name = equipId.ToString();
            NGUITools.FindInChild<UISprite>(obj, "gradeicn").spriteName = "epz_"+equipVo.grade;
            NGUITools.FindInChild<UISprite>(obj, "icn").spriteName = equipVo.icon.ToString();


            NGUITools.FindInChild<UISprite>(obj, "icn1").spriteName = equipVo.icon.ToString();



            int cNum = Singleton<GoodsMode>.Instance.GetCountByGoodsId((uint) equipId);
            NGUITools.FindInChild<UILabel>(obj, "num").text = cNum + "/" + num;
            if (cNum >= num)
            {
                NGUITools.FindInChild<UILabel>(obj, "num").color = ColorConst.FONT_YELLOW;
            }
            else
            {
                if (PetLogic.CanCombine((uint) equipId, true, num) > 0) //子项可以合成
                {
                    NGUITools.FindInChild<UILabel>(obj, "num").color = ColorConst.FONT_GREEN;
                }
                else
                {
                    NGUITools.FindInChild<UILabel>(obj, "num").color = ColorConst.FONT_RED;
                }
            }

        }
Beispiel #2
0
        private void SetFBInfo()
        {
            SysItemVo itemVo = BaseDataMgr.instance.GetDataById <SysItemVo>((uint)currentPet.stone_id);

            int[] fbs = StringUtils.GetStringToInt(itemVo.source);
            PetLogic.SetFBInfo(fbList, fbs);
        }
Beispiel #3
0
        public static string GetEquipPropertyDes(SysEquipVo equipVo)
        {
            StringBuilder sb = new StringBuilder();

            if (equipVo.hp.Length > 4)
            {
                sb.Append("生命+").Append(PetLogic.GetEquipProperty(equipVo.hp));
            }
            if (equipVo.att_max > 0)
            {
                sb.Append("\n").Append("攻击+").Append(equipVo.att_max);
            }
            if (equipVo.def_p.Length > 4)
            {
                sb.Append("\n").Append("物防+").Append(PetLogic.GetEquipProperty(equipVo.def_p));
            }
            if (equipVo.def_m.Length > 4)
            {
                sb.Append("\n").Append("魔防+").Append(PetLogic.GetEquipProperty(equipVo.def_m));
            }
            if (equipVo.hurt_re.Length > 4)
            {
                sb.Append("\n").Append("减伤+").Append(PetLogic.GetEquipProperty(equipVo.hurt_re));
            }
            return(sb.ToString());
        }
Beispiel #4
0
        private void SetStoneInfo()
        {
            SysPet pet = currentPet;

            NGUITools.FindInChild <UILabel>(gameObject, "info/top/name").text = pet.name;
            SysItemVo itemVo = BaseDataMgr.instance.GetDataById <SysItemVo>((uint)currentPet.stone_id);

            NGUITools.FindInChild <UISprite>(gameObject, "info/fb/current/icn").spriteName      = itemVo.icon.ToString();
            NGUITools.FindInChild <UISprite>(gameObject, "info/fb/current/gradeicn").spriteName = "";

            int own = Singleton <GoodsMode> .Instance.GetCountByGoodsId((uint)pet.stone_id);

            PPet p = Singleton <PetMode> .Instance.GetPetByPetId((uint)pet.id);

            int need = 0;

            if (p != null)
            {
                need = PetLogic.GetNeedStone(p.star, true);
            }
            else
            {
                need = PetLogic.GetNeedStone((uint)pet.star, false);
            }
            NGUITools.FindInChild <UILabel>(gameObject, "info/fb/num").text = "(" + own + "/" + need + ")";
        }
Beispiel #5
0
        private void SetSkillInfo(uint[] pskill, PPet pet, int num)
        {
            if (pskill != null)
            {
                NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "level").text = "Lv." + pskill[1];
                UIUtils.ChangeNormalShader(NGUITools.FindInChild <UISprite>(skillObjs[num - 1], "skillicn"), 20);
                var add = NGUITools.FindChild(skillObjs[num - 1], "add");
                if (add == null)
                {
                    return;
                }
                add.SetActive(true);
                int cost = PetLogic.GetSkillSpend((int)pskill[1], num);
                NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "add/costvalue").text = cost.ToString();
                if (pskill[1] >= pet.lvl)
                {
                    NGUITools.FindInChild <UISprite>(skillObjs[num - 1], "add/background").spriteName = "jiah";
                    NGUITools.FindInChild <BoxCollider>(skillObjs[num - 1], "add").enabled            = false;
                }
                else
                {
                    NGUITools.FindInChild <UISprite>(skillObjs[num - 1], "add/background").spriteName = "jia";
                    NGUITools.FindInChild <BoxCollider>(skillObjs[num - 1], "add").enabled            = true;
                    NGUITools.FindInChild <Button>(skillObjs[num - 1], "add").onClick = OnSkillUpgradeClick;
                    if (cost > MeVo.instance.diam)
                    {
                        NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "add/costvalue").color = ColorConst.FONT_RED;
                    }
                    else
                    {
                        NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "add/costvalue").color =
                            ColorConst.FONT_YELLOW;
                    }
                }
            }
            else
            {
                if (num == 1)
                {
                    NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "level").text = "(进阶到绿色开启)";
                }
                else if (num == 2)
                {
                    NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "level").text = "(进阶到蓝色开启)";
                }
                else if (num == 3)
                {
                    NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "level").text = "(进阶到紫色开启)";
                }
                else
                {
                    NGUITools.FindInChild <UILabel>(skillObjs[num - 1], "level").text = "(进阶到橙色开启)";
                }

                UIUtils.ChangeGrayShader(NGUITools.FindInChild <UISprite>(skillObjs[num - 1], "skillicn"), 21);

                NGUITools.FindChild(skillObjs[num - 1], "add").SetActive(false);
            }
        }
Beispiel #6
0
 private void AddTotal()
 {
     totalAdd = new PetVo();
     foreach (PetVo petVo in PetVos.Values)
     {
         PetLogic.AddPetALL(totalAdd, petVo);
     }
     totalAdd.fight = PetLogic.GetFight(totalAdd);
 }
Beispiel #7
0
 private void SetFBInfo()
 {
     if (equipList.Count > 0)
     {
         SysEquipVo evo = equipList[equipList.Count - 1];
         int[] fbs = StringUtils.GetStringToInt(evo.source);
         PetLogic.SetFBInfo(fbList, fbs);
     }
 }
Beispiel #8
0
        private void OnEquipClick(GameObject obj)
        {
            int  num      = int.Parse(obj.name);
            uint equipdId = 0;

            if (currentPPet != null)
            {
                equipdId = (uint)PetLogic.GetNeedEquip(currentPPet.petId, num);
            }
            Singleton <PetEquipView> .Instance.OpenView(equipdId, num, currentPPet.petId);
        }
Beispiel #9
0
        /// <summary>
        /// 获取阶对应的加成
        /// </summary>
        /// <param name="type"></param>
        /// <param name="grade"></param>
        /// <returns></returns>
        public static BaseRoleVo GetGradeProperties(uint type, uint grade)
        {
            BaseRoleVo       gradeVo  = new BaseRoleVo();
            SysPetAdvancedVo gradeAdd = PetLogic.GetPetGradeAdd(type, grade);

            gradeVo.AttPMax = (uint)gradeAdd.att_max;
            gradeVo.Hp      = (uint)gradeAdd.hp;
            gradeVo.DefP    = (uint)gradeAdd.def_p;
            gradeVo.DefM    = (uint)gradeAdd.def_m;
            gradeVo.HurtRe  = (uint)gradeAdd.hurt_re;
            return(gradeVo);
        }
Beispiel #10
0
        private void SetPetsInfo(int petType)
        {
            ClearPetsInfo();
            int num = 0;

            //先显示可以召唤的宠物数据
            List <SysPet> unOwnPet = new List <SysPet>();

            foreach (SysPet pet in PetLogic.SysPets)
            {
                if (petType == 0 || pet.type == petType)
                {
                    if (PetLogic.CanOwn(pet))
                    {
                        num++;
                        SetPetInfo(pet, num, true);
                    }
                    else if (!PetLogic.IsOwn(pet))
                    {
                        unOwnPet.Add(pet);
                    }
                }
            }

            //再显示已经拥有的宠物
            foreach (PPet pet in Singleton <PetMode> .Instance.AllPets)
            {
                SysPet spet = BaseDataMgr.instance.GetDataById <SysPet>(pet.petId);
                if (petType == 0 || spet.type == petType)
                {
                    num++;
                    SetPetInfo(spet, num, true);
                }
            }

            //已拥有和可召唤的宠物数
            petNum = num;

            //再显示未拥有的宠物
            foreach (SysPet pet in unOwnPet)
            {
                num++;
                SetPetInfo(pet, num, false);
            }

            SetFGTitlePos();

            scrollView.ResetPosition();

            SetPetPublicInfo();
        }
Beispiel #11
0
        private void SetPetInfo()
        {
            SysPet pet = BaseDataMgr.instance.GetDataById <SysPet>(currentPPet.petId);

            NGUITools.FindInChild <UISprite>(gameObject, "info/gradeicn").spriteName = PetLogic.GetGradeIcn(currentPPet.grade);
            if (currentPPet != null)
            {
                NGUITools.FindInChild <UISprite>(gameObject, "info/typeicn").spriteName =
                    PetLogic.GetTypeIcnName(pet.type);
                name.text = PetLogic.GetGradeDes(currentPPet.grade, pet.name);
                SetStars(currentPPet.star);

                NGUITools.FindInChild <UILabel>(gameObject, "info/levelvalue").text = currentPPet.lvl.ToString();

                SysPetGrowUp petExp = BaseDataMgr.instance.GetDataById <SysPetGrowUp>(currentPPet.lvl);
                float        exp    = petExp.exp_upgrade;
                NGUITools.FindInChild <UISlider>(gameObject, "info/exp").value     = currentPPet.exp / exp;
                NGUITools.FindInChild <UILabel>(gameObject, "info/exp/label").text = currentPPet.exp + "/" + exp;

                int stonenum = Singleton <GoodsMode> .Instance.GetCountByGoodsId((uint)pet.stone_id);

                float need = 0f;
                if (currentPPet.star < 5)
                {
                    need = PetLogic.GetNeedStone(currentPPet.star, true);
                    NGUITools.FindInChild <UISlider>(gameObject, "info/stone/num").value = stonenum / need;
                }
                else
                {
                    NGUITools.FindInChild <UISlider>(gameObject, "info/stone/num").value = 1;
                }

                NGUITools.FindInChild <UILabel>(gameObject, "info/stone/num/label").text = stonenum + "/" + need;


                //出战处理
                if (currentPPet.state == 0)
                {
                    FightButton.FindInChild <UILabel>("lk").text = "出战";
                }
                else
                {
                    FightButton.FindInChild <UILabel>("lk").text = "休息";
                }
                SetPetSkill(currentPPet);
                SetPetEquips(currentPPet);
                SetPetProperty(currentPPet);
            }
        }
Beispiel #12
0
        private static BaseRoleVo[] gradeVos = new BaseRoleVo[39]; //14阶装备

        /// <summary>
        /// 计算宠物的装备属性
        /// </summary>
        /// <param name="petid"></param>
        /// <returns></returns>
        public static void CupPetEquipProperties(PPet pet, PetVo petVo)
        {
            //添加当前装备
            for (int i = 0; i < pet.equip.Count;)
            {
                uint       equipId = pet.equip[i + 1];
                SysEquipVo equipVo = BaseDataMgr.instance.GetDataById <SysEquipVo>(equipId);
                AddEquipProperty(petVo, equipVo);
                i = i + 2;
            }
            //添加当前阶的装备

            BaseRoleVo gradeVo = GetGradeProperties((uint)petVo.SysPet.type, pet.grade);

            PetLogic.AddPetALL(petVo, gradeVo);
        }
Beispiel #13
0
        public void SetPetList(List <PPet> pets)
        {
            AllPets = pets;
            //计算宠物的数据
            PetVos.Clear();
            foreach (PPet pet in AllPets)
            {
                PetVos.Add(pet.id, PetLogic.GetPetVo(pet));
            }
            AddTotal();

            AllPets.Sort(PetLogic.SortPet);


            DataUpdate(PetList);
            SetFightPet();
        }
Beispiel #14
0
 private void OnUpgradeClick(GameObject obj)
 {
     if (PetLogic.CanUpgrade(currentPPet))
     {
         Singleton <PetControl> .Instance.SendPetUpgrade(currentPPet.id);
     }
     else
     {
         if (currentPPet.grade == 14)
         {
             MessageManager.Show("幻兽已升到最高阶");
         }
         else
         {
             MessageManager.Show("幻兽需穿齐装备才可以进阶");
         }
     }
 }
Beispiel #15
0
 //升阶动画
 private void PlayEquips()
 {
     if (currentPPet.grade > 1)
     {
         SysPet pet          = BaseDataMgr.instance.GetDataById <SysPet>(currentPPet.petId);
         int[]  equipConfigs = PetLogic.GetPetNeedEquips((uint)pet.type, (uint)currentPPet.grade - 1);
         for (int i = 0; i < equipObjs.Count; i++)
         {
             GameObject icn     = NGUITools.FindChild(equipObjs[i], "icn");
             SysEquipVo equipVo = BaseDataMgr.instance.GetDataById <SysEquipVo>((uint)equipConfigs[i]);
             icn.GetComponent <UISprite>().spriteName = equipVo.icon.ToString();
             icn.SetActive(true);
             icn.GetComponent <TweenPlay>().PlayForward();
         }
         light.SetActive(true);
         light.GetComponent <TweenPlay>().PlayForward();
     }
 }
Beispiel #16
0
 private void OnEvolveClick(GameObject obj)
 {
     //检查可以进化
     if (PetLogic.CanEvolve(currentPPet))
     {
         Singleton <PetControl> .Instance.SendPetEvolve(currentPPet.id);
     }
     else
     {
         if (currentPPet.star == 5)
         {
             MessageManager.Show("已进化到满星!");
         }
         else
         {
             MessageManager.Show("灵魂石不足");
         }
     }
 }
Beispiel #17
0
        //注册
        protected override void NetListener()
        {
            AppNet.main.addCMD(CMD.CMD_21_1, ReceivePetList);
            AppNet.main.addCMD(CMD.CMD_21_2, ReceivePetFigth);
            AppNet.main.addCMD(CMD.CMD_21_3, ReceivePetEvolve);
            AppNet.main.addCMD(CMD.CMD_21_4, ReceivePetUpgrade);
            AppNet.main.addCMD(CMD.CMD_21_5, ReceivePetSkillUpgrade);
            AppNet.main.addCMD(CMD.CMD_21_6, ReceivePetUpdate);
            AppNet.main.addCMD(CMD.CMD_21_7, ReceivePetSkillPointInfo);
            AppNet.main.addCMD(CMD.CMD_21_8, ReceiveActiveAPet);
            AppNet.main.addCMD(CMD.CMD_21_9, ReceiveBuySkillPointInfo);
            AppNet.main.addCMD(CMD.CMD_21_10, ReceivePetExpItem);
            AppNet.main.addCMD(CMD.CMD_24_1, ReceivePetWearEquip);
            AppNet.main.addCMD(CMD.CMD_24_2, ReceiveEquipCombineEquip);

            PetLogic.InitConfig();
            SendRequestForPetList();
            SendRequestFoSkillPointInfo();
        }
Beispiel #18
0
        public void AddPet(List <PPet> pets)
        {
            if (AllPets == null)
            {
                AllPets = new List <PPet>();
            }

            AllPets.AddRange(pets);
            foreach (PPet pet in pets)
            {
                PetVos.Add(pet.id, PetLogic.GetPetVo(pet));
            }
            AddTotal();
            AllPets.Sort(PetLogic.SortPet);

            DataUpdate(PetList);
            foreach (PPet pet in pets)
            {
                CurrentPet = pet;
                DataUpdate(NewPet);
            }
        }
Beispiel #19
0
        public bool OpenViewForStone(uint stoneId, Action callback)
        {
            SysPet spet = PetLogic.GetSysPetByStoneId(stoneId);

            if (spet == null)
            {
                callback();
                return(false);
            }

            PPet pet = Singleton <PetMode> .Instance.GetPetByPetId((uint)spet.id);

            if (pet != null)
            {
                callback();
                return(false);
            }

            int own = Singleton <GoodsMode> .Instance.GetCountByGoodsId(stoneId);

            int need = PetLogic.GetNeedStone((uint)spet.star, false);

            if (own < need)
            {
                callback();
                return(false);
            }

            OpenForStone  = true;
            closeCallBack = callback;
            petId         = spet.id;
            OpenView();

            //隐藏萌宠献礼相关特效
            EffectMgr.Instance.GetUIEffectGameObject(EffectId.UI_PetAnimation).SetActive(false);
            EffectMgr.Instance.GetUIEffectGameObject(EffectId.UI_PetLight).SetActive(false);

            return(true);
        }
Beispiel #20
0
        //升级宠物技能
        private void OnSkillUpgradeClick(GameObject obj)
        {
            if (currentPPet != null)
            {
                int    num    = int.Parse(obj.transform.parent.gameObject.name);
                int[]  skill  = PetLogic.GetPetSkillInfo((int)currentPPet.petId, num);
                uint[] pskill = Singleton <PetMode> .Instance.GetPetSkill(currentPPet.id, (uint)num);

                int cost = PetLogic.GetSkillSpend((int)pskill[1], num);
                if (cost > MeVo.instance.diam)
                {
                    MessageManager.Show("当前金币不足!");
                }
                else if (Singleton <PetMode> .Instance.SkillPoint.point <= 0)
                {
                    MessageManager.Show("技能点不足!");
                }
                else
                {
                    Singleton <PetControl> .Instance.UpgradePetSkill(currentPPet.id, (uint)num);
                }
            }
        }
Beispiel #21
0
        private string GetEquipIcn(GameObject obj, uint petId, int num)
        {
            int result = PetLogic.CheckEquip(petId, num);

            if (result == 0)
            {
                return("");
            }
            else if (result == 1 || result == 3) //满足等级-可装备或者可以合成
            {
                NGUITools.FindChild(obj, "tips").SetActive(true);
                return("add2");
            }
            else if (result == 2 || result == 4)
            {
                return("add");
            }
            else
            {
                SysEquipVo equipVo = BaseDataMgr.instance.GetDataById <SysEquipVo>((uint)result);
                return(equipVo.icon.ToString());
            }
        }
Beispiel #22
0
        private void OnPetClick(GameObject obj)
        {
            uint   petId = uint.Parse(obj.name);
            SysPet pet   = BaseDataMgr.instance.GetDataById <SysPet>(petId);

            if (PetLogic.CanOwn(pet))
            {
                Singleton <PetControl> .Instance.ActiveAPet(petId);
            }
            else
            {
                PPet p = Singleton <PetMode> .Instance.GetPetByPetId(petId);

                if (p == null)
                {
                    Singleton <PetStoneTipsView> .Instance.OpenView(petId);
                }
                else
                {
                    Singleton <PetInfoView> .Instance.OpenView(petId);
                }
            }
        }
Beispiel #23
0
        private void OnSkillPress(GameObject obj, bool press)
        {
            int num = int.Parse(obj.name);

            int[]  skill  = PetLogic.GetPetSkillInfo((int)currentPPet.petId, num);
            uint[] pskill = Singleton <PetMode> .Instance.GetPetSkill(currentPPet.id, (uint)num);

            int lvl = 0;

            if (pskill != null)
            {
                lvl = (int)pskill[1];
            }
            if (press)
            {
                skillTips.transform.localPosition = new Vector3(-5, 190 - (num - 1) * 91);
                skillTips.SetActive(true);
                NGUITools.FindInChild <UILabel>(skillTips, "label").text = PetLogic.GetSkillDes((int)currentPPet.petId, num, lvl);
            }
            else
            {
                skillTips.SetActive(false);
            }
        }
Beispiel #24
0
        public void OpenViewForEvolve(uint uid)
        {
            newPet = false;

            PPet pet = Singleton <PetMode> .Instance.GetPetById(uid);

            Singleton <PetView> .Instance.LoadPet(pet.petId, gameObject.transform, new Vector3(-100, -15, 0));

            NGUITools.FindInChild <UISprite>(gameObject, "info/gradeicn").spriteName = PetLogic.GetGradeIcn(pet.grade);
            SysPet sPet = BaseDataMgr.instance.GetDataById <SysPet>(pet.petId);

            name.text = PetLogic.GetGradeDes(pet.grade, sPet.name);
            tips.text = "您的幻兽进化到了" + pet.star + "星";
            PetVo petVo = Singleton <PetMode> .Instance.PetVos[pet.id];

            NGUITools.FindInChild <UILabel>(gameObject, "info/fightvalue").text = petVo.fight.ToString();

            SetStars(pet.star);
            gameObject.SetActive(true);
            close = false;
            Singleton <PetView> .Instance.PetPlay(Status.Win);

            tipsPlay.PlayReverse();
        }
Beispiel #25
0
        private void OnLeftButtonClick(GameObject obj)
        {
            if (currentEquip != null)
            {
                int need = PetLogic.CheckEquip(petId, equipPos);
                if (need == 1) //可装备
                {
                    PPet pet = Singleton<PetMode>.Instance.GetPetByPetId(petId);

                    uint bagid = 0;
                    foreach (PGoods goods in Singleton<GoodsMode>.Instance.GetEquipListInBag())
                    {
                        if (goods.goodsId == currentEquip.id)
                        {
                            bagid = goods.id;
                            break;
                        }
                    }
                    Singleton<PetControl>.Instance.WearPetEquip(pet.id, equipPos, bagid);
                }
                else if (need == 2) //不可装备
                {
                    MessageManager.Show("需要幻兽等级:" + currentEquip.lvl.Replace("[","").Replace("]",""));
                }else if (need == 3 || need == 4 || need == 0) //合成或者获取途径
                {
                    if (!rightOpen)
                    {
                        OpenRigthPanel();
                    }

                }else if (need > 4)
                {
                    CloseView();
                }
            }
        }
Beispiel #26
0
        private bool CheckTips()
        {
            foreach (SysPet spet in PetLogic.SysPets)
            {
                if (PetLogic.CanOwn(spet))
                {
                    return(true);
                }
            }

            if (AllPets != null)
            {
                foreach (PPet pet in AllPets)
                {
                    for (int i = 1; i < 7; i++) //检查装备
                    {
                        int result = PetLogic.CheckEquip(pet.petId, i);
                        if (result == 1 || result == 3)
                        {
                            return(true);
                        }
                    }

                    if (PetLogic.CanEvolve(pet))
                    {
                        return(true);
                    }
                    if (PetLogic.CanUpgrade(pet))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #27
0
        private void SetEquipInfo(uint equipId)
        {
            SysEquipVo equipVo = BaseDataMgr.instance.GetDataById<SysEquipVo>(equipId);
            currentEquip = equipVo;
            if (currentEquip != null)
            {
                equipIcn.spriteName = equipVo.icon.ToString();

                NGUITools.FindInChild<UISprite>(leftObj, "gradeicn").spriteName = "epz_" + equipVo.grade;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/name").text = equipVo.name;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/des").text = equipVo.desc;
                SetEquipProperty(equipVo);
                int num = Singleton<GoodsMode>.Instance.GetCountByGoodsId((uint)equipVo.id);

                NGUITools.FindInChild<UILabel>(leftObj, "labels/numvalue").text = num.ToString();
                if (num == 0)
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/numvalue").color = ColorConst.FONT_RED;
                }
                else
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/numvalue").color = ColorConst.FONT_YELLOW;
                }
                

                int need = PetLogic.CheckEquip(petId, equipPos);
                if (need > 4) //已装备
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "需要幻兽等级: " + equipVo.lvl.Replace("[","").Replace("]","");
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_YELLOW;
                    NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "确认";
                }
                else if (need == 1) //可装备
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "装备后将与幻兽绑定";
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_YELLOW;
                    NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "装备";
                }else if (need == 2) //存在不可装备
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "需要幻兽等级: " + equipVo.lvl.Replace("[", "").Replace("]", "");
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_RED;
                    NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "装备";
                }
                else if (need == 3) //可合成可装备
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "装备后将与幻兽绑定";
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_YELLOW;
                    NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "合成方式";
                }
                else if(need ==4) //可合成不可装备
                {
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "需要幻兽等级: " + equipVo.lvl.Replace("[", "").Replace("]", "");
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_RED;
                    NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "合成方式";
                }else if (need == 0) //不存在也不可合成
                {
                    PPet pet = Singleton<PetMode>.Instance.GetPetByPetId(petId);
                    NGUITools.FindInChild<UILabel>(leftObj, "labels/level").text = "需要幻兽等级: " + equipVo.lvl.Replace("[", "").Replace("]", "");                    
                    int needlvl =int.Parse( equipVo.lvl.Replace("[", "").Replace("]", ""));

                    if (needlvl > pet.lvl)
                    {
                        NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_RED;
                    }
                    else
                    {
                        NGUITools.FindInChild<UILabel>(leftObj, "labels/level").color = ColorConst.FONT_YELLOW;
                    }

                    //有合成途径
                    if (equipVo.material.Length > 4)
                    {
                        NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "合成方式";
                    }
                    else //产出途径
                    {
                        NGUITools.FindInChild<UILabel>(leftObj, "button/name").text = "获取途径";
                    }
                }
            }
        }
Beispiel #28
0
        private void SetEquipProperty(SysEquipVo equipVo)
        {
            int num = 0;
            if (equipVo.hp.Length>4)
            {
                num++;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/property" + num).text = "生命:+" + PetLogic.GetEquipProperty(equipVo.hp);
            }

            if (equipVo.att_max>0)
            {
                num++;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/property" + num).text = "攻击:+" + equipVo.att_max;
            }
            if (equipVo.def_p.Length > 4)
            {
                num++;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/property" + num).text = "物防:+" + PetLogic.GetEquipProperty(equipVo.def_p);
            }
            if (equipVo.def_m.Length > 4)
            {
                num++;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/property" + num).text = "魔防:+" + PetLogic.GetEquipProperty(equipVo.def_m);
            }
            if (equipVo.hurt_re.Length > 4)
            {
                num++;
                NGUITools.FindInChild<UILabel>(leftObj, "labels/property" + num).text = "减伤:+" + PetLogic.GetEquipProperty(equipVo.hurt_re);
            }

            for (int i=1; i< 6; i++)
            {
                if (i <= num)
                {
                    NGUITools.FindChild(leftObj, "labels/property" + i).SetActive(true);
                }
                else
                {
                    NGUITools.FindChild(leftObj, "labels/property" + i).SetActive(false);
                }
            }

        }
Beispiel #29
0
        public void UpdatePet(uint id, List <PItem> items)
        {
            PPet pet          = GetPetById(id);
            bool stateChange  = false;
            bool evolve       = false;
            bool skillUpgrade = false;
            bool equipWear    = false;
            bool gradeUpgrade = false;
            bool levelUpgrade = false;
            bool sortChange   = false;

            if (pet == null)
            {
                Log.error(this, id + "当前宠物数据不存在");
            }
            else
            {
                CurrentPet = pet;
                foreach (PItem item in items)
                {
                    if (item.key == 5)
                    {
                        if (item.value[0] > pet.lvl)
                        {
                            pet.lvl      = item.value[0];
                            sortChange   = true;
                            levelUpgrade = true;
                        }
                    }
                    else if (item.key == 6)
                    {
                        pet.exp = item.value[0];
                    }
                    else if (item.key == 7)
                    {
                        pet.state   = (byte)item.value[0];
                        stateChange = true;
                    }
                    else if (item.key == 8)
                    {
                        pet.star   = item.value[0];
                        evolve     = true;
                        sortChange = true;
                    }
                    else if (item.key == 9)
                    {
                        //升阶
                        if ((byte)item.value[0] > pet.grade)
                        {
                            pet.grade    = (byte)item.value[0];
                            gradeUpgrade = true;
                            sortChange   = true;
                        }
                    }
                    else if (item.key == 10)
                    {
                        //装备升阶
                        if (item.value.Count == 0)
                        {
                            pet.equip = item.value;
                        }
                        else
                        {
                            //装备信息变化
                            for (int i = 0; i < item.value.Count;)
                            {
                                uint pos     = item.value[i];
                                uint equipId = item.value[i + 1];

                                //当前装备
                                int cEquipId = GetPetEquipByPos(pet.id, pos);
                                if (cEquipId == -1)
                                {
                                    //添加装备
                                    pet.equip.Add(pos);
                                    pet.equip.Add(equipId);
                                    equipWear   = true;
                                    WearedEquip = new uint[] { pos, equipId };
                                }
                                i = i + 2;
                            }
                        }
                    }
                    else if (item.key == 15)
                    {
                        for (int i = 0; i < item.value.Count;)
                        {
                            byte pos = (byte)item.value[i];
                            byte lvl = (byte)item.value[i + 1];

                            int index = GetPetSkillIndexByPos(pet.id, pos);
                            if (index == -1)
                            {
                                //添加技能
                                pet.skills.Add(pos);
                                pet.skills.Add(lvl);
                            }
                            else
                            {
                                uint clvl = pet.skills[index + 1];
                                if (clvl < lvl)
                                {
                                    pet.skills[index + 1] = lvl;
                                    skillUpgrade          = true;
                                    UpgradedSkill         = new uint[] { pos, lvl };
                                }
                            }
                            i = i + 2;
                        }
                    }
                }
                //更新属性
                PetLogic.SetPetVo(pet, PetVos[pet.id]);
                AddTotal();

                //发出通知数据更新
                if (stateChange)
                {
                    SetFightPet();
                }
                if (levelUpgrade)
                {
                    DataUpdate(LevelUpgrade);
                }
                if (evolve)
                {
                    DataUpdate(EvolvePet);
                    DataUpdate(FightPet);
                }
                if (skillUpgrade)
                {
                    //技能升级的通知
                    DataUpdate(SkillUpgrade);
                }
                if (equipWear)
                {
                    //穿新装备通知
                    DataUpdate(WearEquip);
                }
                if (gradeUpgrade)
                {
                    DataUpdate(GradeUpgrade);
                }
                DataUpdate(UpdatedPet);
                if (sortChange)
                {
                    AllPets.Sort(PetLogic.SortPet);
                }
                DataUpdate(PetList);
            }
        }
Beispiel #30
0
        private void OnRightButtonClick(GameObject obj)
        {
            SysEquipVo evo = equipList[equipList.Count - 1];
            if (evo.material.Length < 4) //不可合成
            {
                if (equipList.Count > 1) //返回上一物品
                {
                    equipList.RemoveAt(equipList.Count - 1);
                    ShowRightObjInfo();
                }
                else //关闭右边页面
                {
                    rightPlay.PlayReverse();
                    rightOpen = false;
                    leftPlay.PlayReverse();
                }
            }
            else //检查合成
            {
                int[] material = StringUtils.GetArrayStringToInt(evo.material);
                bool oneCanCombine = false;
                bool allCanCombine = true;
                for(int i =0;i<material.Count();) //检查子项目
                {

                    int cnum = Singleton<GoodsMode>.Instance.GetCountByGoodsId((uint) material[i]);
                    if (cnum< material[i+1]) //检查当前已有的数量
                    {
                        allCanCombine = false;
                        if (PetLogic.CanCombine((uint)material[i], true, material[i + 1]) > 0) //检查已有数量+可合成数量
                        {
                            oneCanCombine = true;
                        }
                    }
                    i = i + 2;
                }

                if (allCanCombine)
                {
                    //检查钱
                    if (evo.spend > MeVo.instance.diam)
                    {
                        MessageManager.Show("当前金币不足!");
                    }
                    else
                    {
                        Singleton<PetControl>.Instance.CombinePetEquip((uint)evo.id);
                    }
                    
                }
                else
                {
                    if (oneCanCombine)
                    {
                        MessageManager.Show("请先合成绿色数字提示装备!");
                    }
                    else
                    {
                        MessageManager.Show("材料不足,请先去收集一些吧!");
                    }
                }

            }
        }