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


C# PlayerBussiness.GetUserSingleByUserID方法代码示例

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


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

示例1: HandlePacket

        //修改:  Xiaov
        //时间:  2009-11-7
        //描述:  获取用户装备<已测试>
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            bool type = packet.ReadBoolean();//_loc_3.writeBoolean(true);
            int id = packet.ReadInt();
            string nickname;
            if (!type)
                nickname = packet.ReadString();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(id);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.MainBag.GetItems(0, 31);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(id);
                    items = pb.GetUserEuqip(id);
                }
            }

            if (info != null && items != null)
                client.Out.SendUserEquip(info, items);
            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:31,代码来源:UserEquipListHandler.cs

示例2: BuildCelebConsortia

        public static string BuildCelebConsortia(string file, int order, string fileNotCompress)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = 1;
                int size = 50;
                //int order = 10;
                int consortiaID = -1;
                string name = "";
                int level = -1;

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page, size, ref total, order, name, consortiaID, level,-1);
                    foreach (ConsortiaInfo info in infos)
                    {
                        XElement node = FlashUtils.CreateConsortiaInfo(info);

                        if (info.ChairmanID != 0)
                        {
                            using (PlayerBussiness pb = new PlayerBussiness())
                            {
                                PlayerInfo player = pb.GetUserSingleByUserID(info.ChairmanID);
                                if (player != null)
                                {
                                    node.Add(FlashUtils.CreateCelebInfo(player));
                                }
                            }
                        }
                        result.Add(node);
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error(file + " is fail!", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            result.Add(new XAttribute("date", System.DateTime.Today.ToString("yyyy-MM-dd")));

            if (!string.IsNullOrEmpty(fileNotCompress))
            {
                csFunction.CreateCompressXml(result, fileNotCompress, false);
            }

            return csFunction.CreateCompressXml(result, file, true);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:58,代码来源:csFunction.cs

示例3: TestMethod2

        public void TestMethod2()
        {
            PlayerBussiness pb = new PlayerBussiness();

            for (int i = 2000; i < 3000; i++)
            {
                PlayerInfo info = pb.GetUserSingleByUserID(i);
                Assert.IsNotNull(info);
            }
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:10,代码来源:TestDB.cs

示例4: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            bool result = packet.ReadBoolean();
            int UserID = packet.ReadInt();
            int AnswerId = packet.ReadInt();   //答复对话框ID
            //先判断自已有没有结婚
            if (result && client.Player.PlayerCharacter.IsMarried)
            {
                client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2"));                
            }

            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
                //发送好人卡
                if (!result)
                {
                    SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db);
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);                    
                }

                //判断对方有没有结婚                
                if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                {
                    return 1;
                }
                if (tempSpouse.IsMarried)
                {
                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3"));
                }

                MarryApplyInfo info = new MarryApplyInfo();
                info.UserID = UserID;
                info.ApplyUserID = client.Player.PlayerCharacter.ID;
                info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                info.ApplyType = 2;
                info.LoveProclamation = "";
                info.ApplyResult = result;
                int id = 0;
                if (db.SavePlayerMarryNotice(info, AnswerId, ref id))
                {
                    if (result)
                    {                        
                        client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id);
                        client.Player.LoadMarryProp();
                        SendSYSMessages(client.Player, tempSpouse);
                    }
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
                    return 0;
                }
            }
            return 1;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:53,代码来源:MarryApplyReplyHandler.cs

示例5: HandleUPDATE_PET

        protected void HandleUPDATE_PET(GameClient client, int ID)
        {
            GamePlayer player = Managers.WorldMgr.GetPlayerById(ID);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.CardBag.GetItems(0, 6);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(ID);
                    items = pb.GetUserCardEuqip(ID);
                }
            }

            if (info != null && items != null)
                client.Out.SendUpdatePetInfo(info, items);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:22,代码来源:PetHandler.cs

