Beispiel #1
0
    private void CreateVirtualAxes()
    {
        _useX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal);
        _useY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical);

        if (_useX)
        {
            _horizontalVirtualAxis =
                new CrossPlatformInputManager.VirtualAxis(horizontalAxisName);
            CrossPlatformInputManager.RegisterVirtualAxis(_horizontalVirtualAxis);
        }

        if (_useY)
        {
            _verticalVirtualAxis =
                new CrossPlatformInputManager.VirtualAxis(verticalAxisName);
            CrossPlatformInputManager.RegisterVirtualAxis(_verticalVirtualAxis);
        }

        if (canFire)
        {
            _virtualButton = new CrossPlatformInputManager.VirtualButton(fireButtonName);
            CrossPlatformInputManager.RegisterVirtualButton(_virtualButton);
        }
    }
        private void AddButton(string name)

        {
            // we have not registered this button yet so add it, happens in the constructor

            CrossPlatformInputManager.RegisterVirtualButton(new CrossPlatformInputManager.VirtualButton(name));
        }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        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]);
            NMATK[i]    = new CrossPlatformInputManager.VirtualButton(nmatk_n + i); CrossPlatformInputManager.RegisterVirtualButton(NMATK[i]);
            FR1[i]      = new CrossPlatformInputManager.VirtualButton(fr1_n + i); CrossPlatformInputManager.RegisterVirtualButton(FR1[i]);
            FR2[i]      = new CrossPlatformInputManager.VirtualButton(fr2_n + i); CrossPlatformInputManager.RegisterVirtualButton(FR2[i]);
            FR3[i]      = new CrossPlatformInputManager.VirtualButton(fr3_n + i); CrossPlatformInputManager.RegisterVirtualButton(FR3[i]);
            SK1[i]      = new CrossPlatformInputManager.VirtualButton(sk1_n + i); CrossPlatformInputManager.RegisterVirtualButton(SK1[i]);
            SK2[i]      = new CrossPlatformInputManager.VirtualButton(sk2_n + i); CrossPlatformInputManager.RegisterVirtualButton(SK2[i]);
            SK3[i]      = new CrossPlatformInputManager.VirtualButton(sk3_n + i); CrossPlatformInputManager.RegisterVirtualButton(SK3[i]);
            TRAIL[i]    = new CrossPlatformInputManager.VirtualButton(trail_n + i); CrossPlatformInputManager.RegisterVirtualButton(TRAIL[i]);
        }

        NetworkServer.Listen(25000);
        NetworkServer.RegisterHandler(578, ServerReceiveMessageJoystick);   //JST - Joystick
        NetworkServer.RegisterHandler(286, ServerReceiveMessageButton);     //BTN - Button
        NetworkServer.RegisterHandler(796, ServerReceiveMessagePlayerName); //PYN - Player Name
        NetworkServer.RegisterHandler(737, ServerReceiveMessageRespond);    //REP - Respond
        NetworkServer.RegisterHandler(834, ServerReceiveUpdateHealth);      //UDH - Update Health
        NetworkServer.RegisterHandler(773, ServerReceiveResurrection);      //SRE - Server REsurrection
    }
 void Start()
 {
     if (CrossPlatformInputManager.ButtonExists(Name))
     {
         CrossPlatformInputManager.UnRegisterVirtualButton(Name);
     }
     myBt = new CrossPlatformInputManager.VirtualButton(Name);
     CrossPlatformInputManager.RegisterVirtualButton(myBt);
 }
Beispiel #5
0
    //If this rig is enabled we will register the two virtual buttons with the CrossPlatformInputManager. The button state will be driven from this script.
    private void OnEnable()
    {
        leftButton = new CrossPlatformInputManager.VirtualButton("Left");
        CrossPlatformInputManager.RegisterVirtualButton(leftButton);

        rightButton = new CrossPlatformInputManager.VirtualButton("Right");
        CrossPlatformInputManager.RegisterVirtualButton(rightButton);

        SetupInputAreas();
    }
 private void Start()
 {
     m_WButton = new CrossPlatformInputManager.VirtualButton("W");
     CrossPlatformInputManager.RegisterVirtualButton(m_WButton);
     m_SButton = new CrossPlatformInputManager.VirtualButton("S");
     CrossPlatformInputManager.RegisterVirtualButton(m_SButton);
     m_AButton = new CrossPlatformInputManager.VirtualButton("A");
     CrossPlatformInputManager.RegisterVirtualButton(m_AButton);
     m_DButton = new CrossPlatformInputManager.VirtualButton("D");
     CrossPlatformInputManager.RegisterVirtualButton(m_DButton);
 }
