private void Awake() { if (instance != null) { Destroy(instance); } instance = this; }
public void OnClientEvent(Client player, string eventName, params object[] arguments) { if (eventName.Equals("onClientStartLogin")) { string password = (string)arguments[0]; MySqlCommand doesPlayerExistInDb = TTRPG.Mysql.Conn.CreateCommand(); doesPlayerExistInDb.CommandText = "SELECT * FROM user WHERE Nickname = @nickname"; doesPlayerExistInDb.Parameters.AddWithValue("@nickname", player.name); DataTable result = new DataTable(); result.Load(doesPlayerExistInDb.ExecuteReader()); string salt = (string)result.Rows[0]["Salt"]; string dbPassword = (string)result.Rows[0]["Password"]; if (PasswordHelper.Hash(password, salt).Equals(dbPassword)) { // Password was correct and now Update fingerprint and last login // before starting Login process if (!DevServer.CheckDevServerLogin(player, result.Rows[0])) { MySqlCommand updateUserEntryCommand = TTRPG.Mysql.Conn.CreateCommand(); updateUserEntryCommand.CommandText = "UPDATE user SET Last_Fingerprint = @fingerprint, Last_Login=current_timestamp() WHERE Nickname=@nickname"; updateUserEntryCommand.Parameters.AddWithValue("fingerprint", player.getSyncedData("fingerprint")); updateUserEntryCommand.Parameters.AddWithValue("nickname", player.name); updateUserEntryCommand.ExecuteNonQuery(); EnsureAllDatabaseTableEntries((Int32)result.Rows[0]["ID"]); StartLoginProcess(player, result.Rows[0]); player.setSyncedData("loggedin", true); API.consoleOutput("Account " + player.name + "(" + player.getSyncedData("ID") + ") logged in."); player.invincible = false; PlayerSpawnManager.Spawn(player); TTRPG.Api.exported.scoreboard.setPlayerScoreboardData(player, "ID", result.Rows[0]["ID"].ToString()); TTRPG.Api.exported.scoreboard.setPlayerScoreboardData(player, "Nickname", player.name); MoneyManager.RefreshPlayerMoneyDisplay(player); RpLevelManager.CalculateAndSetLevelOfPlayer(player); RpLevelManager.RefreshPlayerRpAndLevelDisplay(player); UpdatePlayerPlayTime.UpdatePlayerPlayTimeDisplay(player); } } else { player.sendNotification("System-Error", "Das Passwort, dass du eingegeben hast, ist fehlerhaft.", false); player.triggerEvent("startLogin", player.name); } } }
private void Awake() { if (singleton == null) { singleton = this; } else if (singleton != this) { Destroy(gameObject); } }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void Awake() { if (!instance) { instance = this; } else { Destroy(instance); instance = this; } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } SpawnPlayers(); }
public void OnEndDrag(PointerEventData _eventData) { GameObject.Find("AuthorizedDropZone").GetComponent <SpriteRenderer>().enabled = false; if (m_available == false) { return; } if (m_spawnManager == null) { m_spawnManager = new List <PlayerSpawnManager>(Component.FindObjectsOfType <PlayerSpawnManager>()) { } }
// Start is called before the first frame update void Start() { playerHUDContainer = GameObject.Find("PlayerHUDs"); playerHUDRContainer = GameObject.Find("PlayerHUDsR"); playerManager = GameObject.Find("PlayerManager"); playerSpawnManager = playerManager.GetComponent <PlayerSpawnManager>(); for (int i = 0; i < playerSpawnManager.GetPlayerCount(); i++) { GameObject playerHUD = Resources.Load <GameObject>("UI/PlayerHUDBox"); playerHUD.GetComponent <HUDBoxPlayerTracker>().player = playerSpawnManager.GetPlayer(i); if (playerSpawnManager.GetPlayer(i).GetComponent <InputToIntent>().team == 1) { Instantiate(playerHUD, playerHUDContainer.transform); } else { Instantiate(playerHUD, playerHUDRContainer.transform); } } }
public void BeginGame(string _matchID) { // Spawn in GameManager; GameObject newSpawnManager = Instantiate(spawnManagerPrefab); NetworkServer.Spawn(newSpawnManager); newSpawnManager.GetComponent <NetworkMatchChecker>().matchId = _matchID.ToGuid(); PlayerSpawnManager spawnManager = newSpawnManager.GetComponent <PlayerSpawnManager>(); for (int i = 0; i < matches.Count; i++) { if (matches[i].matchID == _matchID) { foreach (var player in matches[i].players) { Player _player = player.GetComponent <Player>(); Debug.Log($"Spawning player {_player.playerName}"); spawnManager.SpawnPlayer(); } break; } } }
void Start() { instance = this; playerSpawns = gameObject.GetComponentsInChildren <Transform>(); }
private void Awake() { PlayerSpawnManager.AddSpawnPoint(transform); Debug.Log("Spawn point added"); }
private void OnDestroy() { PlayerSpawnManager.RemoveSpawnPoint(transform); Debug.Log("Spawn point deleted"); }
private void Start() { playerSpawnManager = facade.GetComponent <MainPlayerSpawnManager>(); spawnManager = facade.GetComponent <PlayerSpawnManager>(); adjuster = facade.GetComponent <PositionAdjuster>(); }
void Start() { instance = this; playerSpawns = gameObject.GetComponentsInChildren<Transform>(); }