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


C# Entity.HasField方法代码示例

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


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

示例1: OnPlayerKilled

        public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
        {
            // update the own score
            if (attacker.HasField("bohud_created"))
            {
                attacker.AfterDelay(10, entity =>
                {
                    var scoreText = entity.GetField<HudElem[]>("bohud_messageText")[1];
                    scoreText.SetText(entity.GetField<int>("score").ToString());
                });
            }

            // update all players' ranking
            UpdateScores();
        }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:15,代码来源:BOHud.cs

示例2: UpdateHUDAmmo

        private void UpdateHUDAmmo(Entity player)
        {
            if (!player.HasField("bohud_created"))
            {
                return;
            }

            if (!player.IsAlive)
            {
                return;
            }

            var ammoStock = player.GetField<HudElem>("bohud_ammoStock");
            var ammoClip = player.GetField<HudElem>("bohud_ammoClip");
            var weaponName = player.GetField<HudElem>("bohud_weaponName");
            var currentWeapon = player.CurrentWeapon;

            ammoStock.SetText(player.GetWeaponAmmoStock(currentWeapon).ToString());
            ammoClip.SetText(player.GetWeaponAmmoClip(currentWeapon).ToString());

            var weapon = player.CurrentWeapon;

            if ((MapEdit.weaponlist.Contains(weapon) || MapEdit.upgradeweaponlist.Contains(weapon)) || weapon == "iw5_usp45_mp_tactical")
            {
                if (weapon == "iw5_usp45_mp_tactical")
                {
                    weaponName.SetText("^2Zombie's Knife");
                }
                if (weapon == "iw5_usp45_mp")
                {
                    weaponName.SetText("USP .45");
                }
                if (weapon == "iw5_usp45_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1XM31 Akimbo");
                }
                if (weapon == "iw5_p99_mp")
                {
                    weaponName.SetText("P99");
                }
                if (weapon == "iw5_p99_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1P99 Akimbo");
                }
                if (weapon == "iw5_fnfiveseven_mp")
                {
                    weaponName.SetText("FN FiveSeven");
                }
                if (weapon == "iw5_fnfiveseven_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1FN FiveSeven Akimbo");
                }
                if (weapon == "iw5_deserteagle_mp")
                {
                    weaponName.SetText("Desert Eagle");
                }
                if (weapon == "iw5_deserteagle_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1Desert Eagle Akimbo");
                }
                if (weapon == "iw5_mp412_mp")
                {
                    weaponName.SetText("MP412");
                }
                if (weapon == "iw5_mp412_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1MP412 Akimbo");
                }
                if (weapon == "iw5_44magnum_mp")
                {
                    weaponName.SetText(".44 Magnum");
                }
                if (weapon == "iw5_44magnum_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1.44 Magnum Akimbo");
                }
                if (weapon == "iw5_fmg9_mp")
                {
                    weaponName.SetText("FMG9");
                }
                if (weapon == "iw5_fmg9_mp_akimbo_eotechsmg_xmags")
                {
                    weaponName.SetText("^1FMG9 Akimbo");
                }
                if (weapon == "iw5_g18_mp")
                {
                    weaponName.SetText("Glock 18");
                }
                if (weapon == "iw5_g18_mp_akimbo_eotechsmg_xmags")
                {
                    weaponName.SetText("^1Glock 18 Akimbo");
                }
                if (weapon == "iw5_skorpion_mp")
                {
                    weaponName.SetText("Skorpion");
                }
                if (weapon == "iw5_skorpion_mp_akimbo_xmags")
                {
                    weaponName.SetText("^1Skorpion Akimbo");
                }
//.........这里部分代码省略.........
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:101,代码来源:LSDZombie_Extreme.cs

