/// <summary>
        /// Constructor for the Game.
        /// </summary>
        public TetrisGameRunner()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            IsMouseVisible = true;
            Content.RootDirectory = "Content";
            handler = new InputHandler();
            original = null;
            Myself = Process.GetCurrentProcess();
            light = new BlendState();
            light.ColorBlendFunction = BlendFunction.Add;
            light.ColorSourceBlend = Blend.DestinationColor;
            light.ColorDestinationBlend = Blend.One;
            editor = new WorldEditor();
            classic = new MainMenuButton("Play Classic");
            story = new MainMenuButton("Beta Story Mode");
            story.ModifyY(51 * 4);
            options = new MainMenuButton("Options");
            options.ModifyY(51*2);
            maker = new MainMenuButton("Make Levels");
            maker.ModifyY(51*3);
            anyLevel = new MainMenuButton("Play Any Level");
            anyLevel.ModifyY(51);
            exit = new MainMenuButton("Exit");
            exit.ModifyY(51 * 5);

            package = new LevelPack();
            package.AddLevel("Volcano");
            package.AddLevel("Chef");

            package.AddLevel("RaiseDaRoof");

            package.AddLevel("School");

            package.AddLevel("Vault");

            package.AddLevel("TheMugging");

            package.AddLevel("CabinetDiver");

            package.AddLevel("Programmer");
            package.UnlockUpTo(1);

            cache = new MainMenuButton("Cache Off");

            pieceMode = new MainMenuButton("Piece Mode A");
            pieceMode.ModifyY(51);
            back = new MainMenuButton("Back To Menu");
            back.ModifyY(51 * 2);

            Save = new MainMenuButton("Save");
            Load = new MainMenuButton("Load");
            Load.ModifyY(51);

            graphics.PreferredBackBufferHeight = VirtualHeight;
            graphics.PreferredBackBufferWidth = VirtualWidth;

            classicLink = new TajLevelLinker();
            classicLink.OnStart("ClassicTetris 0 %Score \"Score:`0\" SetText");
            classicLink.SetRowCleared("\"Score:`\" $Score 1 + string + SetText $Score 1 + %Score del");

            /*
            TajParser p = new TajParser();
            p.Parse("\"Hello`World`\" 10 string +");
            p.Parse("10 20 + 10 * %Hello");
            p.Parse("$Hello $Hello + %Corn");
            p.Parse("$Corn $Corn * $Corn + %g");
            p.Parse("\"Hello`world`I`am`a`computer.`\" %Computer");
            SaveFileSystem.SaveObjectToFile(p, "Heh.taj");
            p = SaveFileSystem.LoadObjectFromFile<TajParser>("Heh.taj", new GameLoader());

            Console.Beep();
            */
        }
Exemplo n.º 2
0
        private void BuildTajLevelLinker()
        {
            TajLevelLinker tjl = new TajLevelLinker();
            tjl.SetRedCleared((string)variablesToBuild.Peek()["RedCleared"]);
            tjl.SetBlueCleared((string)variablesToBuild.Peek()["BlueCleared"]);
            tjl.SetTealCleared((string)variablesToBuild.Peek()["TealCleared"]);
            tjl.SetYellowCleared((string)variablesToBuild.Peek()["YellowCleared"]);
            tjl.SetPurpleCleared((string)variablesToBuild.Peek()["PurpleCleared"]);
            tjl.SetGreenCleared((string)variablesToBuild.Peek()["GreenCleared"]);
            tjl.SetOrangeCleared((string)variablesToBuild.Peek()["OrangeCleared"]);
            tjl.SetAnyCleared((string)variablesToBuild.Peek()["AnyCleared"]);
            tjl.SetRowCleared((string)variablesToBuild.Peek()["RowCleared"]);

            tjl.OnStart((string)variablesToBuild.Peek()["Start"]);
            tjl.SetFileName((string)variablesToBuild.Peek()["FileName"]);

            buildStack.Push(tjl);
            currentClass.Pop();
            variablesToBuild.Pop();
        }
