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


C# Game.SendPacketClient方法代码示例

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


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

示例1: OnNewFrameFixed

 public override void OnNewFrameFixed(Game game, NewFrameEventArgs args)
 {
     Packet_Item activeitem = game.d_Inventory.RightHand[game.ActiveMaterial];
     int activeblock = 0;
     if (activeitem != null) { activeblock = activeitem.BlockId; }
     if (activeblock != PreviousActiveMaterialBlock)
     {
         game.SendPacketClient(ClientPackets.ActiveMaterialSlot(game.ActiveMaterial));
     }
     PreviousActiveMaterialBlock = activeblock;
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:11,代码来源:SendActiveMaterial.ci.cs

示例2: OnNewFrame

    public override void OnNewFrame(Game game, NewFrameEventArgs args)
    {
        if (game.spawned && ((game.platform.TimeMillisecondsFromStart() - game.lastpositionsentMilliseconds) > 100))
        {
            game.lastpositionsentMilliseconds = game.platform.TimeMillisecondsFromStart();

            game.SendPacketClient(ClientPackets.PositionAndOrientation(game, game.LocalPlayerId,
                game.player.position.x, game.player.position.y, game.player.position.z,
                game.player.position.rotx, game.player.position.roty, game.player.position.rotz,
                game.localstance));
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:12,代码来源:SendPosition.ci.cs

示例3: OnKeyDown

 public override void OnKeyDown(Game game, KeyEventArgs args)
 {
     if (!(game.guistate == GuiState.Normal && game.GuiTyping == TypingState.None))
     {
         //Do nothing when in dialog or chat
         return;
     }
     int eKey = args.GetKeyCode();
     if (eKey == game.GetKey(GlKeys.R))
     {
         Packet_Item item = game.d_Inventory.RightHand[game.ActiveMaterial];
         if (item != null && item.ItemClass == Packet_ItemClassEnum.Block
             && game.blocktypes[item.BlockId].IsPistol
             && game.reloadstartMilliseconds == 0)
         {
             int sound = game.rnd.Next() % game.blocktypes[item.BlockId].Sounds.ReloadCount;
             game.AudioPlay(StringTools.StringAppend(game.platform, game.blocktypes[item.BlockId].Sounds.Reload[sound], ".ogg"));
             game.reloadstartMilliseconds = game.platform.TimeMillisecondsFromStart();
             game.reloadblock = item.BlockId;
             game.SendPacketClient(ClientPackets.Reload());
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:23,代码来源:ReloadAmmo.ci.cs

示例4: OnKeyPress

 public override void OnKeyPress(Game game, KeyPressEventArgs args)
 {
     if (game.guistate != GuiState.ModalDialog
         && game.guistate != GuiState.Normal)
     {
         return;
     }
     for (int i = 0; i < game.dialogsCount; i++)
     {
         if (game.dialogs[i] == null) { continue; }
         game.dialogs[i].screen.OnKeyPress(game, args);
     }
     for (int k = 0; k < game.dialogsCount; k++)
     {
         if (game.dialogs[k] == null)
         {
             continue;
         }
         VisibleDialog d = game.dialogs[k];
         for (int i = 0; i < d.value.WidgetsCount; i++)
         {
             Packet_Widget w = d.value.Widgets[i];
             if (w == null)
             {
                 continue;
             }
             // Only typeable characters are handled by KeyPress (for special characters use KeyDown)
             string valid = "abcdefghijklmnopqrstuvwxyz1234567890\t ";
             if (game.platform.StringContains(valid, game.CharToString(w.ClickKey)))
             {
                 if (args.GetKeyChar() == w.ClickKey)
                 {
                     game.SendPacketClient(ClientPackets.DialogClick(w.Id, new string[0], 0));
                     return;
                 }
             }
         }
     }
 }
开发者ID:Matthewism,项目名称:manicdigger,代码行数:39,代码来源:Dialog.ci.cs

示例5: OnKeyDown

 public override void OnKeyDown(Game game, KeyEventArgs args)
 {
     for (int i = 0; i < game.dialogsCount; i++)
     {
         if (game.dialogs[i] == null) { continue; }
         game.dialogs[i].screen.OnKeyDown(game, args);
     }
     if (game.guistate == GuiState.Normal)
     {
         if (args.GetKeyCode() == game.GetKey(GlKeys.Escape))
         {
             for (int i = 0; i < game.dialogsCount; i++)
             {
                 if (game.dialogs[i] == null)
                 {
                     continue;
                 }
                 VisibleDialog d = game.dialogs[i];
                 if (d.value.IsModal != 0)
                 {
                     game.dialogs[i] = null;
                     return;
                 }
             }
             game.ShowEscapeMenu();
             args.SetHandled(true);
             return;
         }
     }
     if (game.guistate == GuiState.ModalDialog)
     {
         // Close modal dialogs when pressing ESC key
         if (args.GetKeyCode() == game.GetKey(GlKeys.Escape))
         {
             for (int i = 0; i < game.dialogsCount; i++)
             {
                 if (game.dialogs[i] == null) { continue; }
                 if (game.dialogs[i].value.IsModal != 0)
                 {
                     game.dialogs[i] = null;
                 }
             }
             game.SendPacketClient(ClientPackets.DialogClick("Esc", new string[0], 0));
             game.GuiStateBackToGame();
             args.SetHandled(true);
         }
         // Handle TAB key
         if (args.GetKeyCode() == game.GetKey(GlKeys.Tab))
         {
             game.SendPacketClient(ClientPackets.DialogClick("Tab", new string[0], 0));
             args.SetHandled(true);
         }
         return;
     }
 }
开发者ID:Matthewism,项目名称:manicdigger,代码行数:55,代码来源:Dialog.ci.cs

示例6: NextBullet


//.........这里部分代码省略.........
            game.SelectedBlockPositionX = -1;
            game.SelectedBlockPositionY = -1;
            game.SelectedBlockPositionZ = -1;
            pick0.blockPos = new float[3];
            pick0.blockPos[0] = -1;
            pick0.blockPos[1] = -1;
            pick0.blockPos[2] = -1;
        }
        PickEntity(game, pick, pick2, pick2count);
        if (game.cameratype == CameraType.Fpp || game.cameratype == CameraType.Tpp)
        {
            int ntileX = game.platform.FloatToInt(pick0.Current()[0]);
            int ntileY = game.platform.FloatToInt(pick0.Current()[1]);
            int ntileZ = game.platform.FloatToInt(pick0.Current()[2]);
            if (game.IsUsableBlock(game.map.GetBlock(ntileX, ntileZ, ntileY)))
            {
                game.currentAttackedBlock = Vector3IntRef.Create(ntileX, ntileZ, ntileY);
            }
        }
        if (game.GetFreeMouse())
        {
            if (pick2count.value > 0)
            {
                OnPick_(pick0);
            }
            return;
        }

        if ((one * (game.platform.TimeMillisecondsFromStart() - lastbuildMilliseconds) / 1000) >= BuildDelay(game)
            || IsNextShot)
        {
            if (left && game.d_Inventory.RightHand[game.ActiveMaterial] == null)
            {
                game.SendPacketClient(ClientPackets.MonsterHit(game.platform.FloatToInt(2 + game.rnd.NextFloat() * 4)));
            }
            if (left && !fastclicking)
            {
                //todo animation
                fastclicking = false;
            }
            if ((left || right || middle) && (!isgrenade))
            {
                lastbuildMilliseconds = game.platform.TimeMillisecondsFromStart();
            }
            if (isgrenade && game.mouseleftdeclick)
            {
                lastbuildMilliseconds = game.platform.TimeMillisecondsFromStart();
            }
            if (game.reloadstartMilliseconds != 0)
            {
                PickingEnd(left, right, middle, ispistol);
                return;
            }
            if (ispistolshoot)
            {
                if ((!(game.LoadedAmmo[item.BlockId] > 0))
                    || (!(game.TotalAmmo[item.BlockId] > 0)))
                {
                    game.AudioPlay("Dry Fire Gun-SoundBible.com-2053652037.ogg");
                    PickingEnd(left, right, middle, ispistol);
                    return;
                }
            }
            if (ispistolshoot)
            {
                float toX = pick.End[0];
开发者ID:YoungGames,项目名称:manicdigger,代码行数:67,代码来源:Picking.ci.cs

示例7: UpdateEntityHit

 void UpdateEntityHit(Game game)
 {
     //Only single hit when mouse clicked
     if (game.currentlyAttackedEntity != -1 && game.mouseLeft)
     {
         for (int i = 0; i < game.clientmodsCount; i++)
         {
             if (game.clientmods[i] == null) { continue; }
             OnUseEntityArgs args = new OnUseEntityArgs();
             args.entityId = game.currentlyAttackedEntity;
             game.clientmods[i].OnHitEntity(game, args);
         }
         game.SendPacketClient(ClientPackets.HitEntity(game.currentlyAttackedEntity));
     }
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:15,代码来源:Picking.ci.cs

示例8: CraftingRecipeSelected

 internal void CraftingRecipeSelected(Game game, int x, int y, int z, IntRef recipe)
 {
     if (recipe == null)
     {
         return;
     }
     game.SendPacketClient(ClientPackets.Craft(x, y, z, recipe.value));
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:8,代码来源:GuiCrafting.ci.cs

示例9: UpdateBlockDamageToPlayer

    //TODO server side?
    internal void UpdateBlockDamageToPlayer(Game game, float dt)
    {
        float pX = game.player.position.x;
        float pY = game.player.position.y;
        float pZ = game.player.position.z;
        pY += game.entities[game.LocalPlayerId].drawModel.eyeHeight;
        int block1 = 0;
        int block2 = 0;
        if (game.map.IsValidPos(game.MathFloor(pX), game.MathFloor(pZ), game.MathFloor(pY)))
        {
            block1 = game.map.GetBlock(game.platform.FloatToInt(pX), game.platform.FloatToInt(pZ), game.platform.FloatToInt(pY));
        }
        if (game.map.IsValidPos(game.MathFloor(pX), game.MathFloor(pZ), game.MathFloor(pY) - 1))
        {
            block2 = game.map.GetBlock(game.platform.FloatToInt(pX), game.platform.FloatToInt(pZ), game.platform.FloatToInt(pY) - 1);
        }

        int damage = game.d_Data.DamageToPlayer()[block1] + game.d_Data.DamageToPlayer()[block2];
        if (damage > 0)
        {
            int hurtingBlock = block1;	//Use block at eyeheight as source block
            if (hurtingBlock == 0 || game.d_Data.DamageToPlayer()[hurtingBlock] == 0) { hurtingBlock = block2; }	//Fallback to block at feet if eyeheight block is air or doesn't deal damage
            int times = BlockDamageToPlayerTimer.Update(dt);
            for (int i = 0; i < times; i++)
            {
                game.ApplyDamageToPlayer(damage, Packet_DeathReasonEnum.BlockDamage, hurtingBlock);
            }
        }

        //Player drowning
        int deltaTime = game.platform.FloatToInt(one * (game.platform.TimeMillisecondsFromStart() - game.lastOxygenTickMilliseconds)); //Time in milliseconds
        if (deltaTime >= 1000)
        {
            if (game.WaterSwimmingEyes())
            {
                game.PlayerStats.CurrentOxygen -= 1;
                if (game.PlayerStats.CurrentOxygen <= 0)
                {
                    game.PlayerStats.CurrentOxygen = 0;
                    int dmg = game.platform.FloatToInt(one * game.PlayerStats.MaxHealth / 10);
                    if (dmg < 1)
                    {
                        dmg = 1;
                    }
                    game.ApplyDamageToPlayer(dmg, Packet_DeathReasonEnum.Drowning, block1);
                }
            }
            else
            {
                game.PlayerStats.CurrentOxygen = game.PlayerStats.MaxOxygen;
            }
            if (GameVersionHelper.ServerVersionAtLeast(game.platform, game.serverGameVersion, 2014, 3, 31))
            {
                game.SendPacketClient(ClientPackets.Oxygen(game.PlayerStats.CurrentOxygen));
            }
            game.lastOxygenTickMilliseconds = game.platform.TimeMillisecondsFromStart();
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:59,代码来源:BlockDamageToPlayer.ci.cs


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