Example #1
0
 void DrawPicturePro(DescAndMoveDir[][] descAndMD)
 {
     SuspendControlUpdate.Suspend(outputRichTextBox);
     ClearTextBox();
     AppendText(OutputStringPro(descAndMD));
     SetAllColorPro(descAndMD);
     SuspendControlUpdate.Resume(outputRichTextBox);
 }
Example #2
0
        //Basic drawing functions

        void DrawPictureDef(int[][] desc)
        {
            SuspendControlUpdate.Suspend(outputRichTextBox);
            ClearTextBox();
            AppendText(OutputStringDef(desc));
            SetAllColorDef(desc);
            SuspendControlUpdate.Resume(outputRichTextBox);
        }
        void DrawPicturePro()
        {
            SuspendControlUpdate.Suspend(outputRichTextBox);
            outputRichTextBox.Clear();
            //char cellStand = '☻', cellUp = '▲', cellDown = '▼', cellLeft = '◄', cellRight = '►';
            //char deadCell = '❖', food = '░', empty=' ';
            char cellStand = 'O', cellUp = '∧', cellDown = '∨', cellLeft = '<', cellRight = '>';
            char deadCell = '#', food = '*', empty = ' ', poison = '*';

            DescAndMoveDir[][] descAndMD = universe.GetAllDescriptorsAndMoveDisp();


            string outputStr             = fieldStr + '\n';

            for (int j = 0; j < height; j++)
            {
                outputStr += '|';
                for (int i = 0; i < width; i++)
                {
                    int descriptor = descAndMD[i][j].desc;
                    if (descriptor == 0)
                    {
                        outputStr += empty;
                    }
                    else if (descriptor == -1)
                    {
                        outputStr += food;
                    }
                    else if (descriptor == -2)
                    {
                        outputStr += deadCell;
                    }
                    else if (descriptor == -3)
                    {
                        outputStr += poison;
                    }
                    else
                    {
                        char cell = 'O';
                        switch (descAndMD[i][j].moveDir)
                        {
                        case MoveDirection.up:
                            cell = cellUp;
                            break;

                        case MoveDirection.down:
                            cell = cellDown;
                            break;

                        case MoveDirection.left:
                            cell = cellLeft;
                            break;

                        case MoveDirection.right:
                            cell = cellRight;
                            break;

                        default:
                            cell = cellStand;
                            break;
                        }
                        outputStr += cell;
                    }
                }
                outputStr += "|\n";
            }

            outputStr += fieldStr;
            AppendText(outputStr);

            SetColor(0, fieldStr.Length, border);

            int charNum = fieldStr.Length + 1;

            for (int j = 0; j < height; j++)
            {
                SetColor(charNum, 1, border);
                charNum++;
                for (int i = 0; i < width; i++)
                {
                    int descriptor = descAndMD[i][j].desc;
                    if (descriptor == -1)
                    {
                        SetColor(charNum, 1, Color.Green);
                    }
                    else if (descriptor == -2)
                    {
                        SetColor(charNum, 1, Color.Gray);
                    }
                    else if (descriptor == -3)
                    {
                        SetColor(charNum, 1, Color.DarkOrange);
                    }
                    else
                    {
                        SetColor(charNum, 1, Color.FromArgb(descriptor));
                    }
                    charNum++;
                }
                SetColor(charNum, 1, border);
                charNum += 2;
            }
            SetColor(charNum, fieldStr.Length, border);

            SuspendControlUpdate.Resume(outputRichTextBox);
        }
        void DrawPictureDef()
        {
            SuspendControlUpdate.Suspend(outputRichTextBox);
            outputRichTextBox.Clear();
            char cell = 'O';
            char deadCell = '#', food = '*', empty = ' ', poison = '*';

            int[][] desc = universe.GetAllDescriptors();

            string outputStr = fieldStr + '\n';

            for (int j = 0; j < height; j++)
            {
                outputStr += '|';
                for (int i = 0; i < width; i++)
                {
                    int descriptor = desc[i][j];
                    if (descriptor == 0)
                    {
                        outputStr += empty;
                    }
                    else if (descriptor == -1)
                    {
                        outputStr += food;
                    }
                    else if (descriptor == -2)
                    {
                        outputStr += deadCell;
                    }
                    else if (descriptor == -3)
                    {
                        outputStr += poison;
                    }
                    else
                    {
                        outputStr += cell;
                    }
                }
                outputStr += "|\n";
            }

            outputStr += fieldStr;
            AppendText(outputStr);

            SetColor(0, fieldStr.Length, border);

            int charNum = fieldStr.Length + 1;

            for (int j = 0; j < height; j++)
            {
                SetColor(charNum, 1, border);
                charNum++;
                for (int i = 0; i < width; i++)
                {
                    int descriptor = desc[i][j];
                    if (descriptor == -1)
                    {
                        SetColor(charNum, 1, Color.Green);
                    }
                    else if (descriptor == -2)
                    {
                        SetColor(charNum, 1, Color.Gray);
                    }
                    else if (descriptor == -3)
                    {
                        SetColor(charNum, 1, Color.DarkOrange);
                    }
                    else if (descriptor >= 100)
                    {
                        SetColor(charNum, 1, Color.FromArgb(descriptor));
                    }
                    charNum++;
                }
                SetColor(charNum, 1, border);
                charNum += 2;
            }
            SetColor(charNum, fieldStr.Length, border);
            SuspendControlUpdate.Resume(outputRichTextBox);
        }