Exemple #1
0
    /// <summary>
    /// 라운드가 넘어갈경우나 처음 시작할떄 초기화 해주어야할 변수
    /// </summary>
    public void ResetPlayerVar(SetClient set)
    {
        //클라이언트 플레이어 오브젝트 체력 설정
        SetHealthUI(set.HP);

        //줌 상태 일경우 품
        if (playerList[set.ClientNum].zoomState.Equals(true))
        {
            ZoomChange(set.ClientNum, false);
        }

        playerList[(int)TeamColor.BLUE].transform.position = ToUnityVectorChange(set.StartPos[(int)TeamColor.BLUE]);
        playerList[(int)TeamColor.RED].transform.position  = ToUnityVectorChange(set.StartPos[(int)TeamColor.RED]);

        foreach (var p in playerList)
        {
            if (!p.gameObject.activeSelf)
            {
                p.gameObject.SetActive(true);
            }

            p.isAlive = true;
        }
        //Send
        NetworkManagerTCP.SendTCP(new ReadyCheck(set.ClientNum));
    }
Exemple #2
0
        /// <summary>
        /// Add a listener (usually a query operator) to the list of listeners.
        /// When a stream registers with the system, one of the listeners from the
        /// queue will be assigned to that stream
        /// </summary>
        /// <param name="sc">The method to call when a stream is found</param>
        /// <param name="port">The port to listen on</param>
        public void AddListener(SetClient sc, int port)
        {
            bool foundConnection = false;
            int index = connections.Count; //will be the index if a connection is not found
            for (int i = 0; i < connections.Count; i++)
            {
                if (connections[i].Port == port)
                {
                    foundConnection = true;
                    index = i;
                }
            }
            if (!foundConnection)
            {
                Init(stIP, port); //make a new connection on the port
            }
            PortListener pl = connections[index];

            bool clientSet = false;
            lock (pl.clients)
            {
                if (pl.clients.Count > 0)
                {
                    TcpClient c = pl.clients[0];
                    pl.clients.RemoveAt(0);
                    sc(c.GetStream());
                    clientSet = true;
                }
            }
            if (!clientSet)
            {
                lock (pl.servers)
                {
                    pl.servers.Add(sc);
                }
            }
        }
Exemple #3
0
        public async Task Connect(ConnectionSettings settings)
        {
            if (_session != null)
            {
                throw new InvalidOperationException("Cannot connect because the client is already connected");
            }

            _commonClient       = new CommonClient();
            _hashClient         = new HashClient();
            _listClient         = new ListClient();
            _scriptClient       = new ScriptClient();
            _stringClient       = new StringClient();
            _transactionClient  = new TransactionClient();
            _setClient          = new SetClient();
            _subscriptionClient = new SubscriptionClient();
            _session            = await _commonClient.Connect(settings).ConfigureAwait(false);

            if (!_session.IsOpen)
            {
                throw new IOException("Session could not be opened");
            }

            OnConnected?.Invoke(this);
        }
 public TStringBSKVService(SetClient setClient)
 {
     _setClient = setClient;
 }
Exemple #5
0
        /// <summary>
        /// Add a listener (usually a query operator) to the list of listeners.
        /// When a stream registers with the system, one of the listeners from the
        /// queue will be assigned to that stream
        /// </summary>
        /// <param name="sc">The method to call when a stream is found</param>
        /// <param name="port">The port to listen on</param>
        public void AddListener(SetClient sc, int port)
        {
            if (!connections.ContainsKey(port))
            {
                Init(stIP, port); //make a new connection on the port
            }
            PortListener pl;
            connections.TryGetValue(port, out pl);

            bool clientSet = false;
            lock (pl.clients)
            {
                if (pl.clients.Count > 0)
                {
                    TcpClient c = pl.clients[0];
                    pl.clients.RemoveAt(0);
                    sc(c.GetStream());
                    clientSet = true;
                }
            }
            if (!clientSet)
            {
                lock (pl.servers)
                {
                    pl.servers.Add(sc);
                }
            }
        }
Exemple #6
0
 /// <summary>
 /// Add a listener (usually a query operator) to the list of listeners.
 /// When a stream registers with the system, one of the listeners from the
 /// queue will be assigned to that stream
 /// </summary>
 /// <remarks>The listener will listen on the default WhitStream port</remarks>
 /// <param name="sc">The method to call when a stream is found</param>
 public void AddListener(SetClient sc)
 {
     AddListener(sc, WHITSTREAM_PORT);
 }