Exemplo n.º 3
0
        private void BuildTajLevelSave()
        {
            TajLevelLinker tjl = new TajLevelLinker();
            tjl.SetRedCleared((string)variablesToBuild.Peek()["RedCleared"]);
            tjl.SetBlueCleared((string)variablesToBuild.Peek()["BlueCleared"]);
            tjl.SetTealCleared((string)variablesToBuild.Peek()["TealCleared"]);
            tjl.SetYellowCleared((string)variablesToBuild.Peek()["YellowCleared"]);
            tjl.SetPurpleCleared((string)variablesToBuild.Peek()["PurpleCleared"]);
            tjl.SetGreenCleared((string)variablesToBuild.Peek()["GreenCleared"]);
            tjl.SetOrangeCleared((string)variablesToBuild.Peek()["OrangeCleared"]);
            tjl.SetAnyCleared((string)variablesToBuild.Peek()["AnyCleared"]);
            tjl.SetRowCleared((string)variablesToBuild.Peek()["RowCleared"]);

            tjl.SetGame((ClassicTetrisGame)variablesToBuild.Peek()["Game"]);
            tjl.SetFlashlight((bool)variablesToBuild.Peek()["Flashlight"]);
            if (variablesToBuild.Peek().ContainsKey("Text"))
                tjl.SetText((String)variablesToBuild.Peek()["Text"]);
            else tjl.SetText("");
            tjl.SetParser((TajParser)variablesToBuild.Peek()["Parser"]);
            tjl.OnStart((string)variablesToBuild.Peek()["Start"]);

            tjl.SetWorld((World)variablesToBuild.Peek()["World"]);
            buildStack.Push(tjl);
            currentClass.Pop();
            variablesToBuild.Pop();
        }
        public void Update(InputHandler inputHandler)
        {
            #region Update Parts
            UpdateMode(inputHandler);
            UpdateElements(inputHandler);
            UpdateScrolling(inputHandler);
            UpdateTextBox(inputHandler);
            UpdateSuggestions(inputHandler);
            #endregion

            if(inputHandler.CheckJustPressedKey(Keys.E) && inputHandler.CheckPressedKey(Keys.D9))
            {
               TajLevelLinker linker = new TajLevelLinker();
               foreach(LooseDragDropLink link in elements)
                {
                    if(link  != null)
                    {
                        if(link.GetElement() is CodeDragDropHolder)
                        {
                            CodeDragDropHolder holder = ((CodeDragDropHolder)link.GetElement());

                            // "Code", "If", "Else", "EndIf", "Start", "Cleared Row", "Cleared Red", "Cleared Blue", "Cleared Teal", "Cleared Purple", "Cleared Orange", "Cleared Yellow", "Cleared Green", "Cleared Any Color"
                            switch(holder.GetMode())
                            {
                            case 4:
                                linker.OnStart(holder.GetCode());
                                break;
                            case 5 :
                                linker.SetRowCleared(holder.GetCode());
                                break;
                            case 6:

                                linker.SetRedCleared(holder.GetCode());
                                break;
                            case 7:

                                linker.SetBlueCleared(holder.GetCode());
                                break;
                            case 8:

                                linker.SetTealCleared(holder.GetCode());
                                break;
                            case 9:
                                linker.SetPurpleCleared(holder.GetCode());
                                break;
                            case 10:

                                linker.SetOrangeCleared(holder.GetCode());
                                break;
                            case 11:

                                linker.SetYellowCleared(holder.GetCode());
                                break;
                            case 12:
                                linker.SetGreenCleared(holder.GetCode());
                                break;
                            case 13:
                                linker.SetAnyCleared(holder.GetCode());
                                break;
                            }

                        }
                    }
                }
               linker.CreateGame(fileName);
               linker.SetFullSave(true);
               SaveFileSystem.SaveObjectToFile(linker, "LevelPacks" + Path.DirectorySeparatorChar + safeFileName);
            }

            /*
            if(inputHandler.CheckJustPressedKey(Keys.Y))
            {

                TempList list = new TempList();
                list.elements = this.elements.ToArray();

                SaveFileSystem.SaveObjectToFile(list, "Haha.taj");
            }
            */
            //Temporary Code
            if(classManager == null && !test)
            {

                suggestions.Add(new LooseDragDropLink(new StringTextbox()));
                suggestions.Add(new LooseDragDropLink(new NumberTextbox()));
                suggestions.Add(new LooseDragDropLink(new BooleanDragDrop()));
                suggestions.Add(new LooseDragDropLink(new NotBooleanMethod()));
                suggestions.Add(new LooseDragDropLink(new BooleanMethod()));
                suggestions.Add(new LooseDragDropLink(new NumberMethodDragDrop()));
                suggestions.Add(new LooseDragDropLink(new NumberMethod()));
                suggestions.Add(new LooseDragDropLink(new StringMethod()));
                suggestions.Add(new LooseDragDropLink(new SetVariableDragDrop()));
                suggestions.Add(new LooseDragDropLink(new GameCommandDragDrop()));
                suggestions.Add(new LooseDragDropLink(new GetVariableDragDrop()));
                suggestions.Add(new LooseDragDropLink(new CodeTextbox()));
                suggestions.Add(new LooseDragDropLink(new CodeDragDropHolder()));

                test = true;
                //Show New Class Button
            }
        }