Ejemplo n.º 1
0
        // 新增一个用户账户到在线客户端
        private string AddOnLine(NetAccount item)
        {
            string result = string.Empty;

            lock (obj_lock)
            {
                all_accounts.Add(item);
                result = JArray.FromObject(all_accounts).ToString();
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void ComplexServer_ClientOnline(AppSession object1)
        {
            // 客户端上线,发送消息给客户端
            complexServer.SendAllClients(1, object1.IpAddress + " " + object1.LoginAlias + " : 上线");
            // 发送在线信息
            NetAccount account = new NetAccount()
            {
                Guid       = object1.ClientUniqueID,
                Ip         = object1.IpAddress,
                Name       = object1.LoginAlias,
                OnlineTime = DateTime.Now.ToString(),
            };

            complexServer.SendAllClients(3, AddOnLine(account));

            // 在主界面显示信息
            ShowMsg(object1.IpAddress + " " + object1.LoginAlias + " : 上线");
            ShowOnlineClient( );
        }