当前位置: 首页>>代码示例>>C#>>正文


C# PlayerBussiness.GetUserSingleByNickName方法代码示例

本文整理汇总了C#中Bussiness.PlayerBussiness.GetUserSingleByNickName方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.GetUserSingleByNickName方法的具体用法?C# PlayerBussiness.GetUserSingleByNickName怎么用?C# PlayerBussiness.GetUserSingleByNickName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bussiness.PlayerBussiness的用法示例。


在下文中一共展示了PlayerBussiness.GetUserSingleByNickName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePacket

        //修改:  Xiaov
        //时间:  2009-11-7
        //描述:  用户与用户之间私聊<已测试>
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int receiverID = packet.ReadInt();
            //int senderID = packet.ReadInt();
            string receiver = packet.ReadString();
            string sender = packet.ReadString();
            string msg = packet.ReadString();
            bool isAutoReply = packet.ReadBoolean();

            if (receiverID == 0)
            {
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    PlayerInfo info = db.GetUserSingleByNickName(receiver);
                    if (info != null)
                        receiverID = info.ID;
                }
            }

            if (receiverID != 0)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.WriteInt(receiverID);
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                //pkg.WriteInt(senderID);
                pkg.WriteString(receiver);
                pkg.WriteString(sender);
                pkg.WriteString(msg);
                pkg.WriteBoolean(false);

                GamePlayer player = Managers.WorldMgr.GetPlayerById(receiverID);

                if (player != null)
                {
                    if (player.IsBlackFriend(client.Player.PlayerCharacter.ID))
                        return 1;
                    player.Out.SendTCP(pkg);
                }
                else
                {

                    GameServer.Instance.LoginServer.SendPacket(pkg);
                }
                client.Out.SendTCP(pkg);
            }
            else
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser"));
            }

            return 1;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:56,代码来源:UserPrivateChatHandler.cs

示例2: KitoffUserByNickName

        public int KitoffUserByNickName(string name, string msg)
        {
            int result = 1;
            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo player = db.GetUserSingleByNickName(name);
                if (player == null)
                    return 2;

                result = KitoffUser(player.ID, msg);
            }
            return result;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:13,代码来源:ManageBussiness.cs

