Exemple #1
0
    private void CreateLeadboardRows()
    {
        foreach (GameObject row in _rowList)
        {
            Destroy(row);
        }

        List <LFGameSession> sessions = _sessionManager.GetSessions();

        for (int i = 0; i < sessions.Count; i++)
        {
            LFGameSession  session   = sessions [i];
            GameObject     row       = Instantiate(rowPrefab, content) as GameObject;
            LFLeadboardRow rowScript = row.GetComponent <LFLeadboardRow> ();
            rowScript.SetValue(i.ToString(), session.PlayerName, session.CoinCount.ToString(), session.GameTime.ToString(),
                               session.StartDate, session.ExitType.ToString());
            _rowList.Add(row);
        }

        /*	for (int i = 0; i < 2; i++) {
         *              GameObject row = Instantiate (rowPrefab,  content) as GameObject;
         *              LFLeadboardRow rowScript = row.GetComponent<LFLeadboardRow> ();
         *              row.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 1);
         *              _rowList.Add (row);
         *      }*/
    }
    // Use this for initialization
    void Start()
    {
        LoadXml();

        if (_session == null)
        {
            _session = _container.AddNewSession();
        }
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        _userInput             = new LFUserInput();
        _userInput.exitAction += CancelAction;
        _sessionManager        = GameObject.FindGameObjectWithTag("tSession").GetComponent <LFSessionManager>();

        if (_sessionManager != null && _sessionManager.GetCurrentSession() != null)
        {
            _session = _sessionManager.GetCurrentSession();
        }

        playerName.text = _session.PlayerName;
    }
    private void ShowResult()
    {
        if (coinLabel != null && _sessionManager != null && _sessionManager.GetCurrentSession() != null)
        {
            LFGameSession session = _sessionManager.GetCurrentSession();
            coinLabel.text = "COINS = " + session.CoinCount;
        }

        if (timeLabel != null && _sessionManager != null && _sessionManager.GetCurrentSession() != null)
        {
            LFGameSession session = _sessionManager.GetCurrentSession();
            timeLabel.text = "Time = " + (int)session.GameTime;
        }
    }
 public void AddGameSession()
 {
     _session = _container.AddNewSession();
 }