Exemplo n.º 1
0
 public void Load()
 {
     // BEGIN loading_test
     // Try to load the game from a file called "SaveGame.json"
     SavingService.LoadGame("SaveGame.json");
     // END loading_test
 }
Exemplo n.º 2
0
 public void Save()
 {
     // BEGIN saving_test
     // Save the game to a file called "SaveGame.json"
     SavingService.SaveGame("SaveGame.json");
     // END saving_test
 }
Exemplo n.º 3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject == player)
     {
         TimeLapseController.instance.TimeLapseCharge += 4;
         Destroy(this.gameObject);
         SavingService.SaveGame("SaveGame.json");
     }
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    throw new WrongCommandLineArguments("Arguments are not specified.");
                }
                switch (args[0].Substring(1))
                {
                case "s":
                    if (args.Length < 2)
                    {
                        throw new WrongCommandLineArguments("Folder path is not specified.");
                    }
                    EstimatingService.EstimateWorkToSave(@args[1]);
                    if (args.Length < 3)
                    {
                        SavingService.Save(@args[1], null);
                    }
                    else
                    {
                        SavingService.Save(@args[1], @args[2]);
                    }
                    break;

                case "u":
                    if (args.Length < 2)
                    {
                        throw new WrongCommandLineArguments("File path is not specified.");
                    }
                    EstimatingService.EstimateWorkToUnpack(@args[1]);
                    if (args.Length < 3)
                    {
                        UnpackingService.Unpack(@args[1], null);
                    }
                    else
                    {
                        UnpackingService.Unpack(@args[1], @args[2]);
                    }
                    break;

                default:
                    throw new WrongCommandLineArguments("Arguments are not recognized.");
                }
            }
            catch (WrongCommandLineArguments e)
            {
                InfoService.ShowErrorMessage(e.Message);
                InfoService.ShowHelpMessage();
            }
            catch (Exception e)
            {
                InfoService.ShowErrorMessage(e.Message);
            }
        }
 public AddInterestCommand(SavingService savingService)
 {
     this.savingService = savingService;
 }
        public string DispatchCommand(string[] commandParameters)
        {
            string commandName = commandParameters[0];

            commandParameters = commandParameters.Skip(1).ToArray();
            string          result          = string.Empty;
            SavingService   savingService   = new SavingService();
            CheckingService checkingService = new CheckingService();
            UserService     userService     = new UserService();


            switch (commandName)
            {
            case "Exit":
                ExitCommand exit = new ExitCommand();
                result = exit.Execute();
                break;

            case "Deposit":
                DepositCommand deposit = new DepositCommand(savingService);
                result = deposit.Execute(commandParameters);
                break;

            case "Withdraw":
                WithdrawCommand withdeow = new WithdrawCommand(savingService);
                result = withdeow.Execute(commandParameters);
                break;

            case "AddInterest":
                AddInterestCommand addInterest = new AddInterestCommand(savingService);
                result = addInterest.Execute(commandParameters);
                break;

            case "DeductFee":
                DeductCommand deduct = new DeductCommand(checkingService);
                result = deduct.Execute(commandParameters);
                break;

            case "Register":
                RegisterCommand register = new RegisterCommand(userService);
                result = register.Execute(commandParameters);
                break;

            case "Login":
                LoginCommand login = new LoginCommand();
                result = login.Execute(commandParameters);
                break;

            case "Logout":
                Logout logout = new Logout();
                result = logout.Execute();
                break;

            case "AddSavingAccount":
                AddSavingAccountCommand addAccount = new AddSavingAccountCommand(savingService);
                result = addAccount.Execute(commandParameters);
                break;

            case "ListAccounts":
                ListAccounts listAccounts = new ListAccounts(savingService, checkingService);
                result = listAccounts.Execute();
                break;
            }
            return(result);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Call the LoadGame() method from SavingService.cs
 /// Input fileName is case sensitive, make sure input written excatly like it is a Application.persistentDataPath.
 /// </summary>
 /// <param name="fileName"></param>
 public void loadGame()
 {
     SavingService.LoadGame("SaveGame.json");
 }
Exemplo n.º 8
0
 /// <summary>
 /// Call the SavingService.cs SaveGame method on the current active scene.
 /// </summary>
 public void saveGame()
 {
     // Save the game to a file called "SaveGame.json"
     SavingService.SaveGame("SaveGame.json");
 }
Exemplo n.º 9
0
 // Start is called before the first frame update
 void Start()
 {
     SavingService.SaveGame(fileName);
 }
Exemplo n.º 10
0
 public void SaveGame()
 {
     SavingService.SaveGame("saveGame.json");
 }
Exemplo n.º 11
0
 public RecordingController(RecordingService recordingService, SavingService savingService)
 {
     this.savingService    = savingService;
     this.recordingService = recordingService;
 }
 public AddSavingAccountCommand(SavingService savingAccount)
 {
     this.savingService = savingAccount;
 }