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


C# ScrollItemWidget.Get方法代码示例

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


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

示例1: AddPlayerFlagAndName

        public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
        {
            var flag = template.Get<ImageWidget>("FLAG");
            flag.GetImageCollection = () => "flags";
            if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
                flag.GetImageName = () => player.DisplayFaction.InternalName;
            else
                flag.GetImageName = () => player.Faction.InternalName;

            var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);
            var playerName = template.Get<LabelWidget>("PLAYER");
            var playerNameFont = Game.Renderer.Fonts[playerName.Font];
            var suffixLength = new CachedTransform<string, int>(s => playerNameFont.Measure(s).X);
            var name = new CachedTransform<Pair<string, int>, string>(c =>
                WidgetUtils.TruncateText(c.First, playerName.Bounds.Width - c.Second, playerNameFont));

            playerName.GetText = () =>
            {
                var suffix = player.WinState == WinState.Undefined ? "" : " (" + player.WinState + ")";
                if (client != null && client.State == Session.ClientState.Disconnected)
                    suffix = " (Gone)";

                var sl = suffixLength.Update(suffix);
                return name.Update(Pair.New(player.PlayerName, sl)) + suffix;
            };

            playerName.GetColor = () => player.Color.RGB;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:28,代码来源:LobbyUtils.cs

示例2: AddPlayerFlagAndName

        public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
        {
            var flag = template.Get<ImageWidget>("FLAG");
            flag.GetImageName = () => player.Country.Race;
            flag.GetImageCollection = () => "flags";

            var playerName = template.Get<LabelWidget>("PLAYER");
            playerName.GetText = () => player.PlayerName + (player.WinState == WinState.Undefined ? "" : " (" + player.WinState + ")");
            playerName.GetColor = () => player.Color.RGB;
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:10,代码来源:LobbyUtils.cs

示例3: AddPlayerFlagAndName

        public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
        {
            var flag = template.Get<ImageWidget>("FLAG");
            flag.GetImageCollection = () => "flags";
            if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
                flag.GetImageName = () => player.DisplayFaction.InternalName;
            else
                flag.GetImageName = () => player.Faction.InternalName;

            var playerName = template.Get<LabelWidget>("PLAYER");
            var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);
            playerName.GetText = () =>
            {
                if (client != null && client.State == Network.Session.ClientState.Disconnected)
                    return player.PlayerName + " (Gone)";
                return player.PlayerName + (player.WinState == WinState.Undefined ? "" : " (" + player.WinState + ")");
            };
            playerName.GetColor = () => player.Color.RGB;
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:19,代码来源:LobbyUtils.cs

示例4: SetupKeyBinding

        void SetupKeyBinding(ScrollItemWidget keyWidget, string description, Func<string> getValue, Action<string> setValue)
        {
            keyWidget.Get<LabelWidget>("FUNCTION").GetText = () => description;

            var textBox = keyWidget.Get<TextFieldWidget>("HOTKEY");

            textBox.Text = getValue();

            textBox.OnLoseFocus = () =>
            {
                textBox.Text.Trim();
                if (textBox.Text.Length == 0)
                    textBox.Text = getValue();
                else
                    setValue(textBox.Text);
            };

            textBox.OnEnterKey = () => { textBox.LoseFocus(); return true; };
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:19,代码来源:SettingsMenuLogic.cs


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