public TComponent Add <TComponent>() where TComponent : class, IStateComponent, new() { var comp = new TComponent(); _components.Add(typeof(TComponent), comp); return(comp); }
public TComponent instantiate <TComponent>() where TComponent : MonoBehaviour { GameObject game_object = get_from_pool(); TComponent component = game_object.GetComponent <TComponent>(); return(component); }
/// <summary> /// Creates a prefab with the specified component /// </summary> /// <typeparam name="TComponent">The component</typeparam> /// <returns>A prefab with the specified component</returns> public static Prefab Create <TComponent>() where TComponent : IComponent, new() { Prefab pfb = Create(); TComponent tc = pfb.original.AddComponent <TComponent>(); return(pfb); }
public void Execute([ReadOnly] DynamicBuffer <TSnapshot> snapshots, ref TComponent component, ref Predicted <TSnapshot> predictedData, ref GhostPredictedComponent globalPredicted) { snapshots.GetDataAtTick(targetTick, out var snapshotData); var lastPredictedTickInst = lastPredictTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedData = new Predicted <TSnapshot> { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; globalPredicted.AppliedTick = predictedData.AppliedTick; globalPredicted.PredictionStartTick = predictedData.PredictionStartTick; if (lastPredictedTickInst != snapshotData.Tick) { return; } snapshotData.SynchronizeTo(ref component, jobData); }
public TComponent Page <TComponent>() where TComponent : BasePage, new() { var page = new TComponent(); page.Init(this); return(page); }
/// <summary> /// Add component by type /// </summary> /// <typeparam name="TComponent">Component type</typeparam> /// <returns></returns> public TComponent Add <TComponent>() where TComponent : IComponent, new() { TComponent component = new TComponent(); Components.Add(component.GetType(), component); OnComponentAdded?.Invoke(this, component); return(component); }
public void RemoveComponent <TComponent>() where TComponent : class, T { TComponent component = this.GetComponent <TComponent>(); if ((object)component == null) { return; } this.RemoveComponent((T)component); }
public SelectionData(TData _data, TComponent _item, bool _isSelected = false) { data = _data; item = _item; this._isSelected = !_isSelected; isSelected = _isSelected; _item.SetData(_data); }
public TComponent AddComponent <TComponent>() where TComponent : IComponent { if (Entity.HasComponent <TComponent>()) { return(Entity.GetComponent <TComponent>()); } TComponent component = (TComponent)_resolver.Container.Resolve(typeof(TComponent)); Entity.AddComponent <TComponent>(component); return(component); }
/// <summary> /// Add an entity that has the specified component in it /// </summary> /// <typeparam name="TComponent">The component</typeparam> /// <returns></returns> public TComponent Add <TComponent>() where TComponent : IComponent, new() { Entity entity = new Entity(); entity.Name = typeof(TComponent).Name; TComponent com = entity.AddComponent <TComponent>(); entity.SetParent(this); return(com); }
public IComponent GetComponent <TComponent>() where TComponent : IComponent { TComponent match = Components.OfType <TComponent>().FirstOrDefault(); if (match != null) { return((TComponent)match); } throw new Exception(); //component does not exist }
/// <summary> /// Ajoute un composant à l'entité. Si l'entité dispose déjà du composant, retourne null </summary> /// <param name="componentToAdd"></param> /// <returns></returns> public TComponent AddComponent(TComponent componentToAdd) { foreach (TComponent component in m_components) { if (component.Type == componentToAdd.Type) { return(null); } } m_components.Add(componentToAdd); componentToAdd.Attach(this); return(componentToAdd); }
public TComponent AddComponent <TComponent>() where TComponent : Component, new() { var type = typeof(TComponent); if (_components.ContainsKey(type)) { throw new InvalidOperationException("Component already exists."); } var component = new TComponent(); component._gameObject = this; _components.Add(type, component); return(component); }
public IEnumerable <TComponent> GetCells <TComponent>() where TComponent : Component, new() { var listOfElements = new List <TComponent>(); var cells = GetCells().ToList(); for (int columnIndex = 0; columnIndex < cells.Count; columnIndex++) { var cell = cells[columnIndex]; TComponent element = new TComponent(); if (cell.CellControlComponentType == null) { listOfElements.Add(cell.As <TComponent>()); } else { var repo = new ComponentRepository(); element = repo.CreateComponentWithParent(cell.CellControlBy, cell.WrappedElement, typeof(TComponent), false); listOfElements.Add(element); } } return(listOfElements); }
/// <summary> /// Initializes a new <see cref="TNewComboBox"/> /// </summary> /// <param name="AOwner">The owner component</param> public TNewComboBox(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Inno Setup <a href="https://jrsoftware.org/ishelp/index.php?topic=scriptclasses">Documentation</a> /// </summary> public new static TUIStateForm CreateNew(TComponent AOwner) => null;
/// <summary> /// Initializes a new <see cref="TDownloadWizardPage"/> /// </summary> /// <param name="AOwner">The owner component</param> public TDownloadWizardPage(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Inno Setup <a href="https://jrsoftware.org/ishelp/index.php?topic=scriptclasses">Documentation</a> /// </summary> public static TForm CreateNew(TComponent AOwner) => null;
/// <summary> /// Initializes a new <see cref="TForm"/> /// </summary> /// <param name="AOwner">The owner component</param> public TForm(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TNewListBox"/> /// </summary> /// <param name="AOwner">The owner component</param> public TNewListBox(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TNewNotebookPage"/> /// </summary> /// <param name="AOwner">The owner component</param> public TNewNotebookPage(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TNewButton"/> /// </summary> /// <param name="AOwner">The owner component</param> public TNewButton(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TWizardPage"/> /// </summary> /// <param name="AOwner">The owner component</param> public TWizardPage(TComponent AOwner) : base(AOwner) { }
public TComponent Get <TComponent>() { TComponent result = kernel.Get <TComponent>(); return(result); }
/// <summary> /// Initializes a new <see cref="TOutputProgressWizardPage"/> /// </summary> /// <param name="AOwner">The owner component</param> public TOutputProgressWizardPage(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TCustomCheckBox"/> /// </summary> /// <param name="AOwner">The owner component</param> public TCustomCheckBox(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TGraphicControl"/> /// </summary> /// <param name="AOwner">The owner component</param> public TGraphicControl(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TWizardForm"/> /// </summary> /// <param name="AOwner">The owner component</param> public TWizardForm(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TCustomComboBox"/> /// </summary> /// <param name="AOwner">The owner component</param> public TCustomComboBox(TComponent AOwner) : base(AOwner) { }
/// <summary> /// Initializes a new <see cref="TMemo"/> /// </summary> /// <param name="AOwner">The owner component</param> public TMemo(TComponent AOwner) : base(AOwner) { }