コード例 #1
0
        public DuelRule()
        {
            BaseGame.ShowMouse = true;

            AIListForTank1 = new Combo("AIListForTank1", new Vector2(100, 100), 250);
            AIListForTank2 = new Combo("AIListForTank1", new Vector2(100, 300), 250);

            AIListForTank1.OnChangeSelection += new EventHandler(AIListForTank1_OnChangeSelection);
            AIListForTank2.OnChangeSelection += new EventHandler(AIListForTank2_OnChangeSelection);

            aiLoader = new AILoader();
            aiLoader.AddInterAI(typeof(DuelerNoFirst));
            aiLoader.AddInterAI(typeof(ManualControl));
            aiLoader.AddInterAI(typeof(DuelAIModel));
            aiLoader.AddInterAI(typeof(AutoShootAI));
            aiLoader.InitialCompatibleAIs(typeof(IDuelAIOrderServer), typeof(AICommonServer));
            foreach (string name in aiLoader.GetAIList())
            {
                AIListForTank1.AddItem(name);
                AIListForTank2.AddItem(name);
            }
            btn          = new TextButton("OkBtn", new Vector2(700, 500), "Begin", 0, Color.Yellow);
            btn.OnClick += new EventHandler(btn_OnPress);

            LoadResouce();
        }
コード例 #2
0
        public ICommandResult Handler(FormularioCommand command)
        {
            var formulario = new Formulario();

            command.Validate();
            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, "Não foi possível criar o Formulario"));
            }

            foreach (var item in command.Campos)
            {
                if (item.TipoCampo == TipoCampo.Combo)
                {
                    var combo = new Combo(item.Nome, item.TipoCampo, item.Valor, item.Descricao, item.Obrigatorio);

                    foreach (var valor in item.Items)
                    {
                        combo.AddItem(new Item(valor));
                    }

                    formulario.AddItem(combo);
                    AddNotifications(combo);
                }
                else
                {
                    var campo = new Campo(item.Nome, item.TipoCampo, item.Valor, item.Descricao, item.Obrigatorio);
                    formulario.AddItem(campo);
                    AddNotifications(campo);
                }
            }

            if (formulario.Invalid)
            {
                return(new CommandResult(false, "Não foi possível criar o formulario"));
            }

            _repository.CreateFormulario(formulario);

            return(new CommandResult(true, "Formulário criado com sucesso"));
        }
コード例 #3
0
        public FindPathRule()
        {
            BaseGame.ShowMouse = true;

            aiList = new Combo("AIList", new Vector2(200, 200), 300);

            aiList.OnChangeSelection += new EventHandler(AIList_OnChangeSelection);

            aiLoader = new AILoader();
            aiLoader.AddInterAI(typeof(PathFinderThird));
            aiLoader.AddInterAI(typeof(PathFinderSecond));
            aiLoader.AddInterAI(typeof(ManualControl));
            aiLoader.AddInterAI(typeof(PathFinderFirst));
            aiLoader.InitialCompatibleAIs(typeof(IAIOrderServerSinTur), typeof(AICommonServer));
            foreach (string name in aiLoader.GetAIList())
            {
                aiList.AddItem(name);
            }
            btn          = new TextButton("OkBtn", new Vector2(700, 500), "Begin", 0, Color.Blue);
            btn.OnClick += new EventHandler(btn_OnClick);
        }
