Exemplo n.º 1
0
        /// <summary>
        /// Creates a prompt
        /// </summary>
        /// <param name="Title">Text displayed at the top.</param>
        /// <param name="BodyText">Main display text.</param>
        /// <param name="OptionA">Option text for option A (left).</param>
        /// <param name="OptionB">Option text for option B (right).</param>
        /// <returns>True if option A was used.</returns>
        public static bool DoPrompt(string Title, string BodyText, string OptionA, string OptionB)
        {
            GenericPrompt GP = new GenericPrompt();

            GP.Text           = Title;
            GP.labelBody.Text = BodyText;
            GP.buttonA.Text   = OptionA;
            GP.buttonB.Text   = OptionB;
            DialogResult dr = GP.ShowDialog();

            return(dr == DialogResult.OK);
        }
Exemplo n.º 2
0
        private void buttonSaveMapping_Click(object sender, EventArgs e)
        {
            DialogResult dr = saveFileDialogMapping.ShowDialog();

            if (dr == DialogResult.OK)
            {
                bool           useSelectedXInput = false;
                bool           useSelectedVJoy   = false;
                DeviceListItem selectedvJoy      = comboVJoyDevices.SelectedItem as DeviceListItem;

                if (XInputObj.ActiveController != null)
                {
                    useSelectedXInput = GenericPrompt.DoPrompt("XInput Controller", "Use selected XInput controller index or any available controller?", "Selected (#" + XInputObj.LastActiveControllerIndex + ")", "Any");
                }

                if (selectedvJoy != null)
                {
                    useSelectedVJoy = GenericPrompt.DoPrompt("vJoy Controller", "Use selected vJoy controller index or any available controller?", "Selected (#" + selectedvJoy.DeviceIndex + ")", "Any");
                }

                StreamWriter wr = new StreamWriter(saveFileDialogMapping.FileName, false);

                wr.WriteLine("XInput=" + ((useSelectedXInput) ? XInputObj.LastActiveControllerIndex.ToString() : "any"));
                wr.WriteLine("vJoy=" + ((useSelectedVJoy) ? selectedvJoy.DeviceIndex.ToString() : "any"));

                WriteInputLineToSaveFile(ref wr, inputLSX, "LSX");
                WriteInputLineToSaveFile(ref wr, inputLSY, "LSY");
                WriteInputLineToSaveFile(ref wr, inputRSX, "RSX");
                WriteInputLineToSaveFile(ref wr, inputRSY, "RSY");
                WriteInputLineToSaveFile(ref wr, inputLT, "LT");
                WriteInputLineToSaveFile(ref wr, inputRT, "RT");
                WriteInputLineToSaveFile(ref wr, inputA, "A");
                WriteInputLineToSaveFile(ref wr, inputB, "B");
                WriteInputLineToSaveFile(ref wr, inputX, "X");
                WriteInputLineToSaveFile(ref wr, inputY, "Y");
                WriteInputLineToSaveFile(ref wr, inputLB, "LB");
                WriteInputLineToSaveFile(ref wr, inputRB, "RB");
                WriteInputLineToSaveFile(ref wr, inputDPadLeft, "DPadLeft");
                WriteInputLineToSaveFile(ref wr, inputDPadRight, "DPadRight");
                WriteInputLineToSaveFile(ref wr, inputDPadUp, "DPadUp");
                WriteInputLineToSaveFile(ref wr, inputDPadDown, "DPadDown");
                WriteInputLineToSaveFile(ref wr, inputLeftStick, "LeftStick");
                WriteInputLineToSaveFile(ref wr, inputRightStick, "RightStick");
                WriteInputLineToSaveFile(ref wr, inputStart, "Start");
                WriteInputLineToSaveFile(ref wr, inputBack, "Back");

                wr.Close();
            }
        }