You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
819 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. using Networking.Server;
  6. using Networking;
  7. public class NetworkedClient : MonoBehaviour
  8. {
  9. public ServerObject server;
  10. public BlockReader reader;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. Debug.Log("Registering: " + LogicProtocols.SendLogicList);
  15. server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
  16. }
  17. public void RecieveLogicList(NetworkMessage msg)
  18. {
  19. LogicProtocols.LogicMsg logicMsg;
  20. if (!msg.TryRead(out logicMsg))
  21. {
  22. Debug.Log("Recieved unknown message");
  23. return;
  24. }
  25. reader.LogicChain = new List<LogicBlock>(logicMsg.elements);
  26. }
  27. }