示例3: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool value = false;
            //string message = "Name is Exist!";
            string message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Exist");
            XElement result = new XElement("Result");

            try
            {
                string nickName = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["NickName"]));
                if (System.Text.Encoding.Default.GetByteCount(nickName) <= 14)
                {
                    if (!string.IsNullOrEmpty(nickName))
                    {
                        using (PlayerBussiness db = new PlayerBussiness())
                        {
                            if (db.GetUserSingleByNickName(nickName) == null)
                            {
                                value = true;
                                //message = "You can register!";
                                message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Right",new object [0]);

                            }
                        }
                    }
                }
                else
                {
                    message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Long", new object[0]);
                }
            }
            catch(Exception ex)
            {
                log.Error("NickNameCheck", ex);
                value = false;
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:44,代码来源:NickNameCheck.ashx.cs

示例4: HandlePacket

        // <summary>
        // 修改:  Xiaov 
        // 时间:  2009-11-7
        // 描述:  发送邮件<未测试>   
       
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {

           
            if (client.Player.PlayerCharacter.Gold < 100)
                return 1;

           

            string msg = "UserSendMailHandler.Success";
            eMessageType eMsg = eMessageType.Normal;
            GSPacketIn pkg = packet.Clone();
            pkg.ClearContext();

            string nickName = packet.ReadString().Trim();
            string title = packet.ReadString();
            string content = packet.ReadString();
            bool isPay = packet.ReadBoolean();
            int validDate = packet.ReadInt();
            int money = packet.ReadInt();

            eBageType bag1 = (eBageType)packet.ReadByte();
            int place1 = packet.ReadInt();
            eBageType bag2 = (eBageType)packet.ReadByte();
            int place2 = packet.ReadInt();
            eBageType bag3 = (eBageType)packet.ReadByte();
            int place3 = packet.ReadInt();
            eBageType bag4 = (eBageType)packet.ReadByte();
            int place4 = packet.ReadInt();

            if ((money!=0||place1!=-1||place2!=-1||place3!=-1||place4!=-1)&&(client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked))
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                pkg.WriteBoolean(false);
                client.Out.SendTCP(pkg);
                return 1;
            }

            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo user;
                GamePlayer player = Managers.WorldMgr.GetClientByPlayerNickName(nickName);
                if (player == null)
                {
                    user = db.GetUserSingleByNickName(nickName);
                }
                else
                {
                    user = player.PlayerCharacter;
                }

                if (user != null && !string.IsNullOrEmpty(nickName))
                {
                    if (user.NickName != client.Player.PlayerCharacter.NickName)
                    {
                        client.Player.SaveIntoDatabase();

                        //附件内容描述(例:邮件最后一行标注附件为:1、大喇叭x5;2、强化石4级x1;3、极•烈火x1;4、点券999999;5、强化公式-朱雀x5
                        MailInfo message = new MailInfo();
                        message.SenderID = client.Player.PlayerCharacter.ID;
                        message.Sender = client.Player.PlayerCharacter.NickName;
                        message.ReceiverID = user.ID;
                        message.Receiver = user.NickName;
                        message.IsExist = true;
                        message.Gold = 0;
                        message.Money = 0;

                        message.Title = title;
                        message.Content = content;
                        List<ItemInfo> items = new List<ItemInfo>();
                        List<eBageType> bagType = new List<eBageType>();
                        StringBuilder annexRemark = new StringBuilder();
                        annexRemark.Append(LanguageMgr.GetTranslation("UserSendMailHandler.AnnexRemark"));
                        int index = 0;

                        if (place1 != -1)
                        {
                            ItemInfo goods = client.Player.GetItemAt(bag1, place1);
                            if (goods != null && !goods.IsBinds)
                            {
                                message.Annex1Name = goods.Template.Name;
                                message.Annex1 = goods.ItemID.ToString();
                                items.Add(goods);
                                bagType.Add(bag1);
                                //annexRemark = message.Annex1Name + "x" + goods.Count;
                                index++;
                                annexRemark.Append(index);
                                annexRemark.Append("、");
                                //annexRemark.Append(annexRemark.Length);
                                annexRemark.Append(message.Annex1Name);
                                annexRemark.Append("x");
                                annexRemark.Append(goods.Count);
                                annexRemark.Append(";");
                                //goods.UserID = 0;
                                //client.Player.RemoveAllItem(goods, true, ItemRemoveType.Mail);
//.........这里部分代码省略.........
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:101,代码来源:UserSendMailHandler.cs

示例5: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int gold = 0;            //表示金币
            int money = 0;           //表示点券
            int offer = 0;           //表示功勋
            int gifttoken = 0;       //表示礼劵
            StringBuilder payGoods = new StringBuilder();                    //表示支付物品ID
            eMessageType eMsg = eMessageType.Normal;
            string msg = "GoodsPresentHandler.Success";

            string content = packet.ReadString();       //赠送人留言
            string nickName = packet.ReadString();      //购买人昵称
            List<int> needitemsinfo = new List<int>();  //存放兑换物品的templateID,Count

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 0;
            }

            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo receiver = db.GetUserSingleByNickName(nickName);
                if (receiver != null)
                {
                    List<ItemInfo> items = new List<ItemInfo>();
                    StringBuilder types = new StringBuilder();

                    int count = packet.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        int GoodsID = packet.ReadInt();         //序号
                        int type = packet.ReadInt();       //购买方式
                        string color = packet.ReadString();//颜色
                        string skin = packet.ReadString(); //皮肤

                        ShopItemInfo shopItem = Bussiness.Managers.ShopMgr.GetShopItemInfoById(GoodsID);                   //获取商品信息

                        if (shopItem == null)                                                                              //商品不存在
                        {
                            continue;
                        }

                        ItemTemplateInfo goods = Bussiness.Managers.ItemMgr.FindItemTemplate(shopItem.TemplateID);              //查找物品属性
                        ItemInfo item = ItemInfo.CreateFromTemplate(goods, 1, (int)ItemAddType.Gift);                           //构建物品临时属性

                        if (item == null)
                            continue;

                        //未开始
                        //if (shopitem.AValue1 <= 0 || shopitem.Beat <= 0)
                        //    continue;

                        item.Color = color == null ? "" : color;
                        item.Skin = skin == null ? "" : skin;

                        if (item == null)
                            continue;

                        types.Append(type);
                        types.Append(",");
                        items.Add(item);

                        needitemsinfo = ItemInfo.SetItemType(shopItem, type, ref gold, ref money, ref offer, ref gifttoken);
                    }

                    if (items.Count == 0)
                        return 1;

                    //////////////////////////////////////////////////////////////////////////////////////
                    //玩家背包中是否有兑换物品所需要的物品
                    int icount = client.Player.MainBag.GetItems().Count;       //获取个数
                    bool result = true;
                    for (int j = 0; j < needitemsinfo.Count; j += 2)
                    {
                        if (client.Player.GetItemCount(needitemsinfo[j]) < needitemsinfo[j + 1])
                        {
                            result = false;
                        }
                    }

                    if (!result)
                    {
                        eMsg = eMessageType.ERROR;
                        msg = "UserBuyItemHandler.NoBuyItem";
                        return 1;
                    }
                    /////////////////////////////////////////////////////////////

                    if (gold <= client.Player.PlayerCharacter.Gold && money <= client.Player.PlayerCharacter.Money && offer <= client.Player.PlayerCharacter.Offer && gifttoken <= client.Player.PlayerCharacter.GiftToken)
                    {

                        types.Remove(types.Length - 1, 1);
                        client.Player.RemoveMoney(money);
                        client.Player.RemoveGold(gold);
                        client.Player.RemoveOffer(offer);
                        client.Player.RemoveGiftToken(gifttoken);
                        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        //从玩家背包中删除兑换所需要的物品
                        for (int j = 0; j < needitemsinfo.Count; j += 2)
//.........这里部分代码省略.........
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:101,代码来源:GoodsPresentHandler.cs

示例6: HandlePacket

        //0友好,1黑名单
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();
            pkg.ClearContext();

            string nickName = packet.ReadString();
            int relation = packet.ReadInt();
            if (relation < 0 || relation > 1)
                return 1;

            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo user = null;
                GamePlayer player = Managers.WorldMgr.GetClientByPlayerNickName(nickName);
                if (player != null)
                    user = player.PlayerCharacter;
                else
                    user = db.GetUserSingleByNickName(nickName);
                if (!string.IsNullOrEmpty(nickName) && user != null)
                {
                    if (!client.Player.Friends.ContainsKey(user.ID) || client.Player.Friends[user.ID] != relation)
                    {
                        FriendInfo friend = new FriendInfo();
                        friend.FriendID = user.ID;
                        friend.IsExist = true;
                        friend.Remark = "";
                        friend.UserID = client.Player.PlayerCharacter.ID;
                        friend.Relation = relation;
                        if (db.AddFriends(friend))
                        {
                            client.Player.FriendsAdd(user.ID, relation);
                            pkg.WriteInt(user.ID);
                            pkg.WriteString(user.NickName);
                            pkg.WriteBoolean(user.Sex);
                            pkg.WriteString(user.Style);
                            pkg.WriteString(user.Colors);
                            pkg.WriteString(user.Skin);
                            pkg.WriteInt(user.State == 1 ? 1 : 0);
                            pkg.WriteInt(user.Grade);
                            pkg.WriteInt(user.Hide);
                            pkg.WriteString(user.ConsortiaName);
                            pkg.WriteInt(user.Total);
                            pkg.WriteInt(user.Escape);
                            pkg.WriteInt(user.Win);
                            pkg.WriteInt(user.Offer);
                            pkg.WriteInt(user.Repute);
                            pkg.WriteInt(relation);
                            pkg.WriteString(user.UserName);
                            pkg.WriteInt(user.Nimbus);
                            pkg.WriteInt(user.FightPower);
                            pkg.WriteInt(500);
                            pkg.WriteString("Honor");
                            if (relation != 1 && user.State != 0)
                            {
                                GSPacketIn response = new GSPacketIn((byte)ePackageType.FRIEND_RESPONSE, client.Player.PlayerCharacter.ID);
                                response.WriteInt(user.ID);
                                response.WriteString(client.Player.PlayerCharacter.NickName);
                                if (player != null)
                                    player.Out.SendTCP(response);
                                else
                                    GameServer.Instance.LoginServer.SendPacket(response);
                            }
                            client.Out.SendTCP(pkg);
                        }
                    }
                    else
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("FriendAddHandler.Falied"));
                    }
                }
                else
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("FriendAddHandler.Success"));
                }
            }
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:78,代码来源:FriendAddHandler.cs


注:本文中的Bussiness.PlayerBussiness.GetUserSingleByNickName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。