示例6: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int UserID = packet.ReadInt();

            GamePlayer Spouse = WorldMgr.GetPlayerById(UserID);

            if (Spouse != null)
            {
                client.Player.Out.SendPlayerMarryStatus(client.Player, Spouse.PlayerCharacter.ID, Spouse.PlayerCharacter.IsMarried);
            }
            else
            { 
                using (PlayerBussiness db = new PlayerBussiness())
                {                                                                                   
                    PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
                    client.Player.Out.SendPlayerMarryStatus(client.Player, tempSpouse.ID, tempSpouse.IsMarried);
                }

            }

            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:22,代码来源:MarryStatusHandler.cs

示例7: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int user_id = packet.ReadInt();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(user_id);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.CardBag.GetItems(0, 6);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(user_id);
                    items = pb.GetUserCardEuqip(user_id);
                }
            }

            if (info != null && items != null)
            client.Out.SendPlayerCardInfo(info, items);
            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:24,代码来源:PlayerCardInfoHandler.cs

示例8: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (!client.Player.PlayerCharacter.IsMarried)
            {
                return 1;
            }

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {

                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 0;
            }

            if(client.Player.PlayerCharacter.IsCreatedMarryRoom)
            {
                client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2"));
                return 1;

            }

            int needMoney = GameProperties.PRICE_DIVORCED;
            if (client.Player.PlayerCharacter.Money < needMoney)
            {
                client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1"));
                return 1;
            }
            else
            {
                client.Player.RemoveMoney(needMoney);
                LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, needMoney, client.Player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
                CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Divorce);

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    PlayerInfo tempSpouse = db.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID);
                    if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                    {
                        return 1;
                    }

                    MarryApplyInfo info = new MarryApplyInfo();
                    info.UserID = client.Player.PlayerCharacter.SpouseID;
                    info.ApplyUserID = client.Player.PlayerCharacter.ID;
                    info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                    info.ApplyType = 3;
                    info.LoveProclamation = "";
                    info.ApplyResult = false;
                    int id = 0;
                    if (db.SavePlayerMarryNotice(info,0, ref id))
                    {
                        GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
                        client.Player.LoadMarryProp();
                    }
                }

                client.Player.QuestInventory.ClearMarryQuest(); //离婚后清除结婚后任务.
                client.Player.Out.SendPlayerDivorceApply(client.Player, true,true);
                client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3"));
            }

            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:63,代码来源:DivorceApplyHandler.cs

示例9: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //判断是否结婚
            if(client.Player.PlayerCharacter.IsMarried)  
            {
                return 1;
            }
            //是否有二级密码
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 1;
            }
            //开始求婚,购买戒指
            int SpouseID = packet.ReadInt();
            string loveProclamation = packet.ReadString();
            bool Broadcast = packet.ReadBoolean();
            bool result = false;
            bool removeRing = true;
            string SpouseName = "";
            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo tempSpouse = db.GetUserSingleByUserID(SpouseID);
                if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                {
                    return 1;
                }
                if (tempSpouse.IsMarried)
                {
                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg2"));
                    return 1;
                }
                ItemInfo WeddingRing = client.Player.PropBag.GetItemByTemplateID(0,11103);
                if (WeddingRing == null)
                {                    
                    ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
                    if (tempRing != null)
                    {
                        //玩家身上钱是否足够。
                        if (client.Player.PlayerCharacter.Money >= tempRing.AValue1)
                        {
                            removeRing = false;
                        }
                        else
                        {
                            client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1"));
                            return 1;
                        }
                    }
                    else
                    {
                        client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg6"));
                        return 1;
                    }
                }
                //插入结婚消息
                MarryApplyInfo info = new MarryApplyInfo();
                info.UserID = SpouseID;
                info.ApplyUserID = client.Player.PlayerCharacter.ID;
                info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                info.ApplyType = 1;
                info.LoveProclamation = loveProclamation;
                info.ApplyResult = false;
                int id=0;
                if (db.SavePlayerMarryNotice(info,0,ref id))
                {
                    if (removeRing)
                    {
                        client.Player.RemoveItem(WeddingRing);
                    }
                    else
                    {
                        //未开始                        
                        ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
                        client.Player.RemoveMoney(tempRing.AValue1);
                        LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Spark, client.Player.PlayerCharacter.ID, tempRing.AValue1, client.Player.PlayerCharacter.Money, 0, 0, 0, "", tempRing.TemplateID.ToString(), "1");
                    }
                    client.Player.Out.SendPlayerMarryApply(client.Player, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, loveProclamation,id);  //发送求婚信息
                    //发送消息给中心服务器
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(SpouseID);
                    SpouseName = tempSpouse.NickName;
                    result = true;

                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg3"));
                }

            }
            if (result && Broadcast && SpouseName != "")
            {
                string msg = LanguageMgr.GetTranslation("MarryApplyHandler.Msg5", client.Player.PlayerCharacter.NickName, SpouseName);
                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                pkg.WriteInt(2);
                pkg.WriteString(msg);
                GameServer.Instance.LoginServer.SendPacket(pkg);
                GamePlayer[] players = WorldMgr.GetAllPlayers();
                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }
            }           
