예제 #1
0
    protected IRuneDetailObj GetOrCreateRuneDetailObj(RuneDetailObjType type, Transform parent)
    {
        if (mObjPool != null && mObjPool.Count > 0)
        {
            for (int i = 0; i < mObjPool.Count; i++)
            {
                if (mObjPool[i].isInUse)
                {
                    continue;
                }

                if (mObjPool[i].objType != type)
                {
                    continue;
                }

                mObjPool[i].isInUse = true;
                return(mObjPool[i].obj);
            }
        }

        IRuneDetailObj detailObj = RuneFactory.Create(type, parent);

        RuneDetailCommonObjData objData = new RuneDetailCommonObjData();

        objData.isInUse = true;
        objData.obj     = detailObj;
        objData.objType = type;

        mObjPool.Add(objData);

        return(detailObj);
    }
예제 #2
0
    private void ItemTypeProcess(ItemTemplate itemData)
    {
        if (m_RuneItemCommon == null)
        {
            m_RuneItemCommon = RuneFactory.CreateRuneItemCommom(m_ItemBG.transform);
        }
        RuneItemCommonData _data = new RuneItemCommonData();

        _data.ItemT = itemData;
        m_RuneItemCommon.SetRuneItemData(_data, RuneItemCommon.RuneItemShowType.IconOnly);
        m_RuneItemCommon.transform.localScale = Vector3.one * 0.9f;
    }
예제 #3
0
    public override void InitUIData()
    {
        mIns = transform.GetComponent <UI_RuneIdentifyMgr>();

        //Transform transform = mObj.transform;

        mDefineTitleTxt = transform.FindChild("Image/Text").GetComponent <Text>();
        mRuneNameTxt    = transform.FindChild("RuneDetail/RuneName/Text").GetComponent <Text>();
        Transform tmpTrans = transform.FindChild("RuneDetail/RunItem");

        mItemCommon = RuneFactory.CreateRuneItemCommom(tmpTrans);
        //mDefineRuneItem = new RuneIconItem(tmpTrans);
        mDetailTxt            = transform.FindChild("RuneDetail/detailTxt").GetComponent <Text>();
        mAttriList            = transform.FindChild("RuneDetail/Attris/AttriList").gameObject;   //属性根节点obj;
        mDefineBtn            = transform.FindChild("RedefineBtn").GetComponent <Button>();
        mBtChange             = transform.FindChild("RedefineBtn/change").gameObject;
        mBtUnChange           = transform.FindChild("RedefineBtn/unchange").gameObject;
        mDefineBtnTxt         = transform.FindChild("RedefineBtn/unchange/Text").GetComponent <Text>();
        mDefineBtnTxtUnchange = transform.FindChild("RedefineBtn/change/Text").GetComponent <Text>();
        mCostItemImg          = transform.FindChild("RedefineBtn/change/Gold/Text/Image").GetComponent <Image>();
        mCostItemNum          = transform.FindChild("RedefineBtn/change/Gold/Text").GetComponent <Text>();
        mCloseBtn             = transform.FindChild("CloseBtn").GetComponent <Button>();
        mCloseBtnTxt          = transform.FindChild("CloseBtn/Text").GetComponent <Text>();
        mHintTxt    = transform.FindChild("HintObj/Bottom/Text").GetComponent <Text>();
        mSpeHeroTxt = transform.FindChild("RuneDetail/SpecialHeroName").GetComponent <Text>();

        //右上角金钱信息显示;
        mCostObj1 = transform.FindChild("TitlePanel/MoneyObj").gameObject;
        mCostTxt1 = transform.FindChild("TitlePanel/MoneyObj/One/Text").GetComponent <Text>();
        //mDiamondObj = trans.FindChild("").GetComponent<Text>();
        //mDiamondTxt = trans.FindChild("").GetComponent<Text>();
        mCostImg1 = transform.FindChild("TitlePanel/MoneyObj/One/Image").GetComponent <Image>();
        //消费金币处;
        mConsumeGoldTxt = transform.FindChild("").GetComponent <Text>();
        mConsumeGoldObj = transform.FindChild("").gameObject;

        mAttriTitleTxt   = transform.FindChild("Items/AttriTitle").gameObject;
        mAttriDetailTxt  = transform.FindChild("Items/LineTxt").gameObject;
        mRuneAttriObj    = transform.FindChild("Items/AttriPair").gameObject;
        mAddRuneAttriObj = transform.FindChild("Items/AddAttriPair").gameObject;

        mDetailCommonObj = transform.FindChild("RuneDetail/DetailCommon");

        mDefineBtn.onClick.AddListener(OnDefineBtnClick);
        mCloseBtn.onClick.AddListener(OnCloseBtnClick);

        initString();
    }
