public int TopAddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if (branch != null) { if (branch.Leaves.Count == 0) { return(0); } for (int i = branch.Leaves.Count - 1; i >= 0; i--) { GameObjectTextLeaf leaf = branch.Leaves[i]; if ((gameObject != null) && (leaf.Property != "")) { this.AddText(0, StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(0, leaf.Text, leaf.TextColor); } } this.ResortTexts(); foreach (SimpleText text in this.Texts) { if (text.NewLine) { return(text.Row); } } } return(0); }
public void AddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if ((branch != null) && (branch.Leaves.Count != 0)) { foreach (GameObjectTextLeaf leaf in branch.Leaves) { if ((gameObject != null) && (leaf.Property != "")) { this.AddText(StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(leaf.Text, leaf.TextColor); } } this.ResortTexts(); } }
//public FreeRichText(FreeTextBuilder builder) //{ // this.Texts = new List<SimpleText>(); // this.PageIndexs = new List<int>(); // this.ClientWidth = 200; // this.ClientHeight = 600; // //this.Builder = builder; //} public void AddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if ((branch != null) && (branch.Leaves.Count != 0)) { foreach (GameObjectTextLeaf leaf in branch.Leaves) { if ((gameObject != null) && (leaf.Property != "")) { this.AddText(StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(leaf.Text, leaf.TextColor); } } this.ResortTexts(); } }
public void LoadFromXmlFile(string filePath) { XmlDocument document = new XmlDocument(); document.Load(filePath); XmlNode nextSibling = document.FirstChild.NextSibling; foreach (XmlNode node2 in nextSibling.ChildNodes) { GameObjectTextBranch branch = new GameObjectTextBranch { BranchName = node2.Attributes.GetNamedItem("Name").Value }; if (node2.Attributes.GetNamedItem("Time") != null) { branch.Time = int.Parse(node2.Attributes.GetNamedItem("Time").Value); } branch.LoadFromXmlNode(node2); this.Branches.Add(branch.BranchName, branch); } }
public int TopAddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if (branch != null) { if (branch.Leaves.Count == 0) { return 0; } for (int i = branch.Leaves.Count - 1; i >= 0; i--) { GameObjectTextLeaf leaf = branch.Leaves[i]; if ((gameObject != null) && (leaf.Property != "")) { this.AddText(0, StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(0, leaf.Text, leaf.TextColor); } } this.ResortTexts(); foreach (SimpleText text in this.Texts) { if (text.NewLine) { return text.Row; } } } return 0; }
public void AddItem(string branchName, GameObjectTextBranch content) { Branches.Add(branchName, content); }
public void SetScenario(GameScenario scen) { foreach (GameObjects.TroopDetail.CombatMethod m in scen.GameCommonData.AllCombatMethods.CombatMethods.Values) { if (!this.help.TextTree.HasItem("TroopCombatMethod_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("战法", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopCombatMethod_" + m.ID, branch); } } foreach (GameObjects.TroopDetail.Stratagem m in scen.GameCommonData.AllStratagems.Stratagems.Values) { if (!this.help.TextTree.HasItem("TroopStratagem_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("计略", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopStratagem_" + m.ID, branch); } } foreach (GameObjects.PersonDetail.Stunt m in scen.GameCommonData.AllStunts.Stunts.Values) { if (!this.help.TextTree.HasItem("TroopStunt_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("特技", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopStunt_" + m.ID, branch); } } }