Example #1
0
 /// <summary>
 /// 合成按钮
 /// </summary>
 void OnClickComposeBtn(GameObject go)
 {
     if (GameCenter.mercenaryMng.seleteEquip != null)
     {
         int num = 0;
         for (int i = 0; i < choosedBookInMat.Count; i++)
         {
             EquipmentRef eqt = ConfigMng.Instance.GetEquipmentRef(choosedBookInMat[i]);
             if (eqt != null && eqt.psetSkillLevel >= needLev)
             {
                 ++num;
             }
         }
         if (num >= needBookNum)
         {
             GameCenter.mercenaryMng.C2S_ReqComposeSkill(composeBookId, choosedBookInMat);
         }
         else//材料不足
         {
             MessageST mst = new MessageST();
             mst.messID = 12;
             mst.words  = new string[1] {
                 "材料"
             };
             GameCenter.messageMng.AddClientMsg(mst);
         }
     }
 }
Example #2
0
    /// <summary>
    /// 让技能书从高品质到低品质排序
    /// </summary>
    public List <int> CompareByQuality(List <int> _pet_skill)
    {
        int exchange = 0;

        if (_pet_skill.Count > 0)
        {
            for (int j = 0, max = _pet_skill.Count; j < max; j++)
            {
                for (int i = 0; i < max - j - 1; i++)
                {
                    EquipmentRef skill1 = ConfigMng.Instance.GetEquipmentRef(_pet_skill[i]);
                    EquipmentRef skill2 = ConfigMng.Instance.GetEquipmentRef(_pet_skill[i + 1]);
                    if (skill1 != null && skill2 != null)
                    {
                        if (skill1.psetSkillLevel < skill2.psetSkillLevel)
                        {
                            exchange          = _pet_skill[i];
                            _pet_skill[i]     = _pet_skill[i + 1];
                            _pet_skill[i + 1] = exchange;
                        }
                    }
                }
            }
        }
        return(_pet_skill);
    }
Example #3
0
 void OnEnable()
 {
     if (eqt == null)
     {
         eqt = ConfigMng.Instance.GetEquipmentRef(2200001);
     }
     ShowBook();
     GameCenter.mercenaryMng.OnCopyBookUpdate += ShowBook;
     GameCenter.inventoryMng.OnBackpackUpdate += ShowBook;
 }
Example #4
0
    /// <summary>
    /// 注灵绑铜不足提示
    /// </summary>
    void AddSoulPrompt()
    {
        MessageST mst = new MessageST();

        mst.messID = 12;
        EquipmentRef equipRef = ConfigMng.Instance.GetEquipmentRef(data.AddSoulConsumeCoinId);

        mst.words = new string[1] {
            equipRef == null ? string.Empty : equipRef.name
        };
        GameCenter.messageMng.AddClientMsg(mst);
    }
Example #5
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(ProcessInfo model)
        {
            int count = 0;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //插入基本信息
                    count = session.Insert <ProcessInfo>(model);
                    string sql = "DELETE FROM T_FP_EQUIPMENTREF WHERE PRID = @PRID";
                    parameters.Add(new DataParameter {
                        ParameterName = "PRID", DataType = DbType.String, Value = model.PID
                    });
                    session.ExecuteSqlScalar(sql, parameters.ToArray());
                    if (model.Details != null)
                    {
                        foreach (EquipmentRef detail in model.Details)
                        {
                            EquipmentRef eref = new EquipmentRef();
                            eref.PID  = Guid.NewGuid().ToString();
                            eref.EQID = detail.EQID;
                            eref.PRID = model.PID;
                            session.Insert <EquipmentRef>(eref);
                        }
                    }

                    string sql2 = "DELETE FROM T_FP_STATIONREF WHERE PRID = @PRID";
                    session.ExecuteSqlScalar(sql2, parameters.ToArray());
                    if (model.Details2 != null)
                    {
                        foreach (StationRef detail in model.Details2)
                        {
                            StationRef eref = new StationRef();
                            eref.PID  = Guid.NewGuid().ToString();
                            eref.STID = detail.STID;
                            eref.PRID = model.PID;
                            session.Insert <StationRef>(eref);
                        }
                    }
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
    /// <summary>
    /// 穿/脱装备 by吴江
    /// </summary>
    /// <param name="_data"></param>
    public void Update(List <st.net.NetBase.equip_id_state_list> equip_id_state_list)
    {
        for (int i = 0; i < equip_id_state_list.Count; i++)
        {
            if (equip_id_state_list[i].equip_state > 0)//穿
            {
                EquipmentInfo eq = new EquipmentInfo((int)equip_id_state_list[i].equip_id, EquipmentBelongTo.EQUIP);
                switch (eq.Family)
                {
                case EquipmentFamily.COSMETIC:
                    cosmeticDictionary[eq.Slot] = eq;
                    break;

                default:
                    equipmentDictionary[eq.Slot] = eq;
                    break;
                }
            }
            else
            {
                EquipmentRef refData = ConfigMng.Instance.GetEquipmentRef((int)equip_id_state_list[i].equip_id);
                if (refData != null)
                {
                    switch (refData.family)
                    {
                    case EquipmentFamily.COSMETIC:
                        cosmeticDictionary[refData.slot] = null;
                        break;

                    default:
                        equipmentDictionary[refData.slot] = null;
                        break;
                    }
                }
            }
        }

        UpdateCurShowEquipments();
        if (OnEquipUpdate != null)
        {
            OnEquipUpdate();
        }
    }
Example #7
0
    /// <summary>
    /// 一键放入
    /// </summary>
    void OnClickPutInBagBtn(GameObject go)
    {
        ItemUI choodeitem = composeBookBtn.GetComponent <ItemUI>();

        if (choodeitem != null && choodeitem.EQInfo != null && choosedBookInMat.Count < needBookNum) //选择了要合成的技能书了才可点击
        {
            foreach (int bookId in bookInBag.Keys)
            {
                EquipmentRef   info         = ConfigMng.Instance.GetEquipmentRef(bookId);
                NewPetSkillRef petskill     = ConfigMng.Instance.GetPetSkillRefByBook(bookId);        //合成材料
                NewPetSkillRef composeskill = ConfigMng.Instance.GetPetSkillRefByBook(composeBookId); //要合成的书
                int            num          = 0;
                for (int j = 0; j < choosedBookInMat.Count; j++)
                {
                    if (bookId == choosedBookInMat[j])
                    {
                        ++num;
                    }
                }
                int val = GameCenter.inventoryMng.GetNumberByType(bookId) - num;
                if (info != null && petskill != null)
                {
                    if (petskill.kind != composeskill.kind && info.psetSkillLevel >= needLev) //不同类别、且材料等级要高
                    {
                        while (val > 0 && choosedBookInMat.Count < needBookNum)               //判断满足条件的书数量,满足添加到材料链表
                        {
                            choosedBookInMat.Add(bookId);
                            --val;
                        }
                        if (val <= 0) //如果书都添加到材料链表就从背包移出该书
                        {
                            choosedPetSkill.Remove(bookId);
                        }
                    }
                }
            }
            ShowBookInMat();
            ShowBookInBag();
        }
    }
Example #8
0
    /// <summary>
    /// 穿/脱装备
    /// </summary>
    /// <param name="_eid"></param>
    public void UpdateEquipment(int _eid, bool _equip)
    {
        if (_equip)
        {
            EquipmentInfo eq = new EquipmentInfo(_eid, EquipmentBelongTo.EQUIP);
            //Debug.logger.Log(eq.ShortUrl + " , " + eq.ShowType + " , " + eq.FightWeaponPointName);
            switch (eq.Family)
            {
            case EquipmentFamily.COSMETIC:
                cosmeticDictionary[eq.Slot] = eq;
                break;

            default:
                equipmentDictionary[eq.Slot] = eq;
                break;
            }
        }
        else
        {
            EquipmentRef equipmentRef = ConfigMng.Instance.GetEquipmentRef(_eid);
            if (equipmentRef != null)
            {
                switch (equipmentRef.family)
                {
                case EquipmentFamily.COSMETIC:
                    cosmeticDictionary[equipmentRef.slot] = null;
                    break;

                default:
                    equipmentDictionary[equipmentRef.slot] = null;
                    break;
                }
            }
        }
        UpdateCurShowEquipments();
        if (OnEquipUpdate != null)
        {
            OnEquipUpdate();
        }
    }
Example #9
0
    /// <summary>
    /// 加载掉落物品模型 by吴江
    /// </summary>
    /// <param name="_id"></param>
    /// <param name="_onComplete"></param>
    /// <returns></returns>
    public static AssetMng.DownloadID GetDropItem(int _id, System.Action <GameObject, EResult> _onComplete)
    {
        EquipmentRef itemRef = ConfigMng.Instance.GetEquipmentRef(_id);

        if (itemRef != null)
        {
            string[]            strs    = itemRef.dropModel.Split('/');
            string              resName = strs[strs.Length - 1];
            AssetMng.DownloadID downloadID
                = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(itemRef.dropModel, AssetPathType.PersistentDataPath),
                                                           resName,
                                                           _onComplete,
                                                           true);
            return(downloadID);
        }
        else
        {
            GameSys.LogError("Unknown type " + _id);
            _onComplete(null, EResult.NotFound);
            return(null);
        }
    }
