コード例 #1
0
        public override string ToLink(bool link = true, DwarfObject pov = null)
        {
            if (this == Unknown)
            {
                return(Name);
            }

            if (link)
            {
                string icon = GetIcon();
                if (pov == null || pov != this)
                {
                    if (pov != null && pov.GetType() == typeof(BeastAttack) && (pov as BeastAttack)?.Beast == this) //Highlight Beast when printing Beast Attack Log
                    {
                        return(icon + "<a href=\"hf#" + Id + "\" title=\"" + Title + "\"><font color=#339900>" + ShortName + "</font></a>");
                    }

                    return("the " + RaceString + " " + icon + "<a href=\"hf#" + Id + "\" title=\"" + Title + "\">" + Name + "</a>");
                }
                return("<a href=\"hf#" + Id + "\" title=\"" + Title + "\">" + HtmlStyleUtil.CurrentDwarfObject(ShortName) + "</a>");
            }
            if (pov == null || pov != this)
            {
                return(RaceString + " " + Name);
            }
            return(ShortName);
        }
コード例 #2
0
 public override string ToLink(bool link = true, DwarfObject pov = null)
 {
     if (this == HistoricalFigure.Unknown)
     {
         return(this.Name);
     }
     if (link)
     {
         if ((pov == null || pov != this))
         {
             string title = Caste + ", " + AssociatedType + " (" + BirthYear + " - ";
             if (DeathYear == -1)
             {
                 title += "Present)";
             }
             else
             {
                 title += DeathYear + ")";
             }
             title += "&#13Events: " + Events.Count;
             if (pov != null && pov.GetType() == typeof(BeastAttack) && (pov as BeastAttack).Beast == this) //Highlight Beast when printing Beast Attack Log
             {
                 if (this.Name.IndexOf(" ") > 0)
                 {
                     return("<a href=\"hf#" + this.ID + "\" title=\"" + title + "\"><font color=#339900>" + this.Name.Substring(0, this.Name.IndexOf(" ")) + "</font></a>");
                 }
                 else
                 {
                     return("<a href=\"hf#" + this.ID + "\" title=\"" + title + "\"><font color=#339900>" + this.Name + "</font></a>");
                 }
             }
             else
             {
                 return("the " + GetRaceString() + " " + "<a href = \"hf#" + this.ID + "\" title=\"" + title + "\">" + this.Name + "</a>");
             }
         }
         else
         {
             return(HTMLStyleUtil.CurrentDwarfObject(Name.IndexOf(" ") > 0 ? Name.Substring(0, Name.IndexOf(" ")) : Name));
         }
     }
     else if ((pov == null || pov != this))
     {
         return(GetRaceString() + " " + Name);
     }
     else
     {
         return(Name.IndexOf(" ") > 0 ? Name.Substring(0, Name.IndexOf(" ")) : Name);
     }
 }
コード例 #3
0
ファイル: ChartControl.cs プロジェクト: RossM/Legends-Viewer
        public ChartPanel(World world, DwarfObject focusObject, List<ChartOption> options = null)
        {
            Dock = DockStyle.Fill;

            FocusObject = focusObject as DwarfObject;
            World = world;
            DwarfChart = new Chart();
            DwarfChart.Dock = DockStyle.Fill;
            Controls.Add(DwarfChart);
            this.Refresh();

            DwarfChart.BackColor = Color.Wheat;
            DwarfChart.BackGradientStyle = GradientStyle.TopBottom;
            DwarfChart.ChartAreas.Add(new ChartArea());
            DwarfChart.ChartAreas.Last().AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
            DwarfChart.ChartAreas.Last().BackColor = Color.FromArgb(235, 235, 235);
            DwarfChart.Legends.Add(new Legend());
            DwarfChart.Legends.Last().LegendStyle = LegendStyle.Row;
            DwarfChart.Legends.Last().Position.Width = 100;
            DwarfChart.Legends.Last().Position.Y = 100;
            DwarfChart.Legends.Last().Position.Height = 4;
            DwarfChart.Titles.Add(new Title());
            DwarfChart.Titles.Last().Position.Auto = false;
            DwarfChart.Titles.Last().Position.X = 50;
            DwarfChart.Titles.Last().Position.Y = 1.5f;
            if (options != null) SeriesOptions = options;
            else if (FocusObject.GetType() == typeof(Battle))
                SeriesOptions.Add(ChartOption.OtherBattleRemaining);
            else
            {
                SeriesOptions.Add(ChartOption.TimelineEvents);
                SeriesOptions.Add(ChartOption.TimelineEventsFiltered);
            }
            SetupMenu();
            //GenerateSeries();
        }
