Beispiel #1
0
 public FormListClients(ControllerClient service, ControllerSelection serviceR, ControllerService serviceS, ControllerValidation serviceV)
 {
     InitializeComponent();
     this.service  = service;
     this.serviceR = serviceR;
     this.serviceS = serviceS;
     this.serviceV = serviceV;
 }
        private void Initialize() {
            dialog = new DialogHelper();
            actionQueue = new Queue<QueueEntry>();
            selectedController = new ControllerSelection();
            ReInput.ControllerConnectedEvent += JoystickConnected;
            ReInput.ControllerPreDisconnectEvent += JoystickPreDisconnect; // runs before joystick is completely disconnected so we can save maps
            ReInput.ControllerDisconnectedEvent += JoystickDisconnected; // final disconnect that runs after joystick has been fully removed
            Reset();
            initialized = true;
            LoadAllMaps(); // load saved user maps on start if there are any to load

            if(ReInput.unityJoystickIdentificationRequired) {
                IdentifyAllJoysticks();
            }
        }
    /*******\
    * START *
    \*******/
    void Start()
    {
        // Determine the default controller assignments
        numOfControllers = Input.GetJoystickNames().Length;
        Debug.Log(Input.GetJoystickNames().ToString());

        if (numOfControllers == 0)
        {
            P1Controller = ControllerSelection.KB1;
            P2Controller = ControllerSelection.KB2;
            P3Controller = ControllerSelection.None;
            P4Controller = ControllerSelection.None;
        }
        else if (numOfControllers == 1)
        {
            P1Controller = ControllerSelection.KB1;
            P2Controller = ControllerSelection.KB2;
            P3Controller = ControllerSelection.C1;
            P4Controller = ControllerSelection.None;
        }
        else if (numOfControllers == 2)
        {
            P1Controller = ControllerSelection.KB1;
            P2Controller = ControllerSelection.KB2;
            P3Controller = ControllerSelection.C1;
            P4Controller = ControllerSelection.C2;
        }
        else if (numOfControllers == 3)
        {
            P1Controller = ControllerSelection.KB1;
            P2Controller = ControllerSelection.C1;
            P3Controller = ControllerSelection.C2;
            P4Controller = ControllerSelection.C3;
        }
        else if (numOfControllers >= 4)
        {
            P1Controller = ControllerSelection.C1;
            P2Controller = ControllerSelection.C2;
            P3Controller = ControllerSelection.C3;
            P4Controller = ControllerSelection.C4;
        }

        // transition straight into the main menu
        Application.LoadLevel("mainmenu");
    }
        public ControllerSelectionControl(IServiceProvider provider, ControllerSelection selection)
        {
            InitializeComponent();

            using (var graphics = Graphics.FromHwnd(IntPtr.Zero))
            {
                SuspendLayout();

                foreach (var c in selection.Controllers)
                {
                    if (!string.IsNullOrWhiteSpace(c.ToString()))
                    {
                        controllerListBox.Items.Add(c.ToString());
                    }
                }

                var drawScale = graphics.DpiY / DefaultDpi;
                controllerListBox.Height = (int)Math.Ceiling(controllerListBox.ItemHeight * controllerListBox.Items.Count * drawScale);
                ResumeLayout();
            }
        }
 private void DrawAddActionMapButton(int playerId, InputAction action, Pole actionAxisContribution, ControllerSelection controller, ControllerMap controllerMap,
     bool assignFullAxis) {
     if(GUILayout.Button("Add...", GUILayout.ExpandWidth(false))) {
         EnqueueAction(new ElementAssignmentChange(playerId, controller.id, controller.type, controllerMap,
             ElementAssignmentChangeType.Add, -1, action.id, actionAxisContribution, action.type, assignFullAxis, false));
     }
     GUILayout.Space(10);
 }
 private void DrawInvertButton(int playerId, InputAction action, Pole actionAxisContribution, ControllerSelection controller, ControllerMap controllerMap, ActionElementMap elementMap) {
     bool value = elementMap.invert;
     bool newValue = GUILayout.Toggle(value, "Invert", GUILayout.ExpandWidth(false));
     if(newValue != value) {
         elementMap.invert = newValue;
     }
     GUILayout.Space(10);
 }
        private void DrawActionAssignmentButton(int playerId, InputAction action, Pole actionAxisContribution, ControllerSelection controller, ControllerMap controllerMap,
            bool assignFullAxis, ActionElementMap elementMap) {

            if(GUILayout.Button(elementMap.elementIdentifierName, GUILayout.ExpandWidth(false), GUILayout.MinWidth(30.0f))) {
                EnqueueAction(new ElementAssignmentChange(playerId, controller.id, controller.type, controllerMap,
                    ElementAssignmentChangeType.ReassignOrRemove, elementMap.id, action.id, actionAxisContribution, action.type, assignFullAxis, elementMap.invert));
            }
            GUILayout.Space(4);
        }
 public ControllerSelectionControl(ControllerSelection selection)
     : this(null, selection)
 {
 }