Exemple #1
0
    public ItemEquipment(ItemEquipmentInstance _instanceData)
    {
        try
        {
            this.instanceData     = _instanceData;
            equipmentInstanceData = _instanceData;

            //Debug.Log("ItemEquipment(id=" + _instanceData.templeId+")");

            if (!ItemEquipmentData.dataMap.ContainsKey(_instanceData.templeId))
            {
                Debug.Log("OMG!!!!");
            }
            templateData = ItemEquipmentData.dataMap[_instanceData.templeId];
            //templateData = new ItemEquipmentData();
            equipmentTemplateData = (ItemEquipmentData)templateData;
            //Debug.Log("quality:" + quality + ",vocation:" + vocation + ",type:" + type + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

            level = levelNeed;
        }
        catch (System.Exception e)
        {
            Debug.Log(e);
        }
    }
Exemple #2
0
    /// <summary>
    /// 设置推荐装备Grid数据
    /// </summary>
    /// <param name="m_equipRecommendGridDataList"></param>
    public void SetEquipRecommendDataList(List <EquipRecommendGridData> m_equipRecommendGridDataList)
    {
        for (int index = 0; index < m_equipRecommendGridDataList.Count; index++)
        {
            if (!m_maplistEquipRecommendUIGrid.ContainsKey(index))
            {
                continue;
            }

            int recommendScore = 0;
            int currentScore   = 0;

            EquipRecommendGridData gridData = m_equipRecommendGridDataList[index];
            EquipRecommendUIGrid   gridUI   = m_maplistEquipRecommendUIGrid[index];

            gridUI.LoadResourceInsteadOfAwake();
            gridUI.SetEquipRecommendAccess(gridData.access, gridData.accessType);

            if (gridData.currentItemEquipment != null)
            {
                gridUI.SetCurrentEquipID(gridData.currentItemEquipment.templateId);
                gridUI.SetCurrentEquip(gridData.currentItemEquipment.icon, gridData.currentItemEquipment.color, gridData.currentItemEquipment.quality);
                gridUI.SetCurrentEquipName(gridData.currentItemEquipment.name, true);

                currentScore = gridData.currentItemEquipment.GetScore(MogoWorld.thePlayer.level);
                gridUI.SetCurrentEquipScore((currentScore));
            }
            else
            {
                gridUI.SetCurrentEquipID(0);
                gridUI.SetCurrentEquip(EquipSlotIcon.icons[gridData.equipSlot], 0);
                gridUI.SetCurrentEquipName(EquipSlotName.GetEquipSlotNameBySlot(gridData.equipSlot), false);
                gridUI.SetCurrentEquipScore(0);
            }

            ItemEquipmentData recommendEquipData = ItemEquipmentData.GetItemEquipmentData(gridData.recommendEquipID);
            if (recommendEquipData != null)
            {
                gridUI.SetRecommendEquipID(recommendEquipData.id);
                gridUI.SetRecommendEquip(recommendEquipData.Icon, recommendEquipData.color, (int)recommendEquipData.quality);
                gridUI.SetRecommendEquipName(recommendEquipData.Name, true);

                recommendScore = recommendEquipData.GetScore(MogoWorld.thePlayer.level);
                gridUI.SetRecommendEquipScore(recommendScore);
            }
            else
            {
                gridUI.SetRecommendEquipID(0);
                gridUI.SetRecommendEquip(EquipSlotIcon.icons[gridData.equipSlot], 0);
                gridUI.SetRecommendEquipName(EquipSlotName.GetEquipSlotNameBySlot(gridData.equipSlot), false);
                gridUI.SetRecommendEquipScore(0);
            }

            gridUI.SetScoreUpgradeNum(recommendScore, currentScore);
        }
    }
