public void Add(BlockAttribs attribs, RABlock block) { if (!_blockList.ContainsKey(attribs)) _blockList.Add(attribs, new List<RABlock>() { block }); else _blockList[attribs].Add(block); }
public void RemoveBlock(BlockAttribs attribs, RABlock block) { if (!_blockList.ContainsKey(attribs)) throw new InvalidOperationException("Attribs don't exist"); if (!_blockList[attribs].Contains(block)) throw new InvalidOperationException("Block doesn't exist"); _blockList[attribs].Remove(block); }
public BlockAttribs GetAttribs(RABlock block) => _blockList.Single(p => p.Value.Contains(block)).Key;
/// <summary> /// Dequeues the current block attribute set and returns it, queuing a new attribute set. /// </summary> /// <returns></returns> public BlockAttribs NextAttribs(RABlock block) { BlockAttribs attribs = _newAttribs; _blockManager.Add(attribs, block); _blockManager.SetPrevAttribs(attribs); switch (attribs.Persistence) { case AttribPersistence.Off: _newAttribs = new BlockAttribs(); break; case AttribPersistence.On: _newAttribs = new BlockAttribs(); break; case AttribPersistence.Once: _newAttribs = _blockManager.GetPrevious(1); break; } return attribs; }