// DNMPlayerListener
        //////////////////////////////////////////

        public void Init(string username, int role, DualNetworkManager.GameState gameState, Mode mode, bool isHosted = true, bool isLocal = true)
        {
            this.isHosted = isHosted;
            this.isLocal  = isLocal;

            nameDisplay.text = username;

            SetColor(GetColor(false));

            roleDisplay.text        = GetRoleText(role);
            roleButton.interactable = isHosted;

            // TODO do this here?
            readyToggle.isOn = mode == Mode.OfflineMode;
        }
Exemple #2
0
        public StatusMessage(bool accepted, string scene, DualNetworkManager.GameState gameState, MessageBase extraMessage)
        {
            this.accepted  = accepted;
            this.scene     = scene;
            this.gameState = gameState;

            if (extraMessage != null)
            {
                NetworkWriter w = new NetworkWriter();
                extraMessage.Serialize(w);

                msgData = w.ToArray();
                msgSize = w.Position;

                extraReader = new NetworkReader(msgData);
            }
        }
Exemple #3
0
        public override void Deserialize(NetworkReader reader)
        {
            accepted  = reader.ReadBoolean();
            scene     = reader.ReadString();
            gameState = (DualNetworkManager.GameState)reader.ReadInt32();

            msgData = reader.ReadBytesAndSize();
            if (msgData == null)
            {
                msgSize = 0;
            }
            else
            {
                msgSize = msgData.Length;
            }

            extraReader = new NetworkReader(msgData);
        }
Exemple #4
0
 public Client(NetworkConnection conn)
 {
     connection = conn;
     players = new List<DNMPlayer>();
     stateInServer = DualNetworkManager.GameState.NoGame;
 }
Exemple #5
0
 public override void Deserialize(NetworkReader reader)
 {
     newState = (DualNetworkManager.GameState)reader.ReadInt32();
 }
Exemple #6
0
 public GameStateMessage(DualNetworkManager.GameState newState)
 {
     this.newState = newState;
 }