Beispiel #1
0
    static public FlagTableData LoadFlagTable(string fileName)
    {
#if UNITY_WEBPLAYER
        string flagXmlStr = PlayerPrefs.GetString(fileName + "Flag.xml");
#else
        string flagXmlStr = ViNoGameSaveLoad.LoadXML(fileName + "Flag.xml");
#endif
        FlagTableData flagData = ViNoGameSaveLoad.DeserializeObject <FlagTableData>(flagXmlStr) as FlagTableData;
        return(flagData);
//		return flagData.flags;
    }
Beispiel #2
0
    static public void SaveFlagTable(string fileName, FlagTable flagTable)
    {
        if (flagTable != null)
        {
            FlagTableData flagData = new FlagTableData();
            flagData.flags        = flagTable.flags;
            flagData.stringValues = flagTable.stringValues;

            string flagXmlStr = ViNoGameSaveLoad.SerializeObject <FlagTableData>(flagData);
#if UNITY_WEBPLAYER
            PlayerPrefs.SetString(fileName + "Flag.xml", flagXmlStr);
#else
            ViNoGameSaveLoad.CreateXML(fileName + "Flag.xml", flagXmlStr);
#endif
        }
    }
Beispiel #3
0
    /// <summary>
    /// Loads the data.
    /// </summary>
    static public bool LoadData(string fileName, ref ViNoSaveInfo info)
    {
//		IScriptEngine vino =  IScriptEngine.Instance;
        ScenarioNode scenario = ScenarioNode.Instance;

        if (scenario != null)
        {
//			if( vino.saveToExternalFile ){
            // Load Flag Data from Storage.
//				FlagTable.FlagUnit[] flags = LoadFlagTable( fileName );
            FlagTableData flagData = LoadFlagTable(fileName);
            if (scenario.flagTable != null)
            {
#if false
//					scenario.flagTable.flags = flags;
#else
                scenario.flagTable.flags        = flagData.flags;
                scenario.flagTable.stringValues = flagData.stringValues;
#endif
            }
            else
            {
                Debug.LogWarning("ScenarioNode.Instance " + scenario.name + " flagTable Not attached.");
            }

            // Load SaveData from Storage.
            LoadDataFromStorage(fileName, ref info);
            return(ViNo.Load(info));
//			}

/*			else{
 *                              return ViNo.Load( info );
 *                      }
 * //*/
        }
        else
        {
            Debug.LogWarning("ScenarioNode instance NOT FOUND.");
            return(false);
        }
    }