Beispiel #7
0
 void CreateVirtualButton()
 {
     if (m_ButtonName != "")
     {
         if (CrossPlatformInputManager.ButtonExists(m_ButtonName))
         {
             CrossPlatformInputManager.UnRegisterVirtualButton(m_ButtonName);
         }
         m_VirtualButton = new CrossPlatformInputManager.VirtualButton(m_ButtonName);
         CrossPlatformInputManager.RegisterVirtualButton(m_VirtualButton);
     }
 }
Beispiel #8
0
 private void ResetButton(ref CrossPlatformInputManager.VirtualButton button, string buttonName)
 {
     if (!CrossPlatformInputManager.ButtonExists(buttonName))
     {
         button = new CrossPlatformInputManager.VirtualButton(buttonName);
         CrossPlatformInputManager.RegisterVirtualButton(button);
     }
     else
     {
         button = CrossPlatformInputManager.VirtualButtonReference(buttonName);
     }
 }
    private void Awake()
    {
        if (!CrossPlatformInputManager.ButtonExists(Name))
        {
            vbutton = new CrossPlatformInputManager.VirtualButton(Name);
            CrossPlatformInputManager.RegisterVirtualButton(vbutton);
            print("registered");
        }
        if (CrossPlatformInputManager.ButtonExists(Name))
        {
            print("verfied registration");
        }

        //  gameObject.SetActive(false);
    }
Beispiel #10
0
 // Token: 0x06000AAF RID: 2735 RVA: 0x0003F8E1 File Offset: 0x0003DCE1
 private void AddButton(string name)
 {
     CrossPlatformInputManager.RegisterVirtualButton(new CrossPlatformInputManager.VirtualButton(name));
 }
Beispiel #11
0
 private void CreateVirtualInput()
 {
     fire = new CrossPlatformInputManager.VirtualButton(Statics.FIRE_BUTTON);
     CrossPlatformInputManager.RegisterVirtualButton(fire);
 }
Beispiel #12
0
 private void OnEnable()
 {
     button = new CrossPlatformInputManager.VirtualButton(buttonName);
     CrossPlatformInputManager.RegisterVirtualButton(button);
 }
Beispiel #13
0
 private void Awake()
 {
     button  = GetComponent <ButtonHandler>();
     vbutton = new CrossPlatformInputManager.VirtualButton(arrowKeyName);
     CrossPlatformInputManager.RegisterVirtualButton(vbutton);
 }
 private void CreateVirtualButton()
 {
     crouchButton = new CrossPlatformInputManager.VirtualButton("Crouch");
     CrossPlatformInputManager.RegisterVirtualButton(crouchButton);
 }
 //If this rig is enabled we will register the virtual shake button with the CrossPlatformInputManager. The button state will be driven from this script.
 private void OnEnable()
 {
     shakeButton = new CrossPlatformInputManager.VirtualButton("Shake");
     CrossPlatformInputManager.RegisterVirtualButton(shakeButton);
 }
Beispiel #16
0
 private void CreateVirtualButton()
 {
     fireButton = new CrossPlatformInputManager.VirtualButton("Fire1");
     CrossPlatformInputManager.RegisterVirtualButton(fireButton);
 }
        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());
                    }
                }
            }
        }
Beispiel #18
0
 private void CreateVirtualButton()
 {
     jumpButton = new CrossPlatformInputManager.VirtualButton("Jump");
     CrossPlatformInputManager.RegisterVirtualButton(jumpButton);
 }
 private void Awake()
 {
     CrossPlatformInputManager.VirtualButton button = new CrossPlatformInputManager.VirtualButton(crossplatformInputButtonName, true);
     CrossPlatformInputManager.RegisterVirtualButton(button);
 }