private void OpenWeatherWeapon()
        {
            WeatherSetting weatherSetting = new WeatherSetting
            {
                Region          = TextBoxRegion,
                MeasureTemp     = _measureTemp,
                MeasurePressure = _measurePressure,
                TimeParse       = TimeParse
            };

            if (!_weatherSettings.Contains <WeatherSetting>(weatherSetting))
            {
                _weatherSettings.Add(weatherSetting);

                var weatherWindow = new WeatherWindow()
                {
                    DataContext = new WeatherViewModel
                    {
                        WeatherSett     = weatherSetting,
                        WeatherSettings = _weatherSettings
                    }
                };
                weatherWindow.Show();
            }
        }
        public WeatherSetter(GameContext context, WeatherSetting setting)
        {
            _context        = context;
            _setting        = setting;
            _costRandomizer = new WeigthRandomizer <int>();
            InitRandom();

            _playerCount = _context.GetEntities(GameMatcher.Player)
                           .Count(e => !e.isBossPlayer);
        }
Beispiel #3
0
    WeatherSetting FindWeatherSetting(string type)
    {
        Debug.Log("Weather type: " + type);
        WeatherSetting wsetting = _weatherSettings.Where(x => x.Name.Equals(type)).FirstOrDefault();

        if (wsetting == null)
        {
            Debug.LogWarning("Unknown type of weather data: " + type);
            wsetting = _weatherSettings.First();
        }
        return(wsetting);
    }
Beispiel #4
0
        public static void SetSettings(WeatherSetting s)
        {
            if (s == null)
            {
                s = new WeatherSetting();
            }
            settings = s;

            Rain.IsOn      = settings.IsRainOn;
            Snow.IsOn      = settings.IsSnowOn;
            Lightning.IsOn = settings.IsLightningOn;

            Rain.SetSettings(settings.RainSettings);
            Snow.SetSettings(settings.SnowSettings);
            setLengths();
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (objectToEdit == null)
            {
                objectToEdit = new WeatherSetting();
            }

            WeatherSetting obj = objectToEdit as WeatherSetting;

            obj.BaseObjectId   = txtBaseObjectId.Text;
            obj.BaseObjectName = txtBaseObjectName.Text;

            ComboBoxItem cbItemRain = ddlRain.SelectedItem as ComboBoxItem;
            ComboBoxItem cbItemSnow = ddlSnow.SelectedItem as ComboBoxItem;
            ComboBoxItem cbItemSky  = ddlSky.SelectedItem as ComboBoxItem;

            obj.RainSettingId = cbItemRain.Name.ToString();
            obj.SnowSettingId = cbItemSnow.Name.ToString();
            obj.SkySettingId  = cbItemSky.Name.ToString();

            obj.IsRainOn      = (chkRainIsOn.IsChecked.HasValue && chkRainIsOn.IsChecked.Value) ? true : false;
            obj.IsSnowOn      = (chkSnowIsOn.IsChecked.HasValue && chkSnowIsOn.IsChecked.Value) ? true : false;
            obj.IsLightningOn = (chkLightningIsOn.IsChecked.HasValue && chkLightningIsOn.IsChecked.Value) ? true : false;

            obj.Category = objCategory;
            bool success = isEditingObj ? WorldData.UpdateObject(obj) : WorldData.AddObject(obj);

            if (!success)
            {
                MessageBox.Show(Application.Current.MainWindow, "ID already exists", "AddObject Failure", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel);
            }
            else
            {
                this.Close();
                if (parentWindow != null)
                {
                    parentWindow.Refresh();
                }
            }
        }
Beispiel #6
0
    IEnumerator WaitForWeatherData()
    {
        _weatherData = _weatherController.GetCurrentData();
        while (_weatherData == null)
        {
            yield return(new WaitForSeconds(1));

            _weatherData = _weatherController.GetCurrentData();
        }
        _currentWeatherSetting     = FindWeatherSetting(_weatherData);
        DayNightAffected.FolowTime = !_currentWeatherSetting.Name.Equals("thunderstorm");

        _mistImage.SetActive(_currentWeatherSetting.CloudFrequency < 0);
        _cloudMovement.SpawningClouds((_currentWeatherSetting.CloudFrequency > 0) ? true : false, _currentWeatherSetting.CloudFrequency, _currentWeatherSetting.AmountOfDrops, _currentWeatherSetting.Snow);
        if (_currentWeatherSetting.Name.Contains("thunder"))
        {
            _thunderFlash.StartFlashing();
        }
        else
        {
            _thunderFlash.StopFlashing();
        }
    }
