コード例 #1
0
ファイル: BiggerSeed.cs プロジェクト: crecheng/DSPMod
        static bool SeedRadom(UIGalaxySelect __instance)
        {
            GameDesc gameDesc = Traverse.Create(__instance).Field("gameDesc").GetValue <GameDesc>();

            System.Random random = Traverse.Create(__instance).Field("random").GetValue <System.Random>();
            gameDesc.galaxySeed = random.Next(int.MaxValue);
            __instance.SetStarmapGalaxy();
            return(false);
        }
コード例 #2
0
        public static bool OnStarCountSliderValueChange(UIGalaxySelect __instance, ref Slider ___starCountSlider,
                                                        ref GameDesc ___gameDesc, float val)
        {
            var num = (int)(___starCountSlider.value + 0.100000001490116);

            if (num == ___gameDesc.starCount)
            {
                return(false);
            }

            ___gameDesc.starCount = num;
            __instance.SetStarmapGalaxy();
            return(false);
        }
コード例 #3
0
        // Methods
        public static void OnDensityChanged()
        {
            // Null checkup
            if (!starDensitySlider || !starDensitySliderText)
            {
                Debug.LogError($"More or Less Dense::OnDensityChanged() -- FATAL ERROR: missing slider or text for star density info");
                return;
            }

            // Update text
            starDensitySliderText.text = Math.Round(starDensitySlider.value * 0.25f, 2).ToString() + "x";

            // Regenerate galaxy
            DensityDTO.SetDensityInformation(starDensitySlider?.value);
            uiGalaxySelect.SetStarmapGalaxy();
        }
コード例 #4
0
        public static bool Patch(ref UIGalaxySelect __instance, ref float val)
        {
            // Replicate the code of the original method
            int num = (int)(__instance.starCountSlider.value + 0.1f);

            if (num < desiredMinStars)
            {
                num = desiredMinStars;
            }
            else if (num > desiredMaxStars)
            {
                num = desiredMaxStars;
            }
            if (num != __instance.gameDesc.starCount)
            {
                __instance.gameDesc.starCount = num;
                __instance.SetStarmapGalaxy();
            }

            // Return to prevent the call of the original method
            return(false);
        }