예제 #1
0
 public void OnHighScoresButtonClicked()
 {
     MainButtonPanel.SetActive(false);
     HighScorePanel.SetActive(true);
     SaveController.Load(highScoreData);
     highScoreMenu.Show(highScoreData);
 }
예제 #2
0
    public void Init(ScoreSettings settings, SaveController saveController)
    {
        m_Settings       = settings;
        m_SaveController = saveController;

        m_RecordScore = m_SaveController.MaxSingleScore;
    }
예제 #3
0
 public GameController(RenderController renderController,
                       InputController inputController,
                       SaveController saveController,
                       LevelController levelController,
                       LevelFactory levelFactory,
                       ItemFactory itemFactory,
                       ScreenFactory screenFactory,
                       PlayerFactory playerFactory,
                       EnemyFactory enemyFactory,
                       EventBus eventBus,
                       ScheduleController scheduleController
                       )
 {
     _renderController   = renderController;
     _inputController    = inputController;
     _saveController     = saveController;
     _levelController    = levelController;
     _levelFactory       = levelFactory;
     _itemFactory        = itemFactory;
     _screenFactory      = screenFactory;
     _playerFactory      = playerFactory;
     _enemyFactory       = enemyFactory;
     _eventBus           = eventBus;
     _scheduleController = scheduleController;
 }
예제 #4
0
    public void Load()
    {
        SaveController saveController = new SaveController();


        if (GameController.instance != null)
        {
            GameController.instance.talentTree.savedData = (SavedUnlockmentsData)saveController.LoadData("talentsData.json", GameController.instance.talentTree.savedData);
        }

        // Player block
        GameController.instance.player.playerData = (PlayerData)saveController.LoadData("player.json", GameController.instance.player.playerData);
        // load inventory
        GameController.instance.player.inventory = (Inventory)saveController.LoadData("inventory.json", GameController.instance.player.inventory);
        GameController.instance.player.inventory.OnLoad();

        GameController.instance.researcher.saveData = (SaveResearchData)saveController.LoadData("research.json", GameController.instance.researcher.saveData);
        GameController.instance.buttons.engineeringPanel.saveData = (SaveResearchData)saveController.LoadData("enhancement.json", GameController.instance.buttons.engineeringPanel.saveData);
        GameController.instance.buttons.engineeringPanel.OnLoad();
        World.instance.saveData           = (WorldSaveData)saveController.LoadData("world.json", World.instance.saveData);
        GameController.instance.time.date = (GameDate)saveController.LoadData("date.json", GameController.instance.time.date);
        GameController.instance.tutorialSettings.LoadTutorialState((List <bool>)saveController.LoadData("tutorial.json", GameController.instance.tutorialSettings.GetTutorialsState()));
        GameController.instance.buttons.market.SetTimers((List <int>)saveController.LoadData("timers.json", GameController.instance.buttons.market.GetTimers()));


        saveController.FireLoadEvent();

        World.instance.GenerateEpidemic();
    }
예제 #5
0
 public void end()
 {
     lastY = 666;
     adWindow.GetComponent <AdButtonMove>().moveIn();
     BrickCreator.end = true;
     SaveController.updateScore(score);
 }
예제 #6
0
        public GameController GetGameController(IOutputter outputter)
        {
            var randomiser         = new Randomiser(new System.Random());
            var scheduleController = new ScheduleController();
            var renderController   = new RenderController(outputter);
            var inputController    = new InputController();
            var saveController     = new SaveController();
            var levelController    = new LevelController();
            var levelFactory       = new LevelFactory(randomiser);
            var itemFactory        = new ItemFactory();
            var stringFormatter    = new StringFormatterSmartFormat();
            var assetBank          = new AssetBank(stringFormatter);
            var eventBus           = new EventBus();
            var eventKeeper        = new EventKeeper(eventBus, assetBank);
            var screenFactory      = new ScreenFactory(eventKeeper);
            var playerFactory      = new PlayerFactory(levelController, eventBus, randomiser, scheduleController);
            var enemyFactory       = new EnemyFactory(eventBus, randomiser, scheduleController);

            return(new GameController(
                       renderController,
                       inputController,
                       saveController,
                       levelController,
                       levelFactory,
                       itemFactory,
                       screenFactory,
                       playerFactory,
                       enemyFactory,
                       eventBus,
                       scheduleController
                       ));
        }
