Ejemplo n.º 1
0
    bool CreateSearchResultList(NpcDropItem[] infos, uint total)
    {
        if (infos != null && infos.Length != 0)
        {
            foreach (NpcDropItem info in infos)
            {
                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                if (info.itemTemplateId != null && info.itemTemplateId.Length != 0)
                {
                    FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(info.itemTemplateId);
                    if (itemData != null)
                    {
                        string colorStr = "Black";
                        switch (itemData.Quality)
                        {
                        case FS2ItemQuality.White:
                            colorStr = "Black";
                            break;

                        case FS2ItemQuality.Blue:
                            colorStr = "#3165FF";
                            break;

                        case FS2ItemQuality.Green:
                            colorStr = "#00FB00";
                            break;

                        case FS2ItemQuality.Yellow:
                            colorStr = "Yellow";
                            break;

                        case FS2ItemQuality.Orange:
                            colorStr = "#F8952C";
                            break;
                        }

                        cell.Text = string.Format("<span onmouseover='{0}' style='color:{1};'>{2}</span>",
                                                  string.Format("updateRoleItemInfo(\"{0}\")", itemData.TemplateId), colorStr,
                                                  itemData.Name);
                    }
                    else
                    {
                        cell.Text = info.itemTemplateId;
                    }
                }
                row.Cells.Add(cell);

                cell      = new TableCell();
                cell.Text = info.num.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                if (total != 0)
                {
                    cell.Text = Decimal.Round((decimal)info.num / total, 3) * 100 + "%";
                }
                else
                {
                    cell.Text = "0";
                }
                row.Cells.Add(cell);
                TableSearchNpc.Rows.Add(row);
            }
            TableRow  rowTail  = new TableRow();
            TableCell cellTail = new TableCell();
            cellTail.ColumnSpan = 3;
            cellTail.Font.Bold  = true;
            FS2NpcData NpcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(TextBoxNpcId.Text));
            if (NpcData != null)
            {
                cellTail.Text = string.Format("[{0}]{1}", NpcData.Name, StringDef.DropItem);
            }
            cellTail.Text += StringDef.Total + StringDef.Colon + total;
            rowTail.Cells.Add(cellTail);
            TableSearchNpc.Rows.Add(rowTail);
        }
        return(true);
    }
Ejemplo n.º 2
0
    protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        Color  statColor      = Color.Blue;
        string statTitle      = string.Empty;
        string statXAxisTitle = string.Empty;

        switch (ListBoxViewContent.SelectedValue)
        {
        case "NpcBeKilled":
            statColor      = Color.Orange;
            statTitle      = StringDef.NpcBeKilledStatistic;
            statXAxisTitle = StringDef.NpcBeKilledCount;
            break;

        case "NpcKill":
            statColor      = Color.Red;
            statTitle      = StringDef.NpcKillPlayerStatistic;
            statXAxisTitle = StringDef.NpcKillPlayerCount;
            break;
        }

        GraphPane graphPane = masterPane[0];

        graphPane.Fill                  = new Fill(WebConfig.GraphPaneBgColor);
        graphPane.Title.Text            = statTitle;
        graphPane.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.Title.FontSpec.Size   = 10;
        graphPane.Legend.IsVisible      = false;
        graphPane.BarSettings.Base      = BarBase.Y;

        graphPane.XAxis.Title.Text            = statXAxisTitle;
        graphPane.XAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.XAxis.Title.FontSpec.Size   = 6.2f;
        graphPane.XAxis.MajorGrid.IsVisible   = true;
        graphPane.XAxis.MajorGrid.DashOff     = 0;
        graphPane.XAxis.MajorGrid.Color       = Color.Gray;
        graphPane.XAxis.MinorGrid.IsVisible   = true;
        graphPane.XAxis.MinorGrid.Color       = Color.LightGray;
        graphPane.XAxis.MinorGrid.DashOff     = 0;
        graphPane.XAxis.Scale.FontSpec.Size   = 5.6f;
        graphPane.XAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;

        //graphPane.YAxis.Title.Text = StringDef.NpcTemplate;
        graphPane.YAxis.Title.FontSpec.Family       = StringDef.DefaultFontFamily;
        graphPane.YAxis.MajorTic.IsBetweenLabels    = true;
        graphPane.YAxis.Scale.IsPreventLabelOverlap = false;
        graphPane.YAxis.Scale.AlignH          = AlignH.Center;
        graphPane.YAxis.Scale.FontSpec.Size   = 5.6f;
        graphPane.YAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.YAxis.Scale.IsReverse       = true;
        graphPane.YAxis.Type = AxisType.Text;

        double[] countList    = new double[_recordList.Count];
        string[] templateList = new string[_recordList.Count];
        for (int i = 0; i < _recordList.Count; i++)
        {
            NpcStatisticInfo info = _recordList[i];
            countList[i] = info.Count;
            FS2NpcData npcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.TemaplteId));
            if (npcData != null)
            {
                templateList[i] = npcData.ToString();
            }
            else
            {
                templateList[i] = info.TemaplteId;
            }
        }
        BarItem barItem = graphPane.AddBar(StringDef.NpcBeKilledCount, countList, null, Color.Blue);

        barItem.Bar.Fill = new Fill(statColor);
        graphPane.YAxis.Scale.TextLabels = templateList;
        masterPane.AxisChange();
        BarItem.CreateBarLabels(graphPane, false, string.Empty, StringDef.DefaultFontFamily, 5.6f, TextObj.Default.FontColor, false, false, false);
    }
