Exemple #1
0
        public void RejectAskingPrice(int ask, bool wayTooHigh)
        {
            var clr = wayTooHigh ? XleColor.Yellow : XleColor.Cyan;

            offerWind.Clear();
            offerWind.WriteLine(" " + ask + " is " +
                                (wayTooHigh ? "way " : "") + "too high!", clr);
        }
Exemple #2
0
        private void ResetLowerWindow()
        {
            lowerWindow.Location = new Point(3, 17);
            lowerWindow.Clear();

            lowerWindow.WriteLine("` Press return key when finished `");
            lowerWindow.WriteLine();
            lowerWindow.WriteLine();
            lowerWindow.WriteLine(" - Press 'del' key to backspace -");
            lowerWindow.WriteLine();
            lowerWindow.WriteLine("- Press 'F1' or Escape to cancel -");
        }
Exemple #3
0
        public override void Update(GameTime time)
        {
            filesWindow.Clear();

            if (page == 0)
            {
                filesWindow.WriteLine("0.  Cancel");
            }
            else
            {
                filesWindow.WriteLine("0.  Previous Page");
            }

            for (int i = 0; i < 8; i++)
            {
                filesWindow.Write((i + 1).ToString());
                filesWindow.Write(".  ");

                if (files.Count <= FileStartIndex + i)
                {
                    filesWindow.WriteLine("Empty");
                }
                else
                {
                    filesWindow.WriteLine(Path.GetFileNameWithoutExtension(files[i]));
                }
            }

            if (page < maxPages)
            {
                filesWindow.WriteLine("9.  Next Page");
            }
        }
Exemple #4
0
        private void SetAskRejectPrice(TextWindow offerWind, int ask, bool wayTooHigh)
        {
            var clr = wayTooHigh ? XleColor.Yellow : XleColor.Cyan;

            offerWind.Clear();
            offerWind.WriteLine(" " + ask + " is " +
                                (wayTooHigh ? "way " : "") + "too high!", clr);
        }
Exemple #5
0
 private void ResetUpperWindow()
 {
     upperWindow.Location = new Point(2, 4);
     upperWindow.Clear();
     upperWindow.WriteLine(" Type in your new character's name.");
     upperWindow.WriteLine();
     upperWindow.WriteLine("  It may be up to 14 letters long.");
 }
Exemple #6
0
        private void SetFirstWindow()
        {
            window.Clear();

            window.WriteLine("You are only a poor peasant on the");
            window.WriteLine("world of Tarmalon, so it's hardly");
            window.WriteLine("surprising that you've never seen");
            window.WriteLine("a dead man before.  His crumpled");
            window.WriteLine("figure lies forlornly by the side");
            window.WriteLine("of the road.");
            window.WriteLine("");
            window.WriteLine("");
            window.WriteLine("Fighting your fear, you kneel by");
            window.WriteLine("the still-warm corpse.  You see a");
            window.WriteLine("a look of panic on his face, a gold");
            window.WriteLine("band around his wrist, and a large");
            window.WriteLine("leather scroll, clutched tightly to");
            window.WriteLine("his chest.");
        }
Exemple #7
0
        private void InitializeWindows()
        {
            titlePrompt.Clear();
            itemsPrompt.Clear();
            inventoryDisplay.Clear();

            titlePrompt.Location = new Point(17, 2);
            titlePrompt.WriteLine(StoreType);

            itemsPrompt.Location = new Point(7, 4);

            inventoryDisplay.Location = new Point(4, 6);
        }
Exemple #8
0
        protected override void UserSelectedFile(string name)
        {
            inPrompt = true;

            SoundMan.PlaySound(LotaSound.TitleErasePrompt);
            instruction.Location = new Point(9, instruction.Location.Y - 1);

            instruction.Clear();
            instruction.WriteLine("Erase " + name + "?", XleColor.Yellow);
            instruction.WriteLine("Choose: yes  no", XleColor.Yellow);

            cursor = new TextWindow();
            cursor.Write("`", XleColor.Yellow);
            cursor.Location = new Point(19, instruction.Location.Y + 2);

            Windows.Add(cursor);
            selectedFile = name;
        }