예제 #7
0
 public void playButton()
 {
     if (ScrollableResearchView == null)
     {
         ScrollableResearchView = ResearchController.instance.getScrollableResearchView();
         ScrollableResearchView.transform.SetParent(researchParent.transform, false);
     }
     updateXP();
     enableTraits();
     anim.SetFloat("speed", -1f);
     anim.SetBool("options", false);
     anim.SetFloat("speed", 1f);
     anim.SetBool("playButton", true);
     foreach (var o in saves)
     {
         Destroy(o);
     }
     foreach (var fileInfo in SaveController.GetFilePaths(SaveController.waveFolderName))
     {
         var save = Instantiate(saveObject, savesParent.transform);
         save.GetComponentInChildren <Text>().text = "Wave " + fileInfo.Name.Substring(0, fileInfo.Name.Length - 4);
         save.GetComponentInChildren <Button>().onClick.AddListener(() => loadSave(fileInfo.Name));
         save.GetComponentsInChildren <Text>()[1].text =
             "XP earned: " + SaveController.instance.LoadWave(fileInfo.Name).xpEarned;
         saves.Add(save);
     }
 }
예제 #8
0
        public void SaveTest_()
        {
            SaveDataDto dto = new SaveDataDto("toom");

            SaveController.SaveGame("key", dto);
            Assert.AreEqual(SaveController.SavedGameExists("key"), true);
        }
 public override void init()
 {
     saveController = Get <SaveController>();
     gameController = Get <GameController>();
     InitSquares();
     ProduceNextSquares();
 }
예제 #10
0
 /// <summary>
 /// add the new card to the deck and remove the old one
 /// </summary>
 public void ReplaceCard()
 {
     //CardGenerator.instance.LoadCards();
     //if the player confirmed
     if (playerChoice)
     {
         for (int i = 0; i < PlayerStats.instance.playerClass.deckList.Length; i++)
         {
             //find the card information from player stats
             Card temp = cardToRemove.GetComponent <CardDisplay>().card;
             //haha, this sucks man (i'm checking to see where the card we're replacing is)
             if (removeCardSpawns[i].card.GetComponent <CardDisplay>().card.ToString() == temp.ToString())
             {
                 //replace the card in the deck list and destroy the one we're removing
                 PlayerStats.instance.playerClass.deckList[i] = rewardChosen;
                 //theStack.AddCard(rewardChosen);
                 DeletePlayerDeck();
                 break;
             }
         }
         //going to a new round, so reset everything
         //theStack.RemoveCardFromDeck(cardToRemove.GetComponent<CardDisplay>().card.ToString());
         Destroy(cardToRemove.gameObject);
         cardToRemove = null;
         rewardChosen = null;
         SaveController.SaveGame();
         //TODO: put in animation/delay for removing card
     }
 }
    void Start()
    {
        saveController = FindObjectOfType <SaveController>();


        countUnlockedLevel = saveController.sv.level;

        if (countUnlockedLevel < 1) // Если сохранений нет
        {
            countUnlockedLevel = 1;
            saveController.sv.level++;   // Стартовое сохранение (значение 1)
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            if (i < countUnlockedLevel)
            {
                transform.GetChild(i).GetComponent <Image>().sprite        = unlocedIcon;
                transform.GetChild(i).GetComponent <Button>().interactable = true;
            }
            else
            {
                transform.GetChild(i).GetComponent <Image>().sprite        = lockedIcon;
                transform.GetChild(i).GetComponent <Button>().interactable = false;
            }

            transform.GetChild(i).gameObject.name = (i + 1).ToString();
            transform.GetChild(i).transform.GetChild(0).GetComponent <Text>().text = (i + 1).ToString();
            transform.GetChild(i).GetComponent <LevelSettings>().numberLevel       = (i + 1);
        }
    }
예제 #12
0
        public void Route(string[] args)
        {
            IController controller;
            var         command = args.Length != 0 ? args[0].ToLowerInvariant() : String.Empty;

            switch (command)
            {
            case "save":
                controller = new SaveController();
                break;

            case "list":
                controller = new ListController();
                break;

            case "fetch":
                controller = new FetchController();
                break;

            case "deleteboard":
                controller = new DeleteController();
                break;

            default:
                controller = new Controller();
                break;
            }

            controller.Process(command, args.Skip(1).ToArray());
        }