Example #10
0
    public void SetData(guild_check_out_item_ask_list item)
    {
        if (memName != null)
        {
            memName.text = item.name;
        }
        if (memLev != null)
        {
            memLev.text = item.lev.ToString();
        }
        if (memContribution != null)
        {
            memContribution.text = item.all_contribute.ToString();
        }
        EquipmentRef equip = ConfigMng.Instance.GetEquipmentRef(item.item_type);

        if (itemName != null && equip != null)
        {
            itemName.text = equip.name.ToString();
        }

        if (btnAgree != null)
        {
            UIEventListener.Get(btnAgree.gameObject).onClick = (x) =>
            {
                GameCenter.guildMng.C2S_ApplyCheckOutItem(item.uid, item.item_id, 1);
            };
        }
        if (btnRefruse != null)
        {
            UIEventListener.Get(btnRefruse.gameObject).onClick = (x) =>
            {
                GameCenter.guildMng.C2S_ApplyCheckOutItem(item.uid, item.item_id, 0);
            };
        }
    }
Example #11
0
    public UIFxAutoActive addLevEffect; //升级特效
    #endregion

    void OnEnable()
    {
        if (promoteBtn != null)
        {
            EventDelegate.Add(promoteBtn.onClick, OnClickPromoteBtn);
        }
        if (equBtn != null)
        {
            EventDelegate.Add(equBtn.onClick, OnClickEquBtn);
        }
        if (unlodBtn != null)
        {
            EventDelegate.Add(unlodBtn.onClick, OnClickUnlodBtn);
        }
        //点击消耗材料,弹出信息框
        if (consumBtn != null)
        {
            UIEventListener.Get(consumBtn.gameObject).onClick = delegate
            {
                ToolTipMng.ShowEquipmentTooltip(new EquipmentInfo(data.WingPromoteList[0].eid, EquipmentBelongTo.PREVIEW), ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None);
            }
        }
        ;
        GameCenter.wingMng.OnGetWingChange -= showEffect;
        GameCenter.wingMng.OnGetWingChange += showEffect;
        GameCenter.wingMng.OnAddLev        -= ShowAddLevEffect;
        GameCenter.wingMng.OnAddLev        += ShowAddLevEffect;
    }

    void OnDisable()
    {
        if (promoteBtn != null)
        {
            EventDelegate.Remove(promoteBtn.onClick, OnClickPromoteBtn);
        }
        if (equBtn != null)
        {
            EventDelegate.Remove(equBtn.onClick, OnClickEquBtn);
        }
        if (unlodBtn != null)
        {
            EventDelegate.Remove(unlodBtn.onClick, OnClickUnlodBtn);
        }
        GameCenter.wingMng.OnGetWingChange -= showEffect;
        GameCenter.wingMng.OnAddLev        -= ShowAddLevEffect;
    }

    /// <summary>
    /// 淬炼
    /// </summary>
    void OnClickPromoteBtn()
    {
        num     = GameCenter.inventoryMng.GetNumberByType(data.WingPromoteList[0].eid);
        goldNum = GameCenter.mainPlayerMng.MainPlayerInfo.TotalCoinCount;

        // 淬炼提升判断条件
        if (data.WingLev == maxWingLev)
        {
            //("提示翅膀已到达满级!!!");
            GameCenter.messageMng.AddClientMsg(280);
        }
        else if (isQuickBuy.value == false && data.WingPromoteNum[0] > num)//没有勾选上直接用元宝购买的按钮,且材料不足
        {
            MessageST mst = new MessageST();
            mst.messID = 217;
            string str2 = string.Empty;
            if (num == 0)
            {
                str2 = data.WingPromoteNum[0].ToString();
            }
            else
            {
                str2 = (data.WingPromoteNum[0] - num).ToString();
            }
            mst.words = new string[3] {
                data.ConsumeYb.ToString(), str2, ConfigMng.Instance.GetEquipmentRef(data.WingPromoteList[0].eid).name
            };
            mst.delYes = UseYB;
            GameCenter.messageMng.AddClientMsg(mst);
        }
        else if (isQuickBuy.value == true && data.WingPromoteNum[0] > num)//勾选上直接用元宝购买的按钮,且材料不足
        {
            UseYB(null);
        }
        //铜钱不足提示
        else if (goldNum < (ulong)data.WingPromoteNum[1])
        {
            GoldNotEnough();
        }
        else
        {
            GameCenter.wingMng.C2S_RequestUpLev(WingState.UPWINGLEV, data.WingId, false);
        }
    }

    void UseYB(object[] pars)
    {
        if ((ulong)data.ConsumeYb > GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount)// (元宝)
        {
            MessageST mst = new MessageST();
            mst.messID = 137;
            mst.delYes = delegate
            {
                //充值界面
                GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
            };
            GameCenter.messageMng.AddClientMsg(mst);
        }
        //铜钱不足提示
        else if (goldNum < (ulong)data.WingPromoteNum[1])
        {
            GoldNotEnough();
        }
        else
        {
            GameCenter.wingMng.C2S_RequestUpLev(WingState.UPWINGLEV, data.WingId, true);
        }
    }

    /// <summary>
    /// 铜钱不足提示
    /// </summary>
    void GoldNotEnough()
    {
        MessageST mst = new MessageST();

        mst.messID = 12;
        EquipmentRef equipRef = ConfigMng.Instance.GetEquipmentRef(data.WingPromoteList[1].eid);

        mst.words = new string[1] {
            equipRef == null ? string.Empty : equipRef.name
        };
        GameCenter.messageMng.AddClientMsg(mst);
    }

    /// <summary>
    /// 穿戴
    /// </summary>
    void OnClickEquBtn()
    {
        GameCenter.wingMng.C2S_RequestChangeWing(data.WingId, true);
    }

    /// <summary>
    /// 卸下
    /// </summary>
    void OnClickUnlodBtn()
    {
        GameCenter.wingMng.C2S_RequestChangeWing(data.WingId, false);
    }

    #region 刷新翅膀激活窗口
    void ShowAddLevEffect()
    {
        if (addLevEffect != null)
        {
            addLevEffect.ShowFx();
        }
    }

    void showEffect()
    {
        if (effect != null)
        {
            effect.ReShowFx();
        }
    }
