Ejemplo n.º 1
0
        public bool Load(string fileName)
        {
            if (!File.Exists(fileName))
            {
                return(false);
            }

            using (FileStream stream = new FileStream(fileName, FileMode.Open))
            {
                XmlSerializer deserializer = new XmlSerializer(typeof(Quest), ManagerArray.GetAllDetailTypes());
                try
                {
                    Quest loadedQuest = (Quest)deserializer.Deserialize(stream);
                    if (loadedQuest.version == null)
                    {
                        System.Windows.Forms.MessageBox.Show("The selected xml file does not contain a version number. \n\nThe save file is likely earlier than SOC 0.7.0.0 and no longer supported.", "SOC", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return(false);
                    }
                    coreDetails        = loadedQuest.coreDetails;
                    questObjectDetails = loadedQuest.questObjectDetails;
                    return(true);
                }
                catch (InvalidOperationException e)
                {
                    System.Windows.Forms.MessageBox.Show(string.Format("An Exception has occurred and the selected xml file could not be loaded. \n\nInnerException message: \n{0}", e.InnerException), "SOC", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
 public void Save(string fileName)
 {
     using (FileStream stream = new FileStream(fileName, FileMode.Create))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Quest), ManagerArray.GetAllDetailTypes());
         serializer.Serialize(stream, this);
     }
 }
Ejemplo n.º 3
0
	public void OnGlobalEnable()
	{
		_managerArray = this.GetComponent<ManagerArray>();
		_managerInput = this.GetComponent<ManagerInput>();
		_giveAllObjectsToManagers = GameObject.FindGameObjectWithTag("GiveAllObjectsToManagers").GetComponent<GiveAllObjectsToManagers>();

		_player = _giveAllObjectsToManagers.player;
		_elementMenuToShow = _giveAllObjectsToManagers.menuGame;
		_elementGameOverToShow = _giveAllObjectsToManagers.menuLoose;
		_elementWinToShow = _giveAllObjectsToManagers.menuWin;

		_displayMenuOnce = true;
		_canPause = true;
		_isOnGame = true;
	}
Ejemplo n.º 4
0
        internal static bool Build(params Quest[] quests)
        {
            string buildDir;

            if (quests.Length > 1)
            {
                buildDir = BATCHBUILDDIR;
                ClearBatchFolder();
            }
            else
            {
                buildDir = SINGLEBUILDDIR;
            }

            Lang.LangBuilder.WriteQuestLangs(buildDir, quests.Select(singleQuest => singleQuest.coreDetails).ToArray());

            foreach (Quest quest in quests)
            {
                CoreDetails     coreDetails = quest.coreDetails;
                DetailManager[] managers    = new ManagerArray(quest.questObjectDetails).GetManagers();

                ClearQuestFolders(buildDir, coreDetails.FpkName);

                Lua.LuaBuilder.WriteDefinitionLua(buildDir, coreDetails, managers);
                Lua.LuaBuilder.WriteMainQuestLua(buildDir, coreDetails, managers);
                Fox2.Fox2Builder.WriteQuestFox2(buildDir, coreDetails.FpkName, managers);
                Assets.AssetsBuilder.BuildAssets(buildDir, coreDetails, managers);
            }

            /*
             * steps to building a quest:
             * 1. Clear possible existing fpk directories
             * 2. Write lang files (preferably all custom quest langs would be stored in a single file)
             * 3. write definition lua
             * 4. write main quest lua
             * 5. write fox2 file
             * 6. Add necessary asset files
             */
            return(true);
        }
Ejemplo n.º 5
0
	void OnEnable()
	{
		_managerArray = GameObject.FindGameObjectWithTag("Manager").GetComponent<ManagerArray>();
		_attractedFrom = _managerArray.getOrbArray();
	}
Ejemplo n.º 6
0
	void OnEnable()
	{
		_managerArray = GameObject.FindGameObjectWithTag("Manager").GetComponent<ManagerArray>();
		_managerArray.addOrbToArray(this.gameObject);
	}