コード例 #1
0
ファイル: HeroData.cs プロジェクト: ww386362087/MoyuHero
        /// <summary>
        /// 判断指定物品是否装备在英雄身上;
        /// </summary>
        /// <param name="itemEquip"></param>
        /// <returns></returns>
        public bool IsItemEquiped(ItemEquip itemEquip)
        {
            if (itemEquip != null && itemEquip.GetItemGuid().IsValid())
            {
                return(IsItemEquiped(itemEquip.GetItemGuid()));
            }

            return(false);
        }
コード例 #2
0
    void OnIdentifyBtnClick()
    {
        //HideRuneDetailUI();
        ItemEquip    itemE = _ObjectCard.GetHeroData().GetRuneItemInfo(mRunePoint);
        ItemTemplate itemT = itemE.GetItemRowData();

        //一星符文没法鉴定;
        if (itemT.getRune_quality() <= 1)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip3"), mMsgBoxTrans);
            return;
        }

        //是否鉴定满级;
        int count = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(itemT);

        if (itemE.GetDefineTimes() >= count)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip4"), mMsgBoxTrans);
            return;
        }

        //if (!initRuneIdentifyUIDone)
        //{
        //    initRuneIdentifyUIDone = true;
        //    mRuneIdentifyMgr = new UI_RuneIdentifyMgr(mRuneIdentityObj);
        //}

        //mRuneIdentifyMgr.ShowUI(itemE.GetItemGuid());
        GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_OpenUI, UI_RuneIdentifyMgr.UI_ResPath);
        UI_RuneIdentifyMgr.SetShowRuneGUID(itemE.GetItemGuid());
        RunOnBack();
    }
コード例 #3
0
 public void OnMyselfClick()
 {
     UI_RuneMange._instance.RuneList(index);
     UI_RuneMassage._instance.UpdateShow(id, rune);
     //功能提示
     ObjectSelf.GetInstance().CommonItemContainer.SetItemPreview(m_CurItem.GetItemGuid());
     m_Tip.SetActive(false);
     UI_Bag._instance.m_TipsController.Refresh();
 }
コード例 #4
0
    /// <summary>
    /// 打开符文强化界面;
    /// </summary>
    void ShowRuneStrenthUI(ItemEquip itemEquip)
    {
        ItemEquip itemE = _ObjectCard.GetHeroData().GetRuneItemInfo(mRunePoint);

        //if (!initRuneStrenthUIDone)
        //{
        //    initRuneStrenthUIDone = true;
        //    mRuneStrenthMgr = new UI_RuneStrenthMgr(mRuneStrenthObj.transform);
        //}

        //mRuneStrenthMgr.ShowUI(itemE.GetItemGuid());
        GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_OpenUI, UI_RuneStrenthMgr.UI_ResPath);
        UI_RuneStrenthMgr.SetShowRuneGUID(itemE.GetItemGuid());
    }
