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


C# ISettings.Set方法代码示例

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


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

示例1: CreateUniverseScreen

        public CreateUniverseScreen(ScreenComponent manager)
            : base(manager)
        {
            Manager = manager;
            settings = manager.Game.Settings;

            Padding = new Border(0, 0, 0, 0);

            Title = Languages.OctoClient.CreateUniverse;

            SetDefaultBackground();

            Panel panel = new Panel(manager);
            panel.VerticalAlignment = VerticalAlignment.Stretch;
            panel.HorizontalAlignment = HorizontalAlignment.Stretch;
            panel.Margin = Border.All(50);
            panel.Background = new BorderBrush(Color.White * 0.5f);
            panel.Padding = Border.All(10);
            Controls.Add(panel);

            Grid grid = new Grid(manager);
            grid.VerticalAlignment = VerticalAlignment.Stretch;
            grid.HorizontalAlignment = HorizontalAlignment.Stretch;
            panel.Controls.Add(grid);

            grid.Columns.Add(new ColumnDefinition() { ResizeMode = ResizeMode.Auto });
            grid.Columns.Add(new ColumnDefinition() { Width = 1,ResizeMode = ResizeMode.Parts });

            nameInput = GetTextbox();
            nameInput.TextChanged += (s, e) => {
                createButton.Visible = !string.IsNullOrEmpty(e.NewValue);
            };
            AddLabeledControl(grid, string.Format("{0}: ", Languages.OctoClient.Name), nameInput);

            seedInput = GetTextbox();
            AddLabeledControl(grid, string.Format("{0}: ", Languages.OctoClient.Seed), seedInput);

            createButton = Button.TextButton(manager, Languages.OctoClient.Create);
            createButton.HorizontalAlignment = HorizontalAlignment.Right;
            createButton.VerticalAlignment = VerticalAlignment.Bottom;
            createButton.Visible = false;
            createButton.LeftMouseClick += (s, e) =>
            {
                if (string.IsNullOrEmpty(nameInput.Text))
                    return;

                int? seed = null;
                int textseed;
                if (int.TryParse(seedInput.Text, out textseed))
                    seed = textseed;

                manager.Player.RemovePlayer();
                Guid guid = Manager.Game.Simulation.NewGame(nameInput.Text, seed);
                settings.Set("LastUniverse", guid.ToString());
                manager.Game.Player.InsertPlayer();
                manager.NavigateToScreen(new GameScreen(manager));
            };
            panel.Controls.Add(createButton);
        }
开发者ID:BlackOrca,项目名称:octoawesome,代码行数:59,代码来源:CreateUniverseScreen.cs


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