예제 #1
0
        public void AddNewValue(ScoreValue value)
        {
            if (Data.Exists(x => x.uid == value.uid))
            {
                var i = Data.FindIndex(x => x.uid == value.uid);
                Data[i] = value;
            }
            else
            {
                Data.Add(value);

                base.AddNewValue();
            }

#if HAS_SERVER
            if (!isReceiving)
            {
                OnDataUpdateCall(GetActual());
            }
            else
            if (OnDataUpdated != null)
            {
                OnDataUpdated();
            }
#else
            OnDataUpdateCall(GetActual());
#endif
        }
예제 #2
0
        public void NetworkSendScoreValueToServer(ScoreValue value)
        {
            if (_isServer || isReceiving)
            {
                return;
            }

            _clientController.SendMessageToServer("NetworkUpdateScore", JsonConvert.SerializeObject(value));
        }
예제 #3
0
        public bool TryGetScore(string uid, out ScoreValue value)
        {
            value = null;

            if (Data.Exists(x => x.uid == uid))
            {
                value = Data.Find(x => x.uid == uid);
                return(true);
            }

            return(false);
        }
예제 #4
0
        //Events
        protected void OnDataUpdateCall(ScoreValue value)
        {
            if (SaveToRegistry)
            {
                _rg.AddRegisterValue("Score", GetActual().value.ToString("000"), false);
                _rg.AddRegisterValue("GameTime", GetActual().time.ToString(), false);
            }

            if (OnDataUpdated != null)
            {
                OnDataUpdated();
            }
            if (OnScoreDataUpdated != null)
            {
                OnScoreDataUpdated(value);
            }
        }