Пример #1
0
 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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 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;
 }
Пример #4
0
 public EvaluationContext(GurpsCharacter character, PurchasedProperty purchasedProperty, int levelValue = int.MinValue)
 {
     this.character = character;
     this.purchasedProperty = purchasedProperty;
     this.levelValue = levelValue;
 }
Пример #5
0
 public PurchasedProperty(GurpsProperty property, GurpsCharacter character)
 {
     this.property = property;
     this.character = character;
 }
Пример #6
0
 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;
     }
 }
Пример #7
0
 public List<GurpsProperty> search(string query, TraitTypeFilter filter, GurpsCharacter character)
 {
     return new List<GurpsProperty>(order(internalSearch(query, filter, character)));
 }