public void serializeCommonParameters(DataSerializer s, EnhancedDisaster disaster)
 {
     s.WriteBool(disaster.Enabled);
     s.WriteFloat(disaster.BaseOccurrencePerYear);
     s.WriteFloat(disaster.calmDaysLeft);
     s.WriteFloat(disaster.probabilityWarmupDaysLeft);
     s.WriteFloat(disaster.intensityWarmupDaysLeft);
 }
示例#2
0
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedForestFire d = disaster as EnhancedForestFire;

            if (d != null)
            {
                WarmupDays = d.WarmupDays;
            }
        }
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedTsunami d = disaster as EnhancedTsunami;

            if (d != null)
            {
                WarmupYears = d.WarmupYears;
            }
        }
示例#4
0
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedSinkhole d = disaster as EnhancedSinkhole;

            if (d != null)
            {
                GroundwaterCapacity = d.GroundwaterCapacity;
            }
        }
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedEarthquake d = disaster as EnhancedEarthquake;

            if (d != null)
            {
                AftershocksEnabled = d.AftershocksEnabled;
                WarmupYears        = d.WarmupYears;
            }
        }
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedThunderstorm d = disaster as EnhancedThunderstorm;

            if (d != null)
            {
                RainFactor          = d.RainFactor;
                MaxProbabilityMonth = d.MaxProbabilityMonth;
            }
        }
示例#7
0
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedTornado d = disaster as EnhancedTornado;

            if (d != null)
            {
                MaxProbabilityMonth = d.MaxProbabilityMonth;
                NoTornadoDuringFog  = d.NoTornadoDuringFog;
            }
        }
示例#8
0
        public override void CopySettings(EnhancedDisaster disaster)
        {
            base.CopySettings(disaster);

            EnhancedMeteorStrike d = disaster as EnhancedMeteorStrike;

            if (d != null)
            {
                Meteor1Enabled = d.Meteor1Enabled;
                Meteor2Enabled = d.Meteor2Enabled;
                Meteor3Enabled = d.Meteor3Enabled;
            }
        }
        public override void Update()
        {
            base.Update();

            if (!isVisible)
            {
                return;
            }

            if (--Counter > 0)
            {
                return;
            }
            Counter = 10;

            EnhancedDisastersManager edm = Singleton <EnhancedDisastersManager> .instance;
            int disasterCount            = edm.container.AllDisasters.Count;

            for (int i = 0; i < disasterCount; i++)
            {
                EnhancedDisaster d            = edm.container.AllDisasters[i];
                float            p            = d.GetCurrentOccurrencePerYear();
                byte             maxIntensity = d.GetMaximumIntensity();
                if (d.Enabled)
                {
                    labels[i].text = string.Format(labelFormat, d.GetName(), p, maxIntensity);

                    progressBars_probability[i].value = getProgressValueLog(p);
                    setProgressBarColor(progressBars_probability[i]);
                    progressBars_probability[i].tooltip = d.GetProbabilityTooltip();

                    progressBars_maxIntensity[i].value = maxIntensity * 0.01f;
                    setProgressBarColor(progressBars_maxIntensity[i]);
                    progressBars_maxIntensity[i].tooltip = d.GetIntensityTooltip();
                }
                else
                {
                    labels[i].text = "Disabled";

                    progressBars_probability[i].value         = 0;
                    progressBars_probability[i].progressColor = Color.black;

                    progressBars_maxIntensity[i].value         = 0;
                    progressBars_maxIntensity[i].progressColor = Color.black;
                }
            }
        }
 public void deserializeCommonParameters(DataSerializer s, EnhancedDisaster disaster)
 {
     disaster.Enabled = s.ReadBool();
     disaster.BaseOccurrencePerYear = s.ReadFloat();
     if (s.version <= 2)
     {
         float daysPerFrame = 1f / 585f;
         disaster.calmDaysLeft = s.ReadInt32() * daysPerFrame;
         disaster.probabilityWarmupDaysLeft = s.ReadInt32() * daysPerFrame;
         disaster.intensityWarmupDaysLeft   = s.ReadInt32() * daysPerFrame;
     }
     else
     {
         disaster.calmDaysLeft = s.ReadFloat();
         disaster.probabilityWarmupDaysLeft = s.ReadFloat();
         disaster.intensityWarmupDaysLeft   = s.ReadFloat();
     }
 }
 public virtual void CopySettings(EnhancedDisaster disaster)
 {
     Enabled = disaster.Enabled;
     BaseOccurrencePerYear = disaster.BaseOccurrencePerYear;
 }
        public override void Start()
        {
            base.Start();

            UILabel lTitle = this.AddUIComponent <UILabel>();

            lTitle.position = new Vector3(10, -15);
            lTitle.text     = "Disasters info";

            int y = -50;
            int h = -20;

            addAxisTitle(200, y, "Probability");
            addAxisTitle(300, y, "Max intensity");
            y -= 15;

            addAxisLabel(200, y, "0.1");
            addAxisLabel(240, y, "1");
            addAxisLabel(275, y, "10");
            addAxisLabel(300, y, "1");
            addAxisLabel(375, y, "10");
            y -= 15;

            int disasterCount = Singleton <EnhancedDisastersManager> .instance.container.AllDisasters.Count;

            labels = new UILabel[disasterCount];
            progressBars_probability  = new UIProgressBar[disasterCount];
            progressBars_maxIntensity = new UIProgressBar[disasterCount];

            EnhancedDisastersManager edm = Singleton <EnhancedDisastersManager> .instance;

            for (int i = 0; i < disasterCount; i++)
            {
                EnhancedDisaster d = edm.container.AllDisasters[i];
                labels[i]      = addLabel(10, y);
                labels[i].text = string.Format(labelFormat, d.GetName(), 0, 0);
                progressBars_probability[i]  = addProgressBar(200, y);
                progressBars_maxIntensity[i] = addProgressBar(300, y);
                y += h;
            }

            UIButton bigRedBtn = this.AddUIComponent <UIButton>();

            bigRedBtn.name     = "bigRedBtn";
            bigRedBtn.position = new Vector3(10, -height + 30);
            bigRedBtn.size     = new Vector2(22, 22);
            //bigRedBtn.color = Color.red;
            bigRedBtn.focusedColor     = Color.red;
            bigRedBtn.textColor        = Color.red;
            bigRedBtn.focusedTextColor = Color.red;
            bigRedBtn.text             = "■";
            bigRedBtn.normalBgSprite   = "ButtonMenu";
            bigRedBtn.hoveredBgSprite  = "ButtonMenuHovered";
            bigRedBtn.eventClick      += BigRedBtn_eventClick;

            UILabel bigRedBtnLabel = this.AddUIComponent <UILabel>();

            bigRedBtnLabel.name      = "bigRedBtnLabel";
            bigRedBtnLabel.position  = new Vector3(40, -height + 27);
            bigRedBtnLabel.size      = new Vector2(width - 30, 20);
            bigRedBtnLabel.textColor = Color.white;
            //bigRedBtnLabel.textScale = 0.7f;
            bigRedBtnLabel.text = "← Emergency Button (stop all disasters)";

            UIButton btn = this.AddUIComponent <UIButton>();

            btn.position       = new Vector3(365, -5);
            btn.size           = new Vector2(30, 30);
            btn.normalFgSprite = "buttonclose";
            btn.eventClick    += Btn_eventClick;
        }