Example #1
0
        private void AddMouseAction(MouseChord chord, MouseTarget target)
        {
            MouseChord button = chord & ~(MouseChord.Alt | MouseChord.Ctrl | MouseChord.Shift);

            if (!MouseTargetButtons[target].Contains(button))
            {
                var dict = QTUtility.TextResourcesDic["Options_Page07_Mouse"];
                MessageBox.Show(
                    dict[18] + Environment.NewLine +
                    dict[19] + Environment.NewLine +
                    MouseTargetButtons[target].Select(k => "  " + dict[MouseButtonResx[k]])
                    .StringJoin(Environment.NewLine),
                    dict[20], MessageBoxButton.OK, MessageBoxImage.Hand);
                return;
            }
            MouseEntry entry = MouseBindings.FirstOrDefault(e => e.Chord == chord && e.Target == target);

            if (entry == null)
            {
                entry = new MouseEntry(target, chord, BindAction.Nothing);
                MouseBindings.Add(entry);
            }
            entry.IsSelected = true;
            lvwMouseBindings.UpdateLayout();
            lvwMouseBindings.ScrollIntoView(entry);
            // Need to wait for ScrollIntoView to finish, or the dropdown will open in the wrong place.
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() => { entry.IsEditing = true; }));
        }
Example #2
0
        private void lvwMouseBindings_KeyDown(object sender, KeyEventArgs e)
        {
            MouseEntry entry = lvwMouseBindings.SelectedItem as MouseEntry;

            if (entry == null)
            {
                return;
            }
            if (e.Key == Key.Delete)
            {
                MouseBindings.Remove(entry);
            }
            else if (e.Key == Key.Space || e.Key == Key.Enter)
            {
                entry.IsEditing = true;
            }
        }
Example #3
0
    private void FixedUpdate()
    {
        // Actions
        if (isReplaying && actionEntries.Count > currIndex)
        {
            ActionEntry ae = actionEntries[currIndex];
            while (ae.CapturedFrame <= currFixedFrame)
            {
                ae.InputAction.PlayAction();
                currIndex++;

                // Assign new current ae or break out
                if (actionEntries.Count > currIndex)
                {
                    ae = actionEntries[currIndex];
                }
                else
                {
                    break;
                }
            }
        }

        // Mouse Entries
        if (isReplaying && mouseEntries.Count > currMouseIndex + 1)
        {
            MouseEntry me     = mouseEntries[currMouseIndex];
            MouseEntry meNext = mouseEntries[currMouseIndex + 1];
            cannon.LookAtPoint(Vector3.Lerp(me.MousePos, meNext.MousePos, (float)(currFixedFrame - me.CapturedFrame) / (meNext.CapturedFrame - me.CapturedFrame)));
            //Debug.Log($"Lerping from mousepos index {currMouseIndex} to {currMouseIndex + 1}. t = {(float)(currFixedFrame - me.CapturedFrame) / meNext.CapturedFrame - me.CapturedFrame}");
            //Debug.Log($"Current frame {currFixedFrame}, index frame{me.CapturedFrame}, index + 1 frame {meNext.CapturedFrame}");
            if (currFixedFrame > meNext.CapturedFrame)
            {
                currMouseIndex++;
            }
        }

        // Do this AT THE END of the frame
        currFixedFrame++;
    }
 private void AddMouseAction(MouseChord chord, MouseTarget target) {
     MouseChord button = chord & ~(MouseChord.Alt | MouseChord.Ctrl | MouseChord.Shift);
     if(!MouseTargetButtons[target].Contains(button)) {
         var dict = QTUtility.TextResourcesDic["Options_Page07_Mouse"];
         MessageBox.Show(
                 dict[18] + Environment.NewLine +
                 dict[19] + Environment.NewLine +
                 MouseTargetButtons[target].Select(k => "  " + dict[MouseButtonResx[k]])
                     .StringJoin(Environment.NewLine),
                 dict[20], MessageBoxButton.OK, MessageBoxImage.Hand);
         return;
     }
     MouseEntry entry = MouseBindings.FirstOrDefault(e => e.Chord == chord && e.Target == target);
     if(entry == null) {
         entry = new MouseEntry(target, chord, BindAction.Nothing);
         MouseBindings.Add(entry);
     }
     entry.IsSelected = true;
     lvwMouseBindings.UpdateLayout();
     lvwMouseBindings.ScrollIntoView(entry);
     // Need to wait for ScrollIntoView to finish, or the dropdown will open in the wrong place.
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() => { entry.IsEditing = true; }));
 }