Exemple #1
0
 void Start()
 {
     if (PlayfabManager.IsLoggedIn == false)
     {
         PlayfabManager.Login(OnLoginSuccess, OnLoginFailed);
     }
 }
Exemple #2
0
    private void Start()
    {
        playfabScript = playFab.GetComponent <PlayfabManager>();

        if (isNameSubmit)
        {
            inputField.text = playfabScript.GetDisplayName();
        }
    }
Exemple #3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.CompareTag("obstacles"))
     {
         endGame = true;
         Destroy(gameObject);
         Destroy(LowBattery);
         EndText.SetActive(true);
         PlayfabManager.SendLeaderboard((int)Math.Round(gameManager.traveledDistance / 2f));
     }
 }
Exemple #4
0
 private void OnEnable()
 {
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Exemple #5
0
    private void Start()
    {
        count          = 0;
        gameConfig     = FindObjectOfType <GameConfig>();
        manageCar      = FindObjectOfType <ManageCar>();
        playfabManager = FindObjectOfType <PlayfabManager>();


        distanceMonitorText = distanceStatusMonitor.GetComponent <Text>();
        // PlayerPrefs <<- Guardar configuración, stats, info en el dispositivo.
        createInitialLines();
    }
Exemple #6
0
 public void PostBestTime()
 {
     if (int.TryParse(inputScoreObject.text, out var value))
     {
         Debug.Log($"PostBestTime: Posted best time of {value}");
         PlayfabManager.UpdateStatistic("best_time", value);
     }
     else
     {
         Debug.Log($"Warning: Invalid Numeric Value: {inputScoreObject.text}");
     }
 }
Exemple #7
0
 public void PostNewScore()
 {
     if (int.TryParse(inputScoreObject.text, out var value))
     {
         Debug.Log($"PostNewScore: Posted new score of {value}");
         PlayfabManager.UpdateStatistic("total_score", value);
     }
     else
     {
         Debug.Log($"Warning: Invalid Numeric Value: {inputScoreObject.text}");
     }
 }
Exemple #8
0
    public void PostNewScore()
    {
        int value;

        if (int.TryParse(inputScoreObject.text, out value))
        {
            Debug.Log(string.Format("PostNewScore: Posted new score of {0}", value));
            PlayfabManager.UpdateStatistic("total_score", value);
        }
        else
        {
            Debug.Log(string.Format("Warning: Invalid Numeric Value: {0}", inputScoreObject.text));
        }
    }
Exemple #9
0
    public void PostBestTime()
    {
        int value;

        if (int.TryParse(inputScoreObject.text, out value))
        {
            Debug.Log(string.Format("PostBestTime: Posted best time of {0}", value));
            PlayfabManager.UpdateStatistic("best_time", value);
        }
        else
        {
            Debug.Log(string.Format("Warning: Invalid Numeric Value: {0}", inputScoreObject.text));
        }
    }
Exemple #10
0
    private void Start()
    {
        deathzones = GameObject.FindGameObjectsWithTag("Deathzone");

        startTime = Time.time;

        if (transform.parent != null)
        {
            playfab = transform.parent.GetComponent <PlayfabManager>();
        }
        else
        {
            playfab = transform.GetComponent <PlayfabManager>();
        }
    }
 public SaveManager(AreaManager areaManager, FollowerManager followerManager,
                    NPCManager npcManager, BuildingManager buildingManager, BattleManager battleManager,
                    ItemDatabase itemDatabase, HuntingManager huntingManager, PlayfabManager playfabManager, PetManager petManager, HouseManager houseManager)
 {
     this.areaManager              = areaManager;
     this.followerManager          = followerManager;
     this.buildingManager          = buildingManager;
     this.battleManager            = battleManager;
     this.itemDatabase             = itemDatabase;
     this.npcManager               = npcManager;
     this.huntingManager           = huntingManager;
     this.playfabManager           = playfabManager;
     this.petManager               = petManager;
     this.houseManager             = houseManager;
     playfabManager.gameState      = gameState;
     playfabManager.messageManager = messageManager;
 }
    // Use this for initialization
    public void ShowLeaderboard(string boardName, string boardTitle, string valueName)
    {
        // Remove any existing entries
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        // Get the leaderboard data
        var leaderboards = PlayfabManager.GetLeaderboard(boardName);

        if (leaderboards.Any())
        {
            // Create UI entries for each
            foreach (var leaderboard in leaderboards)
            {
                var entry = Instantiate(entryPrefab, transform, false);
                entry.Set(new EntryModel(
                              (leaderboard.Position + 1).ToString(),
                              leaderboard.DisplayName ?? leaderboard.PlayFabId,
                              leaderboard.StatValue.ToString()
                              ));
            }
        }
        else
        {
            var entry = Instantiate(entryPrefab, this.transform, false);
            entry.Set(new EntryModel(
                          "Leaderboard is empty",
                          "",
                          ""
                          ));
        }

        // Set the label text
        titlePanelText.text  = boardTitle;
        headerPanelText.text = valueName;
    }
    // Use this for initialization
    public void ShowLeaderboard(string boardName, string boardTitle, string valueName)
    {
        // Remove any existing entries
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        // Get the leaderboard data
        var leaderboards = PlayfabManager.GetLeaderboard(boardName);

        if (leaderboards.Count > 0)
        {
            // Create UI entries for each
            foreach (var leaderboard in leaderboards)
            {
                var entry = Instantiate(EntryPrefab);

                entry.transform.SetParent(this.transform, false);
                entry.transform.Find("Player").GetComponent <Text>().text = leaderboard.DisplayName ?? leaderboard.PlayFabId;
                entry.transform.Find("Rank").GetComponent <Text>().text   = (leaderboard.Position + 1).ToString();
                entry.transform.Find("Value").GetComponent <Text>().text  = leaderboard.StatValue.ToString();
            }
        }
        else
        {
            var entry = Instantiate(EntryPrefab);
            entry.transform.SetParent(this.transform, false);
            entry.transform.Find("Player").GetComponent <Text>().text = "Leaderboard is empty";
            entry.transform.Find("Rank").GetComponent <Text>().text   = String.Empty;
            entry.transform.Find("Value").GetComponent <Text>().text  = String.Empty;
        }

        // Set the label text
        GameObject.Find("Title Panel").transform.Find("Title").GetComponent <Text>().text          = boardTitle;
        GameObject.Find("Header Panel").transform.Find("Header: Value").GetComponent <Text>().text = valueName;
    }
Exemple #14
0
 void Awake()
 {
     instance = this;
 }
Exemple #15
0
 public void RefreshLeaderboards()
 {
     PlayfabManager.LoadLeaderboards(OnGotLeaderboards, OnGotLeaderboardsFailed);
 }