Beispiel #1
0
 public void ChangeCellStatus(Int32 index, ECellStatus status)
 {
     if (IsInside(index))
     {
         _grid[index].CellStatus = status;
     }
 }
Beispiel #2
0
 public void ChangeCellStatus(Int32 x, Int32 y, ECellStatus status)
 {
     if (IsInside(x, y))
     {
         _grid[CellIndex(x, y)].CellStatus = status;
     }
 }
Beispiel #3
0
        private void DisplayCellMainStatus(ECellStatus pCellStatus)
        {
            //  Main status
            switch (pCellStatus)
            {
            case ECellStatus.Clean:
                this.textBox1.Text = "Clean";
                break;

            case ECellStatus.Dirty:
                this.textBox1.Text = "Dirty";
                break;

            case ECellStatus.Error:
                this.textBox1.Text = "Error";
                break;

            case ECellStatus.N_A:
                this.textBox1.Text = "N_A";
                break;

            default:
                this.textBox1.Text = "Other";
                break;
            }
        }
Beispiel #4
0
        public void CopyFrom(SerializableCell _cell)
        {
            cellStatus = (ECellStatus)_cell.cellStatus;
            cellType   = (ECellType)_cell.cellType;

            if (cellType == CellScript.ECellType.Number)
            {
                intCellContent = int.Parse(_cell.cellContent);
                m_currentColor = LevelEditor.instance.colorConfiguration.numberBlockColor;
            }
            else if (cellType == CellScript.ECellType.Operation)
            {
                charCellContent = _cell.cellContent.ToCharArray()[0];
                CurrentColor    = LevelEditor.instance.colorConfiguration.operationBlockColor;
            }
            else
            {
                CurrentColor = LevelEditor.instance.colorConfiguration.unusedBlockColor;
            }

            if (cellStatus == CellScript.ECellStatus.Hidden)
            {
                PreviousColor = CurrentColor;
                CurrentColor  = LevelEditor.instance.colorConfiguration.hiddenBlockColor;
            }
        }
Beispiel #5
0
 public static bool IsSet(this ECellStatus status, int cellStatus)
 {
     if (status == ECellStatus.OK)
     {
         // OK is 0, cell status must be 0 as well to match
         return(cellStatus == (int)ECellStatus.OK);
     }
     else
     {
         return(cellStatus != 0 && (cellStatus & (int)status) == (int)status);
     }
 }
Beispiel #6
0
 // --------------------
 // Initialization
 // --------------------
 #region Initialization
 public void InitializeEmptyCell()
 {
     cellType   = ECellType.None;
     cellStatus = ECellStatus.None;
     FetchDependencies();
 }
Beispiel #7
0
        // [TO DO]
        // parameter bool _isFeedback possibly indicates that function has two different behaviors
        // fix that (don't have bool parameters)
        public void AssignBuildingBlock(BuildingBlock _block, bool _isFeedback)
        {
            switch (_block.buildingBlockType)
            {
            case BuildingBlock.EBuildingBlockType.Number:
                cellType   = ECellType.Number;
                cellStatus = ECellStatus.Visible;

                NumberBlock block = (NumberBlock)_block;
                m_textReference.text = block.numberValue.ToString();
                intCellContent       = block.numberValue;
                m_currentColor       = LevelEditor.instance.colorConfiguration.numberBlockColor;
                break;

            case BuildingBlock.EBuildingBlockType.Operation:
                cellType   = ECellType.Operation;
                cellStatus = ECellStatus.Visible;

                OperationBlock opBlock = (OperationBlock)_block;
                m_textReference.text = opBlock.operationCharacter.ToString();
                charCellContent      = opBlock.operationCharacter;
                m_currentColor       = LevelEditor.instance.colorConfiguration.operationBlockColor;
                break;

            case BuildingBlock.EBuildingBlockType.Hide:

                if (cellStatus == ECellStatus.Hidden)
                {
                    cellStatus = ECellStatus.Visible;

                    // current color is now previous color
                    // and previous color is now current color
                    Color tempColor = m_currentColor;
                    m_currentColor  = m_previousColor;
                    m_previousColor = tempColor;
                }
                else if (cellStatus == ECellStatus.Visible)
                {
                    cellStatus = ECellStatus.Hidden;

                    m_previousColor = m_currentColor;
                    m_currentColor  = LevelEditor.instance.colorConfiguration.hiddenBlockColor;
                }


                // just overriding what happened and making the cell blue if it's the feedback cell
                if (_isFeedback)
                {
                    m_currentColor       = LevelEditor.instance.colorConfiguration.hiddenBlockColor;
                    m_textReference.text = "";
                    cellStatus           = ECellStatus.Hidden;
                    cellType             = ECellType.None;
                }
                break;

            case BuildingBlock.EBuildingBlockType.Unused:
                cellType   = ECellType.Unused;
                cellStatus = ECellStatus.Unused;

                m_textReference.text = "";
                m_currentColor       = LevelEditor.instance.colorConfiguration.unusedBlockColor;
                break;
            }

            m_imageReference.color = m_currentColor;
        }