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


C# GSPacketIn.ReadString方法代码示例

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


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

示例1: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            if (client.Player.PlayerCharacter.IsBanChat)
            {
                client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("ConsortiaChatHandler.IsBanChat"));
                return 1;
            }

            packet.ClientID = (client.Player.PlayerCharacter.ID);
            byte channel = packet.ReadByte();
            string nick = packet.ReadString();
            string msg = packet.ReadString();
            packet.WriteInt(client.Player.PlayerCharacter.ConsortiaID);

            GamePlayer[] players = WorldMgr.GetAllPlayers();
            foreach (GamePlayer p in players)
            {
                if (p.PlayerCharacter.ConsortiaID == client.Player.PlayerCharacter.ConsortiaID)
                    p.Out.SendTCP(packet);
            }

            GameServer.Instance.LoginServer.SendPacket(packet);

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

示例2: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.CurrentMarryRoom != null && client.Player.PlayerCharacter.ID == client.Player.CurrentMarryRoom.Info.PlayerID)
            {
                string roomName = packet.ReadString();

                bool isPwdChanged = packet.ReadBoolean();

                string pwd = packet.ReadString();
                
                string introduction = packet.ReadString();

                MarryRoom room = client.Player.CurrentMarryRoom;

                room.Info.RoomIntroduction = introduction;
                room.Info.Name = roomName;
                if (isPwdChanged)
                {
                    room.Info.Pwd = pwd;
                }
                

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    db.UpdateMarryRoomInfo(room.Info);
                }

                room.SendMarryRoomInfoUpdateToScenePlayers(room);

                client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomInfoUpdateHandler.Successed"));
                return 0;
            }

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

示例3: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            byte roomType = packet.ReadByte();
            byte timeType = packet.ReadByte();
            string room = packet.ReadString();
            string pwd = packet.ReadString();
        
            RoomMgr.CreateRoom(client.Player, room, pwd, (eRoomType)roomType, timeType);

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

示例4: 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

示例5: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int activeID = packet.ReadInt();
            string awardID = packet.ReadString();
            string msg = "ActivePullDownHandler.Fail";
            using (ActiveBussiness db = new ActiveBussiness())
            {
                int result = db.PullDown(activeID, awardID, client.Player.PlayerCharacter.ID,ref msg);
                if (result == 0)
                {
                    client.Out.SendMailResponse(client.Player.PlayerCharacter.ID,eMailRespose.Receiver);
                }
                if (msg != "ActiveBussiness.Msg0")
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation(msg));
                }
                else
                {
                    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation(msg));

                }
            }

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

示例6: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            string remark = packet.ReadString();
            if (string.IsNullOrEmpty(remark) || System.Text.Encoding.Default.GetByteCount(remark) > 100)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaUserRemarkHandler.Long"));
                return 1;
            }
            bool result = false;
            string msg = "ConsortiaUserRemarkHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaUserRemark(id, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, remark, ref msg))
                {
                    msg = "ConsortiaUserRemarkHandler.Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例7: 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

示例8: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            
            //bool result = false;
            if (string.IsNullOrEmpty(client.Player.PlayerCharacter.CheckCode))
                return 1;

            //int check  = packet.ReadInt();

            string check = packet.ReadString();
            if (client.Player.PlayerCharacter.CheckCode.ToLower() == check.ToLower())
            {
                client.Player.PlayerCharacter.CheckCount = 0;

                //int rewardItemID = GameServer.Instance.Configuration.CheckRewardItem;
                //ItemTemplateInfo rewardItem = ItemMgr.GetSingleGoods(rewardItemID);
                //ItemInfo item = ItemInfo.CreateFromTemplate(rewardItem, 1, (int)Game.Server.Statics.ItemAddType.CheckCode);
                //if (item != null)
                //{
                //    item.IsBinds = true;
                //    if (client.Player.AddItem(item, Game.Server.Statics.ItemAddType.CheckCode) != -1)
                //    {
                //        client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("CheckCodeHandler.Msg1", item.Template.Name));
                //    }
                //    else
                //    {
                //        client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("CheckCodeHandler.Msg2"));
                //    }
                //}
                int GP = LevelMgr.GetGP(client.Player.PlayerCharacter.Grade);
                client.Player.AddGP(LevelMgr.IncreaseGP(client.Player.PlayerCharacter.Grade, client.Player.PlayerCharacter.GP));
               
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("CheckCodeHandler.Msg1", client.Player.PlayerCharacter.Grade * 12));
                //result = true;
                packet.ClearContext();
                packet.WriteByte(1);
                packet.WriteBoolean(false);
                client.Out.SendTCP(packet);
            }
           // else if (client.Player.PlayerCharacter.CheckError < 1 && client.Player.PlayerCharacter.CheckCount < 20000)
            else if (client.Player.PlayerCharacter.CheckError < 9)
            {
                client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("CheckCodeHandler.Msg3"));
                client.Player.PlayerCharacter.CheckError++;
                client.Out.SendCheckCode();
               
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("CheckCodeHandler.Msg3"));
                client.Disconnect();
              
            }
          
         
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:57,代码来源:CheckCodeHandler.cs

