protected void CreateVirtualAxes() { // set axes to use this.m_UseX = (this.m_AxesToUse == AxisOption.Both || this.m_AxesToUse == AxisOption.OnlyHorizontal); this.m_UseY = (this.m_AxesToUse == AxisOption.Both || this.m_AxesToUse == AxisOption.OnlyVertical); if (this.m_UseX) { this.m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(this.m_HorizontalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(this.m_HorizontalVirtualAxis); } if (this.m_UseY) { this.m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(this.m_VerticalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(this.m_VerticalVirtualAxis); } }
void CreateVirtualAxes() { // set axes to use m_UseX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); m_UseY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (m_UseX) { m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(horizontalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis); } if (m_UseY) { m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(verticalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis); } }
// Start is called before the first frame update void Start() { if (CrossPlatformInputManager.AxisExists(this.horizontalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(this.horizontalAxisName); } if (CrossPlatformInputManager.AxisExists(this.verticalsAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(this.verticalsAxisName); } this.HorizontalAxis = new CrossPlatformInputManager.VirtualAxis(this.horizontalAxisName); this.VerticalAxis = new CrossPlatformInputManager.VirtualAxis(this.verticalsAxisName); CrossPlatformInputManager.RegisterVirtualAxis(this.HorizontalAxis); CrossPlatformInputManager.RegisterVirtualAxis(this.VerticalAxis); }
// Use this for initialization void Start() { playersChoices = new LinkedList <Choice>(); _currentScene = SceneManager.GetActiveScene().name; m_HVAxis = new CrossPlatformInputManager.VirtualAxis(horizontalAxis); m_VVAxis = new CrossPlatformInputManager.VirtualAxis(verticalAxis); CrossPlatformInputManager.RegisterVirtualAxis(m_HVAxis); CrossPlatformInputManager.RegisterVirtualAxis(m_VVAxis); Network.InitializeSecurity(); //_codeText.text = Utilities.RandomCode(Constants.CODE_LENGTH); //displays the rand code //Network.incomingPassword = _codeText.text; //sets the password for connection as the rand generated code //Network.InitializeServer(4, 25000, false); NetworkServer.Listen(25000); NetworkServer.RegisterHandler(888, ServerReceiveMessage); }
//If this rig is enabled we will register the two virtual axis with the CrossPlatformInputManager. This means these axis values will be derived from this script. private void OnEnable() { //TODO this can probably be tidied up if (!CrossPlatformInputManager.AxisExists("Vertical")) { verticalAxis = new CrossPlatformInputManager.VirtualAxis("Vertical"); CrossPlatformInputManager.RegisterVirtualAxis(verticalAxis); } else { verticalAxis = CrossPlatformInputManager.VirtualAxisReference("Vertical"); } if (!CrossPlatformInputManager.AxisExists("Horizontal")) { horizontalAxis = new CrossPlatformInputManager.VirtualAxis("Horizontal"); CrossPlatformInputManager.RegisterVirtualAxis(horizontalAxis); } else { horizontalAxis = CrossPlatformInputManager.VirtualAxisReference("Horizontal"); } }
// Use this for initialization void Start() { messageBuffer = new List <KeyValuePair <int, BufferedMessage> >(); if (networkDiscovery == null) { networkDiscovery = gameObject.GetComponent <MyNetworkDiscovery>(); } // if (networkDiscovery == null) throw new System.Exception(); // running server in background Application.runInBackground = true; ipAddress = LocalIPAddress(); for (int i = 0; i < 4; i++) { HRZTAxis[i] = new CrossPlatformInputManager.VirtualAxis(hrztaxis_n + i); CrossPlatformInputManager.RegisterVirtualAxis(HRZTAxis[i]); VTCAxis[i] = new CrossPlatformInputManager.VirtualAxis(vtcaxis_n + i); CrossPlatformInputManager.RegisterVirtualAxis(VTCAxis[i]); } bool networkStart = false; do { try { networkStart = NetworkServer.Listen(port); } catch (System.Exception err) { Debug.LogWarning("Start Server Not complete: " + err + "Try Changing port"); port++; } }while (!networkStart); //Debug.Log("listening at port: " + port); RegisterHandlers(); }
private void AddAxes(string name) { // we have not registered this button yet so add it, happens in the constructor CrossPlatformInputManager.RegisterVirtualAxis(new CrossPlatformInputManager.VirtualAxis(name)); }
void OnEnable() { // Get power component powerJoystick = GetComponent <PowerJoystick> (); powerDPad = GetComponent <PowerDPad> (); powerButton = GetComponent <PowerButton> (); if (powerJoystick != null) { powerType = PowerType.Joystick; } else if (powerDPad != null) { powerType = PowerType.DPad; } else if (powerButton != null) { powerType = PowerType.Button; } // Subscribe to trigger events if (powerType == PowerType.Joystick) { PowerJoystick.OnJoyPosHTriggerButtonDown += PosHTriggerButtonDown; PowerJoystick.OnJoyPosHTriggerButtonUp += PosHTriggerButtonUp; PowerJoystick.OnJoyNegHTriggerButtonDown += NegHTriggerButtonDown; PowerJoystick.OnJoyNegHTriggerButtonUp += NegHTriggerButtonUp; PowerJoystick.OnJoyPosVTriggerButtonDown += PosVTriggerButtonDown; PowerJoystick.OnJoyPosVTriggerButtonUp += PosVTriggerButtonUp; PowerJoystick.OnJoyNegVTriggerButtonDown += NegVTriggerButtonDown; PowerJoystick.OnJoyNegVTriggerButtonUp += NegVTriggerButtonUp; } if (powerType == PowerType.DPad) { PowerDPad.OnDPadPosHTriggerButtonDown += PosHTriggerButtonDown; PowerDPad.OnDPadPosHTriggerButtonUp += PosHTriggerButtonUp; PowerDPad.OnDPadNegHTriggerButtonDown += NegHTriggerButtonDown; PowerDPad.OnDPadNegHTriggerButtonUp += NegHTriggerButtonUp; PowerDPad.OnDPadPosVTriggerButtonDown += PosVTriggerButtonDown; PowerDPad.OnDPadPosVTriggerButtonUp += PosVTriggerButtonUp; PowerDPad.OnDPadNegVTriggerButtonDown += NegVTriggerButtonDown; PowerDPad.OnDPadNegVTriggerButtonUp += NegVTriggerButtonUp; } // Subscribe to normal button events if (powerType == PowerType.Button) { PowerButton.OnPowerButtonDown += OnPowerButtonDown; PowerButton.OnPowerButtonUp += OnPowerButtonUp; } // Register joystick axis if (powerType == PowerType.Joystick) { if (powerJoystick.useAxis == PowerJoystick.UseAxis.Both || powerJoystick.useAxis == PowerJoystick.UseAxis.Horizontal) { if (powerJoystick.GetHorizontalAxisName() != "" && !CrossPlatformInputManager.AxisExists(powerJoystick.GetHorizontalAxisName())) { horizontalAxis = new CrossPlatformInputManager.VirtualAxis(powerJoystick.GetHorizontalAxisName()); CrossPlatformInputManager.RegisterVirtualAxis(horizontalAxis); } // Unregister doesn't work correctly / Get axis reference (necessary if joysticks gets disbled and enabled again) if (powerJoystick.GetHorizontalAxisName() != "" && CrossPlatformInputManager.AxisExists(powerJoystick.GetHorizontalAxisName())) { horizontalAxis = CrossPlatformInputManager.VirtualAxisReference(powerJoystick.GetHorizontalAxisName()); } } if (powerJoystick.useAxis == PowerJoystick.UseAxis.Both || powerJoystick.useAxis == PowerJoystick.UseAxis.Vertical) { if (powerJoystick.GetVerticalAxisName() != "" && !CrossPlatformInputManager.AxisExists(powerJoystick.GetVerticalAxisName())) { verticalAxis = new CrossPlatformInputManager.VirtualAxis(powerJoystick.GetVerticalAxisName()); CrossPlatformInputManager.RegisterVirtualAxis(verticalAxis); } // Unregister doesn't work correctly / Get axis reference (necessary if joysticks gets disbled and enabled again) if (powerJoystick.GetVerticalAxisName() != "" && CrossPlatformInputManager.AxisExists(powerJoystick.GetVerticalAxisName())) { verticalAxis = CrossPlatformInputManager.VirtualAxisReference(powerJoystick.GetVerticalAxisName()); } } } // Register d-pad axis if (powerType == PowerType.DPad) { if (powerDPad.useAxis == PowerDPad.UseAxis.Both || powerDPad.useAxis == PowerDPad.UseAxis.Horizontal) { if (powerDPad.GetHorizontalAxisName() != "" && !CrossPlatformInputManager.AxisExists(powerDPad.GetHorizontalAxisName())) { horizontalAxis = new CrossPlatformInputManager.VirtualAxis(powerDPad.GetHorizontalAxisName()); CrossPlatformInputManager.RegisterVirtualAxis(horizontalAxis); } // Unregister doesn't work correctly / Get axis reference (necessary if d-pad gets disbled and enabled again) if (powerDPad.GetHorizontalAxisName() != "" && CrossPlatformInputManager.AxisExists(powerDPad.GetHorizontalAxisName())) { horizontalAxis = CrossPlatformInputManager.VirtualAxisReference(powerDPad.GetHorizontalAxisName()); } } if (powerDPad.useAxis == PowerDPad.UseAxis.Both || powerDPad.useAxis == PowerDPad.UseAxis.Vertical) { if (powerDPad.GetVerticalAxisName() != "" && !CrossPlatformInputManager.AxisExists(powerDPad.GetVerticalAxisName())) { verticalAxis = new CrossPlatformInputManager.VirtualAxis(powerDPad.GetVerticalAxisName()); CrossPlatformInputManager.RegisterVirtualAxis(verticalAxis); } // Unregister doesn't work correctly / Get axis reference (necessary if d-pad gets disbled and enabled again) if (powerDPad.GetVerticalAxisName() != "" && CrossPlatformInputManager.AxisExists(powerDPad.GetVerticalAxisName())) { verticalAxis = CrossPlatformInputManager.VirtualAxisReference(powerDPad.GetVerticalAxisName()); } } } // Register button if (powerType == PowerType.Button) { if (powerButton.GetButtonName() != null) { if (!CrossPlatformInputManager.ButtonExists(powerButton.GetButtonName())) { button = new CrossPlatformInputManager.VirtualButton(powerButton.GetButtonName()); CrossPlatformInputManager.RegisterVirtualButton(button); } } } // Register button axis if (powerType == PowerType.Button) { if (powerButton.GetButtonToAxis() && powerButton.GetAxisName() != "") { buttonAxisName = powerButton.GetAxisName(); if (!CrossPlatformInputManager.AxisExists(buttonAxisName)) { buttonAxis = new CrossPlatformInputManager.VirtualAxis(buttonAxisName); CrossPlatformInputManager.RegisterVirtualAxis(buttonAxis); } // Unregister doesn't work correctly / Get axis reference (necessary if button gets disbled and enabled again) if (powerButton.GetAxisName() != "" && CrossPlatformInputManager.AxisExists(powerButton.GetAxisName())) { buttonAxis = CrossPlatformInputManager.VirtualAxisReference(powerButton.GetAxisName()); } } } }
private void Awake() { CrossPlatformInputManager.VirtualAxis axis = new CrossPlatformInputManager.VirtualAxis(crossplatformInputAxisName, true); CrossPlatformInputManager.RegisterVirtualAxis(axis); }
// Token: 0x06000AB0 RID: 2736 RVA: 0x0003F8EE File Offset: 0x0003DCEE private void AddAxes(string name) { CrossPlatformInputManager.RegisterVirtualAxis(new CrossPlatformInputManager.VirtualAxis(name)); }