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


C# GSPacketIn.ReadByte方法代码示例

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


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

示例1: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host && !client.Player.CurrentRoom.IsPlaying)
     {
         //string name = packet.ReadString();
         //string pwd = packet.ReadString();
        
         int mapId = packet.ReadInt();
         if (mapId == 10000) return 0;
         byte rT = packet.ReadByte();
         eRoomType roomType;
         if (rT == 10) roomType = eRoomType.Exploration;
         else 
          roomType = (eRoomType)rT;
         byte timeType = packet.ReadByte();
         byte hardLevel = packet.ReadByte();
         int levelLimits = packet.ReadInt();
         //eRoomType roomType = (eRoomType)packet.ReadByte();
         //eTeamType teamType = (eTeamType)packet.ReadByte();
        
         RoomMgr.UpdateRoomGameType(client.Player.CurrentRoom, packet, roomType, timeType, (eHardLevel)hardLevel, levelLimits, mapId);
         //RoomMgr.StartGame(client.Player.CurrentRoom);
     }
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:25,代码来源:GameUserSetUpHandler.cs

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

示例3: HandleCommand

 public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if (game is PVEGame)
     {
         PVEGame pve = game as PVEGame;
         if (pve.BossCardCount + 1 > 0)
         {
             int index = packet.ReadByte();
             if (index < 0 || index > pve.BossCards.Length)
             {
                 if (pve.IsBossWar != "")
                 {
                     pve.TakeBossCard(player);
                 }
                 else pve.TakeCard(player);
             }
             else
             {
                 if (pve.IsBossWar != "")
                 {
                     pve.TakeBossCard(player, index);
                 }
                 else pve.TakeCard(player, index);
             }
         }
     }
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:27,代码来源:BossTakeCardCommand.cs

示例4: HandleCommand

        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (game.GameState != eGameState.Playing || player.GetSealState())
                return;

            int type = packet.ReadByte();
            int place = packet.ReadInt();
            int templateID = packet.ReadInt();

            ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID);
            if (player.CanUseItem(template))
            {
                //if (player.CurrentBall.ID == 3 && template.TemplateID == 10003)
                //    return;

                //if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving))
                //{
                //    if (player.UseItem(template) == false)
                //    {
                //        BaseGame.log.Error("Using prop error");
                //    }
                //}
                if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving))
                {
                    if (player.UseItem(template) == false)
                    {
                        BaseGame.log.Error("Using prop error");
                    }
                }
                else
                {
                    player.UseItem(template);
                }
            }
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:35,代码来源:PropUseCommand.cs

示例5: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {

           
            //TODO: 储存物品
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 1;

            int bagType = packet.ReadByte();
            int bagPlace = packet.ReadInt();
            int storePlace = packet.ReadInt();

            if (bagType == 0 && bagPlace < 31)
                return 1;

            ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            if (info != null)
            {
                PlayerInventory storeBag = client.Player.StoreBag;
                PlayerInventory toBag = client.Player.GetInventory((eBageType)bagType);
               // client.Player.StoreBag.MoveToStore(storeBag, storePlace, bagPlace, toBag, info.StoreLevel * 10);
            }

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

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

示例7: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int numReadByte = packet.ReadByte();
     int numReadInt = packet.ReadInt();
     PlayerInventory caddyBag = client.Player.CaddyBag;
     PlayerInventory propBag = client.Player.PropBag;
     PlayerInventory storeBag = client.Player.StoreBag;
     PlayerInventory mainBag = client.Player.MainBag;
     for (int i = 0; i < caddyBag.Capalility; i++)
     {
         SqlDataProvider.Data.ItemInfo itemAt = caddyBag.GetItemAt(i);
         if (itemAt != null)
         {
             if (((itemAt.Template.CategoryID == 10) || (itemAt.Template.CategoryID == 11)) || (itemAt.Template.CategoryID == 12))
             {
                 caddyBag.MoveToStore(caddyBag, i, propBag.FindFirstEmptySlot(1), propBag, 999);
             }
             else if ((itemAt.Template.CategoryID == 7) && (mainBag.GetItemAt(6) == null))
             {
                 caddyBag.MoveToStore(caddyBag, i, 6, mainBag, 999);
             }
             else
             {
                 caddyBag.MoveToStore(caddyBag, i, mainBag.FindFirstEmptySlot(31), mainBag, 999);
             }
         }
     }
     client.Lottery = -1;
     return 1;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:30,代码来源:LotteryFinishHandler.cs

示例8: HandleCommand

        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.HasPaymentTakeCard == false)
            {
                if (player.PlayerDetail.RemoveMoney(100) > 0&&player.PlayerDetail.RemoveGiftToken(429)>0)
                {
                    int index = packet.ReadByte();
                    player.CanTakeOut += 1;
                    player.FinishTakeCard = false;
                    player.HasPaymentTakeCard = true;
                    player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_PaymentTakeCard, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money);

                    if (index < 0 || index > game.Cards.Length)
                    {
                        game.TakeCard(player);
                    }
                    else
                    {
                        game.TakeCard(player, index);
                    }
                }
                else
                {
                    player.PlayerDetail.SendInsufficientMoney((int)eBattleRemoveMoneyType.PaymentTakeCard);
                }
            }
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:27,代码来源:PaymentTakeCardCommand.cs

