private void HandleUDPMessageReceived(NetInMessage message) { message.ResetIndex(); MessageType.Command command = (MessageType.Command)message.ReadInt32(); if (command == MessageType.Command.ModeSet) { MessageType.Mode mode = (MessageType.Mode)message.ReadInt32(); dynamicForceUI.SetActive(mode == MessageType.Mode.Dynamic); staticForceUI.SetActive(mode == MessageType.Mode.Static); guitarHeroObj.SetActive(mode == MessageType.Mode.GuitarHero); flappyBirdObj.SetActive(mode == MessageType.Mode.FlappyBird); musicplayObj.SetActive(mode == MessageType.Mode.MusicPlay); } }
private void Update() { lock (lockObj) { while (m_incomingMessageQueue.Count > 0) { NetInMessage receivedMessage = m_incomingMessageQueue.Dequeue(); if (MessageReceived != null) { Delegate[] invocationList = MessageReceived.GetInvocationList(); if (invocationList != null) { for (int i = 0; i < invocationList.Length; i++) { receivedMessage.ResetIndex(); invocationList[i].DynamicInvoke(receivedMessage); } } } } } }