Example #12
0
    void OnClickSend(GameObject go)
    {
        if (flowerData == null)
        {
            return;
        }
        EquipmentRef flower = ConfigMng.Instance.GetEquipmentRef(flowerData.flowerId);

        if (flower == null)
        {
            return;
        }
        if (GameCenter.inventoryMng.GetNumberByType(flowerData.flowerId) > 0)
        {
            GameCenter.friendsMng.C2S_SendFlower(flowerData.flowerId, flowerData.someOneId, flowerData.flowerType);
        }
        else
        {
            if (!GameCenter.systemSettingMng.ShowBuyFlower)
            {
                if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < flower.diamonPrice)
                {
                    MessageST mst1 = new MessageST();
                    mst1.messID = 137;
                    mst1.delYes = delegate
                    {
                        GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                    };
                    GameCenter.messageMng.AddClientMsg(mst1);
                }
                else
                {
                    GameCenter.friendsMng.C2S_SendFlower(flowerData.flowerId, flowerData.someOneId, flowerData.flowerType);
                }
            }
            else
            {
                MessageST mst = new MessageST();
                mst.messID = 489;
                if (flower != null)
                {
                    mst.words = new string[2] {
                        (flower.diamonPrice).ToString(), flower.name
                    }
                }
                ;
                object[] pa = { 1 };
                mst.pars    = pa;
                mst.delPars = delegate(object[] ob)
                {
                    if (ob.Length > 0)
                    {
                        bool b = (bool)ob[0];
                        if (b)
                        {
                            GameCenter.systemSettingMng.ShowBuyFlower = false;
                        }
                    }
                };
                mst.delYes = delegate
                {
                    if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < flower.diamonPrice)
                    {
                        MessageST mst1 = new MessageST();
                        mst1.messID = 137;
                        mst1.delYes = delegate
                        {
                            GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                        };
                        GameCenter.messageMng.AddClientMsg(mst1);
                    }
                    else
                    {
                        GameCenter.friendsMng.C2S_SendFlower(flowerData.flowerId, flowerData.someOneId, flowerData.flowerType);
                    }
                };
                GameCenter.messageMng.AddClientMsg(mst);
            }
        }
    }
}
Example #13
0
    /// <summary>
    /// 获得的技能书(抄写成功)
    /// </summary>
    void ShowBook()
    {
        if (eqt == null)
        {
            eqt = ConfigMng.Instance.GetEquipmentRef(2200001);
        }
        if (diamondLab != null && eqt != null && MainPlayerInfo != null)
        {
            diamondLab.text = eqt.diamonPrice + "/" + MainPlayerInfo.TotalDiamondCount.ToString();
        }
        if (copyLab != null)
        {
            copyLab.text = "1" + "/" + GameCenter.inventoryMng.GetNumberByType(2200001);
        }
        if (copyAllLab != null)
        {
            copyAllLab.text = "10" + "/" + GameCenter.inventoryMng.GetNumberByType(2200001);
        }
        foreach (BookItem book in bookByCopyAll.Values)
        {
            book.gameObject.SetActive(false);
        }
        int len = petSkillByCopyAll.Count;

        if (len > 0)
        {
            if (len == 1)//如果只抄写了一本书
            {
                using (var key = petSkillByCopyAll.GetEnumerator())
                {
                    while (key.MoveNext())
                    {
                        FillAItem(key.Current.Key);
                    }
                }
            }
            else//如果批量抄写
            {
                int i = 0;
                SetItemActive();
                using (var key = petSkillByCopyAll.GetEnumerator())
                {
                    while (key.MoveNext())
                    {
                        int listlen = bookByCopyAllList.Count;
                        int skillId = petSkillByCopyAll[key.Current.Key];
                        if (listlen < 10)
                        {
                            BookItem item = BookItem.CeateBook(i, parent, false);
                            item.gameObject.SetActive(true);
                            ItemUI bookItem = item.GetComponent <ItemUI>();
                            bookItem.FillInfo(new EquipmentInfo(skillId, EquipmentBelongTo.PREVIEW));
                            bookByCopyAll[key.Current.Key] = item;
                            bookByCopyAllList.Add(item);
                            item.chooseBtn.gameObject.SetActive(true);
                            item.chooseYetBtn.gameObject.SetActive(false);
                            if (item.chooseEx != null)
                            {
                                item.chooseEx.IsGray = UISpriteEx.ColorGray.normal;
                            }
                            if (GameCenter.mercenaryMng.choosedSkillId != 0 && key.Current.Key != GameCenter.mercenaryMng.choosedSkillId)
                            {
                                if (item.chooseEx != null)
                                {
                                    item.chooseEx.IsGray = UISpriteEx.ColorGray.Gray;
                                }
                            }
                            else
                            {
                                if (key.Current.Key == GameCenter.mercenaryMng.choosedSkillId)
                                {
                                    item.chooseBtn.gameObject.SetActive(false);
                                    item.chooseYetBtn.gameObject.SetActive(true);
                                }
                            }
                            if (item.chooseBtn != null)
                            {
                                UIEventListener.Get(item.chooseBtn.gameObject).onClick  -= OnClickChooseToBag;
                                UIEventListener.Get(item.chooseBtn.gameObject).onClick  += OnClickChooseToBag;
                                UIEventListener.Get(item.chooseBtn.gameObject).parameter = key.Current.Key;
                            }
                            i++;
                        }
                        else
                        {
                            if (listlen > i)
                            {
                                BookItem item = bookByCopyAllList[i];
                                item.gameObject.SetActive(true);
                                ItemUI bookItem = item.GetComponent <ItemUI>();
                                bookItem.FillInfo(new EquipmentInfo(skillId, EquipmentBelongTo.PREVIEW));
                                bookByCopyAll[key.Current.Key] = item;
                                bookByCopyAllList.Add(item);
                                item.chooseBtn.gameObject.SetActive(true);
                                item.chooseYetBtn.gameObject.SetActive(false);
                                if (item.chooseEx != null)
                                {
                                    item.chooseEx.IsGray = UISpriteEx.ColorGray.normal;
                                }
                                if (GameCenter.mercenaryMng.choosedSkillId != 0 && key.Current.Key != GameCenter.mercenaryMng.choosedSkillId)
                                {
                                    if (item.chooseEx != null)
                                    {
                                        item.chooseEx.IsGray = UISpriteEx.ColorGray.Gray;
                                    }
                                }
                                else
                                {
                                    if (key.Current.Key == GameCenter.mercenaryMng.choosedSkillId)
                                    {
                                        item.chooseBtn.gameObject.SetActive(false);
                                        item.chooseYetBtn.gameObject.SetActive(true);
                                    }
                                }
                                if (item.chooseBtn != null)
                                {
                                    UIEventListener.Get(item.chooseBtn.gameObject).onClick  -= OnClickChooseToBag;
                                    UIEventListener.Get(item.chooseBtn.gameObject).onClick  += OnClickChooseToBag;
                                    UIEventListener.Get(item.chooseBtn.gameObject).parameter = key.Current.Key;
                                }
                                i++;
                            }
                        }
                    }
                }
            }
        }
    }