Exemple #9
0
        private void SetOfferText(TextWindow offerWind, int offer, int ask)
        {
            offerWind.Clear();
            offerWind.Write("My latest offer: ", XleColor.White);
            offerWind.WriteLine(offer.ToString(), XleColor.Cyan);

            if (ask > 0)
            {
                offerWind.Write("You asked for: ");
                offerWind.WriteLine(ask.ToString(), XleColor.Cyan);
            }
            else
            {
                offerWind.WriteLine();
            }

            offerWind.Write("What will you sell for? ");
            offerWind.Write("(0 to quit)", XleColor.Purple);
        }
        private static void PrintHelp()
        {
            string originalForegroundColour = TextWindow.ForegroundColor;
            string helpLine;

            TextWindow.Clear();
            TextWindow.ForegroundColor = "LightBlue";
            TextWindow.WriteLine("Help:");
            TextWindow.ForegroundColor = "Cyan";

            StreamReader file = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Small_Basic_Extension_1.helpText.txt"));

            while ((helpLine = file.ReadLine()) != null)
            {
                TextWindow.WriteLine(helpLine);
            }

            TextWindow.ForegroundColor = originalForegroundColour;
        }
        // Analyseert de lijst en voert bijbehorende commando's uit.
        private static void AnalyseAndPerformActions(List <string> commandList)
        {
            for (var i = 0; i < commandList.Count; i++)
            {
                switch (commandList[i])
                {
                case "fd":
                case "forward":
                    Turtle.Move(GetNextNumber(i, commandList));
                    UpdatePositionVariables();
                    i += lengthOfNumericalInput;
                    break;

                case "bk":
                case "backward":
                    Turtle.Move(-GetNextNumber(i, commandList));
                    UpdatePositionVariables();
                    i += lengthOfNumericalInput;
                    break;

                case "rt":
                case "turn":
                    Turtle.Turn(GetNextNumber(i, commandList));
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "lt":
                    Turtle.Turn(-GetNextNumber(i, commandList));
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "wait":
                    System.Threading.Thread.Sleep((int)System.Math.Round(GetNextNumber(i, commandList) * 1000 / 60));
                    i += lengthOfNumericalInput;
                    break;

                case "speed":
                    Turtle.Speed       = GetNextNumber(i, commandList);
                    variables["speed"] = Turtle.Speed;
                    i += lengthOfNumericalInput;
                    break;

                case "msg":
                case "message":
                case "print":
                    if (i + 1 < commandList.Count)
                    {
                        TextWindow.WriteLine(RemoveBrackets(commandList[i + 1]));
                        i++;
                    }
                    else
                    {
                        ThrowException(5);
                    }
                    break;

                case "line":
                    SplitMultiNumberList(i, commandList, 4);

                    GraphicsWindow.DrawLine(multiNumberList[0], multiNumberList[1], multiNumberList[2], multiNumberList[3]);
                    i++;
                    break;

                case "setpos":
                    SplitMultiNumberList(i, commandList, 2);
                    Turtle.X = multiNumberList[0];
                    Turtle.Y = multiNumberList[1];
                    UpdatePositionVariables();
                    i++;
                    break;

                case "setpc":
                    SplitMultiNumberList(i, commandList, fromPenColor: true);

                    GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(
                        multiNumberList[0], multiNumberList[1], multiNumberList[2]);
                    i++;
                    break;

                case "setbc":
                    SplitMultiNumberList(i, commandList);

                    GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(
                        multiNumberList[0], multiNumberList[1], multiNumberList[2]);
                    i++;
                    break;

                case "hide":
                case "hideturtle":
                case "ht":
                    Turtle.Hide();
                    turtleIsHidden = true;
                    break;

                case "show":
                case "showturtle":
                case "st":
                    if (turtleIsHidden)
                    {
                        Turtle.Show();
                    }

                    turtleIsHidden = false;
                    break;

                case "pu":
                case "penup":
                    Turtle.PenUp();
                    break;

                case "pd":
                case "pendown":
                    Turtle.PenDown();
                    break;

                case "file":
                    if (i + 1 < commandList.Count)
                    {
                        DrawFromFile(RemoveBrackets(commandList[i + 1]));
                        i++;
                    }
                    else
                    {
                        ThrowException(5);
                    }
                    break;

                case "setorientation":
                    Turtle.Angle       = GetNextNumber(i, commandList);
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "setpx":
                case "setpixel":
                    SplitMultiNumberList(i, commandList, 2);

                    GraphicsWindow.SetPixel(multiNumberList[0], multiNumberList[1], GraphicsWindow.PenColor);
                    i++;
                    break;


                case "repeat":
                    i += RepeatCommands(i, commandList);
                    break;

                case "for":
                    ForLoop(i, commandList);
                    i += 2;
                    break;

                case "while":
                    WhileLoop(i, commandList);
                    i += 2;
                    break;

                case "circle":
                    int circleRadius = (int)GetNextNumber(i, commandList);
                    GraphicsWindow.DrawEllipse(Turtle.X - circleRadius, Turtle.Y - circleRadius, circleRadius * 2, circleRadius * 2);
                    i += lengthOfNumericalInput;
                    break;

                case "cs":
                    ResetTurtle();
                    break;

                case "ct":
                    TextWindow.Clear();
                    break;

                case "help":
                    PrintHelp();
                    break;

                case "if":
                    i += CompareInputs(i, commandList);
                    break;

                case "make":
                    AddVariable(i, commandList);
                    i += lengthOfNumericalInput + 1;
                    break;

                case "to":
                    i += ToCommandBase(i, commandList) + 2;
                    break;

                default:
                    if (toShortcuts.ContainsKey(commandList[i]))
                    {
                        AnalyseAndPerformActions(toShortcuts[commandList[i]]);
                    }
                    else if (commandList[i].StartsWith(":"))
                    {
                        TextWindow.WriteLine(GetNextNumber(i, commandList, 0));
                        i += lengthOfNumericalInput - 1;
                    }
                    else
                    {
                        ThrowException(0, commandList[i]);
                    }
                    break;
                }
            }
        }
Exemple #12
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     GraphicsWindow.Clear();
     TextWindow.Clear();
 }