コード例 #1
0
 public void OnHistoryToggleOn()
 {
     if (HistoryToggle.GetComponent <Toggle>().isOn)
     {
         LeagueManager.GetLeagueHistory(new LeagueManager.GetLeaguesCallBack(ShowLeagueHistory));
     }
 }
コード例 #2
0
 public void OnJoinToggleOn()
 {
     if (JoinToggle.GetComponent <Toggle>().isOn)
     {
         LeagueManager.GetOpenLeagues(new LeagueManager.GetLeaguesCallBack(ShowOpenLeagues));
     }
 }
コード例 #3
0
 public void OnLeaguesToggleOn()
 {
     if (LeagueToggle.GetComponent <Toggle>().isOn)
     {
         LeagueManager.GetCurrentLeagues(new LeagueManager.GetLeaguesCallBack(ShowCurrentLeagues));
     }
 }
コード例 #4
0
        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);
            }
                                                );
        }
コード例 #5
0
 public void OnCreateCustomButtonPress()
 {
     LeagueManager.NewCustomLeague();
     SceneManager.LoadScene("NewLeague", LoadSceneMode.Additive);
 }
コード例 #6
0
 public void OnCreateRatedButtonPress()
 {
     LeagueManager.NewRatedLeague();
     SceneManager.LoadScene("NewLeague", LoadSceneMode.Additive);
 }
コード例 #7
0
 private void Start()
 {
     LeagueManager.GetCurrentLeagues(new LeagueManager.GetLeaguesCallBack(ShowCurrentLeagues));
     StartToggle.SendMessage("Select");
 }