public static void Init() { FootStone.NLogger.Init(logger); if (!(client is null)) { return; } client = new FSClient(); client.IceOptions(iceOptions => { iceOptions.EnableDispatcher = false; //iceOptions.PushObjects.Add(new PlayerPushI()); //iceOptions.PushObjects.Add(new ZonePushI()); }); client.Start(); }
public async Task Test(string ip, int port, int count, ushort startIndex, bool needNetty) { NLogger.Info($"begin test,count:${count},startIndex:{startIndex},needNetty:{needNetty}"); var client = new FSClient(); client.IceOptions(iceOptions => { iceOptions.EnableDispatcher = false; //iceOptions.PushObjects.Add(new PlayerPushI()); //iceOptions.PushObjects.Add(new ZonePushI()); }); //启动主线程 //Thread thread = new Thread(new ThreadStart(async () => //{ // do // { // client.Update(); // await Task.Delay(33); // // Thread.Sleep(33); // } while (true); //})); //thread.Start(); client.Start(); for (ushort i = startIndex; i < startIndex + count; ++i) { var sessionId = "session" + i; try { var session = await client.CreateSession(ip, port); _ = RunSession(session, i, 20, needNetty); }catch (System.Exception e) { NLogger.Error(e.ToString()); } playerCount++; await Task.Delay(10); } NLogger.Info("all session created:" + count); }