| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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 OnlineDatabase odb;
- StatsScript statsScript;
-
- 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() {
- GameId = PlayerPrefs.GetInt("GameId");
- GameMode = PlayerPrefs.GetString("GameMode");
- if (GameMode.Equals("Local")) {
- db = Database.Instance;
- db.SetLocalOrOnline(GameMode);
- db.SetLastPlayedDate(GameId);
- } else if (GameMode.Equals("Online")) {
- odb = OnlineDatabase.Instance;
- odb.SetLastPlayedDate(GameId);
- }
- statsScript = GameObject.Find("StatsPanel").GetComponent<StatsScript>();
- }
- private List<KeyValuePair<string,int>> GetPlayersForGame() {
- players = db.GetPlayersForGame(GameId);
- return players;
- }
- public void UpdateQuestiosLost(int questionsLost, string playerName) {
- db.SetQuestionsLost(GameId, playerName, questionsLost);
- }
- public void UpdateQuestionsInAnswerLine(string playerName, int count) {
-
- }
- public List<KeyValuePair<string, int>> GetPlayers() {
- if (players == null) {
- players = GetPlayersForGame();
- }
- return players;
- }
- }
|