Ejemplo n.º 1
0
        private void GameSelectionPanel_Display(On.GameSelectionPanel.orig_Display orig, GameSelectionPanel self, bool isMultiplayer, string mpSaveKey, int slotCount, GameSelectionPanel.GameSelectionFinishedHandler onGameSelectionFinished)
        {
            Log("Attempting to Display!");
            IDatabase <ShipConfig> db = Databases.GetDatabase <ShipConfig>(false);

            Log("Database loaded!");
            if (db.GetValue(this.GetConfig().Name) != null)
            {
                // It already exists within the database, so we can continue
                Log("The shipconfig with name: " + this.GetConfig().Name + " already exists inside the database!");
            }
            else
            {
                db.Add(this.GetConfig());
            }
            DynData <GameSelectionPanel> paneldyn = new DynData <GameSelectionPanel>(self);

            paneldyn.Set <IDatabase <ShipConfig> >("shipConfigDB", db);
            Log("Database set!");

            orig(self, isMultiplayer, mpSaveKey, slotCount, onGameSelectionFinished);

            Log("Available Ships:");
            foreach (string s in paneldyn.Get <List <Amplitude.StaticString> >("availableShips"))
            {
                Log(s);
            }
            Log("DB:");
            foreach (ShipConfig s in paneldyn.Get <IDatabase <ShipConfig> >("shipConfigDB"))
            {
                Log("Name: " + s.Name + " localized: " + s.GetLocalizedName() + " desc: " + s.GetLocalizedDescription() + " abscissa val: " + s.AbscissaValue);
            }
        }
Ejemplo n.º 2
0
        private void GameSelectionPanel_Display(On.GameSelectionPanel.orig_Display orig, GameSelectionPanel self, bool isMultiplayer, string mpSaveKey, int slotCount, GameSelectionPanel.GameSelectionFinishedHandler onGameSelectionFinished)
        {
            // Should happen often enough (before we get to the PodScreen) in order to work out.
            if (!run)
            {
                // Set GameConfig
                SetGameConfig();

                // Need to AT LEAST alter the following:
                // GameSelectionPanel.Display --> NullReference
                // Lift.Show() --> IndexOutOfBounds

                // GameSelectionPanel.Display --> NullReference
                var d = new DynData <GameSelectionPanel>(self);
                mod.Log("Before set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));
                mod.Log("GameSelectionPanel.competitorsTable: " + d.Get <AgeTransform>("competitorsTable"));
                mod.Log("GameSelectionPanel.competitorSlots: " + d.Get <List <CompetitorSlot> >("competitorSlots"));

                d.Set <int>("maxHeroCount", maxHeroShipCountWrapper.Value);

                mod.Log("After set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));

                run = true;
            }
            orig(self, isMultiplayer, mpSaveKey, slotCount, onGameSelectionFinished);
        }