Esempio n. 1
0
        // 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;
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public Client(NetworkConnection conn)
 {
     connection = conn;
     players = new List<DNMPlayer>();
     stateInServer = DualNetworkManager.GameState.NoGame;
 }
Esempio n. 5
0
 public override void Deserialize(NetworkReader reader)
 {
     newState = (DualNetworkManager.GameState)reader.ReadInt32();
 }
Esempio n. 6
0
 public GameStateMessage(DualNetworkManager.GameState newState)
 {
     this.newState = newState;
 }