Ejemplo n.º 3
0
    bool CreateSearchResultList(SearchItemInfo[] infos, uint totalNum)
    {
        if (infos != null)
        {
            foreach (SearchItemInfo info in infos)
            {
                TableRow row = new TableRow();

                TableCell   cell = new TableCell();
                FS2ItemData item = FS2GameDataManager.TheInstance.GetItemData(info.id);
                if (item != null)
                {
                    string colorStr = "Black";
                    switch (item.Quality)
                    {
                    case FS2ItemQuality.White:
                        colorStr = "Black";
                        break;

                    case FS2ItemQuality.Blue:
                        colorStr = "#3165FF";
                        break;

                    case FS2ItemQuality.Green:
                        colorStr = "#00FB00";
                        break;

                    case FS2ItemQuality.Yellow:
                        colorStr = "Yellow";
                        break;

                    case FS2ItemQuality.Orange:
                        colorStr = "#F8952C";
                        break;
                    }

                    cell.Text = string.Format("<span onmouseover='{0}' style='color:{1}'>{2}</span>",
                                              string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId), colorStr,
                                              item.Name);
                }
                else
                {
                    cell.Text = info.id;
                }
                row.Cells.Add(cell);

                cell = new TableCell();
                switch (info.way)
                {
                case LogEvent.BuyStatistic:
                    cell.Text = StringDef.NotAvailable;
                    break;

                case LogEvent.NpcDropStatistic:
                    FS2NpcData npc = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.sourceId));
                    if (npc != null)
                    {
                        cell.Text = string.Format("{0}[{1}]", npc.Name, npc.TemplateId);
                    }
                    else
                    {
                        cell.Text = StringDef.NotAvailable;
                    }
                    break;
                }
                row.Cells.Add(cell);

                cell = new TableCell();
                switch (info.way)
                {
                case LogEvent.BuyStatistic:
                    cell.Text = StringDef.Buy;
                    break;

                case LogEvent.NpcDropStatistic:
                    cell.Text = StringDef.Drop;
                    break;
                }
                row.Cells.Add(cell);

                cell      = new TableCell();
                cell.Text = info.count.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                if (totalNum != 0)
                {
                    cell.Text = Decimal.Round((decimal)info.count / totalNum * 100, 3).ToString() + "%";
                }
                else
                {
                    cell.Text = info.count.ToString();
                }
                row.Cells.Add(cell);

                TableSearchItem.Rows.Add(row);
            }
            TableRow rowHead = new TableRow();
            rowHead.Font.Bold = true;
            TableCell cellHead = new TableCell();
            cellHead.ColumnSpan = 5;
            cellHead.Text       = string.Format("{0} : {1}", StringDef.Total, totalNum);
            rowHead.Cells.Add(cellHead);
            TableSearchItem.Rows.Add(rowHead);

            return(true);
        }
        return(false);
    }