Exemplo n.º 1
0
        public InputProcessor(GamePadState initialState)
        {
            center = new UIntVector(32768, 30650);

            bindings  = new List <ControllerInputBinding>();
            lastState = initialState;

            currentControllerState           = new ControllerState();
            currentControllerState.inputMode = InputMode.Pointer;
            currentControllerState.targetingReticulePosition = center;
            currentControllerState.cursorPosition            = center;
            currentControllerState.centerPosition            = center;

            d3Bindings = new D3Bindings();
            config     = new Configuration();

            stateChangeCommands          = new Queue <StateChangeCommand>();
            cursorMoveCommands           = new Queue <CursorMoveCommand>();
            reticuleTargetedCommands     = new Queue <Command>();
            cursorTargetedCommands       = new Queue <Command>();
            untargetedCommands           = new Queue <Command>();
            centerRandomTargetedCommands = new Queue <Command>();

            CreateDefaultBindings();
        }
Exemplo n.º 2
0
        /*
         * public void DoUpdate()
         * {
         *  while (!terminateThread)
         *  {
         *      if (!currentlyUpdating)
         *      {
         *          currentlyUpdating = true;
         *          diabloActive = false;
         *          string foregroundWindowString = WindowFunctions.GetActiveWindowTitle();
         *
         *          try
         *          {
         *              if (foregroundWindowString != null)
         *              {
         *                  if (foregroundWindowString.ToUpper() == "DIABLO III")
         *                  {
         *                      diabloActive = true;
         *
         *                      if (!setNonTopmost)
         *                      {
         *                          WindowFunctions.DisableTopMost(WindowFunctions.GetForegroundWindowHandle());
         *
         *                          setNonTopmost = true;
         *                      }
         *                  }
         *              }
         *          }
         *          catch (Exception ex)
         *          {
         *              string crashPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\crash.txt";
         *              using (StreamWriter outfile = new StreamWriter(crashPath, true))
         *              {
         *                  outfile.WriteLine();
         *                  outfile.WriteLine(DateTime.Now.ToString());
         *                  outfile.WriteLine(ex.Message);
         *                  outfile.WriteLine(ex.StackTrace);
         *                  outfile.WriteLine();
         *                  outfile.Flush();
         *              }
         *              MessageBox.Show("Exception in windowing functions. Written to crash.txt.");
         *              this.Close();
         *          }
         *
         *          try
         *          {
         *              if (diabloActive) LogicUpdate();
         *          }
         *          catch (Exception ex)
         *          {
         *              string crashPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\crash.txt";
         *              using (StreamWriter outfile = new StreamWriter(crashPath, true))
         *              {
         *                  outfile.WriteLine();
         *                  outfile.WriteLine(DateTime.Now.ToString());
         *                  outfile.WriteLine(ex.Message);
         *                  outfile.WriteLine(ex.StackTrace);
         *                  outfile.WriteLine();
         *                  outfile.Flush();
         *              }
         *              MessageBox.Show("Exception in Logic update. Written to crash.txt.");
         *              this.Close();
         *          }
         *
         *          if (d3bindingsForm.Visible)
         *          {
         *              d3bindingsForm.Refresh();
         *          }
         *
         *          if (configForm.Visible)
         *          {
         *              configForm.Refresh();
         *          }
         *
         *          currentlyUpdating = false;
         *      }
         *      Thread.Sleep(10);
         *  }
         * }
         */

        private void SaveD3Bindings(D3Bindings bindings)
        {
            var bindingsFileStream    = new FileStream(Application.StartupPath + @"\D3Bindings.xml", FileMode.Create);
            var bindingsXMLSerializer = new XmlSerializer(typeof(D3Bindings));

            bindingsXMLSerializer.Serialize(bindingsFileStream, bindings);
            bindingsFileStream.Close();
        }
Exemplo n.º 3
0
        private D3Bindings LoadD3Bindings()
        {
            var        bindingsFileStream    = new FileStream(Application.StartupPath + @"\D3Bindings.xml", FileMode.Open);
            var        bindingsXMLSerializer = new XmlSerializer(typeof(D3Bindings));
            D3Bindings result = (D3Bindings)bindingsXMLSerializer.Deserialize(bindingsFileStream);

            bindingsFileStream.Close();
            return(result);
        }
Exemplo n.º 4
0
        private void saveAndCloseButton_Click(object sender, EventArgs e)
        {
            if (editedBindings != null)
            {
                inputProcessor.d3Bindings = editedBindings;
                editedBindings            = null;
            }
            SaveD3Bindings(inputProcessor.d3Bindings);

            inputProcessor.loadChanges();

            Hide();
        }
Exemplo n.º 5
0
        private void CancelEditing()
        {
            foreach (Control control in this.Controls)
            {
                if (control is TextBox)
                {
                    TextBox controlTextBox = control as TextBox;
                    controlTextBox.BackColor = System.Drawing.SystemColors.Control;
                }
            }

            EditingBinding = false;
            editedBindings = null;
        }
Exemplo n.º 6
0
        private void bindingTextBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (!EditingBinding)
            {
                if (editedBindings == null)
                {
                    editedBindings = CopyBindings(inputProcessor.d3Bindings);
                }

                EditingBinding = true;

                TextBox senderTextBox = sender as TextBox;
                senderTextBox.BackColor = Color.White;
                Refresh();
            }
        }
Exemplo n.º 7
0
        private D3Bindings CopyBindings(D3Bindings d3Bindings)
        {
            D3Bindings result = new D3Bindings();

            result.actionBarSkill1Key = d3Bindings.actionBarSkill1Key;
            result.actionBarSkill2Key = d3Bindings.actionBarSkill2Key;
            result.actionBarSkill3Key = d3Bindings.actionBarSkill3Key;
            result.actionBarSkill4Key = d3Bindings.actionBarSkill4Key;
            result.forceMoveKey       = d3Bindings.forceMoveKey;
            result.forceStandStillKey = d3Bindings.forceStandStillKey;
            result.gameMenuKey        = d3Bindings.gameMenuKey;
            result.inventoryKey       = d3Bindings.inventoryKey;
            result.mapKey             = d3Bindings.mapKey;
            result.potionKey          = d3Bindings.potionKey;
            result.townPortalKey      = d3Bindings.townPortalKey;
            result.worldMapKey        = d3Bindings.worldMapKey;

            return(result);
        }
Exemplo n.º 8
0
 private void D3BindingsForm_Shown(object sender, EventArgs e)
 {
     editedBindings = CopyBindings(inputProcessor.d3Bindings);
     Refresh();
 }