Example #14
0
    /// <summary>
    /// 显示背包中的高级、顶级技能书
    /// </summary>
    void ShowBookInBag()
    {
        int lenth = choosedPetSkill.Count;

        if (lenth <= 0)
        {
            if (noNeedBook != null)
            {
                noNeedBook.gameObject.SetActive(true);
            }
        }
        else
        {
            noNeedBook.gameObject.SetActive(false);
        }
        if (parent != null)
        {
            UIGrid grid = parent.GetComponent <UIGrid>();
            grid.maxPerLine = lenth / 2 + lenth % 2;
        }
        foreach (BookItem book in bookInBag.Values)
        {
            book.gameObject.SetActive(false);
        }
        ItemUI choodeitem = composeBookBtn.GetComponent <ItemUI>();

        for (int i = 0; i < lenth; i++)
        {
            int id = choosedPetSkill[i];
            if (choodeitem != null && choodeitem.EQInfo != null)
            {
                EquipmentRef info = ConfigMng.Instance.GetEquipmentRef(id);
                if (info.psetSkillLevel < needLev)
                {
                    continue;
                }
            }
            if (!bookInBag.ContainsKey(id))//创建
            {
                BookItem item = BookItem.CeateNew(i, parent, true);
                item.gameObject.SetActive(true);
                item.chooseBtn.gameObject.SetActive(true);
                item.chooseYetBtn.gameObject.SetActive(false);
                item.curType = ChooseType.GETMAT;
                ItemUI bookItem = item.GetComponent <ItemUI>();
                bookItem.FillInfo(new EquipmentInfo(id, GameCenter.inventoryMng.GetNumberByType(id), EquipmentBelongTo.PREVIEW));
                int num = 0;
                for (int j = 0; j < choosedBookInMat.Count; j++)
                {
                    if (id == choosedBookInMat[j])
                    {
                        ++num;
                    }
                }
                bookItem.FillInfo(new EquipmentInfo(id, GameCenter.inventoryMng.GetNumberByType(id) - num, EquipmentBelongTo.PREVIEW));
                if (item.chooseBtn != null)
                {
                    UIEventListener.Get(item.chooseBtn.gameObject).onClick  -= OnClickChooseToMat;
                    UIEventListener.Get(item.chooseBtn.gameObject).onClick  += OnClickChooseToMat;
                    UIEventListener.Get(item.chooseBtn.gameObject).parameter = id;
                }
                bookInBag[id] = item;
            }
            else//刷新
            {
                BookItem book = bookInBag[id] as BookItem;
                book.gameObject.SetActive(true);
                book.transform.localPosition = new Vector3((i % 2) * 120, -(i / 2) * 168);
                book.chooseBtn.gameObject.SetActive(true);
                book.chooseYetBtn.gameObject.SetActive(false);
                ItemUI bookItem = book.GetComponent <ItemUI>();
                bookItem.FillInfo(new EquipmentInfo(id, GameCenter.inventoryMng.GetNumberByType(id), EquipmentBelongTo.PREVIEW));
                int num = 0;
                for (int j = 0; j < choosedBookInMat.Count; j++)
                {
                    if (id == choosedBookInMat[j])
                    {
                        ++num;
                    }
                }
                bookItem.FillInfo(new EquipmentInfo(id, (GameCenter.inventoryMng.GetNumberByType(id) - num), EquipmentBelongTo.PREVIEW));
            }
        }
    }
Example #15
0
    /// <summary>
    /// 激活按钮
    /// </summary>
    void OnClickActiveBtn()
    {
        EquipmentRef equipRef = ConfigMng.Instance.GetEquipmentRef(data.condition_2[0]);

        if (equipRef != null)
        {
            consumePrice = (int)equipRef.diamonPrice * data.condition_2[1];
        }
        //前置翅膀没有激活
        if (!GameCenter.wingMng.WingDic.ContainsKey(data.id - 1) && data.id - 1 >= 1)
        {
            // 提示前置翅膀等级不足
            MessageST mst = new MessageST();
            mst.messID = 218;
            WingRef lastWingRef = ConfigMng.Instance.GetWingRef(data.id - 1, 1);
            mst.words = new string[1] {
                lastWingRef == null ? string.Empty : lastWingRef.name
            };
            GameCenter.messageMng.AddClientMsg(mst);
        }
        //前置翅膀激活,没有达到15级
        else if (GameCenter.wingMng.WingDic.ContainsKey(data.id - 1) && (GameCenter.wingMng.WingDic[data.id - 1] as WingInfo).WingLev < data.condition_1[1])
        {
            // 提示前置翅膀等级不足
            MessageST mst = new MessageST();
            mst.messID = 218;
            WingRef lastWingRef = ConfigMng.Instance.GetWingRef(data.id - 1, 1);
            mst.words = new string[1] {
                lastWingRef == null ? string.Empty : lastWingRef.name
            };
            GameCenter.messageMng.AddClientMsg(mst);
        }
        else if (data.condition_2.Count != 0 && GameCenter.inventoryMng.GetNumberByType(data.condition_2[0]) < data.condition_2[1])
        {
            //提示材料不足!!!
            MessageST mst = new MessageST();
            mst.messID = 217;
            //是否花费多少元宝?购买多少个?什么?
            mst.words = new string[3] {
                (ConfigMng.Instance.GetEquipmentRef(data.condition_2[0]).diamonPrice *data.condition_2[1]).ToString(), data.condition_2[1].ToString(), ConfigMng.Instance.GetEquipmentRef(data.condition_2[0]).name
            };
            mst.delYes = delegate
            {
                if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < consumePrice)
                {
                    MessageST message = new MessageST();
                    message.messID = 210;
                    message.delYes = delegate
                    {
                        // 充值界面
                        GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                    };
                    GameCenter.messageMng.AddClientMsg(message);
                }
                else
                {
                    GameCenter.wingMng.C2S_RequestUpLev(WingState.ACTIVEWING, data.id, true);
                }
            };
            GameCenter.messageMng.AddClientMsg(mst);
        }
        else
        {
            GameCenter.wingMng.C2S_RequestUpLev(WingState.ACTIVEWING, data.id, false);
        }
    }