Beispiel #7
0
 public WeatherStatusNameDisplaySystem(Contexts contexts, WeatherSetting setting, WeatherStatusPanel panel) : base(contexts)
 {
     _setting = setting;
     _panel   = panel;
 }
Beispiel #8
0
 public void Init()
 {
     _setting = TestHelper.GetGameSetting().WeatherSetting;
     _panel   = TestHelper.CreateWeatherPanel();
     _systems.Add(new WeatherStatusNameDisplaySystem(_contexts, _setting, _panel));
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (objectToEdit != null && objectToEdit is WeatherSetting)
            {
                WeatherSetting obj = objectToEdit as WeatherSetting;
                txtBaseObjectId.Text   = obj.BaseObjectId;
                txtBaseObjectName.Text = obj.BaseObjectName;

                chkRainIsOn.IsChecked      = obj.IsRainOn;
                chkSnowIsOn.IsChecked      = obj.IsSnowOn;
                chkLightningIsOn.IsChecked = obj.IsLightningOn;

                isEditingObj = true;
                txtBaseObjectId.IsEnabled = false;

                cancelRevert = (WeatherSetting)Utils.DeepClone(obj);
            }


            List <BaseGameObject> rainSettings = WorldData.GetObjectsByType(typeof(RainSetting));
            int x = 0;

            foreach (BaseGameObject s in rainSettings)
            {
                ComboBoxItem i = new ComboBoxItem();
                i.Name       = s.BaseObjectId;
                i.Content    = s.BaseObjectName;
                i.IsSelected = false;
                if (objectToEdit != null && objectToEdit is WeatherSetting)
                {
                    if (((WeatherSetting)objectToEdit).RainSettingId == s.BaseObjectId)
                    {
                        i.IsSelected = true;
                    }
                }
                ddlRain.Items.Add(i);
                x++;
            }

            List <BaseGameObject> snowSettings = WorldData.GetObjectsByType(typeof(SnowSetting));

            x = 0;
            foreach (BaseGameObject s in snowSettings)
            {
                ComboBoxItem i = new ComboBoxItem();
                i.Name       = s.BaseObjectId;
                i.Content    = s.BaseObjectName;
                i.IsSelected = false;
                if (objectToEdit != null && objectToEdit is WeatherSetting)
                {
                    if (((WeatherSetting)objectToEdit).SnowSettingId == s.BaseObjectId)
                    {
                        i.IsSelected = true;
                    }
                }
                ddlSnow.Items.Add(i);
                x++;
            }

            List <BaseGameObject> skySettings = WorldData.GetObjectsByType(typeof(SkySetting));

            x = 0;
            foreach (BaseGameObject s in skySettings)
            {
                ComboBoxItem i = new ComboBoxItem();
                i.Name       = s.BaseObjectId;
                i.Content    = s.BaseObjectName;
                i.IsSelected = false;
                if (objectToEdit != null && objectToEdit is WeatherSetting)
                {
                    if (((WeatherSetting)objectToEdit).SkySettingId == s.BaseObjectId)
                    {
                        i.IsSelected = true;
                    }
                }
                ddlSky.Items.Add(i);
                x++;
            }
        }
Beispiel #10
0
 public WeatherViewModel()
 {
     _weather    = new Weather();
     WeatherSett = new WeatherSetting();
 }
 public RoundStartWeatherCreateSystem(Contexts contexts, WeatherSetting setting) : base(contexts)
 {
     _setting = setting;
 }
Beispiel #12
0
 public void Init()
 {
     _setting = TestHelper.GetGameSetting().WeatherSetting;
 }
Beispiel #13
0
 public void Init()
 {
     _setting = TestHelper.GetGameSetting().WeatherSetting;
     _systems.Add(new RoundStartWeatherCreateSystem(_contexts, _setting));
     _systems.Initialize();
 }
Beispiel #14
0
 public InitializeWeatherEffectSystem(Contexts contexts, WeatherSetting setting, Transform camera)
 {
     this._gameContexts = contexts.game;
     this._setting      = setting;
     this._camera       = camera;
 }