public void Execute() { if (_address != null) { _connection.Send(_message, _address); } else { _connection.Send(_message); } onFinish?.Invoke(); }
void Update() { if (send) { send = false; udp.Send("SAYY:" + tosend + ";"); } if (join) { join = false; udp.Send("JOIN:" + id + ";"); } }
void Update() { float neardist = float.PositiveInfinity; foreach (Pickup p in nearPickups) { float dist = Vector3.Distance(playerPosition.position, p.transform.position); if (dist < neardist) { neardist = dist; if (chosenPickup) { chosenPickup.UnChosen(); } p.Chosen(); chosenPickup = p; } } if (Input.GetKeyDown(KeyCode.F)) { if (chosenPickup) { Debug.Log("picked up " + chosenPickup.ToString()); connection.Send("PCKUP:" + chosenPickup.PickupID + ";"); } } }
void Update() { if (!isInGame) { if ((Time.time - lastTryTime) > tryInterval) { connection.ResetAdress(); connection.Send("MATCH;"); lastTryTime = Time.time; } } else { if (Time.time - pingo.lastHeardFromServer > pingInterval) { if (Time.time - pingo.lastHeardFromServer > pingTimeout) { exittListener.ExitGame(); } else { pingo.SendPingo(); } } } }
void Update() { if (Input.GetKeyDown("p")) { UDPConnection.Send(new Ping()); } }
IEnumerator Auth() { yield return(new WaitUntil(() => UDPConnection.init)); string playerName = NameGenerator.GenerateName(4, 10); UDPConnection.Send(new AuthMessage(playerName)); }
void Start() { //Give Random PlayerID //PlayerID.Variable.SetValue(Random.Range (int.MinValue, int.MaxValue)); connection.Send("CNNRQ;"); player.SetActive(true); }
public override void OnEventInvoked(object eventData) { string[] args = (string[])eventData; connection.ChangeAdress(args [0]); connection.ChangePort(int.Parse(args [1])); connection.Send("CNNRQ;"); playerObject.SetActive(true); autoConnector.isInGame = true; }
public void SendString(string message) { var serializer = new MessageSerializer(); //var debug = new DebugLogMessage //{ // Message = message //}; var welcome = new WelcomeMessage(); var bytes = serializer.SerializeMessage(welcome); _connection.Send(new IPEndPoint(IPAddress.Broadcast, serverPort), bytes); }
public void ExitGame() { connection.Send("EXITT;"); player.SetActive(false); connection.ResetAdress(); bulletOrchestrator.Cleanup(); rivalOrchestrator.Cleanup(); propOrchestrator.Cleanup(); pickupOrchestrator.Cleanup(); autoConnector.isInGame = false; }
//Send Server events void Tick() { //We will send current position to server every tick pkgid++; string tosend = "MOVER:" + pkgid + "," + my_transform.position.x + "," + my_transform.position.y + "," + my_transform.localEulerAngles.z + ";"; if (shootCommand) { shootCommand = false; tosend += "SHOOT;"; } connection.Send(tosend); }
void FixedUpdate() { if (!networkEntity.isAuth) { return; } TransformMessage transformMessage = new TransformMessage( positionTransform.position.x, positionTransform.position.y, positionTransform.position.z, rotationTransform.localEulerAngles.x, positionTransform.eulerAngles.y, 0 ); if (Time.time > nextActionTime) { nextActionTime += period; UDPConnection.Send(transformMessage); } }
public void SendUDP(byte[] data) { udpConnection.Send(data); }
public void Execute() { _connection.Send(new ReadyNotification(), _address); onFinish?.Invoke(); }
public void SendPingo() { stopwatch.Reset(); stopwatch.Start(); Connection.Send("PINGO;"); }
public void RequestItemInfo(int playerID) { //Debug.Log (connection.ServerEndPoint.Address+":"+connection.ServerEndPoint.Port + ">" +"Requesting item info"); connection.Send("PIREQ:" + playerID + ";"); }
public void ButtonPressed() { connection.ResetAdress(); connection.Send("MATCH;"); Invoke("ReenableButton", 5f); }
//发送信息 public bool Send(UdpTerminal ut, String s) { return(udpConnection.Send(ut.Host, ut.Port, s)); }