コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        public hcallc_module(client.client _client)
        {
            module_name = "hcallc";

            reg_event("hcallc", hcallc);

            _client.modulemanager.add_module("hcallc", this);
        }
コード例 #3
0
        public void Init()
        {
            _client = new client.client();
            Login          _login     = new Login();
            Room           _room      = new Room();
            MJHuan         _MJhuan    = new MJHuan();
            ChatRPC        chat       = new ChatRPC();
            PlayerBaseData PlayerData = new PlayerBaseData();
            Pay            plPay      = new Pay();
            BindAgent      bind       = new BindAgent();
            Signin         sign       = new Signin();
            TaskModule     task       = new TaskModule();
            LobbyModule    lobby      = new LobbyModule();
            GMModule       gmm        = new GMModule();
            RankModule     rank       = new RankModule();
            MatchGame      matchGame  = new MatchGame();

            _client.modulemanager.add_module("login", _login);
            _client.modulemanager.add_module("room", _room);
            _client.modulemanager.add_module("mj_huanghuang", _MJhuan);
            _client.modulemanager.add_module("player_data", PlayerData);
            _client.modulemanager.add_module("chat", chat);
            _client.modulemanager.add_module("pay", plPay);
            _client.modulemanager.add_module("agent", bind);
            _client.modulemanager.add_module("signin", sign);
            _client.modulemanager.add_module("task", task);
            _client.modulemanager.add_module("redpackets", lobby);
            _client.modulemanager.add_module("gm", gmm);
            _client.modulemanager.add_module("rank_msg", rank);
            _client.modulemanager.add_module("match", matchGame);
            _tick = Environment.TickCount;
            _client.onConnectHub  += onConnectHub;
            _client.onConnectGate += onGeteHandle;
            log.log.setLogHandle(brokenLine);

            System.Random ran    = new System.Random();
            int           index  = ran.Next(4);
            short         portIP = portIpList[index];

            try
            {
                if (_client.connect_server(serverIp, portIP, serverIp, (short)(portIP + 1), _tick))
                {
                    // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "connect_server_true");
                }
                else
                {
                    // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "connect_server_false");
                }
            }
            catch (Exception e)
            {
                // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, e.Message);
            }
            //EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "connect_server_no_erro!");
            _tickcount = 0;
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
 public ccallh_hubproxy(string _hub_name, client.client _client_handle, cb_ccallh _cb_ccallh_handle)
 {
     hub_name         = _hub_name;
     client_handle    = _client_handle;
     cb_ccallh_handle = _cb_ccallh_handle;
 }
コード例 #6
0
 public ccallh(client.client cli)
 {
     cb_ccallh_handle = new cb_ccallh();
     client_handle    = cli;
     client_handle.modulemanager.add_module("ccallh", cb_ccallh_handle);
 }