public void SubmitChatInput(InputField input) { if (input.text.Length > 0) { var text = "Player " + net.CurrentPlayerId + ": " + input.text; AppendNewText(text); //reset input input.text = ""; // regain focus after hitting enter input.ActivateInputField(); input.Select(); // send out to other players if (text.Length < 1023) { net.SendData(text, 0); } else { var current_message = text; while (current_message.Length > 1023) { string chunk = current_message.Substring(0, 1023); net.SendData(chunk, 0); current_message = current_message.Substring(1024, current_message.Length - 1023); } } } }
void MakeAttack(int id, Vector3 point) { if (id == net.CurrentPlayerId) { net.LogChat("This is Your Map, Attack the Opponent!"); } else { var attack = Instantiate(AttackPrefab); attack.transform.position = point; AttackGameObjects.Add(attack); net.SendData(string.Format("{0}|{1}|{2}", id, point.x, point.z), Protocol.ATTACK, new List <int>() { id }); } }