示例9: HandlePacket

 //0友好,1黑名单
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     var pet_cmd = packet.ReadByte();
     switch (pet_cmd)
     {
         case (byte)Game.Logic.eTankCmdType.UPDATE_PET:
             HandleUPDATE_PET(client, packet.ReadInt());
             break;
         case (byte)Game.Logic.eTankCmdType.ADD_PET://ADD_PET
             break;
         case (byte)Game.Logic.eTankCmdType.MOVE_PETBAG://MOVE_PETBAG
             break;
         case (byte)Game.Logic.eTankCmdType.FEED_PET://FEED_PET
             break;
         case (byte)Game.Logic.eTankCmdType.REFRESH_PET://REFRESH_PET
             client.Out.SendRefreshPet();
             break;
         case (byte)Game.Logic.eTankCmdType.ADOPT_PET://ADOPT_PET
             break;
         case (byte)Game.Logic.eTankCmdType.EQUIP_PET_SKILL://EQUIP_PET_SKILL
             break;
         case (byte)Game.Logic.eTankCmdType.RELEASE_PET://RELEASE_PET
             break;
         case (byte)Game.Logic.eTankCmdType.RENAME_PET://RENAME_PET
             break;
         case (byte)Game.Logic.eTankCmdType.PAY_SKILL://PAY_SKILL
             break;
         case (byte)Game.Logic.eTankCmdType.FIGHT_PET://FIGHT_PET
             break;
     }
     return 0;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:33,代码来源:PetHandler.cs

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

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

示例12: HandleCommand

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

示例13: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host)
     {
         RoomMgr.UpdateRoomPos(client.Player.CurrentRoom, packet.ReadByte(), packet.ReadBoolean());
     }
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:8,代码来源:GameUserUpdatePlaceHandler.cs

示例14: HandleCommand

        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID = player.PlayerCharacter.ID;
                player.CurrentGame.SendToPlayerExceptSelf(pkg, player);

                byte type = packet.ReadByte();
                int tx = packet.ReadInt();
                int ty = packet.ReadInt();
                byte dir = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();
                Player p = player.CurrentGame.Data.Players[player];

                switch (type)
                {
                    case 0:
                    case 1:
                        //p.X = tx;
                        //p.Y = ty;
                        p.SetXY(tx, ty);
                        if (player.CurrentGame != null)
                        {
                            p.StartMoving();
                            if (p.Y - ty > 1 || p.IsLiving != isLiving)
                            {
                                //GameServer.log.Error(string.Format("修正掉落: 动作类型  {0}    原始Y:{1}     最新Y:{2}", type, ty, p.Y));
                                //把服务器修正的掉落指令和客户掉落指令加以区分。
                                pkg = player.Out.SendPlayerMove(3, p.X, p.Y, 0, p.IsLiving);
                                player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
                            }
                        }
                        break;
                    case 2:
                        if (player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
                        {
                            p.EndX = tx;
                            p.EndY = ty;
                        }
                        break;
                }
                return true;
            }
            return false;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:46,代码来源:MoveStartCommand.cs

示例15: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host)
     {
         RoomMgr.KickPlayer(client.Player.CurrentRoom, packet.ReadByte());
     }
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:8,代码来源:GameUserKickHandler.cs


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