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


C# GSPacketIn.WriteByte方法代码示例

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


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

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

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

示例3: ExecuteImp

        protected override void ExecuteImp(BaseGame game, long tick)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, m_living.Id);

            pkg.Parameter1 = m_living.Id;
            pkg.WriteByte((byte)eTankCmdType.LIVING_RANGEATTACKING);

            List<Living> playersAround = game.Map.FindPlayers(m_fx, m_tx, m_players);
            int count = playersAround.Count;
            foreach (Living p in playersAround)
            {
                if (m_living.IsFriendly(p) == true)
                    count--;
            }
            pkg.WriteInt(count);
            m_living.SyncAtTime = false;
            try
            {
                foreach (Living p in playersAround)
                {
                    p.SyncAtTime = false;

                    if (m_living.IsFriendly(p) == true)
                        continue;
                    int dander = 0;
                    p.IsFrost = false;
                    game.SendGameUpdateFrozenState(p);
                    int damage = MakeDamage(p);
                    int critical = MakeCriticalDamage(p, damage);
                    int totalDemageAmount = 0;
                    if (p.TakeDamage(m_living, ref damage, ref critical, "范围攻击"))
                    {
                        totalDemageAmount = damage + critical;
                        if (p is Player)
                        {
                            Player player = p as Player;
                            dander = player.Dander;
                        }
                    }
                    pkg.WriteInt(p.Id);
                    pkg.WriteInt(totalDemageAmount);
                    pkg.WriteInt(p.Blood);
                    //同步怒气值
                    pkg.WriteInt(dander);
                    //attackEffect
                    pkg.WriteInt(new Random().Next(2));
                }
                game.SendToAll(pkg);

                Finish(tick);
            }
            finally
            {
                m_living.SyncAtTime = true;
                foreach (Living p in playersAround)
                {
                    p.SyncAtTime = true;
                }
            }
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:60,代码来源:LivingRangeAttackingAction.cs

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

示例5: HandleCommand

 public void  HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if (game.GameState == eGameState.Loading)
     {
         player.LoadingProcess = packet.ReadInt();
         if (player.LoadingProcess >= 100)
         {
             game.CheckState(0);
         }
        var pkg = new GSPacketIn((short)ePackageType.GAME_CMD);
         pkg.WriteByte((byte)eTankCmdType.LOAD);
         //var pkg = packet.Clone();
       //  pkg.ClearContext();
         pkg.WriteInt(player.LoadingProcess);
         pkg.WriteInt(4);
         pkg.WriteInt(player.PlayerDetail.PlayerCharacter.ID);
         game.SendToAll(pkg);
     }
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:19,代码来源:LoadCommand.cs

示例6: SendAttackEffect

        /*
        internal void SendAttackEffect(Living player, int type)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
            pkg.Parameter1 = player.Id;
            pkg.WriteByte((byte)eTankCmdType.ATTACKEFFECT);
            pkg.WriteBoolean(true);
            pkg.WriteInt(type);
            SendToAll(pkg);

        }
        */
        internal void SendSyncLifeTime()
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
            //pkg.Parameter2 = -1;
            pkg.WriteByte((byte)eTankCmdType.SYNC_LIFETIME);
            pkg.WriteInt(m_lifeTime);
            SendToAll(pkg);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:20,代码来源:BaseGame.cs

示例7: SendRemovePhysicalObj

 internal void SendRemovePhysicalObj(PhysicalObj obj)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.DISAPPEAR);
     pkg.WriteInt(obj.Id);
     SendToAll(pkg);
     //TODO 完成删除物品
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:8,代码来源:BaseGame.cs

示例8: SendPlayerUseProp

 internal void SendPlayerUseProp(Player player, int type, int place, int templateID)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id);
     pkg.Parameter1 = player.Id;
     pkg.WriteByte((byte)eTankCmdType.PROP);
     pkg.WriteByte((byte)type);
     pkg.WriteInt(place);
     pkg.WriteInt(templateID);
     pkg.WriteInt(player.Id);//var _loc_7:* = _gameInfo.findLiving(_loc_2.readInt());
     pkg.WriteBoolean(false);//var _loc_8:* = _loc_2.readBoolean(); buff dan dat
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:12,代码来源:BaseGame.cs

示例9: SendPlayerPicture

 internal void SendPlayerPicture(Living living, int type, bool state)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.Parameter1 = living.Id;
     pkg.WriteByte((byte)eTankCmdType.SEND_PICTURE);
     pkg.WriteInt(type);
     pkg.WriteBoolean(state);
     SendToAll(pkg);
     //(living as Player).PlayerDetail.SendTCP(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:10,代码来源:BaseGame.cs

示例10: SendPlayerMove

 //, bool isLiving, string action) //string action
 internal void SendPlayerMove(Player player, int type, int x, int y, byte dir)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id);
     pkg.Parameter1 = player.Id;
     pkg.WriteByte((byte)eTankCmdType.MOVESTART);
     pkg.WriteByte((byte)type);
     pkg.WriteInt(x);
     pkg.WriteInt(y);
     pkg.WriteByte(dir);
     pkg.WriteBoolean(player.IsLiving);
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:13,代码来源:BaseGame.cs

示例11: SendPhysicalObjFocus

 internal void SendPhysicalObjFocus(Physics obj, int type)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.FOCUS_ON_OBJECT);
     pkg.WriteInt(type);
     pkg.WriteInt(obj.X);
     pkg.WriteInt(obj.Y);
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:9,代码来源:BaseGame.cs

示例12: SendLivingBeat

 internal void SendLivingBeat(Living living, Living target, int totalDemageAmount, string action, int livingCount, int attackEffect)
 {
     int dander = 0;
     if (target is Player)
     {
         Player p = target as Player;
         dander = p.Dander;
     }
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, living.Id);
     pkg.Parameter1 = living.Id;
     pkg.WriteByte((byte)eTankCmdType.LIVING_BEAT);
     pkg.WriteString(!string.IsNullOrEmpty(action) ? action : "");//action
     pkg.WriteInt(livingCount);//livingCount
     for (int i = 1; i <= livingCount; i++)
     {
         pkg.WriteInt(target.Id);//target
         pkg.WriteInt(totalDemageAmount);//damage
         pkg.WriteInt(target.Blood);//targetBlood
         pkg.WriteInt(dander);//dander
         pkg.WriteInt(attackEffect);//attackEffect
     }
     SendToAll(pkg);//, (target as Player).PlayerDetail);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:23,代码来源:BaseGame.cs

示例13: SendIsLastMission

 internal void SendIsLastMission(bool isLast)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.IS_LAST_MISSION);
     pkg.WriteBoolean(isLast);
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:7,代码来源:BaseGame.cs

示例14: SendGameWindPic

 internal void SendGameWindPic(byte windId, byte[] windpic)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.WIND_PIC);
     pkg.WriteByte(windId);
     pkg.Write(windpic);
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:8,代码来源:BaseGame.cs

示例15: SendGameUpdateWind

 internal void SendGameUpdateWind(float wind)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.VANE);
     int _wind = (int)(wind * 10);
     pkg.WriteInt(_wind);
     pkg.WriteBoolean(_wind > 0);
     pkg.WriteByte(GetVane(_wind, 1));
     pkg.WriteByte(GetVane(_wind, 2));
     pkg.WriteByte(GetVane(_wind, 3));
     SendToAll(pkg);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:12,代码来源:BaseGame.cs


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