void Start() { // サービスロケータセットアップ LoggerService.SetLocator(new UnityLogger()); InitSocketService(); SocketService.Locator.AddReceivedEvent(Receive); FileLoaderServer.SetLocator(new UnityResourceLoader()); // 初期化 GameEnities.CreateInstance().Load(); // ログイン { var communication = new Communication(Command.Auth); communication.Pack("ID"); communication.Pack("PW"); SocketService.Locator.Send(communication.GetBytes()); } }
static void Main(string[] args) { // サービスロケータ設定 LoggerService.SetLocator(new ConsoleLogger()); FileLoaderServer.SetLocator(new FileLoader(@"./../../../Resources/Data/csv")); // 初期化 GameState.CreateInstance(); GameEnities.CreateInstance().Load(); // 接続開始 var port = 2007; // Listenするポート番号 TcpListener listener = new TcpListener(IPAddress.Any, port); listener.Start(100); List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(() => TaskReceive(listener))); //tasks.Add(Task.Run(() => TaskSend())); Task.WaitAll(tasks.ToArray()); }