Esempio n. 1
0
    public void UpdateStat(string username, PlayerStatCodes scoreType, int amount)
    {
        Init();

        int currScore = GetScore(username, scoreType);

        SetStat(username, scoreType, currScore + amount);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
    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);
    }
Esempio n. 6
0
    //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);
    }
Esempio n. 7
0
 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]);
 }
Esempio n. 8
0
    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]);
    }
Esempio n. 9
0
    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);
        }
    }
Esempio n. 10
0
    //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);
        }
    }
Esempio n. 11
0
    public string[] GetPlayerNames(PlayerStatCodes sortingScoreType)
    {
        Init();

        return(playerScores.Keys.OrderByDescending(n => GetScore(n, sortingScoreType)).ToArray());
    }