Ejemplo n.º 1
0
 public IFlyweightGraphicComponent AddComponent(ElementTag tagEntity, IFlyweightGraphicComponent com)
 {
     flyweightComSynchronizer.Add((owner, inp) => {
         owner._AddComponent(tagEntity, inp);
     }, com);
     return(com);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public void RemoveComponent(ElementTag tagEntity, IFlyweightGraphicComponent com)
 {
     flyweightComSynchronizer.Add((owner, inp) => {
         owner._RemoveComponent(tagEntity, inp);
     }, com);
 }