Beispiel #1
0
 public SubRaceEditModel(SubRace cond, OGLContext context) : base(cond, context)
 {
     if (cond.RaceName == null)
     {
         cond.RaceName = "*";
     }
     ShowImage = new Command(async() =>
     {
         await Navigation.PushAsync(new ImageEditor(Image, Model.ImageData, SaveImage, "Image"));
     });
     SaveImage = new Command(async(par) =>
     {
         MakeHistory();
         Model.ImageData = par as byte[];
         OnPropertyChanged("Image");
         await Navigation.PopAsync();
     });
     SaveCostumRace = new Command((par) =>
     {
         if (par is string s)
         {
             Races.Add(s);
             ParentRace = s;
         }
     });
     Races.AddRange(context.RacesSimple.Keys);
     Races.Add("*");
     if (!Races.Contains(cond.RaceName))
     {
         Races.Add(cond.RaceName);
     }
     Races.Add(CUSTOM);
 }
        private void LoadRaceData()
        {
            Data  = Interface.Oxide.DataFileSystem.ReadObject <Dictionary <ulong, PlayerData> >("PlayerRaces");
            Races = Interface.Oxide.DataFileSystem.ReadObject <HashSet <Race> >("Races");

            foreach (var player in Data)
            {
                if (player.Value.Race != null && !Races.Contains(player.Value.Race))
                {
                    player.Value.Race = Races.FirstOrDefault(r => string.Equals(r.Name, player.Value.Race.Name, StringComparison.CurrentCultureIgnoreCase));
                }
            }
        }