Beispiel #1
0
    private void RenderItemInfo(FS2ItemDataInfo[] itemInfos, int pageNum, HtmlGenericControl div)
    {
        StringBuilder content = new StringBuilder();
        content.Append("<table border='0' cellspacing='0' cellpadding='0' background='../Resources/Images/FS2Objects/itemCell.gif'>");        
        for (int rowIndex = 0; rowIndex != FS2MacroDef.ItemRowNumPerBag; ++rowIndex)
        {
            content.Append("<tr height='38px'>");
            for (int colIndex = 0; colIndex != FS2MacroDef.ItemColNumPerBag; ++colIndex)
            {
                bool hasItem = false;
                foreach (FS2ItemDataInfo item in itemInfos)
                {
                    //如果找到
                    if (item.Y == rowIndex + (pageNum-1) * FS2MacroDef.ItemRowNumPerBag && item.X == colIndex)
                    {
                        FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(item.TemplateId);
                        //没有资源,先显示默认图标。						
						content.Append(GameDataRender.RenderItemCell(item.ItemCount.ToString(), itemData == null ? string.Empty : (itemData.Image + "_man_small_normal.jpg"), 
                                string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId),
                                string.Format("onclick='window.location=\"../GameMaster/ItemFlow.aspx?{0}={1}&{2}={3}\"'", WebConfig.ParamServerId, _serverId, WebConfig.ParamRoleGuid, item.GUID)));
                        hasItem = true;
                        break;
                    }
                }
                if (!hasItem)
                {
                    content.Append("<td width='38px'></td>");
                }
            }
            content.Append("</tr>");
        }
        content.Append("</table>");

        div.InnerHtml = content.ToString();
    }
Beispiel #2
0
    private void RenderEquipedItem(FS2ItemDataInfo[] itemInfos)
    {
        int rowNum = 3;
        int colNum = 3;
        FS2ItemDataInfo[] equipedSequence = new FS2ItemDataInfo[10];
        foreach (FS2ItemDataInfo item in itemInfos)
        {
            switch ((ItemPart)item.X)
            {
                case ItemPart.Amulet:
                    equipedSequence[0] = item;
                    break;
                case ItemPart.Helm:
                    equipedSequence[1] = item;
                    break;
                case ItemPart.Shoulder:
                    equipedSequence[2] = item;
                    break;
                case ItemPart.Weapon:
                    equipedSequence[3] = item;
                    break;
                case ItemPart.Armor:
                    equipedSequence[4] = item;
                    break;
                case ItemPart.Pendant:
                    equipedSequence[5] = item;
                    break;
                case ItemPart.Ring:
                    equipedSequence[6] = item;
                    break;
                case ItemPart.Boots:
                    equipedSequence[7] = item;
                    break;
                case ItemPart.Cuff:
                    equipedSequence[8] = item;
                    break;
                case ItemPart.Talisman:
                    equipedSequence[9] = item;
                    break;
            }
        }

        StringBuilder content = new StringBuilder();

        content.Append("<table cellspacing='5px' cellpadding='0' border='0' >");
        content.Append("<tr><td>");

        //法宝
        content.Append("<table cellspacing='0px' cellpadding='0' border='0' background='../Resources/Images/FS2Objects/itemCell.gif'>");
        content.Append("<tr height='38px'>");
        
        if (equipedSequence[9] != null)
        {
            content.Append(GameDataRender.RenderItemCell("1", string.Empty, string.Format("updateRoleItemInfo(\"{0}\")", equipedSequence[9].TemplateId), string.Empty));
        }
        else
        {
            content.Append("<td width='38px'></td>");
        }
        content.Append("</tr>");
        content.Append("</table>");


        content.Append("</td><td>");
        //装备
        content.Append("<table cellspacing='0' cellpadding='0' border='0' background='../Resources/Images/FS2Objects/itemCell.gif'>");
        for (int rowIndex = 0; rowIndex != rowNum; ++rowIndex)
        {
            content.Append("<tr height='38px'>");
            for (int colIndex = 0; colIndex != colNum; ++colIndex)
            {
                FS2ItemDataInfo itemSeq = equipedSequence[rowIndex * colNum + colIndex];
                if (itemSeq != null)
                {
                    FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(itemSeq.TemplateId);
                    content.Append(GameDataRender.RenderItemCell("1", itemData == null ? string.Empty : (itemData.Image + "_man_small_normal.jpg") , string.Format("updateRoleItemInfo(\"{0}\")", itemSeq.TemplateId), string.Empty));
                    //content.Append(GameDataRender.RenderItemCell("1",itemData == null ? string.Empty : itemData.Image, string.Format("updateRoleItemInfo(\"{0}\")", itemSeq.TemplateId),string.Empty));
                }
                else
                {
                    content.Append("<td width='38px' ></td>");
                }
            }
        }

        content.Append("</table>");

        content.Append("</td></tr></table>");

        DivRoleState.InnerHtml = content.ToString();
    }