예제 #1
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
    }
예제 #2
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);
        }
    }
예제 #3
0
 public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton newVirtualButton)
 {
     if (ButtonExists(newVirtualButton.Name))
     {
         throw new Exception("There is already a virtual button named " + newVirtualButton.Name + " registered.");
     }
     virtualButtons.Add(newVirtualButton.Name, newVirtualButton);
 }
 void Start()
 {
     if (CrossPlatformInputManager.ButtonExists(Name))
     {
         CrossPlatformInputManager.UnRegisterVirtualButton(Name);
     }
     myBt = new CrossPlatformInputManager.VirtualButton(Name);
     CrossPlatformInputManager.RegisterVirtualButton(myBt);
 }
예제 #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();
    }
예제 #6
0
 public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton virtualButton)
 {
     if (virtualButtons.ContainsKey(virtualButton.Name))
     {
         throw new Exception("There's already such axis registered");
     }
     else
     {
         virtualButtons.Add(virtualButton.Name, virtualButton);
     }
 }
 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);
 }
예제 #8
0
 public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
 {
     if (virtualButtons.ContainsKey(button.Name))
     {
         Debug.LogError("There is already a virtual axis named " + button.Name + " registered.");
     }
     else
     {
         virtualButtons.Add(button.Name, button);
     }
 }
예제 #9
0
 public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
 {
     if (virtualButtons.ContainsKey(button.Name))
     {
         throw new Exception("There is already a virtual button named " + button.Name + " registered.");
     }
     else
     {
         virtualButtons.Add(button.Name, button);
     }
 }
예제 #10
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);
     }
 }
예제 #11
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);
     }
 }
예제 #12
0
    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);
    }
예제 #13
0
    public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
    {
        // check if already have a buttin with that name and log an error if we do
        if (m_VirtualButtons.ContainsKey(button.name))
        {
            Debug.LogError("There is already a virtual button named " + button.name + " registered.");
        }
        else
        {
            // add any new buttons
            m_VirtualButtons.Add(button.name, button);

            // if we dont want to match to the input manager then always use a virtual axis
            if (!button.matchWithInputManager)
            {
                m_AlwaysUseVirtual.Add(button.name);
            }
        }
    }
예제 #14
0
    void Start()
    {
        result = EmptyResult;
        myBt   = new CrossPlatformInputManager.VirtualButton("TouchPanel");
        List <PDollarGestureRecognizer.Gesture> trainingSetList = new List <PDollarGestureRecognizer.Gesture>();

        //Load pre-made gestures
        TextAsset[] gesturesXml = Resources.LoadAll <TextAsset>("GestureSet/10-stylus-MEDIUM/");
        foreach (TextAsset gestureXml in gesturesXml)
        {
            trainingSetList.Add(GestureIO.ReadGestureFromXML(gestureXml.text));
        }

        //Load user custom gestures
        string[] filePaths = Directory.GetFiles(Application.persistentDataPath, "*.xml");
        foreach (string filePath in filePaths)
        {
            trainingSetList.Add(GestureIO.ReadGestureFromFile(filePath));
        }
        trainingSet = trainingSetList.ToArray();
    }
예제 #15
0
 private void CreateVirtualInput()
 {
     fire = new CrossPlatformInputManager.VirtualButton(Statics.FIRE_BUTTON);
     CrossPlatformInputManager.RegisterVirtualButton(fire);
 }
 public override void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
 {
     throw NotPossible();
 }
예제 #17
0
 private void OnEnable()
 {
     button = new CrossPlatformInputManager.VirtualButton(buttonName);
     CrossPlatformInputManager.RegisterVirtualButton(button);
 }
예제 #18
0
        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());
                    }
                }
            }
        }
예제 #19
0
 private void Awake()
 {
     button  = GetComponent <ButtonHandler>();
     vbutton = new CrossPlatformInputManager.VirtualButton(arrowKeyName);
     CrossPlatformInputManager.RegisterVirtualButton(vbutton);
 }
예제 #20
0
 private void CreateVirtualButton()
 {
     fireButton = new CrossPlatformInputManager.VirtualButton("Fire1");
     CrossPlatformInputManager.RegisterVirtualButton(fireButton);
 }
예제 #21
0
 //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);
 }
예제 #22
0
 public override void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
 {
     _configureVirtualInput.RegisterVirtualButton(button);
 }
 private void Awake()
 {
     CrossPlatformInputManager.VirtualButton button = new CrossPlatformInputManager.VirtualButton(crossplatformInputButtonName, true);
     CrossPlatformInputManager.RegisterVirtualButton(button);
 }
예제 #24
0
 private void CreateVirtualButton()
 {
     crouchButton = new CrossPlatformInputManager.VirtualButton("Crouch");
     CrossPlatformInputManager.RegisterVirtualButton(crouchButton);
 }
예제 #25
0
 private void CreateVirtualButton()
 {
     jumpButton = new CrossPlatformInputManager.VirtualButton("Jump");
     CrossPlatformInputManager.RegisterVirtualButton(jumpButton);
 }