Program.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4. using Base;
  5. using Model;
  6. using Object = Base.Object;
  7. namespace App
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. try
  14. {
  15. Log.Info("server start........................");
  16. Object.ObjectManager.Register("Base", typeof(Game).Assembly);
  17. Object.ObjectManager.Register("Model", typeof(Opcode).Assembly);
  18. byte[] dllBytes = File.ReadAllBytes("./Controller.dll");
  19. byte[] pdbBytes = File.ReadAllBytes("./Controller.pdb");
  20. Assembly controller = Assembly.Load(dllBytes, pdbBytes);
  21. Object.ObjectManager.Register("Controller", controller);
  22. Game.Scene.AddComponent<EventComponent>();
  23. TimeComponent timeComponent = Game.Scene.AddComponent<TimeComponent>();
  24. Game.Scene.AddComponent<TimerComponent, TimeComponent>(timeComponent);
  25. Game.Scene.AddComponent<NetworkComponent, NetworkProtocol>(NetworkProtocol.UDP);
  26. Game.Scene.AddComponent<MessageHandlerComponent, MessageType>(MessageType.Realm);
  27. while (true)
  28. {
  29. Object.ObjectManager.Update();
  30. }
  31. }
  32. catch (Exception e)
  33. {
  34. Log.Error(e.ToString());
  35. }
  36. }
  37. }
  38. }