private void newCharacter() { // default human var character = new GurpsCharacter(database); character.getPurchasedProperty("Human").PurchasedLevels = 1; setCharacter(character); filePath = null; savedName = null; Dirty = false; setTitle(); Preferences.Instance.RecentCharacter = filePath; }
private void setCharacter(GurpsCharacter character) { if (this.character != null) character.changed -= setDirty; if (layoutControl != null) this.Controls.Remove(layoutControl); this.character = character; character.changed += setDirty; layout = character.layout.createUi(this); layoutControl = layout.RootControl; this.Controls.Add(layoutControl); layoutControl.BringToFront(); Dirty = false; }
public static GurpsCharacter fromJson(object jsonObject, GurpsDatabase database) { GurpsCharacter character = new GurpsCharacter(database); var dict = (Dictionary<string, object>)jsonObject; character.name = (string)dict["name"]; character.layout = AbstractTraitGroup.fromJson(dict["layout"]); foreach (object purchaseObject in (List<object>)dict["purchases"]) { var purchase = (Dictionary<string, object>)purchaseObject; character.getPurchasedProperty((string)purchase["trait"]).PurchasedLevels = (int)purchase["purchased"]; } return character; }
public EvaluationContext(GurpsCharacter character, PurchasedProperty purchasedProperty, int levelValue = int.MinValue) { this.character = character; this.purchasedProperty = purchasedProperty; this.levelValue = levelValue; }
public PurchasedProperty(GurpsProperty property, GurpsCharacter character) { this.property = property; this.character = character; }
private IEnumerable<GurpsProperty> internalSearch(string query, TraitTypeFilter filter, GurpsCharacter character) { var dontInclude = new HashSet<string>(character.layout.getNames()); var words = query.ToLower().Split(' '); foreach (GurpsProperty property in nameToThing.Values) { if (!filterPasses(filter, property)) continue; if (dontInclude.Contains(property.name)) continue; var nameToLower = property.DisplayName.ToLower(); if (words.All((word) => nameToLower.Contains(word))) yield return property; } }
public List<GurpsProperty> search(string query, TraitTypeFilter filter, GurpsCharacter character) { return new List<GurpsProperty>(order(internalSearch(query, filter, character))); }