コード例 #5
0
    public void RuneShow()
    {
        //Debug.Log(tableID);

        if (itemState == ItemSate.Empty)
        {
            for (int i = 0; i < Parent.childCount; i++)
            {
                Parent.GetChild(i);
                if (i == 0)
                {
                    Parent.GetChild(i).gameObject.SetActive(true);
                }
                else
                {
                    Parent.GetChild(i).gameObject.SetActive(false);
                }
            }
            mySelfBtn.onClick.RemoveListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
            return;
        }
        else if (itemState == ItemSate.Lock)
        {
            for (int i = 0; i < Parent.childCount; i++)
            {
                Parent.GetChild(i);
                if (i == 0 || i == 1)
                {
                    Parent.GetChild(i).gameObject.SetActive(true);
                }
                else
                {
                    Parent.GetChild(i).gameObject.SetActive(false);
                }
            }
            mySelfBtn.onClick.RemoveListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
            return;
        }
        else if (itemState == ItemSate.FillDate)
        {
            Parent.FindChild("lock").gameObject.SetActive(false);
            Parent.FindChild("Border").gameObject.SetActive(false);
            maxLevel.SetActive(true);
            bg.SetActive(true);
            specBg.SetActive(true);
            mIcon.gameObject.SetActive(true);
            mName.gameObject.SetActive(true);
            Parent.FindChild("Level").gameObject.SetActive(true);
            Parent.FindChild("Equip").gameObject.SetActive(false);
            Parent.FindChild("Pos").gameObject.SetActive(true);
            Parent.FindChild("stars").gameObject.SetActive(true);
            mySelfBtn.onClick.RemoveAllListeners();
            mySelfBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
        }
        if (tableID == null)
        {
            return;
        }
        else
        {
            rune = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(tableID);
            //Debug.Log(rune.getIcon());
            mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + rune.getIcon());
            // mIcon.SetNativeSize();
            mIcon.transform.localScale = new Vector3(0.8f, 0.8f, 0f);
            mName.text = GameUtils.getString(rune.getName());
            int starCount = rune.getRune_quality();

            bool isSpec = RuneModule.IsSpecialRune(rune);
            bg.SetActive(!isSpec);
            specBg.SetActive(isSpec);

            for (int i = 0; i < starCount; i++)
            {
                mStarList[i].SetActive(true);
            }

            for (int i = 1; i <= 4; i++)
            {
                mTypes[i - 1].gameObject.SetActive(i == rune.getRune_type());
            }

            for (int i = starCount; i < mStarList.Count; i++)
            {
                mStarList[i].SetActive(false);
            }
            m_CurItem = (ItemEquip)ObjectSelf.GetInstance().CommonItemContainer.FindItem(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP, UI_RuneMange._instance.rune[id].GetItemGuid());
            bool isEquiped = m_CurItem.IsEquip();//ObjectSelf.GetInstance().HeroContainerBag.IsItemEquiped(data);
            mEquip.SetActive(isEquiped);
            mLevel.text = "+" + m_CurItem.GetStrenghLevel();

            //已满级
            int          strengthLv = m_CurItem.GetStrenghLevel();
            ItemTemplate itemT      = m_CurItem.GetItemRowData();
            bool         isFullLv   = DataTemplate.GetInstance().IsRuneStrenthFullLevel(itemT, strengthLv);
            if (isFullLv)
            {
                maxLevel.SetActive(true);
            }
            else
            {
                maxLevel.SetActive(false);
            }
            //设置符文满级特效颜色
            RawImage rawImage = maxLevel.GetComponent <RawImage>();
            switch (itemT.getRune_type())
            {
            case 1:     //蓝色
                rawImage.color = Color.blue;
                break;

            case 2:     //紫色
                rawImage.color = new Color(153 / 255f, 51 / 255f, 250 / 255f);
                break;

            case 3:     //绿色
                rawImage.color = Color.green;
                break;

            case 4:      //红色
                rawImage.color = Color.red;
                break;

            case 5:      //橙色
                rawImage.color = new Color(255 / 255f, 128 / 255f, 0 / 255f);
                break;

            default:
                break;
            }
            m_Tip.SetActive(ObjectSelf.GetInstance().CommonItemContainer.IsNewGetItem(m_CurItem.GetItemGuid()));
        }
    }
