Exemple #1
0
            protected virtual void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, bool addSubtype = true)
            {
                this.block     = block;
                this.SubtypeId = subtypeId;

                if (addSubtype)
                {
                    block.SubtypeId |= subtypeId;
                    block.subtypeAccessors.Add(this);
                }
            }
Exemple #2
0
        public static TBlockSubtypes GetLargestSubtype(this TBlockSubtypes subtypeId)
        {
            for (int n = subtypes.Count - 1; n >= 0; n--)
            {
                if ((subtypeId & subtypes[n]) == subtypes[n])
                {
                    return(subtypes[n]);
                }
            }

            return(TBlockSubtypes.None);
        }
Exemple #3
0
            protected override void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, bool addSubtype = true)
            {
                this.block     = block;
                subtype        = block.TBlock as T;
                this.SubtypeId = subtypeId;

                if (addSubtype && subtype != null)
                {
                    block.SubtypeId |= subtypeId;
                    block.subtypeAccessors.Add(this);
                }
            }
Exemple #4
0
        public virtual void Reset()
        {
            for (int i = 0; i < subtypeAccessors.Count; i++)
            {
                subtypeAccessors[i].Reset();
            }

            if (TBlock != null)
            {
                TBlock.OnMarkForClose -= BlockClosing;
            }

            subtypeAccessors.Clear();
            TypeID       = null;
            TBlock       = null;
            TerminalGrid = null;
            SubtypeId    = 0;
        }
Exemple #5
0
 public static bool UsesSubtype(this TBlockSubtypes subtypeId, TBlockSubtypes flag) =>
 (subtypeId & flag) == flag;
Exemple #6
0
 protected virtual void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, TBlockSubtypes prerequsites) =>
 SetBlock(block, subtypeId, block.SubtypeId.UsesSubtype(prerequsites));
Exemple #7
0
 public virtual void Reset()
 {
     SubtypeId = TBlockSubtypes.None;
     block     = null;
 }