コード例 #1
0
    //显示强化信息
    void ShowEnhanceInfo(int index)
    {
        EnchanceItem = pItem[index];
        Enchancebutton.UpdateItem(EnchanceItem.GetID());
        int j = EnhancePage[nTheIndex] * 10;

        for (int i = 0; i < 10; i++)
        {
            if (i + j >= pItem.Count)
            {
                EnhanceNames[i].Text   = "";
                EnchanceLevels[i].Text = "";
                EnchanceRadios[i].Hide(true);
            }
            else
            {
                EnhanceNames[i].Text   = pItem[i + j].GetName();
                EnchanceLevels[i].Text = CDataPool.Instance.GetStrengthLevelDesc(pItem[i + j].GetStrengthLevel());
                EnchanceRadios[i].Hide(false);
            }
        }

        EnchancePreLevel.Text     = "强化等级:" + CDataPool.Instance.GetStrengthLevelDesc(EnchanceItem.GetStrengthLevel());
        EnchanceCurrentLevel.Text = CDataPool.Instance.GetStrengthLevelDesc(EnchanceItem.GetStrengthLevel());
        EnchanceNextLevel.Text    = CDataPool.Instance.GetStrengthNextLevelDesc(EnchanceItem.GetStrengthLevel());
        int selectIndex = (int)EnchanceSelect[nTheIndex];

        if (EnhancePage[nTheIndex] == EnhancePageRadio[nTheIndex])
        {
            EnchanceRadios[selectIndex].Value = true;
        }
        else
        {
            EnchanceRadios[selectIndex].Value = false;
        }

        EnchancePageNum.Text = (EnhancePage[nTheIndex] + 1) + "/" + GetPageNum();

        Item_Enhance itemEnhance = LifeAbility.Instance.Get_Equip_EnhanceLevel((CObject_Item)EnchanceItem);
        int          NeedMoney   = itemEnhance.needMoney;
        int          Property    = itemEnhance.addProperty;

        if (NeedMoney <= 0 || Property < 0)
        {
            if (EnchanceItem != null)
            {
                EnhanceMoney.Text = "0";
                //QiangHuaButton.Disable();
            }
            else
            {
                LogManager.LogError("此装备无法强化。");
                return;
            }
        }
        else
        {
            QiangHuaButton.Enable();
        }
    }
コード例 #2
0
    void ShowShengDangInfo(int index)
    {
        ShengDangItem = sItem[index];
        ShengDangImageButton[0].UpdateItem(ShengDangItem.GetID());

        int j = ShengDangPage[nTheIndex] * 10;

        for (int i = 0; i < 10; i++)
        {
            if (i + j >= sItem.Count)
            {
                ShengDangNames[i].Text  = "";
                ShengDangLevels[i].Text = "";
                ShengDangRadios[i].Hide(true);
            }
            else
            {
                ShengDangNames[i].Text  = sItem[i + j].GetName();
                ShengDangLevels[i].Text = "档次:" + sItem[i + j].GetCurrentDangCi();
                ShengDangRadios[i].Hide(false);
            }
        }

        int selectIndex = (int)ShengDangSelect[nTheIndex];

        if (ShengDangPage[nTheIndex] == ShengDangPageRadio[nTheIndex])
        {
            ShengDangRadios[selectIndex].Value = true;
        }

        else
        {
            ShengDangRadios[selectIndex].Value = false;
        }

        ShengDangPageNum.Text = (ShengDangPage[nTheIndex] + 1) + "/" + GetPageNum();

        ShengDangPreEnchanceLevel.Text = "强化等级:" + CDataPool.Instance.GetStrengthLevelDesc(ShengDangItem.GetStrengthLevel());
        if (ShengDangItem.GetCurrentDangCi() == -1)
        {
            ShengDangCurrentDangCi.Text = "";
            ShengDangNextDangCi.Text    = "档次1";
        }
        else
        {
            ShengDangCurrentDangCi.Text = "档次:" + ShengDangItem.GetCurrentDangCi();
            ShengDangNextDangCi.Text    = "档次:" + (ShengDangItem.GetCurrentDangCi() + 1);
        }

        Lua_Item_LevelUp item      = LifeAbility.Instance.Get_Equip_LevelUpMaterial(ShengDangItem.GetCurrentDangCi());
        CObject_Item     pItemObj1 = ObjectSystem.Instance.NewItem((uint)item.needItemID);
        CObject_Item     pItemObj2 = ObjectSystem.Instance.NewItem((uint)item.needItemID2);

        CActionItem_Item actionItem1 = CActionSystem.Instance.GetAction_ItemID(pItemObj1.GetID());
        CActionItem_Item actionItem2 = CActionSystem.Instance.GetAction_ItemID(pItemObj2.GetID());

        MaterialName[0].Text = actionItem1.GetName();
        MaterialName[1].Text = actionItem2.GetName();
        MaterialButton[0].SetActionItemByActionId(actionItem1.GetID());
        MaterialButton[1].SetActionItemByActionId(actionItem2.GetID());

        int count1 = CDataPool.Instance.UserBag_CountItemByIDTable(item.needItemID);
        int count2 = CDataPool.Instance.UserBag_CountItemByIDTable(item.needItemID2);

        if (count1 >= item.needItemNum)
        {
            count1 = item.needItemNum;
        }
        else if (count1 == -1)
        {
            count1 = 0;
        }

        if (count2 >= item.needItem2Num)
        {
            count2 = item.needItem2Num;
        }
        else if (count2 == -1)
        {
            count2 = 0;
        }

        MaterialNum[0].Text = count1 + "/" + item.needItemNum;
        MaterialNum[1].Text = count2 + "/" + item.needItem2Num;
        ShengDangMoney.Text = item.money.ToString();
    }
