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


C# GSPacketIn.WriteString方法代码示例

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


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

示例1: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     //Lay Danh Sach tat ca cac phong
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.HOTSPRING_ROOM_LIST_GET);
     pkg.WriteInt(10);
     for (int i = 0; i < 10; i++)
     {
         //loc_2.roomNumber = _loc_3.readInt();
         pkg.WriteInt(i);
         //_loc_2.roomID = _loc_3.readInt();
         pkg.WriteInt(i);
         //_loc_2.roomName = _loc_3.readUTF();
         pkg.WriteString("Room" + i);
         //_loc_2.roomPassword = _loc_3.readUTF();
         pkg.WriteString("");
         //_loc_2.effectiveTime = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.curCount = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.playerID = _loc_3.readInt();
         pkg.WriteInt(client.Player.PlayerCharacter.ID);
         //_loc_2.playerName = _loc_3.readUTF();
         pkg.WriteString("abc");
         //_loc_2.startTime = _loc_3.readDate();
         pkg.WriteDateTime(DateTime.Now.AddDays(-50));
         //_loc_2.roomIntroduction = _loc_3.readUTF();
         pkg.WriteString("Room Intro");
         //_loc_2.roomType = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.maxCount = _loc_3.readInt();
         pkg.WriteInt(10);
     }
     client.SendTCP(pkg);
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:35,代码来源:HotSpringEnterHandler.cs

示例2: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //if (client.Player.CurrentHotSpringRoom != null)
            //{
            //    client.Player.CurrentHotSpringRoom.ProcessData(client.Player, packet);
            //}
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.HOTSPRING_ROOM_PLAYER_ADD);
            var player = client.Player.PlayerCharacter;
            pkg.WriteInt(player.ID);
            pkg.WriteInt(player.Grade);
            pkg.WriteInt(player.Hide);

            pkg.WriteInt(player.Repute);
            pkg.WriteString(player.NickName);
            pkg.WriteBoolean(true);
            pkg.WriteInt(5);
  
            pkg.WriteBoolean(player.Sex);
            pkg.WriteString(player.Style);
            pkg.WriteString(player.Colors);
            pkg.WriteString(player.Skin);
            pkg.WriteInt(405);
            pkg.WriteInt(405);
            //var _loc_6:* = new Point(_loc_2.readInt(), _loc_2.readInt());
            pkg.WriteInt(player.FightPower);
            pkg.WriteInt(player.Win);
            pkg.WriteInt(player.Total);
            pkg.WriteInt(45);
            //_loc_5.FightPower = _loc_2.readInt();
            //_loc_5.WinCount = _loc_2.readInt();
            //_loc_5.TotalCount = _loc_2.readInt();
            //_loc_4.playerDirection = _loc_2.readInt();
            client.SendTCP(pkg);
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:35,代码来源:HotSpringRoomEnterViewHandler.cs

示例3: HandlePacket

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


            int id = packet.ReadInt();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(id);

            if (player == client.Player)
                return 0;

            List<GamePlayer> players = client.Player.CurrentRoom.GetPlayers();
            foreach (GamePlayer p in players)
            {
                if (p == player)
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Sameroom"));
                    return 0;
                }
            }

            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_INVITE);
            if (player != null && player.CurrentRoom == null)
            {

                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.CurrentRoom.RoomId);
                pkg.WriteInt(client.Player.CurrentRoom.MapId);
                pkg.WriteByte((byte)client.Player.CurrentRoom.TimeMode);
                pkg.WriteByte((byte)client.Player.CurrentRoom.RoomType);
                pkg.WriteByte((byte)client.Player.CurrentRoom.HardLevel);
                pkg.WriteByte((byte)client.Player.CurrentRoom.LevelLimits);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteBoolean(true);
                pkg.WriteInt(5);
                pkg.WriteString(client.Player.CurrentRoom.Name);
                pkg.WriteString(client.Player.CurrentRoom.Password);

                //TrieuLSL BN IMInvite barrierNum
                pkg.WriteInt(50);


                player.Out.SendTCP(pkg);
            }
            else
            {
                if (player != null && player.CurrentRoom != null && player.CurrentRoom != client.Player.CurrentRoom)
                {

                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Room"));
                }
                else
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Fail"));
                }
            }
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:59,代码来源:GameInviteHandler.cs

