Exemplo n.º 1
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (!mode.IsGameOrScenario())
            {
                return;
            }

            var disasterInfos = GenericDisasterServices.GetDisasterInfos();

            foreach (var disasterInfo in disasterInfos)
            {
                var settingKey = string.Format("{0}Probability", disasterInfo.name.Replace(" ", string.Empty));

                if (ModConfig.Instance.HasSetting(settingKey))
                {
                    disasterInfo.m_finalRandomProbability = ModConfig.Instance.GetSetting <int>(settingKey);
                }
            }
        }
        private void ConfigureProbabilityGroup(IStronglyTypedUIHelper uiHelper)
        {
            var probabilityGroup = uiHelper.AddGroup("Disaster probabilities");

            if (!GenericDisasterServices.GetDisasterInfos().Any())
            {
                probabilityGroup.AddLabel("You need to be in an active game or scenario to change these settings.");

                return;
            }

            probabilityGroup.AddLabel(
                "The sliders below indicate the risk of a certain type of disaster spawning.\n\n" +
                "These are in relation to each other meaning that if two sliders are set equally\n" +
                "then they have an equal chance of occurring.");
            var disasterInfos = GenericDisasterServices.GetDisasterInfos().ToList();

            foreach (var disasterInfo in disasterInfos)
            {
                var settingKey = string.Format("{0}Probability", disasterInfo.name.Replace(" ", string.Empty));

                AddProbabilitySlider(probabilityGroup, settingKey, disasterInfo);
            }
        }