Exemple #3
0
    /// <summary>
    /// 通过装备槽获取对应的推荐装备评分
    /// </summary>
    /// <param name="xmlData"></param>
    /// <param name="equipSlot"></param>
    /// <returns></returns>
    private int GetEquipRecommendScoreBySlot(EquipRecommendData xmlData, int equipSlot)
    {
        int recommendEquipID = GetEquipRecommendGoodIDBySlot(xmlData, equipSlot);
        ItemEquipmentData recommendEquipData = ItemEquipmentData.GetItemEquipmentData(recommendEquipID);

        if (recommendEquipData != null)
        {
            return(recommendEquipData.GetScore(MogoWorld.thePlayer.level));
        }
        else
        {
            return(0);
        }
    }
    private EquipUpgradeViewManager.EquipUpgradeViewData GetViewdata(ItemEquipment m_equip)
    {
        EquipUpgradeViewManager.EquipUpgradeViewData viewData = new EquipUpgradeViewManager.EquipUpgradeViewData();
        viewData.oldEquipId = m_equip.templateId;

        ItemEffectData    itemEffect = ItemEffectData.dataMap.Get(m_equip.effectId);
        ItemEquipmentData newEquip   = null;

        foreach (int id in itemEffect.reward1.Keys)
        {
            newEquip            = ItemEquipmentData.dataMap.Get(id);
            viewData.newEquipId = newEquip.id;
            break;
        }
        viewData.materialIdList    = new List <int>();
        viewData.materilNumStrList = new List <string>();
        foreach (KeyValuePair <int, int> pair in itemEffect.costId)
        {
            Mogo.Util.LoggerHelper.Debug(pair.Key);
            ItemParentData item = ItemParentData.GetItem(pair.Key);
            if (item.itemType > 0)
            {
                viewData.materialIdList.Add(item.id);
                string numStr  = string.Empty;
                int    num     = InventoryManager.Instance.GetItemNumByIdAndType(item.id, item.itemType);
                int    needNum = pair.Value;
                numStr = string.Concat(num, "/", needNum);
                if (needNum > num)
                {
                    numStr = MogoUtils.GetRedString(numStr);
                }
                viewData.materilNumStrList.Add(numStr);
            }
            else
            {
                viewData.needGold = "X" + pair.Value;
            }
        }

        int level = MogoWorld.thePlayer.level;

        viewData.power = LanguageData.GetContent(190000, newEquip.GetScore(level) - m_equip.GetScore(level));

        return(viewData);
    }
Exemple #5
0
    public void RefreshPlayerEquipmentInfoUI(List <RankEquipData> equipList)
    {
        m_RankEquipDataList = equipList;

        for (int equipSlot = 1; equipSlot <= SLOT_NUM; equipSlot++)
        {
            RankEquipData rankEquipData = GetRankEquipDataBySlot(equipSlot);
            if (rankEquipData != null)
            {
                ItemEquipmentData data = ItemEquipmentData.GetItemEquipmentData(rankEquipData.equipID);
                if (data != null)
                {
                    SetPlayerEquipmentInfo(equipSlot, data.Icon, data.color, data.quality);
                }
            }
            else
            {
                SetPlayerEquipmentInfo(equipSlot, EquipSlotIcon.icons[equipSlot], 10);
            }
        }
    }