예제 #13
0
    // Called when an item is picked up. Prepares the tokens for saving.
    public static void ConvertInventoryToTokens()
    {
        // Remove all current inventory tokens. (anything containing "item|")
        List <string> toRemove = new List <string>();           // Need a list because you cannot modify a hashset while iterating over it.

        foreach (string ii in ConversationTrigger.tokens)
        {
            if (ii.Contains("item|"))
            {
                toRemove.Add(ii);
            }
        }
        foreach (string ii in toRemove)
        {
            ConversationTrigger.RemoveToken(ii, false);
        }

        // Create and add the tokens to model the inventory.
        // "item|PATH|COUNT"
        List <string> toAdd = new List <string>();              // Need a list because you cannot modify a hashset while iterating over it.

        foreach (KeyValuePair <string, InvItem> ii in items)
        {
            string newToken = "item|";
            newToken += ii.Value.pickup.GetComponent <PickUp>().prefabPath;
            newToken += "|";
            newToken += ii.Value.quantity;
            toAdd.Add(newToken);
        }
        foreach (string ii in toAdd)
        {
            ConversationTrigger.AddToken(ii, false);
        }
        SaveController.Save();
    }
예제 #14
0
    public void Save()
    {
        SaveController sC = new SaveController();

        saver.SaveScene();
        sC.SaveData("scene.json", saver);
    }
예제 #15
0
    public void Load()
    {
        SaveController sC = new SaveController();

        saver = (SceneSaver)sC.LoadData("scene.json", saver);
        loader.LoadScene(saver);
    }
    //Initialise Everything
    private void Awake()
    {
        //Initialise Variables
        LetterBoxes = new List <GameObject>();
        AnswerSlots = new List <GameObject>();
        currentSlot = 0;
        totalStars  = 0;
        emptySlots  = new List <int>();
        GetComponent <LevelObjectManager>().Initialise();
        levelObject = GetComponent <LevelObjectManager>().getRandomObject();

        //Initialise Save Controller
        SaveManager.Initialise();
        saveController = GetComponent <SaveController>();
        saveController.ClearLevelData();
        incorrectLetters = 0;
        correctLetters   = 0;
        hints            = 0;

        //Initialise Audio
        audioManager = FindObjectOfType <AudioManager>();

        //Start first level
        startLevel(levelObject);
    }
예제 #17
0
 public void OnSave()
 {
     print("save");
     gameObject.BroadcastMessage("Save");
     SaveController.SaveGame(GameController.currentSceneIndex, infoToSave);
     StartCoroutine(game.SaveAndLoadCooldown(true));
 }
예제 #18
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #19
0
    void Start()
    {
        GameLogic.IterationColors = IterationsColors;
        minDragDist = Screen.width / Colomns;
        field       = new ElementData[Rows, Colomns];
        fieldVis    = new VisualElement[Rows, Colomns];



        SaveData sd = SaveController.Load(SaveKey);

        if (sd == null)
        {
            GameLogic.CleverMapGeneration(field, Min, Max);
            lastNumber = Random.Range(Min, Max);
        }
        else
        {
            field        = sd.ArrayToMap();
            currentScore = sd.Score;
            lastNumber   = sd.LastNumber;
            //lastNumber--;
            //if (lastNumber < Min)
            //    lastNumber = Max;
        }
        Score.text     = currentScore + "";
        HighScore.text = GameData.HighScore.ToString();
        GameLogic.GenerateCircle(fieldVis, field, Parent, ElementPrefab, new Vector2(5, 5), out angles);
        GameLogic.GenerateMapVisuals(1, Colomns, WaitGPSPanel.GetChild(0).GetComponent <RectTransform>(), ElementBasePrefab, CircleBasePrefab, new Vector2(5, 5));
        BackButton.Switch(false);
    }
