Exemple #1
0
    protected override void OnAwake()
    {
        Transform pivot = transform.Find("Pivot");

        btnClose         = pivot.Find("BtnClose").gameObject;
        gemTexture       = pivot.Find("Gem/Texture").GetComponent <UITexture>();
        gemQuality       = pivot.Find("Gem/Quality").GetComponent <UISprite>();
        costMoneyTexture = pivot.Find("Cost/Texture").GetComponent <UITexture>();
        costMoneyNum     = pivot.Find("Cost/Num").GetComponent <UILabel>();
        btnAutoToAddMat  = pivot.Find("Btn_AutoToAddMat").gameObject;
        btnStrengthen    = pivot.Find("Btn_Strengthen").gameObject;

        gemLevel    = pivot.Find("Content0/Level").GetComponent <UILabel>();
        gemExpBar   = pivot.Find("Content0").GetComponent <UISlider>();
        gemExpNum   = pivot.Find("Content0/Num").GetComponent <UILabel>();
        gemName     = pivot.Find("Content1/GemName").GetComponent <UILabel>();
        gemType     = pivot.Find("Content1/GemType").GetComponent <UILabel>();
        gemSuit     = pivot.Find("Content1/GemSuit").GetComponent <UILabel>();
        gemProperty = pivot.Find("Content2/Text").GetComponent <UILabel>();

        Transform itemsTrans = pivot.Find("Items");

        for (int i = 1; i <= 6; i++)
        {
            UCGemItemStrengthen item = new UCGemItemStrengthen();
            item.itemBtn     = itemsTrans.Find("Item_" + i).gameObject;
            item.itemTexture = item.itemBtn.transform.Find("Texture").GetComponent <UITexture>();
            item.itemQuality = item.itemBtn.transform.Find("Quality").GetComponent <UISprite>();
            item.itemNum     = item.itemBtn.transform.Find("Num").GetComponent <UILabel>();
            item.itemPlus    = item.itemBtn.transform.Find("Plus").gameObject;
            mStrengthenItems.Add(item);
        }
    }
Exemple #2
0
    private void ShowView()
    {
        XGem gem    = GTDataManager.Instance.GetGemDataByPos(mPosType, mPos);
        int  itemID = gem.Id;

        GTItemHelper.ShowItemTexture(gemTexture, itemID);
        GTItemHelper.ShowItemQuality(gemQuality, itemID);
        GTItemHelper.ShowItemName(gemName, itemID);

        int costgemNum = mStrengthenMats.Count;

        for (int i = 0; i < mStrengthenItems.Count; i++)
        {
            UCGemItemStrengthen cell = mStrengthenItems[i];
            if (i < costgemNum)
            {
                XItem mat = mStrengthenMats[i];
                cell.Show(true);
                int id = mStrengthenMats[i].Id;
                GTItemHelper.ShowItemTexture(cell.itemTexture, id);
                GTItemHelper.ShowItemQuality(cell.itemQuality, id);
                GTItemHelper.ShowItemNum(cell.itemNum, mat.Num);
            }
            else
            {
                cell.Show(false);
            }
        }
        if (MLGem.Instance.IsFullStrengthenLevel(gem) == true)
        {
            return;
        }
        DGem      gemDB     = ReadCfgGem.GetDataById(itemID);
        DGemLevel levelDB   = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel + 1);
        int       addExpNum = MLGem.Instance.GetExpByStrengthMatList(mStrengthenMats);

        GTItemHelper.ShowItemTexture(costMoneyTexture, levelDB.CostMoneyId);
        costMoneyNum.text = addExpNum.ToString();
        gemLevel.text     = GTTools.Format("强化等级 {0}", gem.StrengthenLevel);
        GTItemHelper.ShowProgressText(gemExpNum, gem.StrengthenExp, levelDB.RequireExp);
        GTItemHelper.ShowProgressSlider(gemExpBar, gem.StrengthenExp, levelDB.RequireExp);
        GTItemHelper.ShowGemPropertyText(gemProperty, itemID, gem.StrengthenLevel, true);
        gemSuit.text = MLGem.Instance.GetGemSuitName(itemID);
        gemType.text = MLGem.Instance.GetGemTypeName(itemID);
    }