Beispiel #1
0
 protected void initValues(T[] list, string[] names)
 {
     if (list == null || names == null)
     {
         return;
     }
     if (weightMap.Map == null || weightMap.Map.Keys.Count != list.Length)
     {
         // If the map size has changed then create a copy of the map and if the new map contains the same keys, use the old map's values
         SerializableDictionary <T, float> oldMap = new SerializableDictionary <T, float>(weightMap.Map);
         weightMap.Map.Clear();
         foreach (T t in list)
         {
             if (oldMap.ContainsKey(t))
             {
                 weightMap.Map.Add(t, oldMap.GetValue(t));
             }
             else
             {
                 weightMap.Map.Add(t, 1);
             }
         }
     }
     this.names = names;
 }
 public string GetRandomFlattery(CharacterWealth wealth)
 {
     if (_flatteryWealth.ContainsKey(wealth))
     {
         return(_flatteryWealth.GetValue(wealth).RandomText);
     }
     return("");
 }
 public string GetRandomFlattery(CharacterAge age)
 {
     if (_flatteryAge.ContainsKey(age))
     {
         return(_flatteryAge.GetValue(age).RandomText);
     }
     return("");
 }
 public string GetRandomFlattery(CharacterOccupation occupation)
 {
     if (_flatteryOccupation.ContainsKey(occupation))
     {
         return(_flatteryOccupation.GetValue(occupation).RandomText);
     }
     return("");
 }
 public string GetRandomThreaten(CharacterWealth wealth)
 {
     if (_threatenWealth.ContainsKey(wealth))
     {
         return(_threatenWealth.GetValue(wealth).RandomText);
     }
     return("");
 }
 public string GetRandomThreaten(CharacterAge age)
 {
     if (_threatenAge.ContainsKey(age))
     {
         return(_threatenAge.GetValue(age).RandomText);
     }
     return("");
 }
 public string GetRandomThreaten(CharacterOccupation occupation)
 {
     if (_threatenOccupation.ContainsKey(occupation))
     {
         return(_threatenOccupation.GetValue(occupation).RandomText);
     }
     return("");
 }