示例3: createPlayerHud

        private void createPlayerHud(Entity player)
        {
            HudElem money = HudElem.CreateFontString(player, "hudbig", 1.0f);
            money.SetPoint("TOP RIGHT", "TOP RIGHT", -10, 325); //25 original
            money.HideWhenInMenu = true;

            HudElem moneytext = HudElem.CreateFontString(player, "hudbig", 1.0f);
            moneytext.SetPoint("TOP RIGHT", "TOP RIGHT", -65, 325); //25 original
            moneytext.HideWhenInMenu = true;

            OnInterval(100, () =>
            {
                if (player.GetField<string>("sessionteam") != "axis")
                {
                    moneytext.SetText("$: ");
                    money.Call("setvalue", player.GetField<int>("lsd_money"));
                }
                else
                {
                    moneytext.SetText("");
                    money.SetText("");
                    money.Alpha = 0;
                }
                return true;
            });

            if (player.HasField("bohud_created"))
            {
                return;
            }

            // ammo stuff
            var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f);
            ammoSlash.SetPoint("bottom right", "bottom right", -85, -35);
            ammoSlash.GlowAlpha = 0;
            ammoSlash.HideWhenInMenu = true;
            ammoSlash.Archived = false;
            ammoSlash.SetText("/");

            player.SetField("bohud_ammoSlash", new Parameter(ammoSlash));

            var ammoStock = HudElem.CreateFontString(player, "default", 1.25f);
            ammoStock.Parent = ammoSlash;
            ammoStock.SetPoint("bottom left", "bottom left", 3, 0);
            ammoStock.GlowAlpha = 0;
            ammoStock.HideWhenInMenu = true;
            ammoStock.Archived = false;
            ammoStock.SetText("48");

            player.SetField("bohud_ammoStock", new Parameter(ammoStock));

            var ammoClip = HudElem.CreateFontString(player, "default", 1.95f);
            ammoClip.Parent = ammoSlash;
            ammoClip.SetPoint("right", "right", -7, -4);
            ammoClip.GlowAlpha = 0;
            ammoClip.HideWhenInMenu = true;
            ammoClip.Archived = false;
            ammoClip.SetText("12");

            var weaponName = HudElem.CreateFontString(player, "default", 2f);
            weaponName.SetPoint("bottom right", "bottom right", -64, -15);
            weaponName.GlowAlpha = 0;
            weaponName.HideWhenInMenu = true;
            weaponName.Archived = false;
            weaponName.SetText("");

            UpdateHUDAmmo(player);

            player.SetField("bohud_weaponName", new Parameter(weaponName));

            player.SetField("bohud_ammoClip", new Parameter(ammoClip));

            player.SetField("bohud_created", true);
        }
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:74,代码来源:LSDZombie_Extreme.cs