示例4: HandlePacket

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

            int id = packet.ReadInt();
            bool result = false;
            int consortiaID = 0;
            string consortiaName = "";
            string msg = "ConsortiaInvitePassHandler.Failed";
            int tempID = 0;
            string tempName = "";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaInviteUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute))
                {
                    client.Player.PlayerCharacter.ConsortiaID = consortiaID;
                    client.Player.PlayerCharacter.ConsortiaName = consortiaName;
                    client.Player.PlayerCharacter.DutyLevel = info.Level;
                    client.Player.PlayerCharacter.DutyName = info.DutyName;
                    client.Player.PlayerCharacter.Right = info.Right;
                    ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                    if (consotia != null)
                        client.Player.PlayerCharacter.ConsortiaLevel = consotia.Level;
                    msg = "ConsortiaInvitePassHandler.Success";
                    result = true;

                    info.UserID = client.Player.PlayerCharacter.ID;
                    info.UserName = client.Player.PlayerCharacter.NickName;
                    info.Grade = client.Player.PlayerCharacter.Grade;
                    info.Offer = client.Player.PlayerCharacter.Offer;
                    info.RichesOffer = client.Player.PlayerCharacter.RichesOffer;
                    info.RichesRob = client.Player.PlayerCharacter.RichesRob;
                    info.Win = client.Player.PlayerCharacter.Win;
                    info.Total = client.Player.PlayerCharacter.Total;
                    info.Escape = client.Player.PlayerCharacter.Escape;
                    info.ConsortiaID = consortiaID;
                    info.ConsortiaName = consortiaName;

                    GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, client.Player.PlayerCharacter.UserName, client.Player.PlayerCharacter.FightPower);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(consortiaID);
            packet.WriteString(consortiaName);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例5: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {

            int Type = packet.ReadInt();
            if (Type == 2)
            {
                int ItemID = packet.ReadInt();

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    ItemInfo Item = db.GetUserItemSingle(ItemID);
                    if (Item != null)
                    {
                        GSPacketIn pkg = new GSPacketIn((byte)ePackageType.LINKREQUEST_GOODS, client.Player.PlayerCharacter.ID);
                        pkg.WriteInt(Item.TemplateID);
                        pkg.WriteInt(Item.ItemID);

                        pkg.WriteInt(Item.StrengthenLevel);

                        pkg.WriteInt(Item.AttackCompose);

                        pkg.WriteInt(Item.AgilityCompose);

                        pkg.WriteInt(Item.LuckCompose);

                        pkg.WriteInt(Item.DefendCompose);
                        pkg.WriteInt(Item.ValidDate);
                        pkg.WriteBoolean(Item.IsBinds);
                        pkg.WriteBoolean(Item.IsJudge);
                        pkg.WriteBoolean(Item.IsUsed);
                        if (Item.IsUsed)
                        {
                            pkg.WriteString(Item.BeginDate.ToString());
                        }
                        pkg.WriteInt(Item.Hole1);
                        pkg.WriteInt(Item.Hole2);
                        pkg.WriteInt(Item.Hole3);
                        pkg.WriteInt(Item.Hole4);
                        pkg.WriteInt(Item.Hole5);
                        pkg.WriteInt(Item.Hole6);

                        pkg.WriteString(Item.Template.Hole);

                        client.Out.SendTCP(pkg);
                    }
                    return 1;
                }

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

示例6: HandlePacket

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

            int banUserID = packet.ReadInt();
            bool isBanChat = packet.ReadBoolean();
            int userID = 0;
            string userName = "";
            bool result = false;
            string msg = "ConsortiaIsBanChatHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaIsBanChat(banUserID, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, isBanChat, ref userID, ref userName, ref msg))
                {
                    msg = "ConsortiaIsBanChatHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaBanChat(userID, userName, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName,isBanChat);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

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

示例8: SendLoginFailed

 public void SendLoginFailed(string msg)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.LOGIN);
     pkg.WriteByte(1);
     pkg.WriteString(msg);
     SendTCP(pkg);
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:7,代码来源:AbstractPacketLib.cs

示例9: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;
            //Type 1表示商城,2表示铁匠铺

            bool result = false;
            string msg = "ConsortiaEquipControlHandler.Fail";
            ConsortiaEquipControlInfo info = new ConsortiaEquipControlInfo();
            info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                for (int i = 0; i < 5; i++)
                {

                    info.Riches = packet.ReadInt();
                    info.Type = 1;
                    info.Level = i + 1;

                    db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                }
                info.Riches = packet.ReadInt();
                info.Type = 2;
                info.Level = 0;
                db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                msg = "ConsortiaEquipControlHandler.Success";
                result = true;
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例10: HandlePacket

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

            int id = packet.ReadInt();
            bool isAlly = packet.ReadBoolean();
            bool result = false;
            string msg = "ConsortiaApplyAllyAddHandler.Add_Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyAllyInfo info = new ConsortiaApplyAllyInfo();
                info.Consortia1ID = client.Player.PlayerCharacter.ConsortiaID;
                info.Consortia2ID = id;
                info.Date = DateTime.Now;
                info.State = 0;// isAlly ? 1 : 0;
                info.Remark = "";
                info.IsExist = true;
                if (db.AddConsortiaApplyAlly(info, client.Player.PlayerCharacter.ID, ref msg))
                {
                    msg = "ConsortiaApplyAllyAddHandler.Add_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例11: HandlePacket

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

            int id = packet.ReadInt();
            bool result = false;
            string nickName = "";
            string msg = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitFailed" : "ConsortiaUserDeleteHandler.KickFailed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortiaUser(client.Player.PlayerCharacter.ID, id, client.Player.PlayerCharacter.ConsortiaID, ref msg, ref nickName))
                {
                    msg = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitSuccess" : "ConsortiaUserDeleteHandler.KickSuccess";
                    int consortiaID = client.Player.PlayerCharacter.ConsortiaID;
                    if (id == client.Player.PlayerCharacter.ID)
                    {
                        client.Player.ClearConsortia();
                        client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver);
                    }

                   // client.Player.StoreBag.SendStoreToMail();
                    GameServer.Instance.LoginServer.SendConsortiaUserDelete(id, consortiaID, id != client.Player.PlayerCharacter.ID, nickName,client.Player.PlayerCharacter.NickName);
                    result = true;
                }
            }

            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例12: HandlePacket

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

            int id = client.Player.PlayerCharacter.ConsortiaID;
            string consortiaName = client.Player.PlayerCharacter.ConsortiaName;
            bool result = false;
            string msg = "ConsortiaDisbandHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                {
                    result = true;
                    msg = "ConsortiaDisbandHandler.Success1";

                    client.Player.ClearConsortia();

                    GameServer.Instance.LoginServer.SendConsortiaDelete(id);
                }
            }

            string temp = LanguageMgr.GetTranslation(msg);
            if (msg == "ConsortiaDisbandHandler.Success1")
            {
                temp += consortiaName + LanguageMgr.GetTranslation("ConsortiaDisbandHandler.Success2");
            }

            packet.WriteBoolean(result);
            packet.WriteInt(client.Player.PlayerCharacter.ID);
            packet.WriteString(temp);
            client.Out.SendTCP(packet);

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

