Beispiel #1
0
        private void ControlProfileButton_MouseLeave(object sender, MouseEventArgs e)
        {
            DoubleAnimation WidthAnimation = new DoubleAnimation();

            WidthAnimation.From     = ControlProfile.Width;
            WidthAnimation.To       = 165;
            WidthAnimation.Duration = TimeSpan.FromSeconds(0.1);
            ControlProfile.BeginAnimation(Border.WidthProperty, WidthAnimation);
        }
Beispiel #2
0
 private void Start()
 {
     upTr            = up.transform.position;
     downTr          = down.transform.position;
     rightTr         = right.transform.position;
     leftTr          = left.transform.position;
     joyTr           = joyStick.transform.position;
     currKeyControls = InputManager.main.keyboardControls;
     SetKeys();
 }
Beispiel #3
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var nam = new Frm_EnterName();

            nam.ShowDialog(this);
            if (nam.OK)
            {
                var pro = new ControlProfile();
                pro.Name = nam.NameEntered;
                Program.Settings.ControlProfiles.Add(pro);
                RefreshProfiles();
                comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
            }
        }
Beispiel #4
0
 void DetectController()
 {
     try
     {
         cProfile = ControlProfile.Controller;
         if(Input.GetJoystickNames()[0] != null)
         {
             isControllerConnected = true;
             IdentifyController();
         }
         else
         {
             cProfile = ControlProfile.PC;
         }
     }
     catch
     {
         isControllerConnected = false;
     }
 }
Beispiel #5
0
        public void Load(BinaryReader reader)
        {
            // Read number of firewall profiles
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                // Read profile header
                string header = reader.ReadString();

                bool foundMatch = false;

                // For each profile in items control
                foreach (ControlProfile profile in MainWindow.itemsFirewallProfiles.Items)
                {
                    // If profile header matches config
                    if (profile.Header == header)
                    {
                        // Load config into control
                        profile.Load(reader);

                        foundMatch = true;
                    }
                }

                // If no match was found
                if (!foundMatch)
                {
                    // Create instance of new profile
                    ControlProfile profile = new ControlProfile();

                    // Load profile to skip outdated info in stream
                    profile.Load(reader);

                    // We do not add this to the list as it is likely outdated information
                }
            }
        }
    private void CheckInputType()
    {
        if (CurrentControlProfile.IsSelected())
        {
            return;
        }

        if (KeyboardControlProfile.IsSelected())
        {
            CurrentControlProfile = KeyboardControlProfile;
            resetInput();
        }
        else if (ControllerControlProfile.IsSelected())
        {
            CurrentControlProfile = ControllerControlProfile;
            resetInput();
        }
        else
        {
            return;
        }
        Debug.Log("Change ControlProfile to " + CurrentControlProfile.name);
    }
 void Awake()
 {
     cProfile = ControlProfile.GetDefaultProfile (controlProfile);
     weaponAttachment = transform.FindChild ("Weapon Attatchment");
     rBody = GetComponent<Rigidbody> ();
     activeBlockMen.Add (this);
 }
 public void SetControlProfile(ControlProfile.DefaultProfiles profile)
 {
     controlProfile = profile;
     cProfile = ControlProfile.GetDefaultProfile (profile);
 }
Beispiel #9
0
 // Update is called once per frame
 void Update()
 {
     if (InputManager.ControllerMode)
     {
         if (!controllerMode)
         {
             SetControllerMode(true);
         }
         if (InputManager.GetAxis(InputAxis.Horizontal) != 0 || InputManager.GetAxis(InputAxis.Vertical) != 0)
         {
             if (joyCr.cr != null)
             {
                 return;
             }
             if (++count >= pressGoal)
             {
                 Finish();
             }
             else
             {
                 joyStick.transform.position = joyTr;
                 joyCr.cr = StartCoroutine(Shake(joyCr, joyStick.gameObject, 0.2f, 0.2f, 0.05f));
             }
         }
     }
     else
     {
         if (controllerMode)
         {
             SetControllerMode(false);
         }
         if (currKeyControls != InputManager.main.keyboardControls)
         {
             currKeyControls = InputManager.main.keyboardControls;
             SetKeys();
         }
         if (InputManager.GetButtonDown(Control.Up))
         {
             if (++count >= pressGoal)
             {
                 Finish();
             }
             else
             {
                 if (upCr.cr != null)
                 {
                     StopCoroutine(upCr.cr);
                 }
                 up.transform.position = upTr;
                 upCr.cr = StartCoroutine(Shake(upCr, up.gameObject, 0.2f, 0.2f, 0.05f));
             }
         }
         else if (InputManager.GetButtonDown(Control.Down))
         {
             if (++count >= pressGoal)
             {
                 Finish();
             }
             else
             {
                 if (downCr.cr != null)
                 {
                     StopCoroutine(downCr.cr);
                 }
                 down.transform.position = downTr;
                 downCr.cr = StartCoroutine(Shake(downCr, down.gameObject, 0.2f, 0.2f, 0.05f));
             }
         }
         else if (InputManager.GetButtonDown(Control.Left))
         {
             if (++count >= pressGoal)
             {
                 Finish();
             }
             else
             {
                 if (leftCr.cr != null)
                 {
                     StopCoroutine(leftCr.cr);
                 }
                 left.transform.position = leftTr;
                 leftCr.cr = StartCoroutine(Shake(leftCr, left.gameObject, 0.2f, 0.2f, 0.05f));
             }
         }
         else if (InputManager.GetButtonDown(Control.Right))
         {
             if (++count >= pressGoal)
             {
                 Finish();
             }
             else
             {
                 if (rightCr.cr != null)
                 {
                     StopCoroutine(rightCr.cr);
                 }
                 right.transform.position = rightTr;
                 rightCr.cr = StartCoroutine(Shake(rightCr, right.gameObject, 0.2f, 0.2f, 0.05f));
             }
         }
     }
 }
Beispiel #10
0
 void SwitchProfile(ControlProfile Switcher)
 {
     cProfile = Switcher;
 }
Beispiel #11
0
 public void SetKeyboardControls(ControlProfile p)
 {
     InputManager.main.SetKeyboardProfile(p);
 }
Beispiel #12
0
 public void SetGamepadControls(ControlProfile p)
 {
     InputManager.main.SetGamepadProfile(p);
 }
    internal void RegisterControl(Control p_control, string p_persistableProperty)
    {
        ControlProfile cp;
        if (m_controlProfiles[p_control.UniqueID] == null)
        {
            cp = new ControlProfile();
            m_controlProfiles.Add(p_control.UniqueID, cp);
        }
        else
        {
            cp = m_controlProfiles[p_control.UniqueID] as ControlProfile;
        }

        cp.PersistableProperty = p_persistableProperty;
    }