예제 #1
0
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isFloat(addTreeScaleTextBox.Text))
     {
         MessageBox.Show("Scale can not be parsed to a floating point number", "Incorrect scale", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(addTreeScaleVarianceTextBox.Text))
         {
             MessageBox.Show("Scale variance can not be parsed to a floating point number", "Incorrect scale variance", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isUint(addTreeInstancesTextBox.Text))
             {
                 MessageBox.Show("Instances can not be parsed to a unsigned integer number", "Incorrect instances", MessageBoxButtons.OK);
                 return(false);
             }
         }
     }
     return(true);
 }
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.assetExists(filenameTextBox.Text))
     {
         MessageBox.Show("The filename selected does not exist in the asset repository", "Invalid Filename", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(sizeXTextBox.Text))
         {
             MessageBox.Show("The SizeX entered can not be parsed to a floating point number", "Invalid size", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isFloat(sizeZTextBox.Text))
             {
                 MessageBox.Show("The SizeZ entered can not be parsed to a floating point number", "Invalid size", MessageBoxButtons.OK);
                 return(false);
             }
             else
             {
                 if (!ValidityHelperClass.isInt(priorityTextBox.Text))
                 {
                     MessageBox.Show("The priority entered can not be parsed to an integer number", "Invalid Priority", MessageBoxButtons.OK);
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isInt(respawnTimeTextbox.Text))
     {
         MessageBox.Show("Respawn time can not be parsed to a integer number", "Incorrect respawn time", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isUint(numberOfSpawnsTextbox.Text))
         {
             MessageBox.Show("Number of spanws can not be parsed to a unsigned integer number", "Incorrect number of spawns", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if ((!ValidityHelperClass.isInt(spawnRadiusTextbox.Text)) && (showRadius))
             {
                 MessageBox.Show("Spawn radius can not be parsed to a integer number", "Incorrect spawn radius", MessageBoxButtons.OK);
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #4
0
 private bool maxFPSValidate()
 {
     if (maxFramesPerSecondCheckBox.Checked)
     {
         if (ValidityHelperClass.isUint(maxFPSTextbox.Text) && uint.Parse(maxFPSTextbox.Text) > 0)
         {
             return(true);
         }
         maxFPSTextbox.ForeColor = Color.Red;
         return(false);
     }
     return(true);
 }
예제 #5
0
 private void uintValidateEvent(object sender, CancelEventArgs e)
 {
     if (!ValidityHelperClass.isUint(((TextBox)sender).Text))
     {
         Color textColor = Color.Red;
         ((TextBox)sender).ForeColor = textColor;
     }
     else
     {
         Color textColor = Color.Black;
         ((TextBox)sender).ForeColor = textColor;
     }
 }
        private void intVerifyevent(object sender, CancelEventArgs e)
        {
            TextBox textbox = (TextBox)sender;

            if (!ValidityHelperClass.isUint(textbox.Text))
            {
                Color textColor = Color.Red;
                textbox.ForeColor = textColor;
            }
            else
            {
                Color textColor = Color.Black;
            }
        }
예제 #7
0
 public bool okButton_validating()
 {
     if (String.Equals(ForestDialogSpeedWindFilenameComboBox.Text, ""))
     {
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isInt(ForestSeedTextBox.Text))
         {
             MessageBox.Show("Random number seed can not be parsed to a integer number", "Incorrect random number seed", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isFloat(forestAddDialogWindSpeedTextBox.Text))
             {
                 MessageBox.Show("Wind speed can not be parsed to a floating point number", "Incorrect wind speed", MessageBoxButtons.OK);
                 return(false);
             }
             else
             {
                 if (!ValidityHelperClass.isFloat(forestAddDialogWindDirectionXTextBox.Text))
                 {
                     MessageBox.Show("Wind direction X can not be parsed to a floating point number", "Incorrect wind direction X", MessageBoxButtons.OK);
                     return(false);
                 }
                 else
                 {
                     if (!ValidityHelperClass.isFloat(forestAddDialogWindDirectionYTextBox.Text))
                     {
                         MessageBox.Show("Wind direction Y can not be parsed to a floating point number", "Incorrect wind direction Y", MessageBoxButtons.OK);
                         return(false);
                     }
                     else
                     {
                         if (!ValidityHelperClass.isFloat(forestAddDialogWindDirectionZTextBox.Text))
                         {
                             MessageBox.Show("Wind direction Z can not be parsed to a floating point number", "Incorrect wind direction Z", MessageBoxButtons.OK);
                             return(false);
                         }
                     }
                 }
             }
         }
     }
     return(true);
 }
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isFloat(positionScaleTextBox.Text))
     {
         MessageBox.Show("Position scale can not be parsed to a floating point number", "Incorrect position scale", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(velocityScaleTextBox.Text))
         {
             MessageBox.Show("Velocity scale can not be parsed to a floating point number", "Incorrect position scale", MessageBoxButtons.OK);
             return(false);
         }
     }
     return(true);
 }
예제 #9
0
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isFloat(FogNearTextBox.Text))
     {
         MessageBox.Show("Start fog distance can not be parsed to a floating point number", "Incorrect start fog distance", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(FogFarTextBox.Text))
         {
             MessageBox.Show("Maximum fog distance can not be parsed to a floating point number", "Maximum fog distance", MessageBoxButtons.OK);
             return(false);
         }
     }
     return(true);
 }
예제 #10
0
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isUint(autoSaveTimeTextBox.Text) || uint.Parse(autoSaveTimeTextBox.Text) == 0)
     {
         return(false);
     }
     else
     {
         if (!maxFPSValidate())
         {
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isFloat(cameraNearDistanceTextBox.Text))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
        public bool okButton_validating()
        {
            string text = ValueTextbox.Text;

            switch (valueType)
            {
            case "Float":
                return(ValidityHelperClass.isFloat(text));

                break;

            case "uInt":
                return(ValidityHelperClass.isUint(text));

                break;

            case "int":
                return(ValidityHelperClass.isInt(text));

                break;
            }
            return(true);
        }
 public bool okButton_validating()
 {
     if (string.Equals(objectComboBox.Text, ""))
     {
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(minScaleTextBox.Text))
         {
             MessageBox.Show("Minimum scale can not be parsed to a floating point number", "Incorrect minimum scale", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isFloat(maxScaleTextBox.Text))
             {
                 MessageBox.Show("Maximum scale can not be parsed to a floating point number", "Incorrect maximum scale", MessageBoxButtons.OK);
                 return(false);
             }
         }
         return(true);
     }
 }
예제 #13
0
 public bool okButton_validating()
 {
     if (!ValidityHelperClass.isFloat(minimumWidthScaleTextBox.Text))
     {
         MessageBox.Show("Minimum width scale can not be parsed to a floating point number", "Incorrect minimum width scale", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         if (!ValidityHelperClass.isFloat(maximumWidthScaleTextBox.Text))
         {
             MessageBox.Show("Maximum width scale can not be parsed to a floating point number", "Maximum width scale", MessageBoxButtons.OK);
             return(false);
         }
         else
         {
             if (!ValidityHelperClass.isFloat(minimumHeightScaleTextBox.Text))
             {
                 MessageBox.Show("Minimum height scale can not be parsed to a floating point number", "Incorrect minimum height scale", MessageBoxButtons.OK);
                 return(false);
             }
             else
             {
                 if (!ValidityHelperClass.isFloat(maximumHeightScaleTextBox.Text))
                 {
                     MessageBox.Show("Maximum height scale can not be parsed to a floating point number", "Incorrect maximum height scale", MessageBoxButtons.OK);
                     return(false);
                 }
                 else
                 {
                     if (!ValidityHelperClass.isFloat(colorMultLowTextBox.Text))
                     {
                         MessageBox.Show("Color muliplier low can not be parsed to a floating point number", "Incorrect color multiplier low", MessageBoxButtons.OK);
                         return(false);
                     }
                     else
                     {
                         if (!ValidityHelperClass.isFloat(colorMultHiTextBox.Text))
                         {
                             MessageBox.Show("Color multiplier high can not be parsed to a floating point number", "Incorrect color multiplier high", MessageBoxButtons.OK);
                             return(false);
                         }
                         else
                         {
                             if (!ValidityHelperClass.isUint(instancesTextBox.Text))
                             {
                                 MessageBox.Show("Instances can not be parsed to a unsigned integer number", "Incorrect instances", MessageBoxButtons.OK);
                                 return(false);
                             }
                             else
                             {
                                 if (!ValidityHelperClass.isFloat(windMagnitudeTextBox.Text))
                                 {
                                     MessageBox.Show("Wind magnitude can not be parsed to a floating point number", "Incorrect wind magnitude", MessageBoxButtons.OK);
                                     return(false);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(true);
 }
예제 #14
0
        protected void FromXml(XmlReader r)
        {
            bool adjustHeightFound = false;
            bool offsetFound       = false;
            bool pRFound           = false;

            // first parse name and mesh, which are attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                case "Name":
                    this.name = r.Value;
                    break;

                case "Mesh":
                    this.meshName = r.Value;
                    break;

                case "Sound":
                    string filename = r.Value;
                    if (!String.Equals(filename, ""))
                    {
                        ICommandFactory ret = new AddSoundCommandFactory(app, this, r.Value);
                        ICommand        com = ret.CreateCommand();
                        com.Execute();
                    }
                    break;

                case "TerrainOffset":
                    terrainOffset = float.Parse(r.Value);
                    offsetFound   = true;
                    break;

                case "AllowHeightAdjustment":
                    if (String.Equals(r.Value.ToLower(), "false"))
                    {
                        allowAdjustHeightOffTerrain = false;
                    }
                    break;

                case "AcceptObjectPlacement":
                    acceptObjectPlacement = bool.Parse(r.Value);
                    break;

                case "PerceptionRadius":
                    pRFound          = true;
                    perceptionRadius = float.Parse(r.Value);
                    break;

                case "CastShadows":
                    castShadows = bool.Parse(r.Value);
                    break;

                case "ReceiveShadows":
                    receiveShadows = bool.Parse(r.Value);
                    break;

                case "Azimuth":
                    azimuth = float.Parse(r.Value);
                    break;

                case "Zenith":
                    zenith = float.Parse(r.Value);
                    break;

                case "WorldViewSelect":
                    worldViewSelectable = bool.Parse(r.Value);
                    break;

                case "Targetable":
                    targetable = bool.Parse(r.Value);
                    break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            // now parse the sub-elements
            while (r.Read())
            {
                // look for the start of an element
                if (r.NodeType == XmlNodeType.Element)
                {
                    // parse that element
                    // save the name of the element
                    string elementName = r.Name;
                    switch (elementName)
                    {
                    case "Position":
                        location = XmlHelperClass.ParseVectorAttributes(r);
                        break;

                    case "Scale":
                        scale = XmlHelperClass.ParseVectorAttributes(r);
                        break;

                    case "Rotation":
                        Vector3 rotation = XmlHelperClass.ParseVectorAttributes(r);
                        // force rotation to be between -180 and 180
                        while (rotation.y < -180)
                        {
                            rotation.y += 360;
                        }
                        while (rotation.y > 180)
                        {
                            rotation.y -= 360;
                        }
                        SetDirection(rotation.y, 90f);
                        break;

                    case "Orientation":
                        orientation = XmlHelperClass.ParseQuaternion(r);
                        break;

                    case "SubMeshes":
                        subMeshes = new SubMeshCollection(r);
                        if (!subMeshes.CheckValid(app, meshName))
                        {
                            app.AddPopupMessage(string.Format("Some submesh names in {0} changed.  Submesh display and material parameters for this object were reset.", meshName));

                            // if the check fails, then reset the subMeshes from the mesh
                            subMeshes = new SubMeshCollection(meshName);
                        }
                        break;

                    case "NameValuePairs":
                        nameValuePairs = new NameValueObject(r);
                        break;

                    case "ParticleEffect":
                        ParticleEffect particle = new ParticleEffect(r, this, app);
                        Add(particle);
                        break;

                    case "PathData":
                        pathData      = new PathData(r);
                        locationDirty = pathData.Version != pathData.CodeVersion;
                        break;

                    case "Sound":
                        Sound sound = new Sound(r, this, app);
                        Add(sound);
                        break;
                    }
                }
                else if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
            }
            if (!adjustHeightFound)
            {
                allowAdjustHeightOffTerrain = true;
            }
            if (!offsetFound)
            {
                terrainOffset = location.y - app.GetTerrainHeight(location.x, location.z);
            }
            if (!pRFound && nameValuePairs != null)
            {
                valueItem value = nameValuePairs.LookUp("perceptionRadius");
                if (value != null && ValidityHelperClass.isFloat(value.value))
                {
                    perceptionRadius = float.Parse(value.value);
                }
            }
            return;
        }