public virtual DisplayInfo GetDisplayInfo(Type modelType, PropertyInfo propertyInfo) { modelType.CheckArgument(nameof(modelType)); propertyInfo.CheckArgument(nameof(propertyInfo)); var handled = false; var result = default(DisplayInfo); var modelName = modelType.Name; var originName = propertyInfo.Name; BeforeGetDisplayInfo(modelName, originName, ref result, ref handled); if (handled == false) { result = ParentComponent?.GetDisplayInfo(modelType, propertyInfo); if (result == default) { if (DisplayInfos.TryGetValue($"{modelName}{originName}", out result) == false) { DisplayInfos.TryGetValue($"{originName}", out result); } } } AfterGetDisplayInfo(modelName, originName, result); return(result); }
public virtual void CreatedEditModelMember(EditModelMember modelMember) { modelMember.CheckArgument(nameof(modelMember)); ParentComponent?.CreatedEditModelMember(modelMember); CreatedEditModelMemberHandler?.Invoke(this, modelMember); }
internal void Set(object value) { var oldValue = CurrentValue; CurrentValue = value; ParentComponent.raiseChangeEvent(Definition.Name, oldValue, CurrentValue); }
public PositionLayout Create(Control control) { UniScalar x, y; if (_horizontalAlignment == HorizontalAlignment.Left) { x = _padding.Left; } else if (_horizontalAlignment == HorizontalAlignment.Right) { x = new UniScalar(1.0f) - _width - _padding.Right; } else { x = new UniScalar(0.5f) - ((_width - _padding.Left - _padding.Right) / 2 + _padding.Left); } if (_verticalAlignment == VerticalAlignment.Top) { y = _padding.Top; } else if (_verticalAlignment == VerticalAlignment.Bottom) { y = new UniScalar(1.0f) - _height - _padding.Bottom; } else { y = new UniScalar(0.5f) - ((_height - _padding.Top - _padding.Bottom) / 2 + _padding.Top); } control.Coordinates = new UniRectangle(x, y, _width, _height); ParentComponent.Register(control); return(this); }
public virtual bool IsScaffoldItem(PropertyInfo propertyInfo) { propertyInfo.CheckArgument(nameof(propertyInfo)); var result = ParentComponent == null || ParentComponent.IsScaffoldItem(propertyInfo); if (result && DisplayInfos.TryGetValue(propertyInfo.Name, out DisplayInfo dp)) { result = dp.ScaffoldItem; } return(result); }
public void Set(object value) { if (value != null && CurrentValue != null && !value.Equals(CurrentValue)) { deRegisterEventHandler(); } var oldValue = CurrentValue; CurrentValue = value; registerChangedEventHandlers(); ParentComponent.raiseChangeEvent(Prototype.Name, oldValue, CurrentValue); }
public Vector3 GetTotalScale() { Vector3 totalScale = componentScale; Vector3 parentScale = new Vector3(1); if (ParentComponent != null) { parentScale *= ParentComponent.GetTotalScale(); } totalScale *= parentScale; return(totalScale); }
public virtual void ShowModelDisplayProperty(ModelDisplayProperty modelDisplayProperty) { modelDisplayProperty.CheckArgument(nameof(modelDisplayProperty)); var handled = false; BeforeShowModelDisplayProperty(modelDisplayProperty, ref handled); if (handled == false) { ParentComponent?.ShowModelDisplayProperty(modelDisplayProperty); ShowModelDisplayPropertyHandler?.Invoke(this, modelDisplayProperty); } AfterShowModelDisplayProperty(modelDisplayProperty); }
public virtual void EvaluateDisplayInfo(DisplayInfo displayInfo) { displayInfo.CheckArgument(nameof(displayInfo)); var handled = false; BeforeEvaluateDisplayInfo(displayInfo, ref handled); if (handled == false) { ParentComponent?.EvaluateDisplayInfo(displayInfo); EvaluateDisplayPropertyHandler?.Invoke(this, displayInfo); } AfterEvaluteDisplayInfo(displayInfo); }
public void PBS_NoGrandParent() { var mockTree = new FakeTreeView(); var pbs = new ProjectBrowserService(sc, tabPage.Object, mockTree); var p = new ParentComponent(); var c = new TestComponent(); pbs.AddComponents(new[] { p }); pbs.AddComponents(p, new[] { c }); var o = pbs.GetAncestorOfType <GrandParentComponent>(c); Assert.IsNull(o); }
void onEntityRemoved(Group group, Entity entity, int index, IComponent component) { removeGameObject((GameObjectComponent)component); if (entity.hasParent) { ParentComponent parentComponent = entity.parent; for (int i = 0; i < parentComponent.children.Count; i++) { Entity child = parentComponent.children[i]; if (child != null && child.hasGameObject) { removeGameObject(child.gameObject); } } } }
public void PBS_FindGrandParent() { var mockTree = new FakeTreeView(); var pbs = new ProjectBrowserService(sc, mockTree); var gp = new GrandParentComponent(); var p = new ParentComponent(); var c = new TestComponent(); pbs.AddComponents(new[] { gp }); pbs.AddComponents(gp, new[] { p }); pbs.AddComponents(p, new[] { c }); var o = pbs.GetAncestorOfType <GrandParentComponent>(c); Assert.AreSame(gp, o); }
public void Execute() { foreach (Entity e in _group.GetEntities()) { if (e.hasParent) { ParentComponent parentComponent = e.parent; for (int i = 0; i < parentComponent.children.Count; i++) { Entity child = parentComponent.children[i]; if (child != null && child.hasChild) { _pool.DestroyEntity(child); } } } _pool.DestroyEntity(e); } }
public virtual void CreateEditModelMember(ModelObject model, PropertyInfo propertyInfo, ref EditModelMember modelMember, ref bool handled) { ParentComponent?.CreateEditModelMember(model, propertyInfo, ref modelMember, ref handled); if (handled == false) { var memberInfo = new EditModelMemberInfo() { Model = model, Property = propertyInfo, Created = false, }; CreateEditModelMemberHandler?.Invoke(this, memberInfo); handled = memberInfo.Created; if (handled) { modelMember = memberInfo.ModelMember; } } }
public virtual Matrix4 GetWorldMatrix() { Matrix4 parentWorldMatrix = Matrix4.Identity; if (ParentComponent != null) { parentWorldMatrix *= ParentComponent.GetWorldMatrix(); } var WorldMatrix = Matrix4.Identity; WorldMatrix *= Matrix4.CreateScale(ComponentScale); WorldMatrix *= Matrix4.CreateRotationX(MathHelper.DegreesToRadians(ComponentRotation.X)); WorldMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(ComponentRotation.Y)); WorldMatrix *= Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(ComponentRotation.Z)); WorldMatrix *= Matrix4.CreateTranslation(ComponentTranslation); WorldMatrix *= parentWorldMatrix; return(WorldMatrix); }
public virtual IEnumerable <DisplayInfo> GetAllDisplayInfos() { var handled = false; var result = new List <DisplayInfo>(); BeforeGetAllDisplayInfos(result, ref handled); if (handled == false) { foreach (var item in DisplayInfos) { result.Add(item.Value); } if (ParentComponent != null) { result.AddRange(ParentComponent.GetAllDisplayInfos()); } } AfterGetAllDisplayInfos(result); return(result); }
public virtual DisplayInfo GetDisplayInfo(PropertyInfo propertyInfo) { propertyInfo.CheckArgument(nameof(propertyInfo)); var handled = false; var result = default(DisplayInfo); var originName = propertyInfo.Name; BeforeGetDisplayInfo(originName, ref result, ref handled); if (handled == false) { result = ParentComponent?.GetDisplayInfo(propertyInfo); if (result == default) { DisplayInfos.TryGetValue(originName, out result); } } AfterGetDisplayInfo(originName, result); return(result); }
private void Update() { if (!IsRunning || TimeRemaining <= 0f) { return; } TimeRemaining -= Time.deltaTime; IsWarning = TimeRemaining <= WarnTime && TimeRemaining > 0; if (TimeRemaining <= 0f) { if (ParentComponent.OnTimerExpired != null) { ParentComponent.OnTimerExpired(); } StopTimer(); } UpdateSevenSegText(); }
private void InitForOutput(string outputName, string externalColumnName) { Output = ParentComponent.GetOutputFromName(outputName); bool externalColumnExists = false; for (int m = 0; m < Output.ExternalMetadataColumnCollection.Count; m++) { if (Output.ExternalMetadataColumnCollection[m].Name == externalColumnName) { externalColumnExists = true; ExternalMetadataColumn = Output.ExternalMetadataColumnCollection[m]; } } if (!(externalColumnExists)) { ExternalMetadataColumn = Output.ExternalMetadataColumnCollection.New(); ExternalMetadataColumn.Name = externalColumnName; } }
public override Matrix4 GetWorldMatrix() { Matrix4 parentWorldMatrix = Matrix4.Identity; if (ParentComponent != null) { parentWorldMatrix *= ParentComponent.GetWorldMatrix(); } Matrix4 modelMatrix = Matrix4.Identity; // Rotation modelMatrix *= Matrix4.CreateRotationX(MathHelper.DegreesToRadians(ComponentRotation.X)); modelMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(ComponentRotation.Y)); modelMatrix *= Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(ComponentRotation.Z)); // Scale modelMatrix *= Matrix4.CreateScale(ComponentScale); // Translation modelMatrix *= Matrix4.CreateTranslation(ComponentTranslation); modelMatrix *= parentWorldMatrix; return(modelMatrix); }
/// <summary> /// Updates a child position relative to its parent /// </summary> /// <param name="gameTime"></param> public void Update(GameTime gameTime) { List <Entity> entities = ComponentManager.Instance.GetAllEntitiesWithComponentType <ParentComponent>(); if (entities == null) { return; } foreach (Entity e in entities) { if (e.Updateable) { ParentComponent parent = ComponentManager.Instance.GetEntityComponent <ParentComponent>(e); Position2DComponent parentPos = ComponentManager.Instance.GetEntityComponent <Position2DComponent>(parent.Parent); Position2DComponent myPos = ComponentManager.Instance.GetEntityComponent <Position2DComponent>(e); if (parentPos != null && myPos != null) { myPos.Position = new Vector2(parent.OffsetX, parent.OffsetY) + parentPos.Position; } } } }
public void SetCustomProperty(string propertyName, object propertyValue) { ParentComponent.SetCustomPropertyToOutput(Output, propertyName, propertyValue); }
public override Vector3 GetTangetY() { Vector3 scale = ParentComponent.GetTotalScale(); return((base.GetTangetY() * scale).Normalized()); }
private void Update() { if (IsStoppedPermanently) { return; } if (State != _newState) { if (_waitAndReset != null) { StopCoroutine(_waitAndReset); _waitAndReset = null; } switch (_newState) { case NeedyState.InitialSetup: _newState = NeedyState.AwaitingActivation; goto default; case NeedyState.AwaitingActivation: break; case NeedyState.Running: if (ParentComponent.OnNeedyActivation != null) { ParentComponent.OnNeedyActivation(); } break; case NeedyState.Cooldown: _waitAndReset = StartCoroutine(WaitAndReset()); goto default; case NeedyState.Terminated: case NeedyState.BombComplete: default: if (ParentComponent.OnNeedyDeactivation != null) { ParentComponent.OnNeedyDeactivation(); } break; } State = _newState; UpdateSevenSegText(); Debug.LogFormat("!IsRunning = {0}, TimeRemaining <= 0f = {1}", !IsRunning, TimeRemaining <= 0f); } if (!IsRunning || TimeRemaining <= 0f) { return; } TimeRemaining -= Time.deltaTime; IsWarning = TimeRemaining <= WarnTime && TimeRemaining > 0; if (TimeRemaining <= 0f) { if (ParentComponent.OnTimerExpired != null) { ParentComponent.OnTimerExpired(); } StopTimer(); } UpdateSevenSegText(); }
public override Vector3 GetExtent() { return(ParentComponent.GetTotalScale()); }
void OnPropertyChanged(object sender, PropertyChangedEventArgs args) { ParentComponent.raiseChangeEventFromInternalChange(Prototype.Name, CurrentValue); }
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) { ParentComponent.raiseChangeEventFromInternalChange(Prototype.Name, CurrentValue); }