示例#1
0
        protected virtual void UpdateData()
        {
#if HAS_SERVER
            if (OrderByRanking)
            {
                var sscc = _ranking.GetSessionConnectionsOrdered(NetworkInstanceType.ActiveClient, ShowPrepared);

                if (sscc.Count <= Index)
                {
                    myUid = null;
                    return;
                }

                myUid = sscc[Index].uid;
            }
            else
            {
                var sscc = _network.GetSessionConnections(NetworkInstanceType.ActiveClient, ShowPrepared);

                if (sscc.Count <= Index)
                {
                    myUid = null;
                    return;
                }

                myUid = sscc[Index].uid;
            }
#endif
        }
示例#2
0
        protected override void OnUpdate()
        {
            //TODO Diego: Refazer logica do RunListener
            //TODO Diego: remover do update e criar vinculo de id com o servidor
#if HAS_SERVER
            int index;

            var pos = _rankingController.GetSessionConnectionsOrdered(NetworkInstanceType.ActiveClient);

            if (_rankingController.TryGetPosition(Id, out index))//.PlayersPositions.Exists(x => x.id == Id))
            {
                //deve ser refeito
                _offsetFromTrackAnimated = Mathf.Lerp(_offsetFromTrackAnimated, (pos.Count - index - 1) * Offset, Time.deltaTime * Speed);

                //throw new NotImplementedException();

                _offsetFromTrack = Vector3.forward * _offsetFromTrackAnimated;
            }

            _counter++;

            if (_counter % 60 == 0 && networkType == NetworkInstanceType.ListeningClient)
            {
                //throw new NotImplementedException();
                //_rankingController.RequestScoreFromServer();
            }
#endif

            base.OnUpdate();
        }
示例#3
0
        protected void UpdateData()
        {
#if HAS_SERVER
            for (int i = 0; i < Characters.Length; i++)
            {
                Characters[i].SetActive(false);
            }

            if (OrderByRanking)
            {
                var sscc = _ranking.GetSessionConnectionsOrdered(NetworkInstanceType.ActiveClient);

                if (sscc.Count <= Index)
                {
                    myUid = null;
                    return;
                }

                myUid = sscc[Index].uid;

                if (!_network.GetConnection(myUid).isGamePrepared || string.IsNullOrEmpty(myUid))
                {
                    return;
                }

                CharacterInfo ch = null;

                if (_character.TryGetCharacter(myUid, out ch))
                {
                    if (Characters.Length > ch.id)
                    {
                        Characters[ch.id].SetActive(true);
                    }
                    //_image.sprite = Characters[ch.id];
                }
            }
            else
            {
                var sscc = _network.GetSessionConnections(NetworkInstanceType.ActiveClient);

                if (sscc.Count <= Index)
                {
                    myUid = null;
                    return;
                }

                myUid = sscc[Index].uid;

                if (!_network.GetConnection(myUid).isGamePrepared || string.IsNullOrEmpty(myUid))
                {
                    return;
                }

                CharacterInfo ch = null;

                if (_character.TryGetCharacter(myUid, out ch))
                {
                    if (Characters.Length > ch.id)
                    {
                        Characters[ch.id].SetActive(true);
                    }
                }
            }
#endif
        }