Example #16
0
 /// <summary>
 /// 成长提升
 /// </summary>
 /// <param name="go"></param>
 void OnClickPromoteBtn(GameObject go)
 {
     if (growItem.Count > 0)
     {
         ulong coinNum = 0;
         int   itemNum = 0;
         for (int i = 0; i < growItem.Count; i++)
         {
             if (growItem[i].eid == 5)
             {
                 coinNum = (ulong)growItem[i].count;
             }
             else
             {
                 itemNum = growItem[i].count;
                 itemRef = ConfigMng.Instance.GetEquipmentRef(growItem[i].eid);
             }
         }
         if (MainPlayerInfo != null && itemRef != null && MainPlayerInfo.TotalCoinCount >= coinNum)
         {
             if (GameCenter.inventoryMng.GetNumberByType(itemId) < itemNum)
             {
                 if (isAutomaticBuy != null && isAutomaticBuy.value)
                 {
                     if (MainPlayerInfo.TotalDiamondCount >= itemRef.diamonPrice)
                     {
                         GameCenter.mercenaryMng.C2S_ReqPromote(PetChange.GROWUP, GameCenter.mercenaryMng.curPetId, (isAutomaticBuy.value == true) ? 1 : 0);
                     }
                     else
                     {
                         MessageST mst1 = new MessageST();
                         mst1.messID = 137;
                         mst1.delYes = delegate
                         {
                             GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                         };
                         GameCenter.messageMng.AddClientMsg(mst1);
                     }
                 }
                 else
                 {
                     MessageST mst = new MessageST();
                     mst.messID = 158;
                     mst.words  = new string[2] {
                         itemRef.diamonPrice.ToString(), itemRef.name
                     };
                     mst.delYes = delegate
                     {
                         if (MainPlayerInfo.TotalDiamondCount >= itemRef.diamonPrice)
                         {
                             GameCenter.mercenaryMng.C2S_ReqPromote(PetChange.GROWUP, GameCenter.mercenaryMng.curPetId, 1);
                         }
                         else
                         {
                             MessageST mst1 = new MessageST();
                             mst1.messID = 137;
                             mst1.delYes = delegate
                             {
                                 GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                             };
                             GameCenter.messageMng.AddClientMsg(mst1);
                         }
                     };
                     GameCenter.messageMng.AddClientMsg(mst);
                 }
             }
             else
             {
                 GameCenter.mercenaryMng.C2S_ReqPromote(PetChange.GROWUP, GameCenter.mercenaryMng.curPetId, 0);
             }
         }
         else
         {
             GameCenter.messageMng.AddClientMsg(155);
         }
     }
 }
Example #17
0
 void Refresh()
 {
     coupleData = GameCenter.coupleMng.coupleData;
     if (coupleData == null || coupleData.tokenId == 0 || coupleData.marrageTime == 0)
     {
         if (notMerrage != null)
         {
             notMerrage.SetActive(true);
         }
         if (merrage != null)
         {
             merrage.SetActive(false);
         }
         return;
     }
     if (coupleData != null)
     {
         if (notMerrage != null)
         {
             notMerrage.SetActive(false);
         }
         if (merrage != null)
         {
             merrage.SetActive(true);
         }
         DateTime _time = GameHelper.ToChinaTime(new DateTime(1970, 1, 1)).AddSeconds(coupleData.marrageTime);
         if (timeLab != null)
         {
             timeLab.text = ConfigMng.Instance.GetUItext(24, new string[6] {
                 _time.Year.ToString(), _time.Month.ToString(), _time.Day.ToString(), _time.Hour.ToString(), _time.Minute.ToString(), coupleData.objName
             });
         }
         if (MainData != null && myIcon != null)
         {
             myIcon.MakePixelPerfect();
             myIcon.spriteName = MainData.IconName;
         }
         if (objIcon != null)
         {
             objIcon.MakePixelPerfect();
             objIcon.spriteName = coupleData.ObjIcon;
         }
         if (intimacyLab != null)
         {
             intimacyLab.text = coupleData.intimacy.ToString();
         }
         if (tokenItem != null)
         {
             tokenItem.FillInfo(new EquipmentInfo(coupleData.tokenId, EquipmentBelongTo.PREVIEW));
         }
         if (tokenExpSli != null)
         {
             tokenExpSli.value = (float)coupleData.tokenExp / coupleData.Exp;
         }
         if (expLab != null)
         {
             expLab.text = coupleData.tokenExp + "/" + coupleData.Exp;
         }
         if (time != null)
         {
             time.text = coupleData.time.ToString();
         }
         if (coupleData.isHoldMerige)
         {
             if (merraigeEx != null)
             {
                 merraigeEx.IsGray = UISpriteEx.ColorGray.Gray;
             }
         }
         else
         {
             if (merraigeEx != null)
             {
                 merraigeEx.IsGray = UISpriteEx.ColorGray.normal;
             }
         }
         for (int i = 0; i < start.Length; i++)
         {
             if (i < coupleData.tokenLev)
             {
                 start[i].gameObject.SetActive(true);
             }
             else
             {
                 start[i].gameObject.SetActive(false);
             }
         }
         EquipmentRef eqt = ConfigMng.Instance.GetEquipmentRef(coupleData.tokenId);
         if (eqt != null)
         {
             if (tokenNameLab != null)
             {
                 tokenNameLab.text = eqt.name;
             }
         }
         if (coupleData.tokenLev >= 10)//等级已满
         {
             if (tokenExpSli != null)
             {
                 tokenExpSli.value = 1;
             }
             if (expLab != null)
             {
                 expLab.text = coupleData.Exp + "/" + coupleData.Exp;
             }
             if (desAfterMaxLev != null)
             {
                 desAfterMaxLev.gameObject.SetActive(true);
             }
             if (things != null)
             {
                 things.gameObject.SetActive(false);
             }
         }
         else
         {
             if (desAfterMaxLev != null)
             {
                 desAfterMaxLev.gameObject.SetActive(false);
             }
             if (things != null)
             {
                 things.gameObject.SetActive(true);
             }
             for (int i = 0, max = coupleData.NextItems.Count; i < max; i++)
             {
                 if (coupleData.NextItems[i].eid == 5 || coupleData.NextItems[i].eid == 6)//消耗金币
                 {
                     if (coinCount != null)
                     {
                         coinCount.text = coupleData.NextItems[i].count + "/" + GameCenter.mainPlayerMng.MainPlayerInfo.TotalCoinCount;
                     }
                 }
                 else//消耗物品
                 {
                     consume  = ConfigMng.Instance.GetEquipmentRef(coupleData.NextItems[i].eid);
                     needItem = coupleData.NextItems[i];
                     if (itemName != null)
                     {
                         itemName.text = GameHelper.GetStringWithBagNumber(coupleData.NextItems[i]);
                     }
                 }
             }
         }
     }
 }
