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


C# Packets.GSPacketIn类代码示例

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


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

示例1: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {

            int index = packet.ReadInt();
            client.Player.FightBag.RemoveItemAt(index);
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:7,代码来源:PropDeleteHandler.cs

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

示例3: HandleCommand

 public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if(game is PVEGame)
     {
         PVEGame pve = game as PVEGame;
         int tryAgain = packet.ReadInt();
         bool isHost = packet.ReadBoolean();
         if (isHost == true)
         {
             if (tryAgain == 1)
             {
                 if (player.PlayerDetail.RemoveMoney(100) > 0)
                 {
                     //退回关卡结算
                     pve.WantTryAgain = 1;
                     game.SendToAll(packet);
                     player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_TryAgain, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money);
                 }
                 else
                 {
                     player.PlayerDetail.SendInsufficientMoney((int)eBattleRemoveMoneyType.TryAgain);
                 }
             }
             else
             {
                 //退回房间
                 pve.WantTryAgain = 0;
                 game.SendToAll(packet);
             }
             pve.CheckState(0);
         }
     }
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:33,代码来源:TryAgainCommand.cs

示例4: OnRecvPacket

 public override void OnRecvPacket(GSPacketIn pkg)
 {
     switch (pkg.Code)
     {
         case (int)eFightPackageType.LOGIN:
             HandleLogin(pkg);
             break;
         case (int)eFightPackageType.ROOM_CREATE:
             HandleGameRoomCreate(pkg);
             break;
         case (int)eFightPackageType.ROOM_REMOVE:
             HandleGameRoomCancel(pkg);
             break;
         case (int)eFightPackageType.SEND_TO_GAME:
             HanleSendToGame(pkg);
             break;
         case (int)eFightPackageType.PLAYER_USE_PROP_INGAME:
             HandlePlayerUsingProp(pkg);
             break;
         case (int)eFightPackageType.DISCONNECT:
             HandlePlayerExit(pkg);
             break;
         case (int)eFightPackageType.CHAT:
             HandlePlayerMessage(pkg);
             break;
         case (int)eFightPackageType.SYS_NOTICE:
             HandleSysNotice(pkg);
             break;
         case (int)eFightPackageType.FIND_CONSORTIA_ALLY:
             HandleConsortiaAlly(pkg);
             break;
         default:
             break;
     }
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:35,代码来源:ServerClient.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;
            //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

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

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

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

示例10: HandleGameRoomCreate

        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int roomId = pkg.ReadInt();
            int gameType = pkg.ReadInt();
            int count = pkg.ReadInt();

            IGamePlayer[] players = new IGamePlayer[count];
            for (int i = 0; i < count; i++)
            {
                PlayerInfo info = new PlayerInfo();
                info.ID = pkg.ReadInt();
                info.Attack = pkg.ReadInt();
                info.Defence = pkg.ReadInt();
                info.Agility = pkg.ReadInt();
                info.Luck = pkg.ReadInt();

                double baseAttack = pkg.ReadDouble();
                double baseDefence = pkg.ReadDouble();
                double baseAgility = pkg.ReadDouble();
                double baseBlood = pkg.ReadDouble();
                int templateId = pkg.ReadInt();

                ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId);
                ItemInfo item = new ItemInfo(itemTemplate);

                players[i] = new ProxyPlayer(info, item, baseAttack, baseDefence, baseAgility, baseBlood);
            }

            ProxyRoomMgr.CreateRoom(players, roomId, this);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:30,代码来源:ServerClient.cs

示例11: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            eBageType bagType = (eBageType)packet.ReadByte();
            int place = packet.ReadInt();
            int count = packet.ReadInt();
            client.Player.BeginChanges();
            PlayerInventory bag = client.Player.GetInventory(bagType);
            if (bag != null && bag.GetItemAt(place) != null)
            {
                ItemTemplateInfo item = bag.GetItemAt(place).Template;
                int price = count * item.ReclaimValue;
                if (item.ReclaimType == 2)
                {
                    client.Player.AddGiftToken(price);
                    //client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.Success1", price));
                }
                if (item.ReclaimType == 1)
                {
                    client.Player.AddGold(price);
                    //client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.Success2", price));
                }
                bag.RemoveItemAt(place);

            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.NoSuccess"));
                return 1;
            }

            client.Player.CommitChanges();
            //LogMgr.LogMoneyAdd(LogMoneyType.Shop, LogMoneyType.Shop_Continue, client.Player.PlayerCharacter.ID, 25, client.Player.PlayerCharacter.Money, 25, 0, 0, 0, "牌子编号",));
            //client.Player.SaveIntoDatabase();//保存到数据库
            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:35,代码来源:ItemReclaimHandler.cs

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

示例13: HandleCommand

 public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if (player.IsAttacking)
     {
         player.Skip(packet.ReadByte());
     }
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:7,代码来源:SkipNextCommand.cs

示例14: HandlePacket

 //0友好,1黑名单
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     var im_cmd = packet.ReadByte();
     switch (im_cmd)
     {
         case (byte)IMPackageType.FRIEND_ADD:
             HandleFRIEND_ADD(packet);
             break;
         case (byte)IMPackageType.FRIEND_REMOVE:
             break;
         case (byte)IMPackageType.FRIEND_UPDATE:
             break;
         case (byte)IMPackageType.FRIEND_STATE:
             break;
         case (byte)IMPackageType.ONS_EQUIP:
             break;
         case (byte)IMPackageType.FRIEND_RESPONSE:
             break;
         case (byte)IMPackageType.SAME_CITY_FRIEND:
             break;
         case (byte)IMPackageType.ADD_CUSTOM_FRIENDS:
             break;
         case (byte)IMPackageType.ONE_ON_ONE_TALK:
             break;
     }
     return 0;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:28,代码来源:IMHandler.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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。