public void OnHistoryToggleOn() { if (HistoryToggle.GetComponent <Toggle>().isOn) { LeagueManager.GetLeagueHistory(new LeagueManager.GetLeaguesCallBack(ShowLeagueHistory)); } }
public void OnJoinToggleOn() { if (JoinToggle.GetComponent <Toggle>().isOn) { LeagueManager.GetOpenLeagues(new LeagueManager.GetLeaguesCallBack(ShowOpenLeagues)); } }
public void OnLeaguesToggleOn() { if (LeagueToggle.GetComponent <Toggle>().isOn) { LeagueManager.GetCurrentLeagues(new LeagueManager.GetLeaguesCallBack(ShowCurrentLeagues)); } }
public void OnCreateLeagueButtonPress() { // Manage UI SetAllButtonsInteractable(false); // Save input from league settings input fields LeagueManager.SetMatchCount(Int32.Parse(matchCountInputField.text)); // * 3600 is hours to seconds conversion LeagueManager.SetRoundDuration(Int32.Parse(roundDurationInputField.text) * 3600); LeaguePlayerStats leaguePlayerData = new LeaguePlayerStats( PlayerManager.PlayerName, PlayerPrefs.GetString("playFabId") ); // call to Playfab cloud script function called "CreateNewLeague" PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest() { FunctionName = "CreateNewLeague", FunctionParameter = new { status = "Open", leagueName = leagueNameInput.text, hostName = PlayerManager.PlayerName, playerData = leaguePlayerData.ToJSON(), leagueSettings = LeagueManager.leagueSettings.ToJSON() }, GeneratePlayStreamEvent = true, }, result => { // get Json object representing the Game State out of FunctionResult JsonObject jsonResult = (JsonObject)result.FunctionResult; // check if data exists if (jsonResult == null) { Debug.Log("server failed to return data"); } else { Debug.Log("New League created"); // save key for accessing the league from server TitleDescriptionButtonLinkData.LinkID = RPSCommon.InterpretCloudScriptData(jsonResult, "leagueKey"); // reselect UI element from league dashboard EventSystem.current.SetSelectedGameObject(prevUISelection); // Load league view for displaying new league SceneManager.UnloadSceneAsync("NewLeague"); SceneManager.LoadScene("LeagueView", LoadSceneMode.Additive); } }, errorCallback => { Debug.Log(errorCallback.ErrorMessage + "error creating new League."); // TODO: more specific error messages to help with league creation. alertPanelText.text = "Oops! According to the server, The league could not be created."; alertPanel.SetActive(true); // let player interact again SetAllButtonsInteractable(true); } ); }
public void OnCreateCustomButtonPress() { LeagueManager.NewCustomLeague(); SceneManager.LoadScene("NewLeague", LoadSceneMode.Additive); }
public void OnCreateRatedButtonPress() { LeagueManager.NewRatedLeague(); SceneManager.LoadScene("NewLeague", LoadSceneMode.Additive); }
private void Start() { LeagueManager.GetCurrentLeagues(new LeagueManager.GetLeaguesCallBack(ShowCurrentLeagues)); StartToggle.SendMessage("Select"); }