Exemple #6
0
    public void Equip(EtyAvatar avatar, int _equipId, Action callback)
    {
        //Debug.Log("_equipId:" + _equipId);
        if (avatar.gameObject == null)
        {
            Debug.Log("Transform == null");
            //Debug.LogError("Transform == null");
            return;
        }
        System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
        stopWatch.Start();

        if (!ItemEquipmentData.dataMap.ContainsKey(_equipId))
        {
            Debug.LogError("can not find equip:" + _equipId);
            return;
        }
        ItemEquipmentData equip = ItemEquipmentData.dataMap[_equipId];

        if (equip.mode > 0)
        {
            if (avatar.actorParent == null)
            {
                Debug.Log("the actor is null!!!!");
                //Debug.LogError("the actor is null!!!!");
                return;
            }
            avatar.actorParent.m_isChangingWeapon = true;
            avatar.actorParent.Equip(equip.mode, () =>
            {
                if (equip.type == (int)EquipType.Weapon)
                {
                    //Debug.Log("ControllerOfWeaponData:" + equip.id);
                    //Debug.Log("ControllerOfWeaponData:" + equip.subtype);
                    //Debug.Log("ControllerOfWeaponData:" + (int)vocation);
                    ControllerOfWeaponData controllerData = ControllerOfWeaponData.dataMap[equip.subtype];
                    RuntimeAnimatorController controller;
                    AssetCacheMgr.GetResource(controllerData.controller,
                                              (obj) =>
                    {
                        controller = obj as RuntimeAnimatorController;
                        if (avatar.animator == null)
                        {
                            return;
                        }
                        avatar.animator.runtimeAnimatorController = controller;


                        if (MogoWorld.inCity)
                        {
                            avatar.animator.SetInteger("Action", -1);
                        }
                        else
                        {
                            avatar.animator.SetInteger("Action", 0);
                        }
                        callback();
                    });
                }
                else
                {
                    callback();
                }
            });

            stopWatch.Stop();
        }
        else
        {
            callback();
        }
    }
    //private int m_iInputTextCount = 0;
    string TranslateInputText(string text)
    {
        string result;

        //switch (text)
        //{
        //    case "<info=(1,1,1)>":
        //        result = "[FF00FF]超级大斧[-]";
        //        break;

        //    case "<info=(1,0,0)>":
        //        result = "[FF0000]³¬Œ¶ŽóŽž[-]";
        //        break;

        //    case "<face=(1)>":
        //        result = "{:1}";
        //        break;

        //    default:
        //        result = "";
        //        break;

        //}


        if (text.Length > 7 && text.Substring(0, 7) == "<info=(")
        {
            result = text.Substring(7);
            result = result.Substring(0, result.Length - 2);

            string tmp = "";

            int[] data = new int[5];

            for (int i = 0; i < 5; ++i)
            {
                data[i] = -1;
            }

            for (int i = 0; i < result.Length; ++i)
            {
                if (result[i] != ',')
                {
                    tmp += result[i];
                }
                else
                {
                    break;
                }
            }

            //result = ItemEquipmentData.dataMap[int.Parse(tmp)].Name;
            result = ItemEquipmentData.GetCommunityEquipNameByID(int.Parse(tmp));
            //result = "[FF00FF]" + result + "[-]";
        }
        else if (text.Length > 7 && text.Substring(0, 7) == "<face=(")
        {
            if (text.Substring(8, 1) == ")")
            {
                result = string.Concat("{:", text.Substring(7, 1), "}");
            }
            else
            {
                result = string.Concat("{:", text.Substring(7, 2), "}");
            }

            //result = "{:1}";
        }
        else
        {
            result = "";
        }

        return(result);
    }
        public void Load(BinaryReader pReader)
        {
            Identifier = pReader.ReadInt32();
            Flags = (EItemFlags)pReader.ReadUInt16();
            Price = pReader.ReadInt32();
            MaxSlotQuantity = pReader.ReadUInt16();
            MaxPossessionCount = pReader.ReadByte();
            MinLevel = pReader.ReadByte();
            MaxLevel = pReader.ReadByte();
            Experience = pReader.ReadInt32();
            MakerLevel = pReader.ReadByte();
            Money = pReader.ReadInt32();
            StateChangeItem = pReader.ReadInt32();
            NPC = pReader.ReadInt32();
            if (pReader.ReadBoolean())
            {
                Equipment = new ItemEquipmentData();
                Equipment.Load(pReader);
            }
            if (pReader.ReadBoolean())
            {
                Consume = new ItemConsumeData();
                Consume.Load(pReader);
            }
            if (pReader.ReadBoolean())
            {
                Card = new ItemCardData();
                Card.Load(pReader);
            }
            if (pReader.ReadBoolean())
            {
                Pet = new ItemPetData();
                Pet.Load(pReader);
            }
            if (pReader.ReadBoolean())
            {
                Recharge = new ItemRechargeData();
                Recharge.Load(pReader);
            }
            if (pReader.ReadBoolean())
            {
                Scroll = new ItemScrollData();
                Scroll.Load(pReader);
            }

            int morphsCount = pReader.ReadInt32();
            Morphs = new List<ItemMorphData>(morphsCount);
            while (morphsCount-- > 0)
            {
                ItemMorphData morph = new ItemMorphData();
                morph.Load(pReader);
                Morphs.Add(morph);
            }

            int skillsCount = pReader.ReadInt32();
            Skills = new List<ItemSkillData>(skillsCount);
            while (skillsCount-- > 0)
            {
                ItemSkillData skill = new ItemSkillData();
                skill.Load(pReader);
                Skills.Add(skill);
            }

            int summonsCount = pReader.ReadInt32();
            Summons = new List<ItemSummonData>(summonsCount);
            while (summonsCount-- > 0)
            {
                ItemSummonData summon = new ItemSummonData();
                summon.Load(pReader);
                Summons.Add(summon);
            }
        }
