Exemplo n.º 1
0
        internal static byte[] GetMenstruationsArr(MenstruationSchedule menstruationSchedule)
        {
            switch (menstruationSchedule)
            {
            default:
                return(HFlag.menstruations);

            case MenstruationSchedule.MostlyRisky:
                return(_menstruationsRisky);

            case MenstruationSchedule.AlwaysSafe:
                return(_menstruationsAlwaysSafe);

            case MenstruationSchedule.AlwaysRisky:
                return(_menstruationsAlwaysRisky);
            }
        }
Exemplo n.º 2
0
        public static PluginData SerializeData(int week, bool gameplayEnabled, float fertility, MenstruationSchedule schedule)
        {
            if (week <= 0 && gameplayEnabled && Mathf.Approximately(fertility, DefaultFertility))
            {
                return(null);
            }

            var data = new PluginData
            {
                version = 1,
                data    =
                {
                    ["Week"]                 = week,
                    ["GameplayEnabled"]      = gameplayEnabled,
                    ["Fertility"]            = fertility,
                    ["MenstruationSchedule"] = (int)schedule
                }
            };

            return(data);
        }
Exemplo n.º 3
0
        public static void DeserializeData(PluginData data, out int week, out bool gameplayEnabled, out float fertility, out MenstruationSchedule schedule)
        {
            week            = 0;
            gameplayEnabled = true;
            fertility       = DefaultFertility;
            schedule        = MenstruationSchedule.Default;

            if (data?.data == null)
            {
                return;
            }

            if (data.data.TryGetValue("Week", out var value) && value is int w)
            {
                week = w;
            }
            if (data.data.TryGetValue("GameplayEnabled", out var value2) && value2 is bool g)
            {
                gameplayEnabled = g;
            }
            if (data.data.TryGetValue("Fertility", out var value3) && value3 is float f)
            {
                fertility = f;
            }
            if (data.data.TryGetValue("MenstruationSchedule", out var value4) && value4 is int s)
            {
                schedule = (MenstruationSchedule)s;
            }
        }