Exemplo n.º 1
0
        internal static void Init(Harmony hi, PregnancyPlugin instance)
        {
            _pluginInstance = instance;

            if (StudioAPI.InsideStudio)
            {
                RegisterStudioControls();
            }
            else
            {
                MakerAPI.RegisterCustomSubCategories += MakerAPI_MakerBaseLoaded;

                Sprite LoadIcon(string resourceFileName)
                {
                    var iconTex = new Texture2D(2, 2, TextureFormat.DXT5, false);

                    Object.DontDestroyOnLoad(iconTex);
                    iconTex.LoadImage(ResourceUtils.GetEmbeddedResource(resourceFileName));

                    var sprite = Sprite.Create(iconTex, new Rect(0f, 0f, iconTex.width, iconTex.height),
                                               new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.FullRect);

                    Object.DontDestroyOnLoad(sprite);
                    return(sprite);
                }

                var pregSprite    = LoadIcon("pregnant.png");
                var riskySprite   = LoadIcon("risky.png");
                var safeSprite    = LoadIcon("safe.png");
                var unknownSprite = LoadIcon("unknown.png");
                var leaveSprite   = LoadIcon("leave.png");

                StatusIcons.Init(hi, unknownSprite, pregSprite, safeSprite, riskySprite, leaveSprite);
            }
        }
Exemplo n.º 2
0
        internal static void Init(Harmony hi, PregnancyPlugin instance)
        {
            _pluginInstance = instance;

            if (StudioAPI.InsideStudio)
            {
                RegisterStudioControls();
            }
            else
            {
                MakerAPI.RegisterCustomSubCategories += MakerAPI_MakerBaseLoaded;

                StatusIcons.Init(hi);
            }
        }
Exemplo n.º 3
0
        [HarmonyWrapSafe] // Ignore crashes
        private static void OnFinishInside(HFlag __instance)
        {
            if (!IsEffectActive())
            {
                return;
            }

            var heroine    = __instance.GetLeadingHeroine();
            var controller = PregnancyPlugin.GetEffectController(heroine);

            if (controller.Data.GameplayEnabled && !controller.Data.IsPregnant && controller.Data.Fertility > 0.001f)
            {
                var isDangerousDay = HFlag.GetMenstruation(heroine.MenstruationDay) == HFlag.MenstruationType.危険日;
                if (UnityEngine.Random.RandomRangeInt(0, 100) < (isDangerousDay ? 95 : 30))
                {
                    PregnancyPlugin.Logger.LogInfo("Through the power of a pin hole, pregnancy");
                    PregnancyGameController.StartPregnancyDelayed(heroine, true);
                }
            }
        }