Exemplo n.º 1
0
        private void InputManager_Update(On.InputManager.orig_Update orig, InputManager self)
        {
            orig(self);
            Dungeon d = SingletonManager.Get <Dungeon>(false);

            if (!overwriteWrapper.Value)
            {
                SeedCollection.UnLoad();
            }
            else
            {
                if (!SeedCollection.Loaded)
                {
                    mod.Log("Reinitializing SeedCollection because it isn't loaded!");
                    SeedCollection.ReadAll();
                }
            }
            if (d == null)
            {
                return;
            }
            if (Input.GetKeyUp((KeyCode)Enum.Parse(typeof(KeyCode), saveKeyWrapper.Value)))
            {
                mod.Log("Saving SeedData to SeedCollection!");
                SeedCollection best = SeedCollection.GetMostCurrentSeeds(d.ShipName, d.Level);
                if (best == null)
                {
                    mod.Log("Creating new SeedCollection because there were no matching SeedCollections!");
                    best = SeedCollection.Create();
                }
                SeedData data = new SeedData();
                d.EnqueueNotification("Saved SeedData: " + data + " to: " + best.ReadFrom);
                best.Add(d.ShipName, d.Level, data);
                SeedCollection.WriteAll();
                mod.Log("Wrote SeedCollection to: " + best.ReadFrom);
            }
            if (Input.GetKeyUp((KeyCode)Enum.Parse(typeof(KeyCode), createNewSeedKeyWrapper.Value)))
            {
                mod.Log("Created new SeedCollection!");
                SeedCollection best = SeedCollection.Create();
                SeedData       data = new SeedData();
                best.Add(d.ShipName, d.Level, data);
                SeedCollection.WriteAll();
                d.EnqueueNotification("Saved SeedData: " + data + " to new: " + best.ReadFrom);
                mod.Log("Wrote SeedCollection to: " + best.ReadFrom);
            }
        }
Exemplo n.º 2
0
 public void UnLoad()
 {
     mod.UnLoad();
     On.InputManager.Update -= InputManager_Update;
     SeedCollection.UnLoad();
 }