Exemplo n.º 1
0
 public static void SetSettings(SnowSetting s)
 {
     if (s == null)
     {
         s = new SnowSetting();
     }
     settings = s;
 }
Exemplo n.º 2
0
 private void initValues(SnowSetting mObj)
 {
     snowValue.Value                = mObj.SnowValue;
     snowWallValue.Value            = mObj.WallSnowValue;
     snowSpeed.Value                = mObj.SnowSpeed;
     percentDrawParticlesSnow.Value = mObj.PercentDrawParticles;
     turbulenceValue.Value          = mObj.Turbulence;
     spriteSizeSnow.Value           = mObj.SpriteSize;
 }
Exemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (objectToEdit != null && objectToEdit is SnowSetting)
            {
                SnowSetting obj = objectToEdit as SnowSetting;
                txtBaseObjectId.Text      = obj.BaseObjectId;
                txtBaseObjectName.Text    = obj.BaseObjectName;
                isEditingObj              = true;
                txtBaseObjectId.IsEnabled = false;

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

            SnowSetting obj = objectToEdit as SnowSetting;

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

            //custom code
            obj.SnowValue            = (float)snowValue.Value;
            obj.WallSnowValue        = (float)snowWallValue.Value;
            obj.SnowSpeed            = (float)snowSpeed.Value;
            obj.PercentDrawParticles = (float)percentDrawParticlesSnow.Value;
            obj.Turbulence           = (float)turbulenceValue.Value;
            obj.SpriteSize           = (float)spriteSizeSnow.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();
                }
            }
        }