Пример #1
0
        public static void LoadSetFileWindowOk(Window callingWindow)
        {
            string fileName = ((FileWindow)callingWindow).Results[0];

            #region Load the file to the mInstructionSetSaveList field - it may be stored off until the .scnx is found
            LastLoadInformation.LastInstructionSetLoaded = fileName;
            mInstructionSetSaveList = InstructionSetSaveList.FromFile(LastLoadInformation.LastInstructionSetLoaded);
            #endregion

            #region Load the properties file (.iepsx) if it exists

            string iepsxFileName = FileManager.RemoveExtension(fileName) + ".iepsx";

            if (FileManager.FileExists(iepsxFileName))
            {
                InstructionEditorPropertiesSave iepsx = InstructionEditorPropertiesSave.FromFile(iepsxFileName);
                iepsx.ApplyToEditor();
            }


            #endregion

            // See if there is already a Blocking scene loaded
            if (EditorData.BlockingScene == null || string.IsNullOrEmpty(EditorData.BlockingScene.Name))
            {
                OkCancelWindow okCancelWindow =
                    GuiManager.ShowOkCancelWindow("There is no blocking scene currently loaded.  Attempt to load the scene " +
                                                  "referenced by the loaded Instruction Set?", "No Scene Loaded");
                okCancelWindow.OkClick += LoadBlockingFromLoadedInstructionSet;
            }
            else
            {
                AddCurrentlyLoadedInstructionSet();
            }

            /*
             *
             #region blueprint Sprites already loaded
             *          if(GuiData.ListBoxWindow.BlueprintSpriteListBox.Count != 0)
             *          {
             *                  CreateActiveSpritesFromIss();
             *                  TimeLineMessages.ToStartPushed(null);
             *
             *          }
             #endregion
             *
             #region blueprint Sprites not already loaded
             *          else
             *          {
             *                  MultiButtonMessageBox mbmb = GuiManager.AddMultiButtonMessageBox();
             *                  mbmb.Name = "No Blueprints Loaded";
             *                  mbmb.Text = ((FileWindow)callingWindow).result[0] + " instruction set requires active Sprites to be loaded.  What would you like to do?";
             *
             *                  mbmb.AddButton("Manually search for .scnx file.", new GuiMessage(LoadActiveSceneClick));
             *
             * //				mbmb.AddButton("Automatically search for .scn with Sprites matching instructions.", new GuiMessage(AutoSearchScn));
             *          }
             #endregion
             */
        }
Пример #2
0
        public static void NewSet(Window callingWindow)
        {
            mInstructionSetSaveList = null;

            // clear the blueprint Sprites
            foreach (Sprite s in EditorData.ActiveSprites)
            {
                SpriteManager.RemoveSprite(s);
            }

            Sprite cameraSprite = null;

            if (EditorData.ActiveSprites.Count != 0)
            {
                cameraSprite = EditorData.ActiveSprites[0];
                EditorData.ActiveSprites.Clear();
                EditorData.ActiveSprites.AddOneWay(cameraSprite);
            }

            EditorData.EditorLogic.SelectObject((Sprite)null, EditorData.EditorLogic.CurrentSprites);

            GuiData.ListBoxWindow.InstructionSetListBox.Clear();
        }
Пример #3
0
        private static void AddSetToSave(InstructionSet instructionSet, InstructionSetSaveList instructionSetSaveList,
                                         string targetName)
        {
            // This following members be used as a buffer for holding the lists that will be saved.
            // In the following loop the code will only copy over instructions that set properties
            // which are included in EditorData.SavedMembers
            List <InstructionList> temporaryListList = new List <InstructionList>();
            InstructionList        temporaryList     = new InstructionList();

            InstructionSetSave instructionSetSave = new InstructionSetSave();

            foreach (KeyframeList keyframeList in instructionSet)
            {
                temporaryListList = new List <InstructionList>();

                foreach (InstructionList instructionList in keyframeList)
                {
                    temporaryList      = new InstructionList();
                    temporaryList.Name = instructionList.Name;

                    foreach (Instruction instruction in instructionList)
                    {
                        // Assume that all instructions are GenericInstructions
                        GenericInstruction asGenericInstruction = instruction as GenericInstruction;

                        bool toAdd = false;

                        if (asGenericInstruction.Target is PositionedModel)
                        {
                            toAdd = EditorData.CurrentPositionedModelMembersWatching.Contains(asGenericInstruction.Member);
                        }
                        else if (asGenericInstruction.Target is Sprite)
                        {
                            toAdd = EditorData.CurrentSpriteMembersWatching.Contains(asGenericInstruction.Member);
                        }
                        else if (asGenericInstruction.Target is SpriteFrame)
                        {
                            toAdd = EditorData.CurrentSpriteFrameMembersWatching.Contains(asGenericInstruction.Member);
                        }
                        else if (asGenericInstruction.Target is Text)
                        {
                            toAdd = EditorData.CurrentTextMembersWatching.Contains(asGenericInstruction.Member);
                        }

                        if (toAdd)
                        {
                            // this instruction is one we want to save
                            temporaryList.Add(instruction);
                        }
                    }

                    if (temporaryList.Count != 0)
                    {
                        temporaryListList.Add(temporaryList);
                    }
                }

                if (temporaryListList.Count != 0)
                {
                    instructionSetSave.AddInstructions(temporaryListList, keyframeList.Name);
                }
            }
            if (instructionSetSave.Instructions.Count != 0)
            {
                instructionSetSave.Target = targetName;
                instructionSetSaveList.InstructionSetSaves.Add(instructionSetSave);
            }
        }