internal static void AppendProperty(StringBuilder builder, NameValueObject value, bool isLastItem) { if (value.Value is List <NameValueObject> valueObject) { NameValueObject first = valueObject.FirstOrDefault(); if (first is null) { builder.AppendProperty(value, isLastItem); } else { bool isArray = first.Name == value.Name; if (!isArray) { AppendObject(builder, value.Name, valueObject, isLastItem); } else if (first.Value is List <NameValueObject> ) { AppendArray(builder, value.Name, valueObject, isLastItem); } else { AppendArrayOfValues(builder, value.Name, valueObject, isLastItem); } } } else { builder.AppendProperty(value, isLastItem); } }
public NameValueDialog(NameValueObject obj, string type, NameValueTemplateCollection temCol) { InitializeComponent(); temColl = temCol; NameValueCollection.SetNameValueObject(obj.nameValuePairs); loadTemplateListBox(temCol.List(type)); if (templatesListBox.Items.Count > 0) { templatesListBox.SelectedIndex = 0; addTemplateButton.Enabled = true; } else { addTemplateButton.Enabled = false; } loadNameListBox(); if (nameListBox.Items.Count == 0) { editNVPButton.Enabled = false; deleteNVPButton.Enabled = false; } else { nameListBox.SelectedIndex = 0; } }
public NameValueDialog(NameValueObject obj, string type, NameValueTemplateCollection temCol) { InitializeComponent(); temColl = temCol; NameValueCollection.SetNameValueObject(obj.nameValuePairs); loadTemplateListBox(temCol.List(type)); loadNameListBox(); }
public static string Serialize(NameValueObject value) { var builder = new StringBuilder(); AppendObject(builder, value.Name, value.Value as List <NameValueObject>, true); return(builder.ToString()); }
public SpawnGen(WorldEditor appin, IWorldContainer parentin, int respawnTimein, uint numberOfSpawnsin, string templateNamein) { this.app = appin; this.parent = parentin; this.respawnTime = respawnTimein; this.numSpawn = numberOfSpawnsin; this.templateName = templateNamein; this.nameValuePairs = new NameValueObject(); }
public RoadObject(String objectName, IWorldContainer parentContainer, WorldEditor worldEditor, int halfWidth) { name = objectName; parent = parentContainer; app = worldEditor; children = new List<IWorldObject>(); this.HalfWidth = halfWidth; this.nameValuePairs = new NameValueObject(); points = new PointCollection(this, app, false, true, app.Config.RoadPointMeshName, app.Config.RoadPointMaterial, MPPointType.Road); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); }
internal static void AppendProperty(this StringBuilder builder, NameValueObject value, bool isLastItem) { string name = value.Name ?? "prop"; builder.Append($"\"{name}\":"); if (value.Value is List <NameValueObject> ) { builder.Append("[]"); } else if (value.Value is NameValueObject) { builder.Append("{}"); } else { builder.Append(value.Value is null || value.Value is List <NameValueObject> ? "null" : $"\"{value.Value}\""); } builder.Append(InsertEnd("", isLastItem)); }
public bool TrySet(string name, object value) { NameValueObject obj = null; if (Dictionary.TryGet(name, out obj)) { obj.Value = value; } else { try { Dictionary.Add(new NameValueObject() { Name = name, Value = value }); } catch { return(false); } } return(true); }
public InteriorPath(WorldEditor worldEditor, IWorldContainer parentContainer, string meshName, InteriorPathContents path) { parent = parentContainer; app = worldEditor; points = new PointCollection(this, worldEditor, true, worldEditor.Config.DisplayRegionPoints, worldEditor.Config.RegionPointMeshName, worldEditor.Config.RegionPointMaterial); nameValuePairs = new NameValueObject(); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); Changed += new InSceneChangedEventHandler(app.SceneChangedHandler); foreach (Vector3 position in path.Points) { int index; points.AddPoint(position, out index); } }
public CategoryEntity(NameValueObject name) { Name = name; Products = new List <ProductEntity>(); }
public RoadObject(WorldEditor worldEditor, String objectName, IWorldContainer parentContainer, int halfWidth) { name = objectName; parent = parentContainer; app = worldEditor; children = new List<IWorldObject>(); this.HalfWidth = halfWidth; this.nameValuePairs = new NameValueObject(); points = null; }
protected void FromXml(XmlReader r) { // first parse the attributes bool adjustHeightFound = false; 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 "Sound": // this.soundAssetName = r.Value; // break; case "TerrainOffset": offsetFound = true; terrainOffset = float.Parse(r.Value); break; case "AllowHeightAdjustment": adjustHeightFound = true; if (String.Equals(r.Value.ToLower(), "false")) { allowAdjustHeightOffTerrain = false; } 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; } } // this.nameValuePairs = new NameValueObject(); r.Read(); do { if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "Position": this.position = XmlHelperClass.ParseVectorAttributes(r); break; case "Orientation": orientation = XmlHelperClass.ParseQuaternion(r); break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; case "ParticleEffect": ParticleEffect particle = new ParticleEffect(r, this, app); Add(particle); break; case "SpawnGen": SpawnGen mob = new SpawnGen(r, app, this); Add(mob); break; case "Sound": Sound sound = new Sound(r, this, app); Add(sound); break; case "Color": Color = XmlHelperClass.ParseColorAttributes(r); break; } } else if (r.NodeType == XmlNodeType.EndElement) { break; } } while (r.Read()); if (!adjustHeightFound) { allowAdjustHeightOffTerrain = true; } if (!offsetFound) { terrainOffset = this.Position.y - app.GetTerrainHeight(position.x, position.z); } if (orientation != null && disp != null) { disp.SetOrientation(orientation); foreach (IWorldObject obj in children) { if (obj is ParticleEffect) { (obj as ParticleEffect).Orientation = this.orientation; } } } }
public ActionResult LoadUsers() { var add = new NameValueObject { Id = 0, Name = "-- Empty User List --" }; try { var userData = MvcApplication.GetUserData(User.Identity.Name); if (userData == null || userData.UserId < 1) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var searchObj = new UserSearchObj { AdminUserId = userData.UserId, Status = -2, StopDate = "", StartDate = "", UserId = 0 }; var retVal = new PortalUserManager().LoadUsers(searchObj, userData.Username); if (retVal?.Status == null) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Status.IsSuccessful) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Users.Any()) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var sleIds = Session["_selUserIds_"] as List <int> ?? new List <int>(); var parentTabs = retVal.Users.FindAll(m => !sleIds.Contains(m.UserId)).OrderBy(g => g.Email); add = new NameValueObject { Id = 0, Name = "-- Select Item --" }; var jsonitem = parentTabs.Select(o => new NameValueObject { Id = o.UserId, Name = o.Email }).ToList(); jsonitem.Insert(0, add); return(Json(jsonitem, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } }
public void FromXml(XmlReader r) { // first parse the 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 "TemplateName": this.templateName = r.Value; break; case "RespawnTime": this.respawnTime = int.Parse(r.Value); break; case "NumSpawns": this.numSpawn = uint.Parse(r.Value); break; case "SpawnRadius": this.spawnRadius = float.Parse(r.Value); break; } } } r.MoveToElement(); //Moves the reader back to the element node. if (!r.IsEmptyElement) { while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; } } } } }
public InteriorPath(IWorldContainer parentContainer, WorldEditor worldEditor, string meshName) { // initialize data members parent = parentContainer; app = worldEditor; this.meshName = meshName; points = new PointCollection(this, worldEditor, true, worldEditor.Config.DisplayRegionPoints, worldEditor.Config.RegionPointMeshName, worldEditor.Config.RegionPointMaterial); nameValuePairs = new NameValueObject(); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); Changed += new InSceneChangedEventHandler(app.SceneChangedHandler); }
public Waypoint(string name, IWorldContainer parent, WorldEditor app, Vector3 location, Quaternion orientation) { this.azimuth = 0f; this.zenith = 0f; this.name = name; this.app = app; this.orientation = new Quaternion(orientation.w, orientation.x, orientation.y, orientation.z); this.position = location; this.parent = parent; this.nameValuePairs = new NameValueObject(); this.children = new List<IWorldObject>(); }
public StaticObject(IWorldContainer parentContainer, WorldEditor worldEditor, XmlReader r) { parent = parentContainer; app = worldEditor; children = new List<IWorldObject>(); FromXml(r); if (nameValuePairs == null) { nameValuePairs = new NameValueObject(); } }
public Boundary(XmlReader r, IWorldContainer parentContainer, WorldEditor worldEditor) { // initialize data members parent = parentContainer; app = worldEditor; children = new List<IWorldObject>(); FromXml(r); if (nameValuePairs == null) { nameValuePairs = new NameValueObject(); } Changed += new InSceneChangedEventHandler(app.SceneChangedHandler); }
public StaticObject(String objectName, IWorldContainer parentContainer, WorldEditor worldEditor, string meshName, Vector3 position, Vector3 scale, Vector3 rotation) { name = objectName; parent = parentContainer; app = worldEditor; children = new List<IWorldObject>(); this.SetDirection(rotation.y, 90f); this.scale = scale; this.location = position; this.meshName = meshName; this.nameValuePairs = new NameValueObject(); this.terrainOffset = 0f; displayObject = null; subMeshes = new SubMeshCollection(meshName); }
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; }
public ActionResult LoadClients() { var add = new NameValueObject { Id = 0, Name = "-- Empty Client List --" }; try { var userData = MvcApplication.GetUserData(User.Identity.Name); if (userData == null || userData.UserId < 1) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var searchObj = new ClientSearchObj { AdminUserId = userData.UserId, Status = -2, ClientId = 0 }; var retVal = ClientService.LoadClients(searchObj, userData.Username); if (retVal?.Status == null) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Status.IsSuccessful) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Clients.Any()) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var parentTabs = retVal.Clients.OrderBy(g => g.ClientName); add = new NameValueObject { Id = 0, Name = "-- Select Client --" }; var jsonitem = parentTabs.Select(o => new NameValueObject { Id = o.ClientId, Name = o.ClientName }).ToList(); jsonitem.Insert(0, add); return(Json(jsonitem, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } }
protected void FromXml(XmlReader r) { // first parse the 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 "mesh": this.meshName = r.Value; break; } } r.MoveToElement(); //Moves the reader back to the element node. while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "PointCollection": if (!r.IsEmptyElement) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, r); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; } } } if (points == null) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } }
public Boundary(IWorldContainer parentContainer, WorldEditor worldEditor, string namein, int priority) { // initialize data members parent = parentContainer; app = worldEditor; name = namein; this.priority = priority; nameValuePairs = new NameValueObject(); children = new List<IWorldObject>(); points = new PointCollection(this, worldEditor, true, worldEditor.Config.DisplayRegionPoints, worldEditor.Config.RegionPointMeshName, worldEditor.Config.RegionPointMaterial, MPPointType.Boundary); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); Changed += new InSceneChangedEventHandler(app.SceneChangedHandler); }
protected void FromXml(XmlReader r) { while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "PointCollection": while (r.Read()) { // look for the start of an element if (r.NodeType == XmlNodeType.Element) { string elementName = r.Name; switch (elementName) { case "Point": points.Add(XmlHelperClass.ParseVectorAttributes(r)); break; } } else if (r.NodeType == XmlNodeType.EndElement) { break; } } r.MoveToElement(); //Moves the reader back to the element node. break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; } } } }
public static string GetStringFromNodeType(Expression body, string tableName) { NameValueObject pair = null; if (ExpressionTools.GetNodeGroup(body) == NodeGroupTypes.Comparison) { pair = ExpressionTools.GetPairFromComparison((BinaryExpression)body, tableName); } else if (ExpressionTools.GetNodeGroup(body) == NodeGroupTypes.Method) { pair = GetPairFromMethod(body, tableName); } switch (body.NodeType) { case ExpressionType.Add: break; case ExpressionType.AddChecked: break; case ExpressionType.And: break; case ExpressionType.AndAlso: return(" AND "); case ExpressionType.ArrayLength: break; case ExpressionType.ArrayIndex: break; case ExpressionType.Call: return($"{tableName}.{pair.Name} {GetSqlTranslationFromMethodName((MethodCallExpression)body, pair.Value)}"); case ExpressionType.Coalesce: break; case ExpressionType.Conditional: break; case ExpressionType.Constant: break; case ExpressionType.Convert: break; case ExpressionType.ConvertChecked: break; case ExpressionType.Divide: break; case ExpressionType.Equal: return(string.Format("{0} {1}", pair.Name, pair.Value == null ? "is null" : $" = {pair.Value}")); case ExpressionType.ExclusiveOr: break; case ExpressionType.GreaterThan: return(string.Format("{0} > {1}", pair.Name, pair.Value ?? "null")); case ExpressionType.GreaterThanOrEqual: return(string.Format("{0} >= {1}", pair.Name, pair.Value ?? "null")); case ExpressionType.Invoke: break; case ExpressionType.Lambda: break; case ExpressionType.LeftShift: break; case ExpressionType.LessThan: return(string.Format("{0} < {1}", pair.Name, pair.Value ?? "null")); case ExpressionType.LessThanOrEqual: return(string.Format("{0} <= {1}", pair.Name, pair.Value ?? "null")); case ExpressionType.ListInit: break; case ExpressionType.MemberAccess: break; case ExpressionType.MemberInit: break; case ExpressionType.Modulo: break; case ExpressionType.Multiply: break; case ExpressionType.MultiplyChecked: break; case ExpressionType.Negate: break; case ExpressionType.UnaryPlus: break; case ExpressionType.NegateChecked: break; case ExpressionType.New: break; case ExpressionType.NewArrayInit: break; case ExpressionType.NewArrayBounds: break; case ExpressionType.Not: break; case ExpressionType.NotEqual: return(string.Format("{0} {1}", pair.Name, pair.Value == null ? "is not null" : $" != {pair.Value }")); case ExpressionType.Or: break; case ExpressionType.OrElse: return(" OR "); case ExpressionType.Parameter: break; case ExpressionType.Power: break; case ExpressionType.Quote: break; case ExpressionType.RightShift: break; case ExpressionType.Subtract: break; case ExpressionType.SubtractChecked: break; case ExpressionType.TypeAs: break; case ExpressionType.TypeIs: break; case ExpressionType.Assign: break; case ExpressionType.Block: break; case ExpressionType.DebugInfo: break; case ExpressionType.Decrement: break; case ExpressionType.Dynamic: break; case ExpressionType.Default: break; case ExpressionType.Extension: break; case ExpressionType.Goto: break; case ExpressionType.Increment: break; case ExpressionType.Index: break; case ExpressionType.Label: break; case ExpressionType.RuntimeVariables: break; case ExpressionType.Loop: break; case ExpressionType.Switch: break; case ExpressionType.Throw: break; case ExpressionType.Try: break; case ExpressionType.Unbox: break; case ExpressionType.AddAssign: break; case ExpressionType.AndAssign: break; case ExpressionType.DivideAssign: break; case ExpressionType.ExclusiveOrAssign: break; case ExpressionType.LeftShiftAssign: break; case ExpressionType.ModuloAssign: break; case ExpressionType.MultiplyAssign: break; case ExpressionType.OrAssign: break; case ExpressionType.PowerAssign: break; case ExpressionType.RightShiftAssign: break; case ExpressionType.SubtractAssign: break; case ExpressionType.AddAssignChecked: break; case ExpressionType.MultiplyAssignChecked: break; case ExpressionType.SubtractAssignChecked: break; case ExpressionType.PreIncrementAssign: break; case ExpressionType.PreDecrementAssign: break; case ExpressionType.PostIncrementAssign: break; case ExpressionType.PostDecrementAssign: break; case ExpressionType.TypeEqual: break; case ExpressionType.OnesComplement: break; case ExpressionType.IsTrue: break; case ExpressionType.IsFalse: break; default: break; } return(string.Empty); }
public Waypoint(XmlReader r, IWorldContainer parent, WorldEditor app) { this.parent = parent; this.app = app; this.children = new List<IWorldObject>(); FromXml(r); if (nameValuePairs == null) { nameValuePairs = new NameValueObject(); } }
public ActionResult LoadTabParents() { var add = new NameValueObject { Id = 0, Name = "-- Empty Tab Parent List --" }; try { var userData = MvcApplication.GetUserData(User.Identity.Name); if (userData == null || userData.UserId < 1) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var searchObj = new TabSearchObj { AdminUserId = userData.UserId, Status = -2, StopDate = "", StartDate = "", TabId = 0 }; var retVal = new PortalTabManager().LoadTabs(searchObj, userData.Username); if (retVal?.Status == null) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Status.IsSuccessful) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } if (!retVal.Tabs.Any()) { return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } var parentTabs = retVal.Tabs.FindAll(m => m.TabType < 2).OrderBy(g => g.Title); add = new NameValueObject { Id = 0, Name = "-- Select Item --" }; var jsonitem = parentTabs.Select(o => new NameValueObject { Id = o.TabId, Name = o.Title }).ToList(); jsonitem.Insert(0, add); return(Json(jsonitem, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <NameValueObject> { add }, JsonRequestBehavior.AllowGet)); } }
public Boundary(WorldEditor worldEditor, IWorldContainer parentContainer, string namein, int priority) { // initialize data members parent = parentContainer; app = worldEditor; name = namein; this.priority = priority; nameValuePairs = new NameValueObject(); children = new List<IWorldObject>(); points = null; Changed += new InSceneChangedEventHandler(app.SceneChangedHandler); }
private static Parameter GetNewParameter(BinaryExpression body) { NameValueObject pair = GetPairFromComparison(body, ""); return(new Parameter(pair.Name.ToString(), pair.Value)); }
protected void FromXml(XmlReader r) { // first parse the 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 "Priority": this.priority = int.Parse(r.Value); break; } } r.MoveToElement(); //Moves the reader back to the element node. while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "PointCollection": if (!r.IsEmptyElement) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial,MPPointType.Boundary, r); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; case "Forest": Forest forest = new Forest(r, this, app); Add(forest); break; case "Fog": Fog fog = new Fog(r, this, app); Add(fog); break; case "Water": Water water = new Water(r, this, app); Add(water); break; case "Sound": Sound sound = new Sound(r, (IWorldContainer)this, app); Add(sound); break; case "Grass": Grass grass = new Grass(r, this, app); Add(grass); break; case "SpawnGen": SpawnGen mob = new SpawnGen(r, app, this); Add(mob); break; case "AmbientLight": AmbientLight ambientLight = new AmbientLight(app, this, r); Add(ambientLight); break; case "DirectionalLight": DirectionalLight directionalLight = new DirectionalLight(app, this, r); Add(directionalLight); break; } } } if (points == null) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } }
public Waypoint(string name, IWorldContainer parent, WorldEditor app, Vector3 location, Vector3 rotation) { this.parent = parent; this.app = app; this.position = location; this.name = name; this.nameValuePairs = new NameValueObject(); this.children = new List<IWorldObject>(); this.orientation = new Quaternion(0, 0, 0, 0); // this.orientation = Quaternion.FromAngleAxis(defaultRot * MathUtil.RADIANS_PER_DEGREE, Vector3.UnitY); SetDirection(rotation.y,90); }