예제 #1
0
        /// <summary>
        /// Saves Control Scheme
        /// </summary>
        /// <param name="Scheme">The supported controller setting to save</param>
        public static void SaveArcadeControlScheme(SupportedControllers Scheme)
        {
            BinaryFormatter Formatter = new BinaryFormatter();
            string          SavePath  = Application.persistentDataPath + "/controlconfig.masf";
            FileStream      Stream    = new FileStream(SavePath, FileMode.OpenOrCreate);

            ArcadeData Data = new ArcadeData(Scheme);

            Formatter.Serialize(Stream, Data);
            Stream.Close();
        }
예제 #2
0
        /// =========================================================================================================================
        /// =========================================================================================================================
        ///
        ///         General Arcade  ( Saving / Loading )
        ///
        /// =========================================================================================================================
        /// =========================================================================================================================


        /// <summary>
        /// Saves Settings Data
        /// </summary>
        /// <param name="Settings">Settings Script With the data to save</param>
        public static void SaveArcadeSettings(Menu.SettingsScript Settings)
        {
            BinaryFormatter Formatter = new BinaryFormatter();
            string          SavePath  = Application.persistentDataPath + "/settings.masf";
            FileStream      Stream    = new FileStream(SavePath, FileMode.OpenOrCreate);

            ArcadeData Data = new ArcadeData(Settings);

            Formatter.Serialize(Stream, Data);
            Stream.Close();
        }
예제 #3
0
        /// <summary>
        /// Loads the Arcade control scheme
        /// </summary>
        /// <returns>ArcadeData with Control Scheme</returns>
        public static ArcadeData LoadArcadeControlScheme()
        {
            string SavePath = Application.persistentDataPath + "/controlconfig.masf";

            if (File.Exists(SavePath))
            {
                BinaryFormatter Formatter = new BinaryFormatter();
                FileStream      Stream    = new FileStream(SavePath, FileMode.Open);

                ArcadeData Data = Formatter.Deserialize(Stream) as ArcadeData;

                Stream.Close();

                return(Data);
            }
            else
            {
                Debug.LogError("Save file not found! (Arcade Control Scheme - Load)");
                return(null);
            }
        }
예제 #4
0
        /*
         * Format Types
         *
         * masf = Micro Arcade Save File
         * malf = Micro Arcade Leaderboard File
         *
         */
        /// <summary>
        /// Creates all the save files with default vlaues if they do not exist on the system (helps avoid errors later on)
        /// </summary>
        public static void InitialseFiles()
        {
            BinaryFormatter _formatter   = new BinaryFormatter();
            string          baseSavePath = Application.persistentDataPath;

            FileStream _stream;

            // Create Save Files
            // /settings.masf
            if (!File.Exists(baseSavePath + "/settings.masf"))
            {
                _stream = new FileStream(baseSavePath + "/settings.masf", FileMode.Create);
                ArcadeData _settingsData = new ArcadeData();
                _formatter.Serialize(_stream, _settingsData);
                _stream.Close();
            }

            // /controlconfig.masf -- is not made here as it works when you first run the project with a multi input
            //if (!File.Exists(baseSavePath + "/controlconfig.masf"))
            //{
            //    _stream = new FileStream(baseSavePath + "/controlconfig.masf", FileMode.Create);
            //    ArcadeData _controlData = new ArcadeData();
            //    _formatter.Serialize(_stream, _controlData);
            //    _stream.Close();
            //}

            // /arcadeonline.masf
            if (!File.Exists(baseSavePath + "/arcadeonline.masf"))
            {
                _stream = new FileStream(baseSavePath + "/arcadeonline.masf", FileMode.Create);
                ArcadeOnlinePaths _onlineData = new ArcadeOnlinePaths();
                _formatter.Serialize(_stream, _onlineData);
                _stream.Close();
            }



            // Pinball Save Files

            // /ultimatepinball.masf
            if (!File.Exists(baseSavePath + "/ultimatepinball.masf"))
            {
                _stream = new FileStream(baseSavePath + "/ultimatepinball.masf", FileMode.Create);
                UltimatePinballData _pinballData = new UltimatePinballData();
                _formatter.Serialize(_stream, _pinballData);
                _stream.Close();
            }

            // /ultimatepinballsession.masf
            if (!File.Exists(baseSavePath + "/ultimatepinballsession.masf"))
            {
                _stream = new FileStream(baseSavePath + "/ultimatepinballsession.masf", FileMode.Create);
                UltimatePinballSessionData _pinballSessionData = new UltimatePinballSessionData();
                _formatter.Serialize(_stream, _pinballSessionData);
                _stream.Close();
            }

            // /ultimatepinballsession.malf
            if (!File.Exists(baseSavePath + "/ultimatepinball.malf"))
            {
                _stream = new FileStream(baseSavePath + "/ultimatepinball.malf", FileMode.Create);
                _formatter.Serialize(_stream, null);
                _stream.Close();
            }



            // Operation Starshine Save Files

            // /operationstarshine.masf
            if (!File.Exists(baseSavePath + "/operationstarshine.masf"))
            {
                _stream = new FileStream(baseSavePath + "/operationstarshine.masf", FileMode.Create);
                OperationStarshineData _operationStarshineData = new OperationStarshineData();
                _formatter.Serialize(_stream, _operationStarshineData);
                _stream.Close();
            }

            // /operationstarshine.malf
            if (!File.Exists(baseSavePath + "/operationstarshine.malf"))
            {
                _stream = new FileStream(baseSavePath + "/operationstarshine.malf", FileMode.Create);
                StarshineLeaderboardData _operationStarshineLeaderboardData = new StarshineLeaderboardData();
                _formatter.Serialize(_stream, _operationStarshineLeaderboardData);
                _stream.Close();
            }



            // Quacking Time Save Files

            // /quackingtime.masf
            if (!File.Exists(baseSavePath + "/quackingtime.masf"))
            {
                _stream = new FileStream(baseSavePath + "/quackingtime.masf", FileMode.Create);
                QuackingTimeData _quackingTimeData = new QuackingTimeData();
                _formatter.Serialize(_stream, _quackingTimeData);
                _stream.Close();
            }



            // Crushing Save Files

            // /crushing.masf
            if (!File.Exists(baseSavePath + "/crushing.masf"))
            {
                _stream = new FileStream(baseSavePath + "/crushing.masf", FileMode.Create);
                CrushingData _crushingData = new CrushingData();
                _formatter.Serialize(_stream, _crushingData);
                _stream.Close();
            }
        }