Exemplo n.º 1
0
 public EmailSettings(SettingList settings)
     : base(settings, Type, TypeId)
 {
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            menuWindow     = new RenderWindow(new VideoMode(400, 650), "Tamagochi by_XLY");
            gameWindow     = new RenderWindow(new VideoMode(800, 600), "Tamagochi by_XLY");
            settingsWindow = new RenderWindow(new VideoMode(400, 650), "Settings");

            menuWindow.SetVerticalSyncEnabled(true);
            gameWindow.SetVerticalSyncEnabled(true);

            menuWindow.Closed  += menuWindowClosed;
            menuWindow.Resized += menuWindowResized;
            gameWindow.Closed  += gameWindowClosed;
            GameWindow.Resized += gameWindowResized;

            gameWindow.SetVisible(false);
            settingsWindow.SetVisible(false);
            isGameWindowVisible    = false;
            isSettingWindowVisible = false;
            isMenuWindowVisible    = true;

            Content.Load();

            Menu       = new Menu();
            Game       = new Game();
            Settings   = new Settings();
            EasterEggs = new EasterEggs();

            SettingList.DownloadSettings();

            //Game.Fake();

            Clock clock = new Clock(), actionCooldown = new Clock();

            while (menuWindow.IsOpen)
            {
                elapsedTime = clock.ElapsedTime.AsMilliseconds();
                clock.Restart();

                if (isMenuWindowVisible)
                {
                    menuWindow.DispatchEvents();

                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && actionCooldown.ElapsedTime.AsMilliseconds() > 300)
                    {
                        actionCooldown.Restart();
                        Menu.Click();
                    }

                    Menu.Update();
                    menuWindow.Clear(Color.White);
                    Menu.Draw();

                    menuWindow.Display();
                }

                if (isGameWindowVisible)
                {
                    gameWindow.DispatchEvents();

                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && actionCooldown.ElapsedTime.AsMilliseconds() > 300)
                    {
                        actionCooldown.Restart();
                        Game.Click();
                    }

                    if (Keyboard.IsKeyPressed(Keyboard.Key.A) ||
                        Keyboard.IsKeyPressed(Keyboard.Key.S) ||
                        Keyboard.IsKeyPressed(Keyboard.Key.D))
                    {
                        EasterEggs.New();
                    }

                    Game.Update();
                    EasterEggs.Check();
                    gameWindow.Clear(Color.White);
                    Game.Draw();

                    gameWindow.Display();
                }

                if (isSettingWindowVisible)
                {
                    settingsWindow.DispatchEvents();

                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && actionCooldown.ElapsedTime.AsMilliseconds() > 300)
                    {
                        actionCooldown.Restart();
                        Settings.Click();
                    }

                    Settings.Update();
                    settingsWindow.Clear(Color.White);
                    Settings.Draw();

                    settingsWindow.Display();
                }
            }
        }
Exemplo n.º 3
0
        public VehicleSettingsDialog(
            SkillConfigurationBase services,
            ResponseManager responseManager,
            IStatePropertyAccessor <AutomotiveSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient,
            IHttpContextAccessor httpContext)
            : base(nameof(VehicleSettingsDialog), services, responseManager, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            // Initialise supporting LUIS models for followup questions
            vehicleSettingNameSelectionLuisRecognizer  = services.LocaleConfigurations["en"].LuisServices["settings_name"];
            vehicleSettingValueSelectionLuisRecognizer = services.LocaleConfigurations["en"].LuisServices["settings_value"];

            // Initialise supporting LUIS models for followup questions
            vehicleSettingNameSelectionLuisRecognizer  = services.LocaleConfigurations["en"].LuisServices["settings_name"];
            vehicleSettingValueSelectionLuisRecognizer = services.LocaleConfigurations["en"].LuisServices["settings_value"];

            // Supporting setting files are stored as embeddded resources
            Assembly resourceAssembly = typeof(VehicleSettingsDialog).Assembly;

            var settingFile = resourceAssembly
                              .GetManifestResourceNames()
                              .Where(x => x.Contains(AvailableSettingsFileName))
                              .First();

            var alternativeSettingFileName = resourceAssembly
                                             .GetManifestResourceNames()
                                             .Where(x => x.Contains(AlternativeSettingsFileName))
                                             .First();

            if (string.IsNullOrEmpty(settingFile) || string.IsNullOrEmpty(alternativeSettingFileName))
            {
                throw new FileNotFoundException($"Unable to find Available Setting and/or Alternative Names files in \"{resourceAssembly.FullName}\" assembly.");
            }

            settingList   = new SettingList(resourceAssembly, settingFile, alternativeSettingFileName);
            settingFilter = new SettingFilter(settingList);

            // Setting Change waterfall
            var processVehicleSettingChangeWaterfall = new WaterfallStep[]
            {
                ProcessSetting,
                ProcessVehicleSettingsChange,
                ProcessChange,
                SendChange
            };

            AddDialog(new WaterfallDialog(Actions.ProcessVehicleSettingChange, processVehicleSettingChangeWaterfall)
            {
                TelemetryClient = telemetryClient
            });

            // Prompts
            AddDialog(new ChoicePrompt(Actions.SettingNameSelectionPrompt, SettingNameSelectionValidator, Culture.English)
            {
                Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions {
                    InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true
                }
            });
            AddDialog(new ChoicePrompt(Actions.SettingValueSelectionPrompt, SettingValueSelectionValidator, Culture.English)
            {
                Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions {
                    InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true
                }
            });

            AddDialog(new ConfirmPrompt(Actions.SettingConfirmationPrompt));

            // Set starting dialog for component
            InitialDialogId = Actions.ProcessVehicleSettingChange;

            // Used to resolve image paths (local or hosted)
            _httpContext = httpContext;
        }
Exemplo n.º 4
0
        private void ValidateSettings(SettingList SettingList)
        {
            Assert.True(SettingList.Value.IsAny());

            SettingList.Value.ForEach(ValidateSetting);
        }