Example #18
0
    /// <summary>
    /// 刷新界面
    /// </summary>
    void RefreshXiuLingInfo()
    {
        FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList;

        if (mercenaryInfoList.Count <= 0)
        {
            if (AttLabAfterTrainTH != null)
            {
                AttLabAfterTrainTH.text = "0";
            }
            tianRedRemind.gameObject.SetActive(false);
            tianfullLev.gameObject.SetActive(false);
            tianHunTrainBtn.gameObject.SetActive(false);
            if (expSp.Count > 2 && expRatio.Length > 2)
            {
                expSp[0].fillAmount = 0;
                expRatio[0].text    = "0";
                expSp[1].fillAmount = 0;
                expRatio[1].text    = "0";
                expSp[2].fillAmount = 0;
                expRatio[2].text    = "0";
            }
            if (HitLabAfterTrainDH != null)
            {
                HitLabAfterTrainDH.text = "0";
            }
            if (CrazyHitLabAfterTrainMH != null)
            {
                CrazyHitLabAfterTrainMH.text = "0";
            }
            if (coinLab != null)
            {
                coinLab.text = "0";
            }
            if (lxPillLab != null)
            {
                lxPillLab.text = "0";
            }
            NoStar(mingHunStarList);
            NoStar(tianHunStarList);
            NoStar(diHunStarList);
            return;
        }
        if (curInfo == null || (curInfo != null && curInfo.ConfigId != GameCenter.mercenaryMng.curPetId))
        {
            curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId);
        }
        if (curInfo != null)
        {
            ShowStar(tianHunStarList, curInfo.Tian_soul);
            ShowStar(diHunStarList, curInfo.Di_soul);
            ShowStar(mingHunStarList, curInfo.Life_soul);
            NewPetDataRef tHPetData   = ConfigMng.Instance.GetPetDataRef(curInfo.Tian_soul > 0 ? curInfo.Tian_soul + 1 : 1);
            NewPetDataRef dHPetData   = ConfigMng.Instance.GetPetDataRef(curInfo.Di_soul > 0 ? curInfo.Di_soul + 1 : 1);
            NewPetDataRef lifePetData = ConfigMng.Instance.GetPetDataRef(curInfo.Life_soul > 0 ? curInfo.Life_soul + 1 : 1);
            if (curInfo.Tian_soul <= 0)
            {
                NoStar(tianHunStarList);
            }
            if (curInfo.Di_soul <= 0)
            {
                NoStar(diHunStarList);
            }
            if (curInfo.Life_soul <= 0)
            {
                NoStar(mingHunStarList);
            }
            bool isCoinEnough = false;
            bool isItemEnough = false;
            if (curInfo.LxItem.Count > 0)
            {
                for (int i = 0; i < curInfo.LxItem.Count; i++)
                {
                    if (curInfo.LxItem[i].eid == 5)
                    {
                        if (MainPlayerInfo != null)
                        {
                            if (MainPlayerInfo.TotalCoinCount < (ulong)curInfo.LxItem[i].count)
                            {
                                coinLab.text = curInfo.LxItem[i].count + "/" + "[ff0000]" + MainPlayerInfo.TotalCoinCount;
                            }
                            else
                            {
                                isCoinEnough = true;
                                coinLab.text = curInfo.LxItem[i].count + "/" + "[6ef574]" + MainPlayerInfo.TotalCoinCount;
                            }
                        }
                    }
                    else
                    {
                        itemId  = curInfo.LxItem[i].eid;
                        itemRef = ConfigMng.Instance.GetEquipmentRef(itemId);
                        if (GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid) >= curInfo.LxItem[i].count)
                        {
                            isItemEnough = true;
                            if (lxPillLab != null)
                            {
                                lxPillLab.text = curInfo.LxItem[i].count + "/" + "[6ef574]" + GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid);
                            }
                        }
                        else
                        {
                            if (lxPillLab != null)
                            {
                                lxPillLab.text = curInfo.LxItem[i].count + "/" + "[ff0000]" + GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid);
                            }
                        }
                    }
                }
            }
            if (MainPlayerInfo != null)
            {
                if (!isItemEnough)
                {
                    if (itemRef != null && diamondLab != null)
                    {
                        diamondLab.text = itemRef.diamonPrice + "/" + MainPlayerInfo.TotalDiamondCount.ToString();
                    }
                }
                else
                {
                    if (diamondLab != null)
                    {
                        diamondLab.text = "0/" + MainPlayerInfo.TotalDiamondCount.ToString();
                    }
                }
            }
            if (curInfo.Tian_soul >= 32)
            {
                tianRedRemind.gameObject.SetActive(false);
                tianfullLev.gameObject.SetActive(true);
                tianHunTrainBtn.gameObject.SetActive(false);
            }
            else
            {
                if (isCoinEnough && isItemEnough)
                {
                    tianRedRemind.gameObject.SetActive(true);
                }
                else
                {
                    tianRedRemind.gameObject.SetActive(false);
                }
                tianfullLev.gameObject.SetActive(false);
                tianHunTrainBtn.gameObject.SetActive(true);
            }
            if (curInfo.Di_soul >= 32)
            {
                diRedRemind.gameObject.SetActive(false);
                difullLev.gameObject.SetActive(true);
                diHunTrainBtn.gameObject.SetActive(false);
            }
            else
            {
                difullLev.gameObject.SetActive(false);
                diHunTrainBtn.gameObject.SetActive(true);
                if (isCoinEnough && isItemEnough)
                {
                    diRedRemind.gameObject.SetActive(true);
                }
                else
                {
                    diRedRemind.gameObject.SetActive(false);
                }
            }
            if (curInfo.Life_soul >= 32)
            {
                mingRedRemind.gameObject.SetActive(false);
                mingfullLev.gameObject.SetActive(true);
                mingHunTrainBtn.gameObject.SetActive(false);
            }
            else
            {
                mingfullLev.gameObject.SetActive(false);
                mingHunTrainBtn.gameObject.SetActive(true);
                if (isCoinEnough && isItemEnough)
                {
                    mingRedRemind.gameObject.SetActive(true);
                }
                else
                {
                    mingRedRemind.gameObject.SetActive(false);
                }
            }

            for (int j = 0, max = curInfo.SoulPropertyList.Count; j < max; j++)
            {
                if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETATT && tHPetData != null)
                {
                    float attr    = curInfo.SoulPropertyList[j].num;
                    float needVal = 0;
                    if (tHPetData.lXExp.Count > 0 && curInfo.Tian_soul < 32)
                    {
                        needVal = tHPetData.lXExp[0];
                    }
                    else
                    {
                        needVal = attr;
                    }
                    float posy = -128;
                    if (needVal != 0)
                    {
                        posy = -128 + (attr / needVal) * 136;
                    }
                    if (AttLabAfterTrainTH != null)
                    {
                        AttLabAfterTrainTH.text = (attr).ToString();
                    }
                    if (expSp.Count > 0)
                    {
                        expSp[0].transform.localPosition = new Vector3
                                                               (expSp[0].transform.localPosition.x, posy, 0);
                    }
                    if (expRatio.Length > 0)
                    {
                        expRatio[0].text = attr + "/" + needVal;
                    }
                }
                if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETHIT && dHPetData != null)
                {
                    float val     = curInfo.SoulPropertyList[j].num;
                    float needVal = 0;
                    if (dHPetData.lXExp.Count > 1 && curInfo.Di_soul < 32)
                    {
                        needVal = dHPetData.lXExp[1];
                    }
                    else
                    {
                        needVal = val;
                    }
                    float posy = -128;
                    if (needVal != 0)
                    {
                        posy = -128 + (val / needVal) * 136;
                    }
                    if (HitLabAfterTrainDH != null)
                    {
                        HitLabAfterTrainDH.text = val.ToString();
                    }
                    if (expSp.Count > 1)
                    {
                        expSp[1].transform.localPosition = new Vector3
                                                               (expSp[1].transform.localPosition.x, posy, 0);
                    }
                    if (expRatio.Length > 1)
                    {
                        expRatio[1].text = val + "/" + needVal;
                    }
                }
                if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETCRI && lifePetData != null)
                {
                    float val     = curInfo.SoulPropertyList[j].num;
                    float needVal = 0;
                    if (lifePetData.lXExp.Count > 2 && curInfo.Life_soul < 32)
                    {
                        needVal = lifePetData.lXExp[2];
                    }
                    else
                    {
                        needVal = val;
                    }
                    float posy = -128;
                    if (needVal != 0)
                    {
                        posy = -128 + (val / needVal) * 136;
                    }
                    if (CrazyHitLabAfterTrainMH != null)
                    {
                        CrazyHitLabAfterTrainMH.text = val.ToString();
                    }
                    if (expSp.Count > 2)
                    {
                        expSp[2].transform.localPosition = new Vector3
                                                               (expSp[2].transform.localPosition.x, posy, 0);
                    }
                    if (expRatio.Length > 2)
                    {
                        expRatio[2].text = val + "/" + needVal;
                    }
                }
            }
        }
    }
