Example #1
0
        public void Load()
        {
            if (allLikedItems == null)
            {
#if NETFX_CORE
                GetLocalSaveSwarmData();
#endif
            }
            spriteBatch   = new SpriteBatch(screen.ScreenManager.GraphicsDevice);
            debugScreen   = screen.ScreenManager.Game.Services.GetService(typeof(IDebugScreen)) as IDebugScreen;
            controlClient = screen.ScreenManager.Game.Services.GetService(typeof(IControlClient)) as IControlClient;
            Viewport viewport = screen.ScreenManager.GraphicsDevice.Viewport;
            position  = new Vector2(screen.ScreenManager.GraphicsDevice.Viewport.Width - rect.Width, 0);// + _containerMargin;
            bgSprite  = screen.ScreenManager.Content.Load <Texture2D>("Backgrounds/gray");
            LabelFont = screen.ScreenManager.Fonts.DetailsFont;
            BigFont   = screen.ScreenManager.Fonts.FrameRateCounterFont;

            for (int i = 0; i < menuEntries.Count; ++i)
            {
                menuEntries[i].Initialize();
            }
#if WINDOWS
            UpdateLikedItemsUI();
#endif
            allLikedItems = SaveHelper.Load("SwarmsSaves");
        }
Example #2
0
        private async void ImportSwarmSaveData()
        {
#if WINDOWS
#else
            allLikedItems = await controlClient.Import();
#endif
            UpdateLikedItemsUI();
        }
Example #3
0
        private void UpdateLikedItemsUI()
        {
#if WINDOWS
            SaveAllSpecies allLikedItems = SaveHelper.Load("SwarmsSaves");
#endif
            menuEntries.RemoveAll(s => s.GetType() == typeof(SavedSwarmButton));
            if (allLikedItems != null)
            {
                if (allLikedItems.Count == 1)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                }
                else if (allLikedItems.Count == 2)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[1].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall2, allLikedItems[1].GetMostUsedColors(), screen);
                }
                else if (allLikedItems.Count == 3)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[1].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall2, allLikedItems[1].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[2].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall3, allLikedItems[2].GetMostUsedColors(), screen);
                }
                else if (allLikedItems.Count == 4)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[1].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall2, allLikedItems[1].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[2].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall3, allLikedItems[2].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[3].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall4, allLikedItems[3].GetMostUsedColors(), screen);
                }
                else if (allLikedItems.Count == 5)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[1].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall2, allLikedItems[1].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[2].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall3, allLikedItems[2].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[3].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall4, allLikedItems[3].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[4].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall5, allLikedItems[4].GetMostUsedColors(), screen);
                }
                else if (allLikedItems.Count == 6)
                {
                    AddSavedSwarm(allLikedItems[0].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall1, allLikedItems[0].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[1].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall2, allLikedItems[1].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[2].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall3, allLikedItems[2].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[3].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall4, allLikedItems[3].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[4].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall5, allLikedItems[4].GetMostUsedColors(), screen);
                    AddSavedSwarm(allLikedItems[5].CreadtedDt.ToString("h:mm:ss"), EntryType.Recall6, allLikedItems[5].GetMostUsedColors(), screen);
                }
            }
        }
Example #4
0
        public static void Save(string filename, SaveAllSpecies savespecies)
        {
#if WINDOWS
            try
            {
                Stream stream = File.Create(filename + ".xml");
                XmlSerializer serializer = new XmlSerializer(typeof(SaveAllSpecies));
                serializer.Serialize(stream, savespecies);
                stream.Close();
            }
            catch
            {
                //
            }
#elif NETFX_CORE
            SaveW8(filename, savespecies);
        #endif
        }
