Ejemplo n.º 1
0
 public void CanRemoveItem()
 {
     Assert.False(_set.Remove(_fx.Block1.Hash));
     _set[_fx.Block1.Hash] = _fx.Block1;
     Assert.True(_set.Remove(_fx.Block1.Hash));
     Assert.Throws <KeyNotFoundException>(() => { var val = _set[_fx.Block1.Hash]; });
 }
Ejemplo n.º 2
0
        private void RemoveFromSets()
        {
            allBlocks.Remove(block);
            switch (block.data.type)
            {
            case BlockType.normal:
                normalBlocks.Remove(block);
                break;

            case BlockType.breaker:
                breakerBlocks.Remove(block);
                break;

            case BlockType.diamond:
                diamondBlocks.Remove(block);
                break;
            }

            switch (block.data.color)
            {
            case BlockColor.blue:
                blueBlocks.Remove(block);
                break;

            case BlockColor.green:
                greenBlocks.Remove(block);
                break;

            case BlockColor.red:
                redBlocks.Remove(block);
                break;

            case BlockColor.yellow:
                yellowBlocks.Remove(block);
                break;
            }
        }
Ejemplo n.º 3
0
    /**
     * DrawBlockSetEditor draws and handles the editing of the BlockSet
     */
    private static void DrawBlockSetEditor(BlockSet blockSet)
    {
        GUILayout.BeginVertical("box");
        selectedBlock = DrawBlockList(blockSet, selectedBlock, ref blockSetScrollPosition);
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Add Cube"))
        {
            selectedBlock = blockSet.Add(new Cube("new Cube"));
        }
        if (GUILayout.Button("Add Cross"))
        {
            selectedBlock = blockSet.Add(new Cross("new Cross"));
        }
        GUILayout.EndHorizontal();
        if (GUILayout.Button("Remove") && blockSet.GetBlock(selectedBlock) != null)
        {
            Undo.RecordObject(blockSet, "Remove block");
            blockSet.Remove(selectedBlock);
            selectedBlock = Mathf.Clamp(selectedBlock, 0, blockSet.GetCount() - 1);
        }
        GUILayout.EndVertical();
    }