コード例 #4
0
        private void InitializeUI()
        {
            Form mainForm = new Form(
                new Vector2(50, 50),
                new Vector2(200, 200),
                s_mainMenuTitle,
                Color.DarkGray,
                Color.Black,
                "Verdana",
                0.7f,
                false,
                false,
                false,
                false,
                Form.BorderStyle.FixedSingle,
                Form.Style.Default
                );

            TextButton startGameButton = new TextButton(
                s_mainMenuStartGame,
                new Vector2(20, 50),
                s_mainMenuStartGame,
                160,
                Color.White,
                m_resourceManager.GetFont(GameFontKey.Verdana),
                Form.Style.Default
                );

            startGameButton.OnPress += startGameButton_OnPress;
            mainForm.Add(startGameButton);

            TextButton optionsButton = new TextButton(
                s_mainMenuOptions,
                new Vector2(20, 80),
                s_mainMenuOptions,
                160,
                Color.White,
                m_resourceManager.GetFont(GameFontKey.Verdana),
                Form.Style.Default
                );

            optionsButton.OnPress += optionsButton_OnPress;
            mainForm.Add(optionsButton);

            TextButton exitButton = new TextButton(
                s_mainMenuExit,
                new Vector2(20, 110),
                s_mainMenuExit,
                160,
                Color.White,
                m_resourceManager.GetFont(GameFontKey.Verdana),
                Form.Style.Default
                );

            exitButton.OnPress += exitButton_OnPress;
            mainForm.Add(exitButton);

            Form optionsForm = new Form(
                new Vector2(270, 50),
                new Vector2(400, 500),
                s_mainMenuOptions,
                Color.DarkGray,
                Color.Black,
                "Verdana",
                0.7f,
                false,
                false,
                false,
                false,
                Form.BorderStyle.FixedSingle,
                Form.Style.Default
                );

            Label musicLabel = new Label(
                s_optionsMenuMusic + "Label",
                new Vector2(45, 50),
                s_optionsMenuMusic + ":",
                Label.Alignment.Left,
                300,
                Color.Black,
                m_resourceManager.GetFont(GameFontKey.Verdana)
                );

            optionsForm.Add(musicLabel);

            Slider musicVolumeSlider = new Slider(
                s_optionsMenuMusic,
                new Vector2(50, 70),
                300,
                0,
                100,
                (int)(m_audioManager.MusicVolume * 100),
                Form.Style.Default
                );

            optionsForm.Add(musicVolumeSlider);

            Label soundLabel = new Label(
                s_optionsMenuSounds + "Label",
                new Vector2(45, 90),
                s_optionsMenuSounds + ":",
                Label.Alignment.Left,
                300,
                Color.Black,
                m_resourceManager.GetFont(GameFontKey.Verdana)
                );

            optionsForm.Add(soundLabel);

            Slider soundVolumeSlider = new Slider(
                s_optionsMenuSounds,
                new Vector2(50, 110),
                300,
                0,
                100,
                (int)(m_audioManager.SoundVolume * 100),
                Form.Style.Default
                );

            optionsForm.Add(soundVolumeSlider);

            Label resolutionLabel = new Label(
                s_optionsResolution + "Label",
                new Vector2(45, 130),
                s_optionsResolution + ":",
                Label.Alignment.Left,
                50,
                Color.Black,
                m_resourceManager.GetFont(GameFontKey.Verdana)
                );

            optionsForm.Add(resolutionLabel);

            Combo resolutionComboBox = new Combo(
                s_optionsResolution,
                new Vector2(145, 130),
                200,
                m_resourceManager.GetFont(GameFontKey.Verdana),
                Form.Style.Default
                );

            resolutionComboBox.AddItem(s_optionsResolution800x600);
            resolutionComboBox.AddItem(s_optionsResolution1024x768);
            resolutionComboBox.AddItem(s_optionsResolution1280x960);

            if (m_graphicsManager.ViewportSize == ViewportSizePreset.Size800x600)
            {
                resolutionComboBox.SelectedItem = s_optionsResolution800x600;
            }
            if (m_graphicsManager.ViewportSize == ViewportSizePreset.Size1024x768)
            {
                resolutionComboBox.SelectedItem = s_optionsResolution1024x768;
            }
            if (m_graphicsManager.ViewportSize == ViewportSizePreset.Size1280x960)
            {
                resolutionComboBox.SelectedItem = s_optionsResolution1280x960;
            }

            optionsForm.Add(resolutionComboBox);

            m_forms.Add(mainForm);
            m_forms.Add(optionsForm);
        }