Example #5
0
        private void SaveSwarm(SaveWorldParameters saveWorldParameters)
        {
#if WINDOWS
            SaveAllSpecies allLikedItems = SaveHelper.Load("AllSaved");
#else
#endif
            if (allLikedItems != null && allLikedItems.Count() >= maxLikedItems)
            {
                //Replacing
                SaveSpecies oldestSpecies = allLikedItems.OrderBy(s => s.CreadtedDt).First();
                allLikedItems.Remove(oldestSpecies);
                Save(saveWorldParameters);
            }

            if (allLikedItems != null && allLikedItems.Count > 0)
            {
                if (allLikedItems.Count == 1)
                {
                    Save(saveWorldParameters);
                }
                else if (allLikedItems.Count == 2)
                {
                    Save(saveWorldParameters);
                }
                else if (allLikedItems.Count == 3)
                {
                    Save(saveWorldParameters);
                }
                else if (allLikedItems.Count == 4)
                {
                    Save(saveWorldParameters);
                }
                else if (allLikedItems.Count == 5)
                {
                    Save(saveWorldParameters);
                }
            }
            else
            {
                Save(saveWorldParameters);
            }
        }
Example #6
0
        public ButtonSection(bool flip, SwarmScreenBase swarmscreen, string desc)
        {
            rect.Width = 100;
            rect.Height = 360;
            screen = swarmscreen;
            innerRect.Width = rect.Width - BorderThickness;
            innerRect.Height = rect.Height - BorderThickness;
            description = desc;
            allLikedItems = new SaveAllSpecies();

            //AddMenuItem("+ ZOOM", EntryType.ZoomIn, _screen);
            //AddMenuItem("- ZOOM", EntryType.ZoomOut, _screen);
            //AddMenuItem("Mutation", EntryType.Game, _screen);

            //AddMenuItem("Stable", EntryType.Stable, _screen);
            //AddMenuItem("Swinger", EntryType.Swinger, _screen);
            //AddMenuItem("Console", EntryType.Debugger, _screen);
            //AddMenuItem("Import", EntryType.ImportLikes, _screen);
            //AddMenuItem("Export", EntryType.ExportLikes, _screen);
            //AddMenuItem("Like", EntryType.Save, _screen);
#if WINDOWS
            AddMenuItem("Stable", EntryType.Stable, screen);
            AddMenuItem("Mutation", EntryType.Mutation, screen);
            AddMenuItem("Start Cluster", EntryType.AudioPlay, screen);
            AddMenuItem("Stop Cluster", EntryType.AudioPause, screen);
            AddMenuItem("Analyze", EntryType.Analyze, screen);
            AddMenuItem("Console", EntryType.Debugger, screen);
            AddMenuItem("Like", EntryType.Save, screen);
#else
            AddMenuItem("Stable", EntryType.Stable, swarmscreen);
            AddMenuItem("Mutation", EntryType.Mutation, swarmscreen);
            AddMenuItem("Console", EntryType.Debugger, swarmscreen);
            AddMenuItem("Import", EntryType.ImportLikes, swarmscreen);
            AddMenuItem("Export", EntryType.ExportLikes, swarmscreen);
            AddMenuItem("Like", EntryType.Save, swarmscreen);
            
#endif


        }
Example #7
0
        public ButtonSection(bool flip, SwarmScreenBase swarmscreen, string desc)
        {
            rect.Width       = 100;
            rect.Height      = 360;
            screen           = swarmscreen;
            innerRect.Width  = rect.Width - BorderThickness;
            innerRect.Height = rect.Height - BorderThickness;
            description      = desc;
            allLikedItems    = new SaveAllSpecies();

            //AddMenuItem("+ ZOOM", EntryType.ZoomIn, _screen);
            //AddMenuItem("- ZOOM", EntryType.ZoomOut, _screen);
            //AddMenuItem("Mutation", EntryType.Game, _screen);

            //AddMenuItem("Stable", EntryType.Stable, _screen);
            //AddMenuItem("Swinger", EntryType.Swinger, _screen);
            //AddMenuItem("Console", EntryType.Debugger, _screen);
            //AddMenuItem("Import", EntryType.ImportLikes, _screen);
            //AddMenuItem("Export", EntryType.ExportLikes, _screen);
            //AddMenuItem("Like", EntryType.Save, _screen);
#if WINDOWS
            AddMenuItem("Stable", EntryType.Stable, screen);
            AddMenuItem("Mutation", EntryType.Mutation, screen);
            AddMenuItem("Start Cluster", EntryType.AudioPlay, screen);
            AddMenuItem("Stop Cluster", EntryType.AudioPause, screen);
            AddMenuItem("Analyze", EntryType.Analyze, screen);
            AddMenuItem("Console", EntryType.Debugger, screen);
            AddMenuItem("Like", EntryType.Save, screen);
#else
            AddMenuItem("Stable", EntryType.Stable, swarmscreen);
            AddMenuItem("Mutation", EntryType.Mutation, swarmscreen);
            AddMenuItem("Console", EntryType.Debugger, swarmscreen);
            AddMenuItem("Import", EntryType.ImportLikes, swarmscreen);
            AddMenuItem("Export", EntryType.ExportLikes, swarmscreen);
            AddMenuItem("Like", EntryType.Save, swarmscreen);
#endif
        }
