Esempio n. 1
0
 public static void SetSettings(RainSetting s)
 {
     if (s == null)
     {
         s = new RainSetting();
     }
     settings = s;
 }
Esempio n. 2
0
 private void initValues(RainSetting mObj)
 {
     rainSpeed.Value            = mObj.RainSpeed;
     dirLightIntensity.Value    = mObj.DirLightIntensity;
     responseDirLight.Value     = mObj.ResponseDirLight;
     rainSplashSpeed.Value      = mObj.RainSplashSpeed;
     rainSplashSize.Value       = mObj.RainSplashSize;
     percentDrawParticles.Value = mObj.PercentDrawParticles;
 }
Esempio n. 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (objectToEdit != null && objectToEdit is RainSetting)
            {
                RainSetting obj = objectToEdit as RainSetting;
                txtBaseObjectId.Text      = obj.BaseObjectId;
                txtBaseObjectName.Text    = obj.BaseObjectName;
                isEditingObj              = true;
                txtBaseObjectId.IsEnabled = false;

                initValues(obj);
                cancelRevert = (RainSetting)Utils.DeepClone(obj);
            }
            else
            {
                RainSetting rs = new RainSetting();
                initValues(rs);
            }
        }
Esempio n. 4
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (objectToEdit == null)
            {
                objectToEdit = new RainSetting();
            }

            RainSetting obj = objectToEdit as RainSetting;

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

            //custom code
            obj.RainSpeed            = (float)rainSpeed.Value;
            obj.DirLightIntensity    = (float)dirLightIntensity.Value;
            obj.ResponseDirLight     = (float)responseDirLight.Value;
            obj.RainSplashSpeed      = (float)rainSplashSpeed.Value;
            obj.RainSplashSize       = (float)rainSplashSize.Value;
            obj.PercentDrawParticles = (float)percentDrawParticles.Value;
            //custom code end

            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();
                }
            }
        }