Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Noaxen

4
Posts
A member registered Jul 05, 2020 · View creator page →

Creator of

Recent community posts

Danke, das habe ich soweit verstanden. Aber mir ging es vorallem um die Methode von SubmitScore().

    public void SubmitScore()

    {

        submitScoreEvent.Invoke(inputName.text, System.Convert.ToInt32(timer_script.lastScore));

    }


Die Methode sumbmtiScoreEvent.Invoke nimmt nur 2 Argumente (ein String für den Namen und ein Integer für den score)

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.Events;

using UnityEngine.UI;

using TMPro;

using Dan.Main;

using System.Runtime.CompilerServices;

using JetBrains.Annotations;

public class Leaderboard : MonoBehaviour

{

    [SerializeField] PlayerMovement playermovement_script;

    [SerializeField] private List<TextMeshProUGUI> names;

    [SerializeField] private List<TextMeshProUGUI> scores;

    private string[] badWords = new string[] { "Hurensohn", "Wixer"};

    private string publicLeaderboardKey = "89ba609eb052086681e456ec870985cb8f14a460da720298cded4a337e9ded2b";

    //Scoremanager

    [SerializeField] private TextMeshProUGUI inputScore;

    [SerializeField] private TMP_InputField inputName;

    public UnityEvent<string, int> submitScoreEvent;

    private void Start()

    {

        GetLeaderboard();

    }

    public void GetLeaderboard()

    {

        LeaderboardCreator.GetLeaderboard(publicLeaderboardKey, ((msg) =>

        {

            int loopLength = (msg.Length < names.Count) ? msg.Length : names.Count;

            for (int i = 0; i < loopLength; ++i)

            {

                names[i].text = msg[i].Username;

                scores[i].text = msg[i].Score.ToString();

            }

        }));

    }

    public void SetLeaderboardEntry(string username, int score)

    {

        LeaderboardCreator.UploadNewEntry(publicLeaderboardKey, username, score, ((msg) =>

        {

            if (System.Array.IndexOf(badWords, name) != -1) return;

            GetLeaderboard();

        }));

    }

    public void SubmitScore()

    {

        submitScoreEvent.Invoke(inputName.text, System.Convert.ToInt32(timer_script.lastScore));

    }

}

Thats my current script. I am very confused with the extra data. Can you help me with it?

You need to check the Box at the leaderboard "Ascendig order"

Is it possible to uploud floats or strings to the leatherboard as a score?

Because I need the decimal places