Esempio n. 1
0
        // Save
        public void SaveHud()
        {
            // Convert to storage format
            Storage.HUD storageHud = hud.SaveToStorage();

            // Open file stream and serialize it
            FileInfo            hudFile    = new FileInfo(hudsDataPath + hud.bundleName + dataExtension);
            FileStream          hudStream  = hudFile.Open(FileMode.Create, FileAccess.Write);
            RbStorageSerializer serializer = new RbStorageSerializer();

            serializer.Serialize(hudStream, storageHud);
            hudStream.Close();
        }
Esempio n. 2
0
        // Load
        public void LoadHud(string hudName)
        {
            // Open file stream and deserialize it
            FileInfo hudFile = new FileInfo(hudsDataPath + hudName + dataExtension);

            if (hudFile.Exists)
            {
                FileStream          hudStream  = hudFile.OpenRead();
                RbStorageSerializer serializer = new RbStorageSerializer();
                Storage.HUD         storageHUD = serializer.Deserialize(hudStream, null, typeof(Storage.HUD)) as Storage.HUD;
                hudStream.Close();
                // Load hud into editor hud format
                hud = HUD.LoadFromStorage(hudName, storageHUD);
            }
            else
            {
                // New hud data
                hud = new HUD(hudName);
            }
            Reset();
        }