예제 #4
0
    public RuneDetailCommon(Transform parent, X_GUID runeId, float scrollRectHeight = -1f, int strenLvAdder = 0)
    {
        mParent       = parent;
        mRuneGUID     = runeId;
        mStrenLvAdder = strenLvAdder;

        GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshItem, OnItemRefresh);

        RuneDetailScrollRect scrollRect = RuneFactory.Create(RuneDetailObjType.ScrollRect, parent) as RuneDetailScrollRect;

        layoutTrans = scrollRect.GetLayoutObj().transform;

        if (scrollRectHeight > 0f)
        {
            scrollRect.SetScrollRectWidth(scrollRectHeight);
        }

        UpdateData(RuneAttriShowType.All);
    }
예제 #5
0
    public RuneDetailCommon(Transform parent, int runeTableId, float scrollRectHeight = -1f)
    {
        mParent      = parent;
        mRuneTableId = runeTableId;
        ItemTemplate itemT = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(runeTableId);

        SetRuneTemplateDate(itemT);

        RuneDetailScrollRect scrollRect = RuneFactory.Create(RuneDetailObjType.ScrollRect, parent) as RuneDetailScrollRect;

        layoutTrans = scrollRect.GetLayoutObj().transform;

        if (scrollRectHeight > 0f)
        {
            scrollRect.SetScrollRectWidth(scrollRectHeight);
        }

        bool isSpec = RuneModule.IsSpecialRune(runeTableId);

        UpdateData(isSpec ? RuneAttriShowType.BaseContent : RuneAttriShowType.BaseAttriOnly);
    }
예제 #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);
    }