示例9: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     GSPacketIn pkg = new GSPacketIn(255);
     pkg.WriteString(packet.ReadString());
     foreach (var item in WorldMgr.GetAllPlayers())
     {
         item.SendTCP(pkg);
     } ;
        // client.SendTCP(pkg);
     return 0;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:11,代码来源:Test30Hand.cs

示例10: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
 
            //修改:  Xiaov 
            //时间:  2009-11-4
            //描述:  小喇叭<未测试>
            
            ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0,11, 4);
            if (item != null)
            {
                //item.Count--;
                //if (item.Count <= 0)
                //{
                //    client.Player.RemoveItem(item);
                //}
                //else
                //{                    
                    client.Player.PropBag.RemoveCountFromStack(item, 1);                   
              //  }
                int senderID = packet.ReadInt();
                string senderName = packet.ReadString();
                string msg = packet.ReadString();
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteString(msg);


                GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();

                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }

            }

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

示例11: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int dutyID = packet.ReadInt();
            int updateType = packet.ReadByte();
            //int level = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaDutyUpdateHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                info.DutyID = dutyID;
                info.IsExist = true;
                info.DutyName = "";
                switch (updateType)
                {
                    case 1:
                        return 1;
                    case 2:
                        info.DutyName = packet.ReadString();
                        if (string.IsNullOrEmpty(info.DutyName) || System.Text.Encoding.Default.GetByteCount(info.DutyName) > 10)
                        {
                            client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long"));
                            return 1;
                        }
                        info.Right = packet.ReadInt();
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                }

                if (db.UpdateConsortiaDuty(info, client.Player.PlayerCharacter.ID, updateType, ref msg))
                {
                    dutyID = info.DutyID;
                    msg = "ConsortiaDutyUpdateHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, client.Player.PlayerCharacter.ConsortiaID);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(dutyID);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例12: HandleCommand

 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if ((player.CurrentHotSpringRoom != null) && (player.CurrentHotSpringRoom.RoomState == eRoomState.FREE))
     {
         string str = packet.ReadString();
         int num = packet.ReadInt();
         player.X = packet.ReadInt();
         player.Y = packet.ReadInt();
         player.CurrentHotSpringRoom.ReturnPacketForScene(player, packet);
         return true;
     }
     return false;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:13,代码来源:MoveCommand.cs

示例13: HandlePacket

        public int HandlePacket(GameClient client,GSPacketIn packet )
        {
            ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0,11, 5);
            if (item != null)
            {
                //item.Count--;
                //if (item.Count <= 0)
                //{
                //    //client.Player.RemoveAllItem(item, false, Game.Server.Statics.ItemRemoveType.Use, item.GetBagType());
                //    client.Player.RemoveItem(item);
                //}
                //else
                //{                    
                   // client.Player.PropBag.RefreshItem(item);
                    client.Player.PropBag.RemoveCountFromStack(item,1);
                  
              
              //  }
                int senderID = packet.ReadInt();
                string senderName = packet.ReadString();
                string msg = packet.ReadString();

                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteString(msg);

                GameServer.Instance.LoginServer.SendPacket(pkg);

                GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();
                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }
            }
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:39,代码来源:BigBugleHandler.cs

示例14: HandleCommand

 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentHotSpringRoom != null && player.CurrentHotSpringRoom.RoomState == eRoomState.FREE)
     {
         var moveString = packet.ReadString();
         var playerId = packet.ReadInt();
         player.X = packet.ReadInt();
         player.Y = packet.ReadInt();
         //0 player.CurrentHotSpringRoom.ReturnPacket(player, packet);
         player.CurrentHotSpringRoom.ReturnPacketForScene(player, packet);
         return true;
     }
     return false;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:14,代码来源:TargetPointCommand.cs

示例15: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            //int id = packet.ReadInt();
            string nickName = packet.ReadString();
            bool result = false;
            string msg = "ConsortiaChangeChairmanHandler.Failed";

            if (string.IsNullOrEmpty(nickName))
            {
                msg = "ConsortiaChangeChairmanHandler.NoName";
            }
            else if( nickName == client.Player.PlayerCharacter.NickName)
            {
                msg = "ConsortiaChangeChairmanHandler.Self";
            }
            else
            {
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    string tempUserName = "";
                    int tempUserID = 0;
                    ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                    if (db.UpdateConsortiaChairman(nickName, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg, ref info,ref tempUserID, ref tempUserName))
                    {
                        ConsortiaDutyInfo orderInfo = new ConsortiaDutyInfo();
                        orderInfo.Level = client.Player.PlayerCharacter.DutyLevel;
                        orderInfo.DutyName = client.Player.PlayerCharacter.DutyName;
                        orderInfo.Right = client.Player.PlayerCharacter.Right;
                        msg = "ConsortiaChangeChairmanHandler.Success1";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaDuty(orderInfo, 9, client.Player.PlayerCharacter.ConsortiaID, tempUserID, tempUserName, 0, "");
                        GameServer.Instance.LoginServer.SendConsortiaDuty(info, 8, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, 0, "");
                    }
                }
            }
            string temp = LanguageMgr.GetTranslation(msg);
            if (msg == "ConsortiaChangeChairmanHandler.Success1")
            {
                temp += nickName + LanguageMgr.GetTranslation("ConsortiaChangeChairmanHandler.Success2");
            }

            packet.WriteBoolean(result);
            packet.WriteString(temp);
            client.Out.SendTCP(packet);

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


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