//显示强化信息
    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();
        }
    }
    //显示镶嵌信息
    void ShowEnchaseInfo(int index)
    {
        EnchaseItem = eItem[index];
        EnchaseEquipIcon.UpdateItem(EnchaseItem.GetID());
        int count = EnchaseItem.GetGemCount();
        int i     = 0;
        //ShowStoneInfo(count);

        int j = EnchasePage[nTheIndex] * 10;

        for (i = 0; i < 10; i++)
        {
            if (i + j >= eItem.Count)
            {
                EnchaseNames[i].Text = "";
                EnchaseNums[i].Text  = "";
                EnchaseRadios[i].Hide(true);
            }
            else
            {
                EnchaseNames[i].Text = eItem[i + j].GetName();
                EnchaseNums[i].Text  = eItem[i + j].GetGemCount().ToString();
                EnchaseRadios[i].Hide(false);
            }
        }

        int selectIndex = (int)EnchaseSelect[nTheIndex];

        if (EnchasePage[nTheIndex] == EnchasePageRadio[nTheIndex])
        {
            EnchaseRadios[selectIndex].Value = true;
        }
        else
        {
            EnchaseRadios[selectIndex].Value = false;
        }

        EnchasePageNum.Text = (EnchasePage[nTheIndex] + 1) + "/" + GetPageNum();

        int k = 0;

        for (k = 0; k < 3; k++)
        {
            if (StoneItem[k] == null)
            {
                StoneIcons[k].SetActionItem(-1);
                StoneInfo[k].Text = "未镶嵌";
                SelectStonesBtn[k].Hide(false);
                RemoveBtns[k].Hide(true);
            }
        }
    }
Esempio n. 3
0
    // 增加一个是否新获得物品的标志 [8/31/2011 Sun]
    public void SetItem(short nBagIndex, CObject_Item pItem, bool bClearOld, bool bNew)
    {
        if (nBagIndex < 0 || nBagIndex >= GAMEDEFINE.MAX_BAG_SIZE)
        {
            return;
        }

        //销毁原有数据
        if (mItems[nBagIndex] != null && bClearOld)
        {
            ObjectSystem.Instance.DestroyItem(mItems[nBagIndex]);
            mItems[nBagIndex] = null;
        }

        if (pItem != null)
        {
            pItem.TypeOwner = ITEM_OWNER.IO_MYSELF_PACKET;
            pItem.PosIndex  = nBagIndex;

            CObject_Item pItemLog = mItems[nBagIndex];
            if (pItemLog != null)
            {
                // 设置物品的保存状态为无详细信息。2006-3-24
                pItemLog.ItemSaveStatus = SAVE_ITEM_STATUS.NO_MORE_INFO;
            }
        }
        else
        {//原来有物品,移走
        }

        mItems[nBagIndex] = pItem;

        // 产生一个新道具的事件 [8/31/2011 Sun]
        if (bNew == true && pItem != null)
        {
            CObject_Item_Equip item = pItem as CObject_Item_Equip;
            if (item != null)
            {
                int point = (int)item.GetItemType();
                if (point == 8)
                {
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_NEW_ITEM, item.GetID());
                }
            }
        }
    }
Esempio n. 4
0
        //    // 装备镶嵌消息 [9/16/2011 edit by ZL]
        //    void Send_EnchaseMsg(int type);
        //    // 返回装备上,总共有多少颗宝石。
        //    INT GetEquip_GemCount(INT nIndexEquip );
        //    // 返回装备上,总共可以镶嵌多少个宝石
        ////	INT GetEquip_GemCount( );
        //    // 返回宝石的级别。
        ////	INT Compound_Preparation(  );
        //    // 是否可以镶嵌
        //    INT	Can_Enchase( INT nIndexEquip, INT nIndexGem );
        //    // 是否可以合成
        //    bool Can_Combine( INT nIndexGem1, INT nIndexGem2 );
        //    // 物品可以放到镶嵌界面这个位置。
        //    bool Enchase_Preparation( INT nIndexInterface, INT nIndexPacket );
        //    // 物品可以放到合成界面这个位置。
        //    bool Compound_Preparation( INT nIndexPacket );
        //    //////////////////////////////////////////////////////////////////////////
        //    INT	Stiletto_GetEquipOwner();
        //    // 装备打孔检测,必须先将装备拖到目标位置上 [7/14/2011 ivan edit]
        //    Lua_SLOT_COST Stiletto_Preparation(INT nEquipIndex, INT equipOwner);
        //    // 装备打孔 [7/15/2011 ivan edit]
        //    INT	Do_Stilietto(int equipOwner = -1, int equipPos = -1);

        //    // 装备强化预览 [9/14/2011 edit by ZL]
        //    CActionItem*	GetStrengthenPreView(INT actionId);
        //    // 装备强化预览 [9/14/2011 edit by ZL]

        // 升档预览 [4/11/2012 SUN]
        public CActionItem      GetEquipUpdatePreView(int actionId)
        {
            CActionItem_Item action = CActionSystem.Instance.GetActionByActionId(actionId) as CActionItem_Item;

            if (action == null)
            {
                throw new NullReferenceException("Can not find actionitem: " + actionId);
            }
            CObject_Item_Equip equip = action.GetImpl() as CObject_Item_Equip;

            if (equip == null)
            {
                return(null);
            }

            CObject_Item_Equip resEquip = CDataPool.Instance.PreviewEquip;
            int nNextTableId            = equip.GetEquipBaseDefine().nNextDangCiItemSN;

            if (resEquip != null && resEquip.GetIdTable() != nNextTableId)
            {
                CDataPool.Instance.PreviewEquip = null;
            }

            resEquip = ObjectSystem.Instance.NewItem((uint)nNextTableId) as CObject_Item_Equip;
            resEquip.CloneForUpLevel(equip);

            resEquip.TypeOwner = ITEM_OWNER.IO_QUESTVIRTUALITEM;
            // 必须保存回去 [10/25/2011 Ivan edit]
            CDataPool.Instance.PreviewEquip = resEquip;

            CActionItem pActionItem = CActionSystem.Instance.GetAction_ItemID(resEquip.GetID(), false);

            if (pActionItem != null)
            {
                return(pActionItem);
            }
            else
            {
                return(CActionItem.s_InvalidAction);
            }
        }
Esempio n. 5
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();
    }
Esempio n. 6
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);
    }