Example #19
0
    /// <summary>
    /// 刷新显示升级信息
    /// </summary>
    void RefreshPromoteInfo()
    {
        FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList;

        if (mercenaryInfoList.Count <= 0 || GameCenter.mercenaryMng.curPetId == MercenaryMng.noPet)
        {
            if (curNameLab != null)
            {
                curNameLab.text = string.Empty;
            }
            if (nameLab != null)
            {
                nameLab.text = string.Empty;
            }
            if (curGrowUpValLab != null)
            {
                curGrowUpValLab.text = "0";
            }
            if (curSp != null)
            {
                curSp.gameObject.SetActive(false);
            }
            if (nextSp != null)
            {
                nextSp.gameObject.SetActive(false);
            }
            if (attValLab != null)
            {
                attValLab.text = "0";
            }
            if (hitValLab != null)
            {
                hitValLab.text = "0";
            }
            if (crazyHitValLab != null)
            {
                crazyHitValLab.text = "0";
            }
            if (GrowUpAfterPromoteLab != null)
            {
                GrowUpAfterPromoteLab.text = "0";
            }
            if (attAfterPromoteLab != null)
            {
                attAfterPromoteLab.text = "0";
            }
            if (hitAfterPromoteLab != null)
            {
                hitAfterPromoteLab.text = "0";
            }
            if (crazyHitAfterPromoteLab != null)
            {
                crazyHitAfterPromoteLab.text = "0";
            }
            if (coinLab != null)
            {
                coinLab.text = "0";
            }
            if (foodLab != null)
            {
                foodLab.text = "0";
            }
            if (upLevelUislider != null)
            {
                upLevelUislider.value = 0;
            }
            if (upBtnRedSp != null)
            {
                upBtnRedSp.gameObject.SetActive(false);
            }
            expLab.text = 0 + "/" + 0;
            for (int i = 0, max = petHonorList.Count; i < max; i++)
            {
                if (petHonorList[i] != null)
                {
                    petHonorList[i].gameObject.SetActive(false);
                }
            }
            return;
        }
        curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId);
        if (curInfo == null)
        {
            return;
        }
        NewPetDataRef petData     = null;
        NewPetDataRef nextPetData = null;

        czid = curInfo.GrowUp;
        len  = ConfigMng.Instance.GetPetDataRefTable.Count - 1;
        if (czid < len)
        {
            fullLev.gameObject.SetActive(false);
            promoteBtn.gameObject.SetActive(true);
        }
        else
        {
            fullLev.gameObject.SetActive(true);
            promoteBtn.gameObject.SetActive(false);
        }
        if (czid <= len && czid <= len)
        {
            petData = ConfigMng.Instance.GetPetDataRef(czid);
        }
        if ((czid + 1) <= len && (czid + 1) <= len)
        {
            nextPetData = ConfigMng.Instance.GetPetDataRef(czid + 1);
        }
        else
        {
            nextPetData = petData;
        }
        if (curNameLab != null)
        {
            curNameLab.text = curInfo.PetName;
        }
        if (nameLab != null)
        {
            nameLab.text = curInfo.PetName;
        }
        if (curGrowUpValLab != null)
        {
            curGrowUpValLab.text = czid.ToString();                         //当前成长值
        }
        if (curSp != null)
        {
            curSp.gameObject.SetActive(true);
            curSp.spriteName = curInfo.Icon;
        }
        int growTitle = 0;

        if (nextSp != null)
        {
            nextSp.gameObject.SetActive(true);
            nextSp.spriteName = curInfo.Icon;
        }
        int curatt = 0;

        if (czid <= 0)
        {
            attValLab.text        = "0";
            hitValLab.text        = "0";
            crazyHitValLab.text   = "0";
            upLevelUislider.value = 0;//当前成长经验/升级所需成长经验
            if (expLab != null && nextPetData != null)
            {
                expLab.text = 0 + "/" + nextPetData.cZExp;
            }
        }
        else if (petData != null)
        {
            int curExp = 0;
            if (czid < len)
            {
                curExp = curInfo.GrowUpExp;
            }
            else
            {
                curExp = petData.cZExp;
            }
            if (upLevelUislider != null && nextPetData != null)
            {
                upLevelUislider.value = (float)curExp / nextPetData.cZExp;                                                //当前成长经验/升级所需成长经验
            }
            if (expLab != null)
            {
                expLab.text = curExp + "/" + nextPetData.cZExp;
            }
            if (petData != null)
            {
                growTitle = petData.cZTitle;
            }
            for (int j = 0; j < petData.chengZhang.Count; j++)
            {
                if (petData.chengZhang[j].eid == (int)PetProperty.PETATT)
                {
                    curatt = petData.chengZhang[j].count;
                    if (attValLab != null)
                    {
                        attValLab.text = curatt.ToString();
                    }
                }
                if (petData.chengZhang[j].eid == (int)PetProperty.PETHIT)
                {
                    if (hitValLab != null)
                    {
                        hitValLab.text = petData.chengZhang[j].count.ToString();
                    }
                }
                if (petData.chengZhang[j].eid == (int)PetProperty.PETCRI)
                {
                    if (crazyHitValLab != null)
                    {
                        crazyHitValLab.text = petData.chengZhang[j].count.ToString();
                    }
                }
            }
        }
        if (GrowUpAfterPromoteLab != null)
        {
            if (czid < (ConfigMng.Instance.GetPetDataRefTable.Count - 1))
            {
                GrowUpAfterPromoteLab.text = (curInfo.GrowUp + 1).ToString();//提升后的成长值
            }
            else
            {
                GrowUpAfterPromoteLab.text = curInfo.GrowUp.ToString();
            }
        }
        int att = 0; int hit = 0; int cri = 0;

        if (nextPetData != null)
        {
            growItem = nextPetData.cZIem;
            for (int i = 0; i < nextPetData.chengZhang.Count; i++)
            {
                if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETATT)
                {
                    att = nextPetData.chengZhang[i].count;
                }
                if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETHIT)
                {
                    hit = nextPetData.chengZhang[i].count;
                }
                if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETCRI)
                {
                    cri = nextPetData.chengZhang[i].count;
                }
            }
        }
        if (attAfterPromoteLab != null)
        {
            attAfterPromoteLab.text = (att).ToString();                            //提升后的攻击
        }
        if (hitAfterPromoteLab != null)
        {
            hitAfterPromoteLab.text = (hit).ToString();                            //提升后的命中
        }
        if (crazyHitAfterPromoteLab != null)
        {
            crazyHitAfterPromoteLab.text = (cri).ToString();                                 //提升后的暴击
        }
        bool isItemEnough = false;
        bool isCoinEnough = false;

        if (growItem.Count > 0 && MainPlayerInfo != null)
        {
            for (int i = 0; i < growItem.Count; i++)
            {
                if (growItem[i].eid == 5)
                {
                    if (MainPlayerInfo.TotalCoinCount < (ulong)growItem[i].count)
                    {
                        coinLab.text = growItem[i].count + "/" + "[ff0000]" + MainPlayerInfo.TotalCoinCount;
                    }
                    else
                    {
                        coinLab.text = growItem[i].count + "/" + "[6ef574]" + MainPlayerInfo.TotalCoinCount;//需要的金币/拥有的
                        isCoinEnough = true;
                    }
                }
                else
                {
                    itemId  = growItem[i].eid;
                    itemRef = ConfigMng.Instance.GetEquipmentRef(itemId);
                    if (GameCenter.inventoryMng.GetNumberByType(growItem[i].eid) >= growItem[i].count)
                    {
                        isItemEnough = true;
                        if (foodLab != null)
                        {
                            foodLab.text = growItem[i].count + "/" + "[6ef574]" + GameCenter.inventoryMng.GetNumberByType(growItem[i].eid);
                        }
                    }
                    else
                    {
                        if (foodLab != null)
                        {
                            foodLab.text = growItem[i].count + "/" + "[ff0000]" + GameCenter.inventoryMng.GetNumberByType(growItem[i].eid);
                        }
                    }
                }
            }
        }
        if (!isItemEnough)
        {
            if (diamondLab != null && MainPlayerInfo != null && itemRef != null)
            {
                diamondLab.text = itemRef.diamonPrice + "/" + MainPlayerInfo.TotalDiamondCount.ToString();
            }
        }
        else
        {
            if (diamondLab != null && MainPlayerInfo != null)
            {
                diamondLab.text = "0/" + MainPlayerInfo.TotalDiamondCount.ToString();
            }
        }
        if (isItemEnough && isCoinEnough && czid < (ConfigMng.Instance.GetPetDataRefTable.Count - 1))
        {
            upBtnRedSp.gameObject.SetActive(true);
        }
        else
        {
            upBtnRedSp.gameObject.SetActive(false);
        }
        ShowHonor(growTitle);
    }
