Example #1
0
        public SaveClient RequestSaveAccess()
        {
            var client = new SaveClient();

            saveClientList.Add(client);
            return(client);
        }
Example #2
0
 private void OnEnable()
 {
     if (_saveClient == null)
     {
         _saveClient = gameConfiguration.RequestSaveAccess(this);
     }
 }
Example #3
0
        public ActionResult Save(SaveService.User user)
        {
            SaveClient saveClient = new SaveClient();

            user.SubmitTime = DateTime.Now;
            saveClient.DoWork(user);
            return(RedirectToAction("Get"));
        }
Example #4
0
        private void Start()
        {
            saveClient = gameConfiguration.RequestSaveAccess(this);

            // disable continue when auto save does not exist
            continueButton.interactable = gameConfiguration.SaveIo.RequestSlotExecutor()
                                          .AtSlotIndex(GameConfiguration.AutoSaveIndex)
                                          .DoesExist();

            newGameButton.gameObject.SetActive(true);
            continueButton.gameObject.SetActive(true);
            optionsButton.gameObject.SetActive(true);
        }
Example #5
0
        private void Awake()
        {
            Debug.Assert(gameConfiguration != null);

            var characterPrefabList = gameConfiguration.characterPrefabList;

            _characterList = new UnifiedCharacterScript[characterPrefabList.Length];
            for (int i = 0; i < characterPrefabList.Length; i++)
            {
                _characterList[i] = InstantiateCharacter(characterPrefabList[i]);
            }

            _narratingCharacter = InstantiateCharacter(gameConfiguration.narratingCharacterPrefab);
            _mainCharacter      = InstantiateCharacter(gameConfiguration.mainCharacterPrefab);

            if (_saveClient == null)
            {
                _saveClient = gameConfiguration.RequestSaveAccess(this);
            }
        }
Example #6
0
        public IActionResult ProcessClient([FromBody] SaveClient client)
        {
            if (null == client)
            {
                return(BadRequest());
            }

            try
            {
                var id = BackgroundJob.Enqueue(() => _htsService.Process(client.Clients));
                return(Ok(new
                {
                    BatchKey = id
                }));
            }
            catch (Exception e)
            {
                Log.Error(e, "manifest error");
                return(StatusCode(500, e.Message));
            }
        }
        private void Awake()
        {
            Debug.Assert(gameConfiguration != null);
            Debug.Assert(runner != null);
            Debug.Assert(memory != null);
            Debug.Assert(dialogueUiManager != null);

            // set up
            if (_saveClient == null)
            {
                _saveClient = gameConfiguration.RequestSaveAccess(this);
            }

            runner.startNode = _saveClient.currentSave.currentYarnNode;
            _gameInstance    = gameConfiguration.gameInstance;

            // attach auto save node
            runner.onNodeStart.AddListener(AutoSaveNode);

            memory.defaultVariables = _saveClient.currentSave.savedVariables.ToArray();
            memory.ResetToDefaults();
        }
Example #8
0
 private void OnDisable()
 {
     gameConfiguration.ReleaseSaveAccess(_saveClient);
     _saveClient = null;
 }
Example #9
0
        private void Awake()
        {
            _impulseSignal = GetComponent <CinemachineImpulseSource>();

            Debug.Assert(gameConfiguration != null);
            Debug.Assert(dialogueRunner != null);
            Debug.Assert(dialogueUiManager != null);
            Debug.Assert(prefabFadedAudio != null);
            Debug.Assert(memoryStorage != null);
            Debug.Assert(inputManager != null);
            Debug.Assert(iconManager != null);
            Debug.Assert(blackScreen != null);

            if (_saveClient == null)
            {
                _saveClient = gameConfiguration.RequestSaveAccess(this);
            }

            // initialize backgrounds
            _backgroundScriptList = new BackgroundScript[backgroundList.Length];
            for (int i = 0; i < backgroundList.Length; i++)
            {
                var script = Instantiate(backgroundList[i].prefab)
                             .GetComponent <BackgroundScript>();
                Debug.Assert(script != null);
                script.SetData(backgroundList[i]);
                _backgroundScriptList[i] = script;
            }

            ChangeHeader(new[] { _saveClient.currentSave.lastHeader });
            PlayAudio(new[] { _saveClient.currentSave.lastAudioName });

            // special case: shelf item
            if (!_saveClient.currentSave.shownItem.Equals(""))
            {
                foreach (var shelfItem in shelfItemDataList)
                {
                    if (shelfItem.variableName.Equals(_saveClient.currentSave.shownItem))
                    {
                        Debug.Log($"Shown item: ");
                        var o = shelfItem.CreateObject();
                        _shownShelfItem = o;
                        o.Initialize(shelfItem, this);
                        o.Display();
                        break;
                    }
                }
            }

            // load all active characters
            EnterStage(_saveClient.currentSave.activeCharacterList);

            dialogueRunner.AddCommandHandler(
                "playAudio", // the name of the command
                PlayAudio    // the method to run
                );

            dialogueRunner.AddCommandHandler("doPuzzle", DoPuzzle);
            dialogueRunner.AddCommandHandler("changeHeader", ChangeHeader);
            dialogueRunner.AddCommandHandler("changeBackground", ChangeHeader); // alias
            dialogueRunner.AddCommandHandler("shake", Shake);
            dialogueRunner.AddCommandHandler("debugLog", DebugLog);
            dialogueRunner.AddCommandHandler("clearShelfItem", ClearShelfItem);
            dialogueRunner.AddCommandHandler("resetSpeaker", ResetSpeaker);
            dialogueRunner.AddCommandHandler("removeSpeaker", ResetSpeaker);
            dialogueRunner.AddCommandHandler("showItem", ShowItem);
            dialogueRunner.AddCommandHandler("hideItem", HideItem);
            dialogueRunner.AddCommandHandler("showDialogue", ShowDialogue);
            dialogueRunner.AddCommandHandler("hideDialogue", HideDialogue);
            dialogueRunner.AddCommandHandler("gameEnd", GameEnd);
            dialogueRunner.AddCommandHandler("enterStage", EnterStage);
            dialogueRunner.AddCommandHandler("exitStage", ExitStage);
            dialogueRunner.AddCommandHandler("fakeLastDialog", FakeLastDialog);
            dialogueRunner.AddCommandHandler("playSFX", PlaySfx);
            dialogueRunner.AddCommandHandler("playSfx", PlaySfx);
            dialogueRunner.AddCommandHandler("playsfx", PlaySfx);
            dialogueRunner.AddCommandHandler("fadePlainBackground", FadePlainBackground);
        }
Example #10
0
 private static Client Map(ulong clientId, SaveClient r) => new Client(clientId, r.ClientName);
Example #11
0
        public async Task <StatusCodeResult> Put(ulong clientId, SaveClient client, CancellationToken cancellationToken)
        {
            var res = await this.mediator.Send(new UpdateClient(Map(clientId, client)), cancellationToken);

            return(res.Match <StatusCodeResult>(success => this.Ok(), _ => this.NotFound()));
        }
Example #12
0
 public Task <ulong> Post(SaveClient client, CancellationToken cancellationToken)
 {
     return(this.mediator.Send(new AddClient(Map(0, client)), cancellationToken));
 }
Example #13
0
 public void RemoveSaveClient(SaveClient saveClient)
 {
     saveClientList.Remove(saveClient);
 }
Example #14
0
 private void OnDestroy()
 {
     gameConfiguration.ReleaseSaveAccess(saveClient);
     saveClient = null;
 }