| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GameManagerScript : MonoBehaviour {
- private int playerCount;
- private string gameMode;
- public Database db;
-
- public string GameMode { get => gameMode; set => gameMode = value; }
- public int GameId { get; internal set; }
- List<KeyValuePair<string, int>> players;
- // Start is called before the first frame update
- void Start() {
- db = GameObject.Find("GameManager").GetComponent<Database>();
- GameId = PlayerPrefs.GetInt("GameId");
- db.SetLocalOrOnline("Local");
- db.SetLastPlayedDate(GameId);
- StatsScript statsScript = GameObject.Find("StatsPanel").GetComponent<StatsScript>();
- }
- private List<KeyValuePair<string,int>> GetPlayersForGame() {
- players = db.GetPlayersForGame(GameId);
- return players;
- }
- public List<KeyValuePair<string, int>> GetPlayers() {
- if (players == null) {
- players = GetPlayersForGame();
- }
- return players;
- }
- public Database GetDatabase() {
- if (db == null) {
- db = GameObject.Find("GameManager").GetComponent<Database>();
- }
- return db;
- }
- }
|