コード例 #6
0
    void ShowRuneDetailUI(ItemEquip itemE)
    {
        if (itemE == null)
        {
            return;
        }

        ItemTemplate itemT = DataTemplate.GetInstance().GetItemTemplateById(itemE.GetItemTableID());

        mSpecHeroName.text = "";

        HideAllRuneSelectEffect();
        mRunes[(int)mRunePoint].SetEffectShow((EM_RUNE_TYPE)(itemT.getRune_type()));

//         mRuneDetailItem.SetIcon(common.defaultPath + itemT.getIcon());
//         mRuneDetailItem.SetStarsNum(itemT.getRune_quality());
//         mRuneDetailItem.SetLevel(itemE.GetStrenghLevel());
//         mRuneDetailItem.SetLevelInfoActive(true);
//         //bool isSpecial = itemT.getRune_type() == 5 || itemT.getRune_type() == 6;
//         bool isSpecial = RuneModule.IsSpecialRune(itemT);
//         mRuneDetailItem.SetIsSpecial(isSpecial);
//         if (!isSpecial)
//         {
//             mRuneDetailItem.SetRuneType(itemT.getRune_type());
//         }

        if (mItemCommon == null)
        {
            mItemCommon = RuneFactory.CreateRuneItemCommom(m_RuneItemPos);
        }

        RuneItemCommonData ricd = new RuneItemCommonData();

        ricd.IsShowMaxEffect = true;
        ricd.ItemT           = itemE.GetItemRowData();
        ricd.RuneLevel       = itemE.GetStrenghLevel();
        ricd.EquipedHeroName = RuneModule.GetItemEuipHeroName(itemE);
        mItemCommon.SetRuneItemData(ricd, RuneItemCommon.RuneItemShowType.IconWithRightName);

        //mRuneName.text = GameUtils.getString(itemT.getName());
        mUserObj.SetActive(false);

        if (mDetailCommon == null)
        {
            mDetailCommon = new RuneDetailCommon(m_RuneAttriPos, itemE.GetItemGuid(), 450f);
        }
        else
        {
            mDetailCommon.SetShowData(itemE.GetItemGuid());
        }
//        GameUtils.DestroyChildsObj(mAttriList);

//         //基础属性;
//         bool titleDone1 = false;
//         RuneData runeData = itemE.GetRuneData();
//         foreach(int id in runeData.BaseAttributeID)
//         {
//             if(id == -1)
//                 continue;
//
//             if(!titleDone1)
//             {
//                 titleDone1 = true;
//                 CreateTitle(mAttriList, GameUtils.getString("hero_rune_content8"));
//             }
//
//             BaseruneattributeTemplate bt = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id);
//             if(bt.getNumshow() == 0)
//             {
//                 //CreateTitle(mAttriList, GameUtils.getString(bt.getAttriDes()));
//                 CreateDetailTxts(mAttriList, GameUtils.getString(bt.getAttriDes()));
//             }
//             else
//             {
//                 //CreateBaseAttriObj(mAttriList, GameUtils.GetAttriName(bt.getAttriType()), "+" + bt.getAttriValue().ToString());
//                 CreateBaseAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes()), "+" + bt.getAttriValue().ToString());
//             }
//         }
//
//         //附加属性-------激活等级分别为强化等级达到3/6/9/12;
//         bool titleDone2 = false;
        int count = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(itemT);

//         int i = 0;
//         int strenthLv = itemE.GetStrenghLevel();
//         bool isGray = false;
//
//         foreach (int id in runeData.AppendAttribute)
//         {
//             i++;
//             isGray = i * 3 > strenthLv;
//             if (id == -1)
//             {
//                 if (i <= count)
//                 {
//                     if (!titleDone2)
//                     {
//                         titleDone2 = true;
//                         CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"));
//                     }
//
//                     //位置属性,未鉴定;
//                     CreateAddAttriObj(mAttriList, GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), isGray);
//                 }
//
//                 continue;
//             }
//
//             if(!titleDone2)
//             {
//                 titleDone2 = true;
//                 CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"));
//             }
//
//             AddruneattributeTemplate bt = DataTemplate.GetInstance().GetAddruneattributeTemplate(id);
//             bool isPercent = bt.getIspercentage() > 0;
//             string val = isPercent ? ((float)bt.getAttriValue() / (float)10f + "%") : bt.getAttriValue().ToString();
//             CreateAddAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, isGray);
//        }

        //设置按钮状态;
        GameUtils.SetBtnSpriteGrayState(mStrenthBtn, DataTemplate.GetInstance().IsRuneStrenthFullLevel(itemT, itemE.GetStrenghLevel()));
        GameUtils.SetBtnSpriteGrayState(mIdentifyBtn, itemE.GetDefineTimes() >= count);

        mRuneDetailObj.SetActive(true);
    }