public IFlyweightGraphicComponent AddComponent(ElementTag tagEntity, IFlyweightGraphicComponent com) { flyweightComSynchronizer.Add((owner, inp) => { owner._AddComponent(tagEntity, inp); }, com); return(com); }
void _RemoveComponent(ElementTag tagEntity, IFlyweightGraphicComponent com) { if (!flyweightComponents[com].Remove(tagEntity)) { //no data to remove - dispose comp com.Dispose(); } entityHas[tagEntity].Remove(com.GetType()); notify.NotifyChange(com); }
void _AddComponent(ElementTag tagEntity, IFlyweightGraphicComponent com) { if (flyweightComponents.ContainsKey(com)) { flyweightComponents[com].Add(tagEntity); } else { flyweightComponents.Add(com, new HashSet <ElementTag> { tagEntity }); } entityHas[tagEntity].Add(com.GetType()); notify.NotifyChange(com); }
public void RemoveComponent(ElementTag tagEntity, IFlyweightGraphicComponent com) { flyweightComSynchronizer.Add((owner, inp) => { owner._RemoveComponent(tagEntity, inp); }, com); }