public void UpdateStat(string username, PlayerStatCodes scoreType, int amount) { Init(); int currScore = GetScore(username, scoreType); SetStat(username, scoreType, currScore + amount); }
public void ChangeScore(string username, PlayerStatCodes scoreType, int amount) { Init(); int currScore = GetScore(username, scoreType); GetComponent <PhotonView>().RPC("SetScore", PhotonTargets.AllBuffered, username, scoreType, currScore + amount); //SetScore (username, scoreType, currScore + amount); }
public void SetLastKilled(string username, PlayerStatCodes scoreType, string value) { Init(); if (playerKilledLast.ContainsKey(username).Equals(false)) { playerKilledLast[username] = new Dictionary <PlayerStatCodes, string>(); } playerKilledLast[username][scoreType] = value; }
public void SetStat(string username, PlayerStatCodes scoreType, int value) { Init(); changeCounter++; if (playerScores.ContainsKey(username).Equals(false)) { playerScores[username] = new Dictionary <PlayerStatCodes, int>(); } playerScores[username][scoreType] = value; }
public void UpdateStat_Deaths(string username, PlayerStatCodes scoreType, int amount) { object[] datas = new object[] { username, scoreType, amount }; RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.DoNotCache, Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)PhotonEventCodes.Deaths, datas, true, options); }
//KD updates public void SetStat_Kills(string username, PlayerStatCodes scoreType, int value) { object[] datas = new object[] { username, scoreType, value }; RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.DoNotCache, Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)PhotonEventCodes.Kills, datas, true, options); }
public string GetKilledLast(string username, PlayerStatCodes scoreType) { Init(); if (playerKilledLast.ContainsKey(username).Equals(false)) { //We have no score record at all for this username return(string.Empty); } if (playerKilledLast[username].ContainsKey(scoreType).Equals(false)) { return(string.Empty); } return(playerKilledLast[username][scoreType]); }
public int GetScore(string username, PlayerStatCodes scoreType) { Init(); if (playerScores.ContainsKey(username).Equals(false)) { //We have no score record at all for this username return(0); } if (playerScores[username].ContainsKey(scoreType).Equals(false)) { return(0); } return(playerScores[username][scoreType]); }
public void UpdateStat_DamageReceived(string username, PlayerStatCodes scoreType, int amount) { object[] datas = new object[] { username, scoreType, amount }; if (PhotonNetwork.offlineMode) { SetStat(username, scoreType, amount); } else { RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.DoNotCache, Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)PhotonEventCodes.DamageReceived, datas, false, options); } }
//Health updates public void SetStat_Health(string username, PlayerStatCodes scoreType, int value) { object[] datas = new object[] { username, scoreType, value }; if (PhotonNetwork.offlineMode) { SetStat(username, scoreType, value); } else { RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.DoNotCache, Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)PhotonEventCodes.HealthReset, datas, false, options); } }
public string[] GetPlayerNames(PlayerStatCodes sortingScoreType) { Init(); return(playerScores.Keys.OrderByDescending(n => GetScore(n, sortingScoreType)).ToArray()); }