//.........这里部分代码省略.........
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:101,代码来源:MarryApplyHandler.cs

示例10: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";

            XElement result = new XElement("Result");
            try
            {
               // int userid = int.Parse(context.Request.Params["ID"]);
                int userid = int.Parse(context.Request["ID"]);
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    PlayerInfo info = pb.GetUserSingleByUserID(userid);
                    result.Add(new XAttribute("Agility", info.Agility),
                        new XAttribute("Attack", info.Attack),
                        new XAttribute("Colors", info.Colors),
                        new XAttribute("Skin", info.Skin),
                        new XAttribute("Defence", info.Defence),
                        new XAttribute("GP", info.GP),
                        new XAttribute("Grade", info.Grade),
                        new XAttribute("Luck", info.Luck),
                        new XAttribute("Hide", info.Hide),
                        new XAttribute("Repute", info.Repute),
                        new XAttribute("Offer", info.Offer),
                        new XAttribute("NickName", info.NickName),
                        new XAttribute("ConsortiaName", info.ConsortiaName),
                        new XAttribute("ConsortiaID", info.ConsortiaID),
                        new XAttribute("ReputeOffer", info.ReputeOffer),
                        new XAttribute("ConsortiaHonor", info.ConsortiaHonor),
                        new XAttribute("ConsortiaLevel", info.ConsortiaLevel),
                        new XAttribute("ConsortiaRepute", info.ConsortiaRepute),
                        new XAttribute("WinCount", info.Win),
                        new XAttribute("TotalCount", info.Total),
                        new XAttribute("EscapeCount", info.Escape),
                        new XAttribute("Sex", info.Sex),
                        new XAttribute("Style", info.Style),
                        new XAttribute("FightPower",info.FightPower));




                    ItemInfo[] items = pb.GetUserEuqip(userid).ToArray();
                    foreach (ItemInfo g in items)
                    {
                        result.Add(Road.Flash.FlashUtils.CreateGoodsInfo(g));
                    }

                    //XElement item = new XElement("Item");
                    //ItemInfo[] items = pb.GetUserEuqip(userid);
                    //foreach (ItemInfo g in items)
                    //{
                    //    item.Add(Road.Flash.FlashUtils.CreateGoodsInfo(g));
                    //}

                    //XElement buff = new XElement("Buff");
                    //BuffInfo[] buffs = pb.GetUserBuff(userid);
                    //foreach (BuffInfo b in buffs)
                    //{
                    //    if (!b.IsValid())
                    //        continue;
                    //    buff.Add(Road.Flash.FlashUtils.CreateBuffInfo(b));
                    //}

                   // result.Add(item);
                    //result.Add(buff);
                }


                value = true;
                message = "Success!";

            }
            catch(Exception ex)
            {
                log.Error("LoadUserEquip", ex);
            }

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

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:83,代码来源:LoadUserEquip.ashx.cs