コード例 #4
0
ファイル: HTMLPrinter.cs プロジェクト: figment/Legends-Viewer
 protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.HTML)
 {
     //<a href=\"collection#" + attack.ID + "\">" + attack.GetOrdinal(attack.Ordinal)
     string objectType = "";
     int id = 0;
     if (dObject is EventCollection)
     {
         objectType = "collection";
         id = (dObject as EventCollection).ID;
     }
     else if (dObject.GetType() == typeof(HistoricalFigure))
     {
         objectType = "hf";
         id = (dObject as HistoricalFigure).ID;
     }
     else if (dObject.GetType() == typeof(Entity))
     {
         objectType = "entity";
         id = (dObject as Entity).ID;
     }
     else if (dObject.GetType() == typeof(WorldRegion))
     {
         objectType = "region";
         id = (dObject as WorldRegion).ID;
     }
     else if (dObject.GetType() == typeof(UndergroundRegion))
     {
         objectType = "uregion";
         id = (dObject as UndergroundRegion).ID;
     }
     else if (dObject.GetType() == typeof(Site))
     {
         objectType = "site";
         id = (dObject as Site).ID;
     }
     else throw new Exception("Unhandled make link for type: " + dObject.GetType());
     string optionString = "";
     if (option != ControlOption.HTML)
         optionString = "-" + option.ToString();
     return "<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>";
 }
コード例 #5
0
        public override string ToLink(bool link = true, DwarfObject pov = null)
        {
            if (this == HistoricalFigure.Unknown) return this.Name;
            if (link)
                if ((pov == null || pov != this))
                {
                    string title = Caste + ", " + AssociatedType + " (" + BirthYear + " - ";
                    if (DeathYear == -1) title += "Present)";
                    else title += DeathYear + ")";
                    title += "&#13Events: " + Events.Count;
                    if (pov != null && pov.GetType() == typeof(BeastAttack) && (pov as BeastAttack).Beast == this) //Highlight Beast when printing Beast Attack Log
                        if (this.Name.IndexOf(" ") > 0)
                            return "<a href = \"hf#" + this.ID + "\" title=\"" + title + "\"><font color=#339900>" + this.Name.Substring(0, this.Name.IndexOf(" ")) + "</font></a>";
                        else return "<a href = \"hf#" + this.ID + "\" title=\"" + title + "\"><font color=#339900>" + this.Name + "</font></a>";
                    else
                        return "the " + GetRaceString() + " " + "<a href = \"hf#" + this.ID + "\" title=\"" + title + "\">" + this.Name + "</a>";
                }
                else// (pov != null && pov.ID == this.ID)
                    if (this.Name.IndexOf(" ") > 0)
                        return "<font color=\"Blue\">" + this.Name.Substring(0, this.Name.IndexOf(" ")) + "</font>";
                    else
                        return "<font color=\"Blue\">" + this.Name + "</font>";
            else

                if ((pov == null || pov != this))
                    return GetRaceString() + " " + this.Name;
                else //(pov != null && pov.ID == this.ID)
                    if (this.Name.IndexOf(" ") > 0)
                        return this.Name.Substring(0, this.Name.IndexOf(" ") + 1);
                    else
                        return this.Name;
        }