예제 #7
0
    //void ResetAttriCount()
    //{
    //    mAttriCount = 0;
    //}

    void UpdateUI()
    {
        //ResetAttriCount();

        ItemTemplate itemT = ItemEquipInfo.GetItemRowData();

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

        RuneItemCommonData ricd = new RuneItemCommonData();

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

        mUserObj.SetActive(false);

        //mRuneNameTxt.text = GameUtils.getString(itemT.getName());

        //mSpeHeroTxt.text = GameUtils.getString(itemT.getSpecialHeroDes());

        //mDefineRuneItem.SetIcon(common.defaultPath + itemT.getIcon());
        //mDefineRuneItem.SetStarsNum(itemT.getRune_quality());
        //mDefineRuneItem.SetLevel(ItemEquipInfo.GetStrenghLevel());
        ////bool isSpecial = itemT.getRune_type() == 5 || itemT.getRune_type() == 6;
        //bool isSpecial = RuneModule.IsSpecialRune(itemT);
        //mDefineRuneItem.SetIsSpecial(isSpecial);

        //if (!isSpecial)
        //{
        //    mDefineRuneItem.SetRuneType(itemT.getRune_type());
        //}

        //if (mRuneGUID !=null)
        //{
        //    ObjectCard oc = ObjectSelf.GetInstance().HeroContainerBag.GetItemUser(ItemEquipInfo);
        //    if (oc == null)
        //    {
        //        mUserObj.SetActive(false);
        //    }
        //    else
        //    {
        //        HeroTemplate heroT = DataTemplate.GetInstance().GetHeroTemplateById(oc.GetHeroData().TableID);
        //        if (heroT != null)
        //            mUserNameTxt.text = GameUtils.getString(heroT.getTitleID()) + "    " + GameUtils.getString("hero_rune_content7");
        //        mUserObj.SetActive(true);
        //    }
        //}
        //else
        //{
        //    mUserObj.SetActive(false);
        //}

        //mDetailTxt.text = "";
        //GameUtils.DestroyChildsObj(mAttriList);
        int count = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(itemT);

        //--------基础属性;
        //RuneData runeData = ItemEquipInfo.GetRuneData();
        //bool titleDone1 = false;
        //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());
        //    }
        //}

        ////--------附加属性;
        //bool titleDone2 = false;
        //int i = 0;
        //bool isGray = false;

        //foreach (int id in runeData.AppendAttribute)
        //{
        //    i++;

        //    isGray = i * 3 > ItemEquipInfo.GetStrenghLevel();

        //    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);
        //}

        //是否鉴定满级;
        bool isFullIdentify = ItemEquipInfo.GetDefineTimes() >= count;

        GameUtils.SetBtnSpriteGrayState(mDefineBtn, isFullIdentify);

        //刷新消耗;
        int itemId    = -1;                   //消耗道具id
        int itemCount = -1;                   //消耗道具数量;
        int curLv     = ItemEquipInfo.GetDefineTimes();

        switch (curLv)
        {
        case 0:
            itemId    = itemT.getRune_exposeCostType1();
            itemCount = itemT.getRune_exposeCostValue1();
            break;

        case 1:
            itemId    = itemT.getRune_exposeCostType2();
            itemCount = itemT.getRune_exposeCostValue2();
            break;

        case 2:
            itemId    = itemT.getRune_exposeCostType3();
            itemCount = itemT.getRune_exposeCostValue3();
            break;

        case 3:
            itemId    = itemT.getRune_exposeCostType4();
            itemCount = itemT.getRune_exposeCostValue4();
            break;

        default:
            break;
        }

        if (!isFullIdentify)
        {
            if (itemId == -1 || itemCount == -1)
            {
                //LogManager.LogError("错误的道具id:" + itemId + "或者是错误的道具数量:" + itemCount);
                LogManager.LogError("符文当前:" + curLv + "级,还可以鉴定,但是鉴定道具id" + itemId + "或者道具数量:" + itemCount + "不对");
            }
            ItemTemplate costItemT = DataTemplate.GetInstance().GetItemTemplateById(itemId);
            mCostItemImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + costItemT.getIcon());
            mCostImg1.sprite    = mCostItemImg.sprite;
            int itemTotal = -1;
            ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, itemId, ref itemTotal);
            mCostTxt1.text = itemTotal.ToString();
            int haveCount = 0;
            ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, itemId, ref haveCount);
            TEXT_COLOR tc = itemCount > haveCount ? TEXT_COLOR.RED : TEXT_COLOR.WHITE;
            mCostItemNum.text = GameUtils.StringWithColor(itemCount.ToString(), tc);
        }
    }
