Exemplo n.º 1
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.º 2
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
            }
        }