예제 #20
0
        public void SaveAs(FileType file)
        {
            if (file == FileType.All)
            {
                Tuple <string, bool> mainOut = _fileBrowser.SaveFileAccess(MainFileDirectory, MainFileName, ExtensionType.Main, "Save Main File As...");

                if (mainOut.Item2 is true)
                {
                    SaveController.PullMainFileData(MainFileName, mainOut.Item1);

                    Tuple <string, bool> budgetOut = _fileBrowser.SaveFileAccess(BudgetDirectory, BudgetFileName, ExtensionType.Budget, "Save Budget As...");

                    if (budgetOut.Item2 is true)
                    {
                        SaveController.PullBudgetFileData(BudgetFileName, budgetOut.Item1, DataViewModel.IncomeDataList.ToArray(), DataViewModel.ExpenseDataList.ToArray());
                    }
                    else
                    {
                        SaveController.Main.Budget = null;
                    }

                    Tuple <string, bool> categoryOut = _fileBrowser.SaveFileAccess(CategoryDirectory, CategoryFileName, ExtensionType.Category, "Save Categories As...");

                    if (categoryOut.Item2 is true)
                    {
                        SaveController.PullCategoryData(CategoryFileName, categoryOut.Item1, Income.AllIncomeCategories.ToArray(), Expense.AllExpenseCategories.ToArray());
                    }
                    else
                    {
                        SaveController.Main.Category = null;
                    }

                    Tuple <string, bool> paystubOut = _fileBrowser.SaveFileAccess(PaystubDirectory, PaystubFileName, ExtensionType.Paystub, "Save Paystubs As...");

                    if (paystubOut.Item2 is true)
                    {
                        SaveController.PullPaystubData(PaystubFileName, paystubOut.Item1, PaystubViewModel.CollectionDescription, PaystubViewModel.PaystubDataList.ToArray());
                    }
                    else
                    {
                        SaveController.Main.Paystub = null;
                    }

                    SaveController.BeginSave(MessageManager.DisplayMessage);
                }
            }
            else if (file == FileType.Budget)
            {
                Tuple <string, bool> budgetOut = _fileBrowser.SaveFileAccess(BudgetDirectory, BudgetFileName, ExtensionType.Budget, "Save Budget As...");
            }
            else if (file == FileType.Category)
            {
                Tuple <string, bool> categoryOut = _fileBrowser.SaveFileAccess(CategoryDirectory, CategoryFileName, ExtensionType.Category, "Save Categories As...");
            }
            else if (file == FileType.Paystub)
            {
                Tuple <string, bool> paystubOut = _fileBrowser.SaveFileAccess(PaystubDirectory, PaystubFileName, ExtensionType.Paystub, "Save Paystubs As...");
            }
        }
예제 #21
0
    IEnumerator LoadFile(string url)
    {
        WWW file = new WWW(url);

        yield return(file);

        SaveController.LoadSave(new System.IO.MemoryStream(file.bytes));
    }
예제 #22
0
        public void SetSaveController(SaveController SaveController)
        {
            _SaveController = SaveController;

            //Loading earlier set paths
            DocumentPathTextBox.Text = _SaveController.GetSavePath();
            SaveFileNameTextBox.Text = _SaveController.GetFileName();
        }
예제 #23
0
 public static void RemoveToken(string token)
 {
     if (tokens.Contains(token))
     {
         tokens.Remove(token);
         SaveController.Save();
     }
 }
예제 #24
0
 public static void AddToken(string token, bool save)
 {
     tokens.Add(token);
     if (save)
     {
         SaveController.Save();
     }
 }
예제 #25
0
    void Awake()
    {
        if (!Instance)
        {
            Instance = this;
        }

        SaveControls = FindObjectOfType <SaveController>();
    }
예제 #26
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     sceneindex    = SceneManager.GetActiveScene().buildIndex;
     levelComplete = PlayerPrefs.GetInt("LevelComplete");
 }
예제 #27
0
 void Awake()
 {
     if (SaveController.instance != null)
     {
         Destroy(gameObject);
         return;
     }
     SaveController.instance = this;
 }
예제 #28
0
 void Start()
 {
     bestScoreText.text = "Лучший счет: " + SaveController.GetBestScore().ToString();
     settingsWindow.gameObject.SetActive(false);
     startGameButton.onClick.AddListener(StartGame);
     settingsButton.onClick.AddListener(Settings);
     exitButton.onClick.AddListener(Exit);
     acceptColorButton.onClick.AddListener(AcceptColor);
 }
예제 #29
0
 public FinishHandler(
     LevelState levelState,
     StateBroker stateBroker,
     EventBus eventBus,
     LevelSettings settings,
     SaveController saveController) : base(levelState, stateBroker, eventBus)
 {
     _settings       = settings;
     _saveController = saveController;
 }
예제 #30
0
    private void DeleteSaves()
    {
        StopAllCoroutines();
        SaveController saveController = new SaveController();

        if (Directory.Exists(Path.Combine(Application.persistentDataPath, saveController.directoryName)))
        {
            Directory.Delete(Path.Combine(Application.persistentDataPath, saveController.directoryName), true);
        }
    }