public GameController(Form gameBoard, LeaderboardController leaderboardManager, int gameBoardSize, int startSpeed, int maxSpeed, int speedIncrease, int maxBlocksCount) { // Disables the block selection this.blockSelectionIsEnabled = false; // Sets initial values for the game this.leaderboardManager = leaderboardManager; this.RequiredCurrentLevelBlocks = new List <string>(); this.SelectedBlocks = new List <string>(); this.CurrentPlayerScore = 0; this.GameBoardSize = gameBoardSize; this.requredCurrentLevelBlocks = Constants.StartBlocksCount; this.gameBoard = gameBoard; this.startSpeed = startSpeed; this.maxSpeed = maxSpeed; this.speedIncrease = speedIncrease; this.maxBlocksCount = maxBlocksCount; this.gameBlocksShowTime = this.startSpeed; }
void Start() { _controller = GameController.Instance; _exitAudio = GetComponent <AudioSource>(); _exitAudio.clip = ExitClip; lb = LeaderboardController.Instance; }
public async Task Quando_Requisitar_GetAll() { // Arrange var serviceMock = new Mock <ILeaderboardService>(); var id = Guid.NewGuid(); serviceMock.Setup(a => a.GetTop100()).ReturnsAsync(new List <LeaderboardViewModel> { new LeaderboardViewModel { PlayerId = 4, Balance = 2, LastUpdateDate = DateTime.UtcNow }, new LeaderboardViewModel { PlayerId = 2, Balance = 3, LastUpdateDate = DateTime.UtcNow } }); _controller = new LeaderboardController(serviceMock.Object); // Act var result = await _controller.GetTop100(); // Assert Assert.True(result is OkObjectResult); var resultValue = ((OkObjectResult)result).Value as IList <LeaderboardViewModel>; Assert.True(resultValue.Count() == 2); }
public async Task Quando_Requisitar_GetAll_BadRequest() { // Arrange var serviceMock = new Mock <ILeaderboardService>(); var id = Guid.NewGuid(); serviceMock.Setup(a => a.GetTop100()).ReturnsAsync(new List <LeaderboardViewModel> { new LeaderboardViewModel { PlayerId = 4, Balance = 2, LastUpdateDate = DateTime.UtcNow }, new LeaderboardViewModel { PlayerId = 2, Balance = 3, LastUpdateDate = DateTime.UtcNow } }); _controller = new LeaderboardController(serviceMock.Object); _controller.ModelState.AddModelError("Id", "Formato Invalido"); // Act var result = await _controller.GetTop100(); // Assert Assert.True(result is BadRequestObjectResult); Assert.False(_controller.ModelState.IsValid); }
private void SceneLoaded(Scene to, LoadSceneMode mode) { Logger.Debug($"Scene loaded: \"{to.name}\""); if (to.name == "MenuCore") { PluginUI.Init(); GameController.Init(to); LeaderboardController.Init(to); Controllers.PlayerController.Init(to); VoiceChatWorker.Init(); } try { if (to.name == "MenuCore" && SteamAPI.getLobbyID().m_SteamID > 0) { Logger.Debug("Creating new lobby"); SteamAPI.CreateLobby(!Config.Instance.IsPublic); Controllers.PlayerController.Instance.DestroyAvatars(); } } catch (Exception e) { Logger.Error(e); } }
public UploadTime(long time, LeaderboardController leaderboardController) { Time = time; LeaderboardController = leaderboardController; LeaderboardController.enabled = true; LeaderboardController.AllScoreDataPath = TimeDataUtil.GetDBRankPath(CommonData.gameWorld.worldMap); }
void MakeSingleton(){ if(instance != null){ Destroy (gameObject); } else { instance = this; DontDestroyOnLoad (gameObject); } }
void Start() { usernameField = GameObject.Find("UsernameField").GetComponent <InputField>(); LeaderboardDataSendError = GameObject.Find("LeaderboardDataSendError").GetComponent <Text>(); leaderboardScorePanel = GameObject.Find("SendLeaderboardScorePanel"); leaderboardScorePanel.SetActive(false); instance = this; }
private void Awake() { _leaderboardController = LeaderboardController.Instance; if (_leaderboardController != null) { _leaderboardController.OnLeaderbordForLevelUpdated += OnLeaderbordForLevelUpdated; } }
public void saveHighScore() { if(PlayerPrefs.GetInt("Highscore") < PlayerPrefs.GetInt("Currentscore")) { PlayerPrefs.SetInt("Highscore" , (int)score); LeaderboardController lead = new LeaderboardController(); lead.SaveScore(); } }
void Awake() { _anim = GetComponent <Animator>(); loadingAnimator = loadingScreen.GetComponent <Animator>(); menuCanvasGroup = GetComponent <CanvasGroup>(); _controlRig = FindObjectOfType <MobileControlRig>(); _tutorialController = FindObjectOfType <TutorialController>(); _leaderboard = FindObjectOfType <LeaderboardController>(); }
public UserGameState(GameController owner, GameModel gameModelCore, UIContainer uiContainer, LeaderboardController leaderboardController) { _owner = owner; _gameModelCore = gameModelCore; _uiContainer = uiContainer; _leaderboardController = leaderboardController; CloseUI(); }
/// <summary> /// Se actualiza periódicamente para mantener el estado de la partida actualizado /// </summary> public void SendGameDataToServer() { _leaderboard = FindObjectOfType <LeaderboardController>(); var updateData = new UpdateData { name = _leaderboard.GetComponent <LeaderboardController>().GetPlayerName(), score = _HUD.GetComponent <HUDManager>().GetScore() }; _client.Send(updateData.ToJson()); }
public void CreateCorrectInstance_WhenParametersAreValid() { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); // Act var actualInstance = new LeaderboardController(leaderboardService.Object); // Assert Assert.That(actualInstance, Is.Not.Null); Assert.That(actualInstance, Is.InstanceOf <LoggingController>()); }
private void UpdateSquadDataForInvites(List <SquadInvite> invites) { LeaderboardController leaderboardController = Service.LeaderboardController; int i = 0; int count = invites.Count; while (i < count) { this.UpdateSquadDataForInvite(invites[i], leaderboardController); i++; } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
void MakeSingleton() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
// Start is called before the first frame update void Start() { Time.timeScale = 1f; //Sets current time as the initial time currentTime = memorizeTime; totalTime = 0; leaderboardControllerScript = GameObject.Find("LeaderboardController").GetComponent <LeaderboardController>(); playerPrefsScript = this.GetComponent <PlayerPreferences>(); objectsControllerScript = this.GetComponent <ObjectsController>(); audioControllerScript = this.GetComponent <AudioController>(); }
public void InvokeILeaderboardDamageService_GetTopStoredDamageOnPageMethodOnceWithCorrectParameter_WhenPageNumberIsIntMaxValue() { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); var leaderboardController = new LeaderboardController(leaderboardService.Object); // Act leaderboardController.WithCallTo(c => c.Damage(int.MaxValue)); // Assert leaderboardService.Verify(s => s.GetTopDamageOnPage(0), Times.Once); }
public HardGameBoard() { InitializeComponent(); this.leaderboardManager = new LeaderboardController(Gamemode.Hard); this.gameManager = new GameController(this, this.leaderboardManager, Constants.HardGameBoardSize, Constants.HardGameBoardStartSpeed, Constants.HardGameBoardMaxSpeed, Constants.HardGameBoardSpeedIncrease, Constants.HardGameBoardMaxBlocksCount); }
public void InvokeILeaderboardDamageService_GetTopStoredDamageOnPageMethodOnceWithCorrectParameter(int pageNumber) { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); var leaderboardController = new LeaderboardController(leaderboardService.Object); // Act leaderboardController.WithCallTo(c => c.Healing(pageNumber)); // Assert leaderboardService.Verify(s => s.GetTopHealingOnPage(pageNumber), Times.Once); }
// Start is called before the first frame update void Start() { playerPreferencesScript = gameManager.GetComponent <PlayerPreferences>(); leaderboardControllerScript = leaderboardController.GetComponent <LeaderboardController>(); if (!playerPreferencesScript.CheckIfExists("playerEmail")) { allPanels.SetActive(true); confirmPrompt.SetActive(false); confirmedPanel.SetActive(false); verifyInfoButton.interactable = false; } }
private void Start() { Instance = this; transform.Find("Prefabs").gameObject.SetActive(false); twitchGame = GetComponentInChildren <TwitchGame>(true); twitchGame.twitchBombPrefab = GetComponentInChildren <TwitchBomb>(true); twitchGame.twitchModulePrefab = GetComponentInChildren <TwitchModule>(true); twitchGame.moduleCamerasPrefab = GetComponentInChildren <ModuleCameras>(true); TwitchGame.Instance = twitchGame; GameRoom.InitializeSecondaryCamera(); _gameInfo = GetComponent <KMGameInfo>(); _gameInfo.OnStateChange += OnStateChange; CoroutineQueue = GetComponent <CoroutineQueue>(); Leaderboard.Instance.LoadDataFromFile(); LeaderboardController.Install(); ModuleData.LoadDataFromFile(); ModuleData.WriteDataToFile(); AuditLog.SetupLog(); MainThreadQueue.Initialize(); TwitchPlaySettings.LoadDataFromFile(); MusicPlayer.LoadMusic(); IRCConnection.Instance.OnMessageReceived.AddListener(OnMessageReceived); twitchGame.ParentService = this; GameObject infoObject = new GameObject("TwitchPlays_Info"); infoObject.transform.parent = gameObject.transform; _publicProperties = infoObject.AddComponent <TwitchPlaysProperties>(); _publicProperties.TwitchPlaysService = this; // TODO: Useless variable? if (TwitchPlaySettings.data.SkipModManagerInstructionScreen || IRCConnection.Instance.State == IRCConnectionState.Connected) { ModManagerManualInstructionScreen.HasShownOnce = true; } UpdateUiHue(); SetupChatSimulator(); }
void Awake() { //DontDestroyOnLoad (gameObject); // If no Player ever existed, we are it. if (instance6 == null) { instance6 = this; } // If one already exist, it's because it came from another level. else if (instance6 != this) { Destroy(gameObject); //return; } }
public void InvokeILeaderboardDamageService_GetTopStoredDamageOnPageMethodOnceWithCorrectParameters() { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); var leaderboardController = new LeaderboardController(leaderboardService.Object); // Act leaderboardController .WithCallTo(c => c.Damage()) .ShouldRenderDefaultView(); // Assert leaderboardService.Verify(s => s.GetTopDamageOnPage(0), Times.Once); }
public static void Quit() { string scene = GetSceneName(); if (scene == "Main") { GameController.Quit(); } else if (scene == "Menu") { MenuController.Quit(); } else if (scene == "Leaderboard") { LeaderboardController.Quit(); } }
public void GetLeaderboard_Ties_Ok() { Player.ClearPlayersList(); // Arrange Mock <RandomGenerator> randomTest = new Mock <RandomGenerator>(MockBehavior.Strict); randomTest.Setup(h => h.GetNumber(It.Is <int>(t => t == 3))) .Returns(2); ShootController controller = new ShootController(randomTest.Object); controller.Get("rock", "Jane"); controller.Get("rock", "Evgeniya"); controller.Get("rock", "Evgeniya"); controller.Get("scissors", "Jane"); controller.Get("paper", "Evgeniya"); LeaderboardController leadController = new LeaderboardController(); // Act var actionResult = leadController.Get(); var objectResult = actionResult.Result as ObjectResult; var list = new List <PlayerInfo>() { new PlayerInfo { PlayerName = "Evgeniya", Score = 2 }, new PlayerInfo { PlayerName = "Jane", Score = 1 } }; var listResult = objectResult.Value as List <PlayerInfo>; //Assert Assert.IsNotNull(objectResult); Assert.AreEqual(200, objectResult.StatusCode); Assert.AreEqual(2, listResult.Count); Assert.AreEqual("Evgeniya", listResult[0].PlayerName); Assert.AreEqual(2, listResult[0].Score); Assert.AreEqual("Jane", listResult[1].PlayerName); Assert.AreEqual(1, listResult[1].Score); randomTest.VerifyAll(); }
private void ActiveSceneChanged(Scene from, Scene to) { Logger.Debug($"Active scene changed from \"{from.name}\" to \"{to.name}\""); CurrentScene = to.name; if (from.name == "EmptyTransition" && to.name == "Menu") { PluginUI.Init(); GameController.Init(to); LeaderboardController.Init(to); Controllers.PlayerController.Init(to); VoiceChatWorker.Init(); } else { GameController.Instance?.ActiveSceneChanged(from, to); LeaderboardController.Instance?.ActiveSceneChanged(from, to); } }
private void KMGameInfo_OnStateChange(KMGameInfo.State state) { if (state == KMGameInfo.State.Gameplay) { // Enabling Show Module Names is considered an advantageous feature, so disable records in that case. // This code is based on the Tweaks mod. if (this.config.ShowModuleNames) { LeaderboardController.DisableLeaderboards(); } this.StartCoroutine(this.CheckForBombs()); } else if (state == KMGameInfo.State.Transitioning && this.gameState == KMGameInfo.State.Setup) { this.KMModSettings.RefreshSettings(); this.RefreshConfig(); } else if (state == KMGameInfo.State.Setup) { this.popups.Clear(); if (this.tweaksService == null) { Debug.Log("[Profile Revealer] Looking for Tweaks service..."); var obj = GameObject.Find("Tweaks(Clone)"); if (obj != null) { this.tweaksService = obj.GetComponent("Tweaks"); } if (this.tweaksService != null) { Debug.Log("[Profile Revealer] Found Tweaks service."); } else { Debug.Log("[Profile Revealer] Did not find Tweaks service."); LeaderboardController.Install(); } } } this.gameState = state; }
/// <summary> /// When the game starts, find the LeaderboardController component attached to this GameObject, /// subscribe to its events (ScoreAdded/TopScoresUpdated) with the callback functions, and /// disable it until we have created the top score prefabs. /// Finally, start a CR to create MaxRetrievableScores top score prefabs and disable them. /// </summary> private void Start() { leaderboard = GetComponent <LeaderboardController>(); NumScoresInput.text = leaderboard.ScoresToRetrieve.ToString(); leaderboard.FirebaseInitialized += OnInitialized; leaderboard.ScoreAdded += ScoreAdded; leaderboard.TopScoresUpdated += UpdateScoreDisplay; leaderboard.UserScoreUpdated += UpdateUserScoreDisplay; leaderboard.enabled = false; ToggleControls(false); // If Editor Auth is not enabled, scores cannot be cleared. if (!leaderboard.EditorAuth) { ClearScoresButton.SetActive(false); } MessageText.text = "Preparing Leaderboard UI..."; StartCoroutine(CreateTopScorePrefabs()); }
public void DisplayCorrectViewWithCorrectViewModel() { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); var leaderboardController = new LeaderboardController(leaderboardService.Object); var healingDonePerSecondViewModels = new List <OutputPerSecondViewModel>(); var expectedViewModel = new LeaderboardViewModel(0, healingDonePerSecondViewModels); leaderboardService.Setup(s => s.GetTopHealingOnPage(It.IsAny <int>())).Returns(expectedViewModel); // Act & Assert leaderboardController .WithCallTo(c => c.Healing()) .ShouldRenderDefaultView() .WithModel <LeaderboardViewModel>(actualViewModel => { Assert.That(actualViewModel, Is.SameAs(expectedViewModel)); }); }
public void RenderCorrectPartialViewWithCorrectViewModel() { // Arrange var leaderboardService = new Mock <ILeaderboardService>(); var leaderboardController = new LeaderboardController(leaderboardService.Object); var damageDonePerSecondViewModels = new List <OutputPerSecondViewModel>(); var expectedViewModel = new LeaderboardViewModel(0, damageDonePerSecondViewModels); leaderboardService.Setup(s => s.GetTopDamageOnPage(It.IsAny <int>())).Returns(expectedViewModel); // Act & Assert leaderboardController .WithCallTo(c => c.Damage(0)) .ShouldRenderPartialView("_DamageAjaxFormPartial") .WithModel <LeaderboardViewModel>(actualViewModel => { Assert.That(actualViewModel, Is.SameAs(expectedViewModel)); }); }
void Awake() { g_instance = this; m_isWorking = false; }
protected void HandleResult(IResult result) { if(result.Cancelled) { Debug.Log("Invite cancelled"); } else if(result.Error != null) { Debug.Log("Invite cancelled"); } else { PlayerPrefs.SetInt("Currentscore" , 2 * PlayerPrefs.GetInt("Currentscore")); GameObject.Find("Score").GetComponent<Text>().text = PlayerPrefs.GetInt("Currentscore") + ""; if(PlayerPrefs.GetInt("Currentscore")> PlayerPrefs.GetInt("Highscore")) { PlayerPrefs.SetInt("Highscore" , PlayerPrefs.GetInt("Currentscore")); GameObject.Find("High Score").GetComponent<Text>().text = PlayerPrefs.GetInt("Highscore") + ""; } LeaderboardController lead = new LeaderboardController(); lead.SaveScore(); GameObject.Find("ChallengeFriendButton").SetActive(false); GameObject.Find("Double").SetActive(false); GameObject.Find("ChallengeFriendButtonFake").GetComponent<Animator>().enabled = false; } }