示例13: HandlePacket

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

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginPassHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaApplyUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ConsortiaID, ref msg, info, ref consortiaRepute))
                {
                    msg = "ConsortiaApplyLoginPassHandler.Success";
                    result = true;
                    if (info.UserID != 0)
                    {
                        info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                        info.ConsortiaName = client.Player.PlayerCharacter.ConsortiaName;
                        GameServer.Instance.LoginServer.SendConsortiaUserPass(client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, info, false, consortiaRepute, info.LoginName, client.Player.PlayerCharacter.FightPower);
                    }
                }
            }

            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例14: HandlePacket

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

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginHandler.ADD_Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyUserInfo info = new ConsortiaApplyUserInfo();
                info.ApplyDate = DateTime.Now;
                info.ConsortiaID = id;
                info.ConsortiaName = "";
                info.IsExist = true;
                info.Remark = "";
                info.UserID = client.Player.PlayerCharacter.ID;
                info.UserName = client.Player.PlayerCharacter.NickName;
                if (db.AddConsortiaApplyUsers(info, ref msg))
                {
                    msg = id != 0 ? "ConsortiaApplyLoginHandler.ADD_Success" : "ConsortiaApplyLoginHandler.DELETE_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

示例15: HandlePacket

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

            int id = packet.ReadInt();
            bool upGrade = packet.ReadBoolean();
            bool result = false;
            string msg = "ConsortiaUserGradeUpdateHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                string tempUserName = "";
                ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                if (db.UpdateConsortiaUserGrade(id, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, upGrade, ref msg, ref info, ref tempUserName))
                {
                    msg = "ConsortiaUserGradeUpdateHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaDuty(info, upGrade ? 6 : 7, client.Player.PlayerCharacter.ConsortiaID,id, tempUserName,client.Player.PlayerCharacter.ID,client.Player.PlayerCharacter.NickName);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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


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