예제 #8
0
    public override void InitUIData()
    {
        //if (mGo == null) return;
        mInst = transform.GetComponent <UI_RuneStrenthMgr>();

        if (!mInitDone)
        {
            mInitDone = true;

            mStrenthTitleTxt = transform.FindChild("Title/Text").GetComponent <Text>();
            mRuneObj         = new GameObject[3];
            mRuneNameTxt     = new Text[3];
            mSpeHeroNameTxt  = new Text[3];
            //mStrenthRuneItem = new RuneIconItem[3];
            mDetailTransPos  = new Transform[3];
            mStrenthBtn      = new Button[2];
            mStrenthBtnTxt   = new Text[2];
            mCloseBtn        = new Button[2];
            mCloseBtnTxt     = new Text[2];
            mCostObj         = new GameObject[2];
            mNorCostItemImg  = transform.FindChild("StrenthBtn2/CostObj/Gold/Text/Image").GetComponent <Image>();
            mSpecCostItemImg = transform.FindChild("StrenthBtn2/CostObj/Diamond/Text/Image").GetComponent <Image>();
            mCostGoldTxt     = new Text[2];

            for (int i = 0; i < 3; i++)
            {
                string title = "RuneDetail" + (i + 1);
                mRuneObj[i]        = transform.FindChild(title).gameObject;
                mRuneNameTxt[i]    = transform.FindChild(title + "/RuneName_txt/Name_txt").GetComponent <Text>();
                mSpeHeroNameTxt[i] = transform.FindChild(title + "/SpecialHeroName").GetComponent <Text>();
                //mStrenthRuneItem[i] = new RuneIconItem(transform.FindChild(title + "/RunItem1"));
                mDetailTransPos[i] = transform.FindChild(title + "/Attris");
            }

            for (int i = 0; i < 2; i++)
            {
                mStrenthBtn[i] = transform.FindChild("StrenthBtn" + (i + 1)).GetComponent <Button>();
                mStrenthBtn[i].onClick.AddListener(OnStrengthBtnClick);
                mStrenthBtnTxt[i] = transform.FindChild("StrenthBtn" + (i + 1) + "/Text").GetComponent <Text>();
                mCloseBtn[i]      = transform.FindChild("CloseBtn" + (i + 1)).GetComponent <Button>();
                mCloseBtn[i].onClick.AddListener(OnCloseBtnClick);
                mCloseBtnTxt[i] = transform.FindChild("CloseBtn" + (i + 1) + "/Text").GetComponent <Text>();
                mCostObj[i]     = transform.FindChild("StrenthBtn" + (i + 1) + "/CostObj").gameObject;
                mCostGoldTxt[i] = transform.FindChild("StrenthBtn" + (i + 1) + "/CostObj/Gold/Text").GetComponent <Text>();
            }

            mCostItemCountTxt = transform.FindChild("StrenthBtn2/CostObj/Diamond/Text").GetComponent <Text>();
            mStrenthObj       = transform.FindChild("StrenthObj").gameObject;
            mStrenthTxt       = transform.FindChild("StrenthObj/Text").GetComponent <Text>();

            mStrenthFullObj1  = transform.FindChild("StrenthBtn1/FullObj").gameObject;
            mStrenthFullImg1  = transform.FindChild("StrenthBtn1/FullObj/Image").GetComponent <Image>();
            mStrenthFullText1 = transform.FindChild("StrenthBtn1/FullObj/Text").GetComponent <Text>();

            mStrenthFullObj2  = transform.FindChild("StrenthBtn2/FullObj").gameObject;
            mStrenthFullImg2  = transform.FindChild("StrenthBtn2/FullObj/Image").GetComponent <Image>();
            mStrenthFullText2 = transform.FindChild("StrenthBtn2/FullObj/Text").GetComponent <Text>();

            mCostObj1        = transform.FindChild("MoneyObj/One").gameObject;
            mCostGoldImg     = transform.FindChild("MoneyObj/One/Image").GetComponent <Image>();
            mCostTxt1        = transform.FindChild("MoneyObj/One/Text").GetComponent <Text>();
            mCostObj2        = transform.FindChild("MoneyObj/Two").gameObject;
            mCost2Img1       = transform.FindChild("MoneyObj/Two/Money1/Image").GetComponent <Image>();
            mCost2Txt1       = transform.FindChild("MoneyObj/Two/Money1/Text").GetComponent <Text>();
            mCost2Img2       = transform.FindChild("MoneyObj/Two/Money2/Image").GetComponent <Image>();
            mCost2Txt2       = transform.FindChild("MoneyObj/Two/Money2/Text").GetComponent <Text>();
            mHintTxt         = transform.FindChild("HintObj/Bottom/Text").GetComponent <Text>();
            mAttriTitleTxt   = transform.FindChild("Items/AttriTitle").gameObject;
            mRuneAttriObj    = transform.FindChild("Items/AttriPair").gameObject;
            mAddRuneAttriObj = transform.FindChild("Items/AddAttriPair").gameObject;
            mAttriDetailTxt  = transform.FindChild("Items/LineTxt").gameObject;

            mItemCommons    = new RuneItemCommon[3];
            mItemCommons[0] = RuneFactory.CreateRuneItemCommom(selfTransform.FindChild("RuneDetail1/RunItem1"));
            mItemCommons[1] = RuneFactory.CreateRuneItemCommom(selfTransform.FindChild("RuneDetail2/RunItem1"));
            mItemCommons[2] = RuneFactory.CreateRuneItemCommom(selfTransform.FindChild("RuneDetail3/RunItem1"));

            initString();
        }
    }