コード例 #1
0
ファイル: BlockManager.cs プロジェクト: W-h-a-t-s/Rant
 public void Add(BlockAttribs attribs, RABlock block)
 {
     if (!_blockList.ContainsKey(attribs))
         _blockList.Add(attribs, new List<RABlock>() { block });
     else
         _blockList[attribs].Add(block);
 }
コード例 #2
0
ファイル: BlockManager.cs プロジェクト: W-h-a-t-s/Rant
        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);
        }
コード例 #3
0
ファイル: BlockManager.cs プロジェクト: W-h-a-t-s/Rant
 public BlockAttribs GetAttribs(RABlock block) => _blockList.Single(p => p.Value.Contains(block)).Key;
コード例 #4
0
ファイル: Sandbox.cs プロジェクト: katnapper323/Rant
		/// <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;
		}