Example #20
0
    /// <summary>
    /// 根据等级刷新
    /// </summary>
    void RefreshMountInfo()
    {
        if (effect != null)
        {
            effect.SetActive(false);
        }
        if (chanceLab != null)
        {
            chanceLab.gameObject.SetActive(false);
        }
        if (trainLab != null)
        {
            trainLab.text = "坐骑培养";
        }
        if (GameCenter.newMountMng.CurLev % 9 == 0)
        {
            if (trainLab != null)
            {
                trainLab.text = "坐骑升阶";
            }
            if (chanceLab != null && MountPropertyRefData != null)
            {
                chanceLab.gameObject.SetActive(true);
                chanceLab.text = ((float)MountPropertyRefData.chance / 10000) * 100 + "%";
            }
            if (GameCenter.newMountMng.CurLev >= (ConfigMng.Instance.RidePropertyRefTable.Count - 1))//满级
            {
                if (trainEx != null)
                {
                    trainEx.IsGray = UISpriteEx.ColorGray.Gray;
                }
            }
        }

        for (int i = 0, max = starSp.Count; i < max; i++)
        {
            starSp[i].IsGray = UISpriteEx.ColorGray.Gray;
        }
        ShowStar();
        if (trainEx != null)
        {
            trainEx.IsGray = UISpriteEx.ColorGray.normal;
        }
        if (GameCenter.newMountMng.CurLev >= (ConfigMng.Instance.RidePropertyRefTable.Count - 1))//满级
        {
            if (trainMountBtn != null)
            {
                trainMountBtn.gameObject.SetActive(false);
            }
            if (levest != null)
            {
                levest.gameObject.SetActive(true);
            }
        }
        if (levLab != null && MountPropertyRefData != null)
        {
            levLab.text = MountPropertyRefData.name;
        }
        //当前等级属性
        if (MountPropertyRefData != null && curInfo != null)
        {
            for (int j = 0; j < curPropertyLab.Count; j++)
            {
                curPropertyLab[j].text = MountPropertyRefData.attr[j].ToString();
            }
        }
        //下级等级属性
        int tableLenth = ConfigMng.Instance.RidePropertyRefTable.Count - 1;

        if (nextLevAddLab.Count > 0 && curInfo != null)
        {
            int next = GameCenter.newMountMng.CurLev + 1;
            if (next >= tableLenth)
            {
                next = tableLenth;//超出表中的数据默认下级为最后一个
            }
            RidePropertyRef nextInfo = ConfigMng.Instance.GetMountPropertyRef(next);
            if (nextInfo != null && MountPropertyRefData != null)
            {
                for (int j = 0; j < nextLevAddLab.Count; j++)
                {
                    nextLevAddLab[j].text = (nextInfo.attr[j] - MountPropertyRefData.attr[j]).ToString();
                }
            }
        }
        //升级需要的财物
        bool isCoinEnough = false;
        bool isItemEnough = false;
        int  itemCount    = 0;

        if (MountPropertyRefData != null && MountPropertyRefData.item != null)
        {
            for (int j = 0; j < MountPropertyRefData.item.Count; j++)
            {
                if (MountPropertyRefData.item[j].eid == 5)
                {
                    if (MainPlayerInfo.TotalCoinCount < (ulong)MountPropertyRefData.item[j].count)
                    {
                        coinLab.text = MountPropertyRefData.item[j].count + "/" + "[ff0000]" + MainPlayerInfo.TotalCoinCount;
                    }
                    else
                    {
                        isCoinEnough = true;
                        coinLab.text = MountPropertyRefData.item[j].count + "/" + "[6ef574]" + MainPlayerInfo.TotalCoinCount;//需要的金币/拥有的
                    }
                }
                else
                {
                    itemId    = MountPropertyRefData.item[j].eid;
                    itemRef   = ConfigMng.Instance.GetEquipmentRef(itemId);
                    itemCount = MountPropertyRefData.item[j].count;
                    if (GameCenter.inventoryMng.GetNumberByType(itemId) >= itemCount)
                    {
                        isItemEnough = true;
                    }
                    if (GameCenter.inventoryMng.GetNumberByType(itemId) >= itemCount)
                    {
                        isItemEnough = true;
                        if (itemLab != null)
                        {
                            itemLab.text = itemCount + "/" + "[6ef574]" + GameCenter.inventoryMng.GetNumberByType(itemId);
                        }
                    }
                    else
                    {
                        if (itemLab != null)
                        {
                            itemLab.text = itemCount + "/" + "[ff0000]" + GameCenter.inventoryMng.GetNumberByType(itemId);
                        }
                    }
                }
            }
        }
        if (!isItemEnough)
        {
            if (itemRef != null && diamondLab != null && MainPlayerInfo != null)
            {
                diamondLab.text = (itemRef.diamonPrice) * itemCount + "/" + MainPlayerInfo.TotalDiamondCount.ToString();
            }
        }
        else
        {
            if (diamondLab != null && MainPlayerInfo != null)
            {
                diamondLab.text = "0/" + MainPlayerInfo.TotalDiamondCount.ToString();
            }
        }
        if (isItemEnough && isCoinEnough && !levest.gameObject.activeSelf)
        {
            trainRedMind.gameObject.SetActive(true);
        }
        else
        {
            trainRedMind.gameObject.SetActive(false);
        }
        //if (curData != null)
        //{
        //    bool isLoadAgin = false;
        //    MountInfo info = mountDic[curData.mountId] as MountInfo;
        //    if (info.MountEffectList.Count > 0)
        //    {
        //        for (int i = 0, max = info.MountEffectList.Count; i < max; i++)
        //        {
        //            MountEffect effect = info.MountEffectList[i];
        //            if ((info.ConfigID - 1) * 9 + effect.effectLev == GameCenter.newMountMng.CurLev)
        //            {
        //                if (mountDic.ContainsKey(curData.mountId))
        //                {
        //                    isLoadAgin = true;
        //                    break;
        //                }
        //            }
        //        }
        //    }
        //    if (isLoadAgin)//重新加载模型及特效
        //    {
        //        GameCenter.previewManager.SetPreviewMountEnpty();
        //        GameCenter.previewManager.TryPreviewSingelMount(info, mountLookTex);
        //    }
        //}
        //if (GameCenter.newMountMng.CurLev == 0)//激活坐骑
        //{
        //    RefreshList();
        //}
        //if ((index != (GameCenter.newMountMng.CurLev - 1) / 9) && isRereshListInvoke)
        //{
        //    CancelInvoke("refresh");//延迟刷新显示当前骑着的
        //    Invoke("refresh", 0.1f);
        //}
        //isRereshListInvoke = true;
    }