示例4: PrintRollNames

 public void PrintRollNames(Entity player, string name, int index, int? roll)
 {
     player.Call("iPrintLnBold", string.Format("You rolled {0} - {1}", roll + 1, name));
     Call(334, string.Format("{0} rolled [{1}] - {2}", player.GetField<string>("name"), roll + 1, name));
     HudElem elem = player.HasField("rtd_rolls") ? player.GetField<HudElem>("rtd_rolls") : HudElem.CreateFontString(player, "bigfixed", 0.6f);
     elem.SetPoint("RIGHT", "RIGHT", -90, 165 - ((index - 1) * 13));
     elem.SetText(string.Format("[{0}] {1}", roll + 1, name));
     player.SetField("rtd_rolls", new Parameter(elem));
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:9,代码来源:ZombieRollTheDice.cs

示例5: OnPlayerSpawned

 public void OnPlayerSpawned(Entity player)
 {
     if (Utility.GetPlayerTeam(player) == "axis")
     {
         if (PlayerStop.Contains(player.GetField<string>("name")))
             PlayerStop.Remove(player.GetField<string>("name"));
         if (!player.HasField("rtd_canroll") || player.GetField<int>("rtd_canroll") == 1)
         {
             ResetPlayer(player);
             AfterDelay(50, () => DoRandom(player));
         }
     }
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:13,代码来源:ZombieRollTheDice.cs

示例6: CreateHUD

        private void CreateHUD(Entity player)
        {
            if (player.HasField("bohud_created"))
            {
                return;
            }

            // background bars, left side
            var bars = new HudElem[2];

            new[] { new { X = -20, Y = 15, i = 0 }, new { X = -20, Y = -4, i = 1 } }.ToList().ForEach(coord =>
            {
                var bar = HudElem.NewClientHudElem(player);
                bar.X = coord.X;
                bar.Y = coord.Y;
                bar.AlignX = "left";
                bar.AlignY = "bottom";
                bar.HorzAlign = "left";
                bar.VertAlign = "bottom";
                bar.SetShader("white", 190, 15);
                bar.Alpha = 0.3f;
                bar.HideWhenInMenu = true;
                bar.Foreground = false;

                bars[coord.i] = bar;
            });

            player.SetField("bohud_bars", new Parameter(bars));

            // ranking background
            var circle = HudElem.CreateIcon(player, "cardicon_radiation", 60, 60);
            circle.SetPoint("bottom left", "bottom left", 15, -15);
            circle.HideWhenInMenu = true;
            circle.Foreground = true;
            circle.Alpha = 1;

            player.SetField("bohud_circle", new Parameter(circle));

            // rank text/shadow
            var rankX = -26;
            player.SetField("bohud_rankX", rankX);

            var rankText = new HudElem[3];

            new[] {
                new { X = rankX - 1, Sort = 3 },
                new { X = rankX + 1, Sort = 4 },
                new { X = rankX, Sort = 5 }
            }.ToList().ForEach(entry =>
            {
                var text = HudElem.NewClientHudElem(player);
                text.X = entry.X;
                text.Y = 18;
                text.AlignX = "left";
                text.AlignY = "bottom";
                text.HorzAlign = "left";
                text.VertAlign = "bottom";
                text.FontScale = 5;
                text.Sort = entry.Sort;
                text.HideWhenInMenu = true;
                text.SetText((entry.Sort == 5) ? "1" : "^01");

                rankText[entry.Sort - 3] = text;
            });

            player.SetField("bohud_rankText", new Parameter(rankText));

            // message texts
            var messageText = new HudElem[2];

            new[] {
                new { X = 30, Y = 16, Text = "", i = 0 },
                new { X = 30, Y = -3, Text = "0", i = 1 },
            }.ToList().ForEach(entry =>
            {
                var text = HudElem.NewClientHudElem(player);
                text.X = entry.X;
                text.Y = entry.Y;
                text.AlignX = "left";
                text.AlignY = "bottom";
                text.HorzAlign = "left";
                text.VertAlign = "bottom";
                text.FontScale = 1.5f;
                text.Alpha = 0.5f;
                text.HideWhenInMenu = true;
                text.Sort = 5;
                text.SetText(entry.Text);

                messageText[entry.i] = text;
            });

            player.SetField("bohud_messageText", new Parameter(messageText));

            // ammo stuff
            var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f);
            ammoSlash.SetPoint("bottom right", "bottom right", -85, -35);
            ammoSlash.GlowAlpha = 0;
            ammoSlash.HideWhenInMenu = true;
            ammoSlash.Archived = false;
            ammoSlash.SetText("/");
//.........这里部分代码省略.........
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:101,代码来源:BOHud.cs

示例7: UpdateHUDAmmo

        private void UpdateHUDAmmo(Entity player)
        {
            if (!player.HasField("bohud_created"))
            {
                return;
            }

            if (!player.IsAlive)
            {
                return;
            }

            var ammoStock = player.GetField<HudElem>("bohud_ammoStock");
            var ammoClip = player.GetField<HudElem>("bohud_ammoClip");
            var currentWeapon = player.CurrentWeapon;

            ammoStock.SetText(player.GetWeaponAmmoStock(currentWeapon).ToString());
            ammoClip.SetText(player.GetWeaponAmmoClip(currentWeapon).ToString());
        }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:19,代码来源:BOHud.cs

示例8: UpdateDisplayScore

        private void UpdateDisplayScore(Entity player, int rank)
        {
            if (!player.HasField("bohud_created"))
            {
                return;
            }

            var rankTexts = player.GetField<HudElem[]>("bohud_rankText");
            rankTexts[0].SetText("^0" + rank.ToString());
            rankTexts[1].SetText("^0" + rank.ToString());
            rankTexts[2].SetText(rank.ToString());

            if (rank > 9)
            {
                rankTexts[0].X = (-26 - 14);
                rankTexts[1].X = (-26 - 12);
                rankTexts[2].X = (-26 - 13);
            }
            else
            {
                rankTexts[0].X = (-26 - 1);
                rankTexts[1].X = (-26);
                rankTexts[2].X = (-26 + 1);
            }
        }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:25,代码来源:BOHud.cs


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