示例#1
0
        public void OnLevelLoaded(LoadMode mode)
        {
            try
            {
                if (!mode.IsGameOrScenario())
                {
                    return;
                }

                if (mode.IsScenario())
                {
                    if (ModConfig.Instance.GetSetting <bool>(SettingKeys.DisableScenarioDisasters))
                    {
                        DisasterManager.instance.ClearAll();
                    }
                }

                BuildingManager.instance.m_firesDisabled = ModConfig.Instance.GetSetting <bool>(SettingKeys.DisableNonDisasterFires);

                GenericDisasterServices.UpdateAutoFollowDisaster(logger);
            }
            catch (Exception ex)
            {
                logger.LogException(ex);

                throw;
            }
        }
示例#2
0
        public override void OnDisasterActivated(ushort disasterId)
        {
            try
            {
                var info = disasterWrapper.GetDisasterSettings(disasterId);

                logger.Info(
                    "DDS: OnDisasterActivated. Id: {0}, Name: {1}, Type: {2}, Intensity: {3}",
                    disasterId,
                    info.name,
                    info.type,
                    info.intensity);

                if (TryDisableDisaster(disasterId, info))
                {
                    return;
                }

                GenericDisasterServices.HandlePauseOnDisaster(logger, info.type);
            }
            catch (Exception ex)
            {
                logger.LogException(ex);

                throw;
            }
        }
示例#3
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);
            }
        }
        private void OnAutoFocusDisasterChanged(bool isChecked)
        {
            SaveSetting(SettingKeys.DisableAutofocusDisaster, isChecked);

            GenericDisasterServices.UpdateAutoFollowDisaster(logger);
        }