示例11: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            int result = 1;
            try
            {
                string IP = Context.Request.UserHostAddress;
                if (ValidLoginIP(IP))
                {
                    string content = HttpUtility.UrlDecode(Request["content"]);
                    string site = Request["site"] == null ? "" : HttpUtility.UrlDecode(Request["site"]).ToLower();
                    string nickname = Request["nickname"] == null ? "" : HttpUtility.UrlDecode(Request["nickname"]);

                    BaseInterface inter = BaseInterface.CreateInterface();
                    string[] str = inter.UnEncryptCharge(content, ref result, site);
                    if (str.Length > 5)
                    {
                        string chargeID = str[0];
                        string userName = str[1].Trim();
                        int money = int.Parse(str[2]);
                        string payWay = str[3];
                        decimal needMoney = decimal.Parse(str[4]);

                        if (!string.IsNullOrEmpty(userName))
                        {
                            userName= BaseInterface.GetNameBySite(userName, site);
                            if (money > 0)
                            {
                                using (PlayerBussiness db = new PlayerBussiness())
                                {
                                    int userID;
                                    DateTime date = DateTime.Now;
                                    if (db.AddChargeMoney(chargeID, userName, money, payWay, needMoney, out userID, ref result, date, IP, nickname))
                                    {
                                        result = 0;
                                        using (CenterServiceClient temp = new CenterServiceClient())
                                        {
                                            temp.ChargeMoney(userID, chargeID);
                                            using (PlayerBussiness pb = new PlayerBussiness())
                                            {
                                                PlayerInfo player = pb.GetUserSingleByUserID(userID);
                                                if (player != null)
                                                    StaticsMgr.Log(date, userName, player.Sex, money, payWay,needMoney);
                                                else
                                                {
                                                    StaticsMgr.Log(date, userName, true, money, payWay, needMoney);
                                                    log.Error("ChargeMoney_StaticsMgr:Player is null!");
                                                }
                                            }

                                        }
                                    }
                                }
                            }
                            else
                            {
                                result = 3;
                            }
                        }
                        else
                        {
                            result = 2;
                        }
                    }
                }
                else
                {
                    result = 5;
                }
            }
            catch (Exception ex)
            {
                log.Error("ChargeMoney:", ex);
            }
            Response.Write(result);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:75,代码来源:ChargeMoney.aspx.cs

示例12: LoadFromDatabase

 public bool LoadFromDatabase()
 {
     using (PlayerBussiness db = new PlayerBussiness())
     {
         PlayerInfo detail = db.GetUserSingleByUserID(m_character.ID);
         if (detail == null)
         {
             Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Forbid"));
             Client.Disconnect();
             return false;
         }
         else
         {
             m_character = detail;
         }
         ChargeToUser();
         int[] sole = new int[] { 0, 1, 2 };
         Out.SendUpdateInventorySlot(FightBag, sole);
         UpdateItemForUser(1);
         UpdateVIPForUser();
         //AddGP(0);
         UpdateWeapon(m_mainBag.GetItemAt(6));
         UpdateSecondWeapon(m_mainBag.GetItemAt(15));
         m_pvepermissions = string.IsNullOrEmpty(detail.PvePermission) ? InitPvePermission() : m_converter.GetBytes(detail.PvePermission);
         _friends = new Dictionary<int, int>();
         _friends = db.GetFriendsIDAll(m_character.ID);
         m_character.State = 1;
         db.UpdatePlayer(m_character);
         //  db.UpdateVIPInfo(m_character);
         return true;
     }
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:32,代码来源:GamePlayer.cs


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