public static void Main() { var _client = new client.client(123456); _client.modulemanager.add_module("ccallh", new ccallh()); _client.modulemanager.add_module("hcallc", new hcallc_module()); if (_client.connect_server("127.0.0.1", 3236)) { _client.onConnectGate += () => { _client.connect_hub("hub_server"); _client.connect_hub("hub_server0"); }; List <string> hubs = new List <string>(); _client.onConnectHub += (string hub_name) => { hubs.Add(hub_name); if (hubs.Contains("hub_server") && hubs.Contains("hub_server0")) { _client.call_hub("hub_server", "ccallh", "ccallh", System.Guid.NewGuid().ToString()); } }; } while (true) { if (_client.poll() < 50) { System.Threading.Thread.Sleep(5); } } }
public void onGeteHandle() { // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "onGeteHandle"); try { _client.connect_hub("lobby"); } catch (Exception e) { // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "lobby"+e.Message); } try { _client.connect_hub("room1"); _client.connect_hub("room2"); _client.connect_hub("room3"); _client.connect_hub("room4"); } catch (Exception e) { // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "room1" + e.Message); } _client.onDisConnect += OnDisCaondctTips; _client.enable_heartbeats(); }
public static void Main() { var _client = new client.client(123456); var ccallh_handle = new req.ccallh(_client); var hcallc_handle = new imp.hcallc_module(_client); hcallc_handle.onhcallc += (string text) => { Console.WriteLine(text); }; if (_client.connect_server("127.0.0.1", 3236)) { _client.onConnectGate += () => { _client.connect_hub("hub_server"); _client.connect_hub("hub_server0"); }; List <string> hubs = new List <string>(); _client.onConnectHub += (string hub_name) => { hubs.Add(hub_name); if (hubs.Contains("hub_server") && hubs.Contains("hub_server0")) { ccallh_handle.get_hub("hub_server").ccallh().callBack((string text) => { Console.WriteLine(text); }, () => { Console.WriteLine("error"); }); } }; } while (true) { if (_client.poll() < 50) { System.Threading.Thread.Sleep(5); } } }