Example #8
0
 private static async void SaveW8(string filename, SaveAllSpecies savespecies)
 {
     await W8SaveFile(filename, savespecies);
 }
Example #9
0
        private async void ExportSwarmSaveData()
        {
            allLikedItems = await controlClient.Export();

            UpdateLikedItemsUI();
        }
Example #10
0
        public async Task <SaveAllSpecies> Export()
        {
            SaveAllSpecies export = await ImportExportHelper.Export();

            return(export);
        }
Example #11
0
        private async void GetLocalSaveSwarmData()
        {
            allLikedItems = await SaveHelper.LoadGameFile("AllSaved");

            UpdateLikedItemsUI();
        }
Example #12
0
        public void Load()
        {
            if (allLikedItems == null)
            {
#if NETFX_CORE
                GetLocalSaveSwarmData();
#endif
            }
            spriteBatch = new SpriteBatch(screen.ScreenManager.GraphicsDevice);
            debugScreen = screen.ScreenManager.Game.Services.GetService(typeof(IDebugScreen)) as IDebugScreen;
            controlClient = screen.ScreenManager.Game.Services.GetService(typeof(IControlClient)) as IControlClient;
            Viewport viewport = screen.ScreenManager.GraphicsDevice.Viewport;
            position = new Vector2(screen.ScreenManager.GraphicsDevice.Viewport.Width - rect.Width, 0);// + _containerMargin;
            bgSprite = screen.ScreenManager.Content.Load<Texture2D>("Backgrounds/gray");
            LabelFont = screen.ScreenManager.Fonts.DetailsFont;
            BigFont = screen.ScreenManager.Fonts.FrameRateCounterFont;

            for (int i = 0; i < menuEntries.Count; ++i)
            {
                menuEntries[i].Initialize();
            }
#if WINDOWS
            UpdateLikedItemsUI();
#endif
            allLikedItems = SaveHelper.Load("SwarmsSaves");
        }
Example #13
0
 private async void ExportSwarmSaveData()
 {
     allLikedItems = await controlClient.Export();
     UpdateLikedItemsUI();
 }
Example #14
0
        private async void ImportSwarmSaveData()
        {
#if WINDOWS
            
#else
            allLikedItems = await controlClient.Import();
#endif
            UpdateLikedItemsUI();
        }
Example #15
0
 private async void GetLocalSaveSwarmData()
 {
     allLikedItems = await SaveHelper.LoadGameFile("AllSaved");
     UpdateLikedItemsUI();
 }
Example #16
0
 static async Task<SaveAllSpecies> W8SaveFile(string filename, SaveAllSpecies data)
 {
     var objectStorageHelper = new WinRtUtility.ObjectStorageHelper<SaveAllSpecies>(WinRtUtility.StorageType.Local);
     await objectStorageHelper.SaveAsync(data, filename + ".xml");
     return data;
 }
Example #17
0
 static async Task<SaveAllSpecies> LoadFile(string filename)
 {
     SaveAllSpecies data = new SaveAllSpecies();
     try
     {
         var objectStorageHelper = new WinRtUtility.ObjectStorageHelper<SaveAllSpecies>(WinRtUtility.StorageType.Local);
         data = await objectStorageHelper.LoadAsync(filename + ".xml");
         return data;
     }
     catch (Exception e)
     {
         //Shit
         return new SaveAllSpecies();
     }
 }
Example #18
0
        public async Task <SaveAllSpecies> Import()
        {
            SaveAllSpecies import = await ImportExportHelper.Import();

            return(import);
        }