Ejemplo n.º 1
0
        private void Session_Update(On.Session.orig_Update orig, Session self)
        {
            orig(self);
            KeyCode key = (KeyCode)Enum.Parse(typeof(KeyCode), keyWrapper.Value);

            if (Input.GetKeyDown(key))
            {
                try
                {
                    Dungeon d = SingletonManager.Get <Dungeon>(false);
                    mod.Log("Attempting to find exit in Dungeon...");
                    d.EnqueueNotification(GetExit(d));
                    if (ExitRoom.CrystalModuleSlots.Count > 0)
                    {
                        // The exit already exists, don't make another one!
                        return;
                    }
                    if (displayExitWrapper.Value)
                    {
                        mod.Log("Attemping to display exit...");
                        ExitRoom.AddCrystalSlot(true);
                        d.DisplayCrystalAndExitOffscreenMarkers(ExitRoom.CrystalModuleSlots[0].transform).Show(true);
                    }
                } catch (NullReferenceException)
                {
                    // The Dungeon/GUI has yet to be setup!
                    // Let's just wait a bit and log it.
                    mod.Log("Dungeon/GUI Not yet initialized!");
                }
            }
        }
Ejemplo n.º 2
0
        private void Session_Update(On.Session.orig_Update orig, Session self)
        {
            orig(self);
            Dungeon d = SingletonManager.Get <Dungeon>(false);

            if (d == null)
            {
                return;
            }
            if (d.GameStartTime != LastGameStartTime)
            {
                // Don't actually do this for floor 1, instead calculate it based off of when the first door is selected to be opened
                if (d.Level == 1)
                {
                    // Skip this
                    return;
                }
                if (d.IsDisplayed && UnityEngine.Time.timeScale != 0) // Basically calculates load time from the very frame the dungeon is loaded and the game is unpaused
                {
                    if (LastGameStartTime != 0)
                    {
                        //dict.Add(DateTime.Now, true);
                        StartTime = DateTime.Now;
                    }
                    LastGameStartTime = d.GameStartTime;
                    mod.Log("Set LastGameStartTime!");
                    mod.Log("Times: ");
                    mod.Log(StartTime.ToLongTimeString());
                }
            }
        }
Ejemplo n.º 3
0
        private void Session_Update(On.Session.orig_Update orig, Session self)
        {
            // Continue attempting to add the ItemHero until it has been added!
            try
            {
                SimulationDescriptor desc;
                Databases.GetDatabase <SimulationDescriptor>(false).TryGetValue(GetBaseDescriptor().Name, out desc);
                if (desc != null)
                {
                    orig(self);
                    return;
                }
                ItemHeroConfig itemHeroConfig = GetItemHeroConfig();
                Databases.GetDatabase <ItemConfig>(false).Add(itemHeroConfig);
                Log("Added the item (ItemHeroConfig) to the database!");
                Log("Attempting to make sim descriptors");
                SimulationDescriptor descriptor = GetBaseDescriptor();
                Log("Successfully retrieved the overall descriptor!");
                SimulationDescriptor common = GetCommonDescriptor();
                Log("Successfully retrieved the common descriptor!");
                SimulationDescriptor rarity0 = GetRarity0Descriptor();
                Log("Successfully retrieved the rarity0 descriptor!");
                SimulationDescriptor rarity1 = GetRarity1Descriptor();
                Log("Successfully retrieved the rarity1 descriptor!");
                SimulationDescriptor rarity2 = GetRarity2Descriptor();
                Log("Successfully retrieved the rarity2 descriptor!");

                Log("Attempting to add descriptors to database!");

                Databases.GetDatabase <SimulationDescriptor>(false).Add(descriptor);
                Log("Added Base!");
                Databases.GetDatabase <SimulationDescriptor>(false).Add(common);
                Log("Added Common!");
                Databases.GetDatabase <SimulationDescriptor>(false).Add(rarity0);
                Log("Added Rarity0!");
                Databases.GetDatabase <SimulationDescriptor>(false).Add(rarity1);
                Log("Added Rarity1!");
                Databases.GetDatabase <SimulationDescriptor>(false).Add(rarity2);
                Log("Added Rarity2!");
                Log("Added all SimDescriptors to the database!");
            }
            catch (ArgumentException e)
            {
                // It already exists!
            } catch (NullReferenceException e)
            {
                // Database doesn't exist yet!
            }
            orig(self);
        }
Ejemplo n.º 4
0
 private void Session_Update(On.Session.orig_Update orig, Session self)
 {
     if (!displayedData)
     {
         Log("Number of Active Heroes: " + Hero.LocalPlayerActiveRecruitedHeroes.Count);
         foreach (Hero h in Hero.LocalPlayerActiveRecruitedHeroes)
         {
             try
             {
                 Log("Entering a check with Name: " + h.LocalizedName);
                 SimulationDescriptor dbdescriptorByName = SimMonoBehaviour.GetDBDescriptorByName(h.Config.Name);
                 Log("DBDescriptorByName: " + dbdescriptorByName.Name);
                 var obj = h.GetSimDescriptorByType(SimulationProperties.SimDescTypeHero);
                 Log("Name: " + obj.Name + " Type: " + obj.Type);
                 Log("Modifiers:");
                 if (obj.SimulationModifierDescriptors != null)
                 {
                     foreach (SimulationModifierDescriptor m in obj.SimulationModifierDescriptors)
                     {
                         Log("- " + m.TargetPropertyName);
                     }
                 }
                 Log("Properties:");
                 if (obj.SimulationPropertyDescriptors != null)
                 {
                     foreach (SimulationPropertyDescriptor d in obj.SimulationPropertyDescriptors)
                     {
                         Log("- " + d.Name + ": " + d.BaseValue);
                     }
                 }
                 Log("Level 1 Name: " + h.GetLevelDescriptorName(1));
                 displayedData = true;
             }
             catch (NullReferenceException e)
             {
                 // Thats ok for now
             }
         }
     }
     orig(self);
 }