コード例 #3
0
    void OnChangedRoleType(RoleType rt)
    {
        Clear();
        bool bResetSelectIndex = true;

        switch (rt)
        {
        case RoleType.ROLE_SELF:
        {
            // 装备点的最大个数.
            int nBeginIndex = mCurrentEquipIndex * MAX_EQUIPGRID;
            int nCount      = 0;    //总装备数量
            for (int i = 0; i < (int)HUMAN_EQUIP.HEQUIP_NUMBER; i++)
            {
                if (i == (int)HUMAN_EQUIP.HEQUIP_RIDER)
                {
                    continue;
                }
                //取得玩家身上的装备
                CObject_Item pItem = CDataPool.Instance.UserEquip_GetItem((HUMAN_EQUIP)i);
                if (pItem != null)
                {
                    if (nCount < nBeginIndex || nCount - nBeginIndex >= MAX_EQUIPGRID)
                    {
                        nCount++;
                        continue;
                    }
                    //不重置当前选择的索引
                    if (nCount - nBeginIndex >= mCurrentSelectedEquip)
                    {
                        bResetSelectIndex = false;
                    }

                    mEquips[nCount - nBeginIndex].SetActionItem(pItem.GetID());
                    mEquipsText[nCount - nBeginIndex].Text = pItem.GetName() + "\n" + "强化 " + pItem.GetStrengthLevel() + "级";

                    nCount++;
                }
            }
            mMaxPage = nCount / MAX_EQUIPGRID;
            if (nCount % MAX_EQUIPGRID != 0)
            {
                mMaxPage++;
            }
            UpatePageNum();
        }
        break;

        case RoleType.ROLE_PACKET:
        {
            int nCount      = 0;
            int nBeginIndex = mCurrentEquipIndex * MAX_EQUIPGRID;
            for (int i = GAMEDEFINE.EQUIP_BAG_BEGIN; i < GAMEDEFINE.EQUIP_BAG_END; i++)
            {
                CObject_Item_Equip item = CDataPool.Instance.UserBag_GetItem(i) as CObject_Item_Equip;

                if (item != null && item.GetItemType() != HUMAN_EQUIP.HEQUIP_RIDER)
                {
                    if (nCount < nBeginIndex || nCount - nBeginIndex >= MAX_EQUIPGRID)
                    {
                        nCount++;
                        continue;
                    }
                    //不重置当前选择的索引
                    if (nCount - nBeginIndex >= mCurrentSelectedEquip)
                    {
                        bResetSelectIndex = false;
                    }

                    mEquips[nCount - nBeginIndex].SetActionItem(item.GetID());
                    mEquipsText[nCount - nBeginIndex].Text = item.GetName() + "\n" + "强化 " + item.GetStrengthLevel() + "级";

                    nCount++;
                }
            }
            mMaxPage = nCount / MAX_EQUIPGRID;
            if (nCount % MAX_EQUIPGRID != 0)
            {
                mMaxPage++;
            }
            UpatePageNum();
        }
        break;

        case RoleType.ROLE_PET1:
        {
            RefreshRolePetPage(0, ref bResetSelectIndex);
        }
        break;

        case RoleType.ROLE_PET2:
        {
            RefreshRolePetPage(1, ref bResetSelectIndex);
        }
        break;

        case RoleType.ROLE_PET3:
        {
            RefreshRolePetPage(2, ref bResetSelectIndex);
        }
        break;

        case RoleType.ROLE_PET4:
        {
            RefreshRolePetPage(3, ref bResetSelectIndex);
        }
        break;

        case RoleType.ROLE_PET5:
        {
            RefreshRolePetPage(4, ref bResetSelectIndex);
        }
        break;

        case RoleType.ROLE_PET6:
        {
            RefreshRolePetPage(5, ref bResetSelectIndex);
        }
        break;

        default:
            break;
        }

        //切换回归第一件装备
        if (bResetSelectIndex)
        {
            mCurrentSelectedEquip = 0;
            mEquipMenus[mCurrentSelectedEquip].Value = true;
        }
        SelectedEquipChanged(mCurrentSelectedEquip);
    }