コード例 #1
0
    public LeaderboardEntry(int rank, string graph, string serverString)
    {
        string[] delimiters = { "ID:", " - Name: ", " - Score:", " - Comment:", HSController.ALGO_START };
        string[] words      = serverString.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

        if (words.Length < 4)
        {
            Debug.Log("ERROR while parsing entry");
        }
        else
        {
            this.Rank = rank;
            this.name = words[1];
            Single.TryParse(words[2], out this.distance);
            Int32.TryParse(words[3], out this.score);

            if (words.Length > 4)
            {
                int id = -1;
                Int32.TryParse(words[4], out id);
                this.algo = PlatformGeneratorLoader.GetGenNameById(id);
            }
            else
            {
                this.algo = "?";
            }

            this.graph = graph;
        }
    }
コード例 #2
0
ファイル: PlatformController.cs プロジェクト: hohl/akhci
    void Start()
    {
        startPlatform = Resources.Load("Platform") as GameObject;
        startTrigger  = Resources.Load("PlatformTrigger") as GameObject;

        var loader = new PlatformGeneratorLoader();

        generator = loader.LoadAny();
        tsp       = loader.Tsp;
        Debug.Log(String.Format("Use PlatformGenerator #{0}", generator.ID));

        CalculateCorridorValues();
        platformHeight = startPlatform.GetComponent <BoxCollider2D>().size.y;
    }
コード例 #3
0
    public LeaderboardEntry(GlobalstatsIO_LeaderboardValue leaderboardValue)
    {
        this.name  = leaderboardValue.name;
        this.Rank  = Int32.Parse(leaderboardValue.rank);
        this.score = Int32.Parse(leaderboardValue.value);


        foreach (GlobalstatsIO_Additional additional in leaderboardValue.additionals)
        {
            if (additional.key == "graph")
            {
                this.graph = TspLoader.Instance.GetTspNameById(Int32.Parse(additional.value));
            }
            else if (additional.key == "algo")
            {
                this.algo = PlatformGeneratorLoader.GetGenNameById(Int32.Parse(additional.value));
            }
            else if (additional.key == "distance")
            {
                this.distance = Single.Parse(additional.value);
            }
        }
    }