Exemple #9
0
    public ItemEquipment(ItemEquipmentInstance _instanceData)
    {
        try
        {
            this.instanceData = _instanceData;
            equipmentInstanceData = _instanceData;

            LoggerHelper.Debug("id:" + _instanceData.templeId);

            if (!ItemEquipmentData.dataMap.ContainsKey(_instanceData.templeId)) LoggerHelper.Debug("OMG!!!!");
            templateData = ItemEquipmentData.dataMap[_instanceData.templeId];
            //templateData = new ItemEquipmentData();
            equipmentTemplateData = (ItemEquipmentData)templateData;
            //LoggerHelper.Debug("quality:" + quality + ",vocation:" + vocation + ",type:" + type + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

            level = levelNeed;

        }
        catch (System.Exception e)
        {

            LoggerHelper.Debug(e);
        }
    }
Exemple #10
0
        public void Equip(int _equipId)
        {
            if (Transform == null)
            {
                return;
            }
            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();

            if (!ItemEquipmentData.dataMap.ContainsKey(_equipId))
            {
                LoggerHelper.Error("can not find equip:" + _equipId);
                return;
            }
            ItemEquipmentData equip = ItemEquipmentData.dataMap[_equipId];

            if (equip.mode > 0)
            {
                if (Actor == null)
                {
                    return;
                }
                Actor.m_isChangingWeapon = true;
                Actor.Equip(equip.mode);
                if (equip.type == (int)EquipType.Weapon)
                {
                    ControllerOfWeaponData    controllerData = ControllerOfWeaponData.dataMap[equip.subtype];
                    RuntimeAnimatorController controller;
                    if (animator == null)
                    {
                        return;
                    }
                    string controllerName = (MogoWorld.inCity ? controllerData.controllerInCity : controllerData.controller);
                    if (animator.runtimeAnimatorController != null)
                    {
                        if (animator.runtimeAnimatorController.name == controllerName)
                        {
                            return;
                        }
                        AssetCacheMgr.ReleaseResource(animator.runtimeAnimatorController);
                    }

                    AssetCacheMgr.GetResource(controllerName,
                                              (obj) =>
                    {
                        controller = obj as RuntimeAnimatorController;
                        if (animator == null)
                        {
                            return;
                        }
                        animator.runtimeAnimatorController = controller;
                        if (this is EntityMyself)
                        {
                            (this as EntityMyself).UpdateSkillToManager();
                            EventDispatcher.TriggerEvent <int, int>(InventoryEvent.OnChangeEquip, equip.type, equip.subtype);
                        }
                        if (this is EntityPlayer)
                        {
                            if (MogoWorld.inCity)
                            {
                                animator.SetInteger("Action", -1);
                            }
                            else
                            {
                                animator.SetInteger("Action", 0);
                            }
                            if (MogoWorld.isReConnect)
                            {
                                ulong s   = stateFlag;
                                stateFlag = 0;
                                stateFlag = s;
                            }
                        }
                    });
                }

                stopWatch.Stop();

                //if (!isCreatingModel)
                //{
                //    SetPosition();
                //    stopWatch.Start();
                //    //AssetCacheMgr.ReleaseInstance(GameObject);
                //    CreateActualModel();
                //    stopWatch.Stop();
                //    Mogo.Util.LoggerHelper.Debug("CreateModel:" + stopWatch.Elapsed.Milliseconds);

                //}
            }
        }