Esempio n. 1
0
 void Awake()
 {
     OuyaSDK.registerMenuButtonUpListener(this);
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
 }
 void Awake()
 {
     OuyaSDK.registerJoystickCalibrationListener(this);
     OuyaSDK.registerMenuButtonUpListener(this);
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
 }
Esempio n. 3
0
    void Awake()
    {
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);

        //Register method listener to handle button events.
        OuyaInputManager.OuyaButtonEvent.addButtonEventListener(HandleButtonEvent);
    }
Esempio n. 4
0
 void Awake()
 {
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
     OuyaSDK.registerGetProductsListener(this);
     OuyaSDK.registerPurchaseListener(this);
     OuyaSDK.registerGetReceiptsListener(this);
 }
Esempio n. 5
0
 void Awake()
 {
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
     OuyaSDK.registerRequestGamerInfoListener(this);
     OuyaSDK.registerRequestProductsListener(this);
     OuyaSDK.registerRequestPurchaseListener(this);
     OuyaSDK.registerRequestReceiptsListener(this);
 }
 void Awake()
 {
     OuyaSDK.registerMenuButtonUpListener(this);
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
     OuyaSDK.registerFetchGamerUUIDListener(this);
     OuyaSDK.registerGetProductsListener(this);
     OuyaSDK.registerPurchaseListener(this);
     OuyaSDK.registerGetReceiptsListener(this);
 }
 void Awake()
 {
     OuyaSDK.registerMenuButtonUpListener(this);
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
     OuyaSDK.registerGetProductsListener(this);
     OuyaSDK.registerPurchaseListener(this);
     OuyaSDK.registerGetReceiptsListener(this);
     loader = this.GetComponent <loadingScript>();
 }
Esempio n. 8
0
    void Awake()
    {
        OuyaSDK.registerMenuButtonUpListener(this);
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);
        Input.ResetInputAxes();

        //import old player prefs
        toggles[0]  = PlayerPrefs.GetInt("music", 1);
        toggles[1]  = PlayerPrefs.GetInt("hellmode", 0);
        toggles [2] = PlayerPrefs.GetInt("doublepipesets", 1);          //default double pipes to on
    }
Esempio n. 9
0
    void Awake()
    {
        OuyaSDK.registerJoystickCalibrationListener(this);
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);

        m_backgroundBlack = new Texture2D(1, 1);
        m_backgroundBlack.SetPixel(0, 0, Color.black);
        m_backgroundBlack.Apply();

        m_guiSkin = ScriptableObject.CreateInstance <GUISkin>();
        m_guiSkin.label.normal.textColor  = Color.white;
        m_guiSkin.label.normal.background = m_backgroundBlack;

        int[] buttons =
        {
            OuyaController.BUTTON_O,
            OuyaController.BUTTON_U,
            OuyaController.BUTTON_Y,
            OuyaController.BUTTON_A,
            OuyaController.BUTTON_L1,
            OuyaController.BUTTON_L3,
            OuyaController.BUTTON_R1,
            OuyaController.BUTTON_R3,
            OuyaController.BUTTON_DPAD_DOWN,
            OuyaController.BUTTON_DPAD_LEFT,
            OuyaController.BUTTON_DPAD_RIGHT,
            OuyaController.BUTTON_DPAD_UP,
            OuyaController.BUTTON_MENU,
        };

        StringBuilder sb = new StringBuilder();

        foreach (int button in buttons)
        {
            Setup(button);

            string label;
            SetLabel(out label, button);

            if (!string.IsNullOrEmpty(label))
            {
                sb.Append(label);
                sb.Append(" ");
            }
            m_label = "Hello from Unity: " + sb.ToString();
        }
    }
    private void Awake()
    {
        m_activity = new OuyaUnityActivity(UnityPlayer.currentActivity);

#if PERFORMANCE_TEST_MEASURE_LATENCY
        ThreadStart ts     = new ThreadStart(TestWorker);
        Thread      thread = new Thread(ts);
        thread.Start();
#endif

        OuyaSDK.registerJoystickCalibrationListener(this);
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);

        m_backgroundBlack = new Texture2D(1, 1);
        m_backgroundBlack.SetPixel(0, 0, Color.black);
        m_backgroundBlack.Apply();

        m_guiSkin = ScriptableObject.CreateInstance <GUISkin>();
        m_guiSkin.label.normal.textColor  = Color.white;
        m_guiSkin.label.normal.background = m_backgroundBlack;

        StringBuilder sb = new StringBuilder();
        foreach (int button in Buttons)
        {
            Setup(button);

            string label;
            SetLabel(out label, button);

            if (!string.IsNullOrEmpty(label))
            {
                sb.Append(label);
                sb.Append(" ");
            }
            m_label = "Hello from Unity: " + sb.ToString();
        }
    }
Esempio n. 11
0
    void Awake()
    {
        OuyaSDK.registerMenuButtonUpListener(this);
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);

        OuyaInputManager.OuyaButtonEvent.addButtonEventListener(HandleButtonEvent);

        //Get our character controller;
        controller = GetComponent <CharacterController>();

#if UNITY_EDITOR
        //If you find that your controller does not work properly in the Unity Editor, You can add a custom controller mapping as seen below.

        /* Here is some code to find keycodes for devices that are mapped to your InputManager.asset
         * List<OuyaGameObject.Device> devices = OuyaInputManager.GetDevices();
         * for (int iPlayerJoystick = 1; iPlayerJoystick <= devices.Count; iPlayerJoystick++)
         * {
         *  OuyaGameObject.Device device = devices.Find(delegate(OuyaGameObject.Device d) { return (null == d || null == devices) ? false : (d.id == devices[iPlayerJoystick - 1].id); });
         *  for (int i = 0; i < 13; i++)
         *  {
         *      //Controller Name:
         *      string fireBtnName = string.Format("Joystick{0}Button{1}", iPlayerJoystick, i);
         *      KeyCode keycode = (KeyCode)System.Enum.Parse(typeof(KeyCode), fireBtnName);
         *      Debug.Log(string.Format("Button Name:{0}, Keycode:{1}",keycode,int(keycode));
         *  }
         * }
         */

        //Custom Controller Mapping.
        List <ButtonMap> buttonMap = new List <ButtonMap>();
        ControllerType   xbox360   = new ControllerType();
        xbox360.name         = "xbox360";
        xbox360.leftAnalogH  = 1;
        xbox360.leftAnalogV  = 2;
        xbox360.rightAnalogH = 4;
        xbox360.rightAnalogV = 5;
        xbox360.triggers     = 3;
        xbox360.dpadH        = 6;
        xbox360.dpadV        = 7;
        JoystickType joystickType = JoystickType.xbox;

        //Start XBOX 360 ButtonMap ( only has 13 buttons )
        buttonMap.Add(new ButtonMap(joystickType, 370, OuyaSDK.KeyEnum.BUTTON_O));
        buttonMap.Add(new ButtonMap(joystickType, 371, OuyaSDK.KeyEnum.BUTTON_A));
        buttonMap.Add(new ButtonMap(joystickType, 372, OuyaSDK.KeyEnum.BUTTON_U));
        buttonMap.Add(new ButtonMap(joystickType, 373, OuyaSDK.KeyEnum.BUTTON_Y));

        buttonMap.Add(new ButtonMap(joystickType, 374, OuyaSDK.KeyEnum.BUTTON_LB));
        buttonMap.Add(new ButtonMap(joystickType, 375, OuyaSDK.KeyEnum.BUTTON_RB));
        buttonMap.Add(new ButtonMap(joystickType, 376, OuyaSDK.KeyEnum.BUTTON_SELECT));
        buttonMap.Add(new ButtonMap(joystickType, 377, OuyaSDK.KeyEnum.BUTTON_START));
        buttonMap.Add(new ButtonMap(joystickType, 378, OuyaSDK.KeyEnum.BUTTON_L3));
        buttonMap.Add(new ButtonMap(joystickType, 379, OuyaSDK.KeyEnum.BUTTON_R3));
        buttonMap.Add(new ButtonMap(joystickType, 380, OuyaSDK.KeyEnum.BUTTON_LT));     //Doesn't Show up
        buttonMap.Add(new ButtonMap(joystickType, 381, OuyaSDK.KeyEnum.BUTTON_RT));     //Doesn't Show up
        buttonMap.Add(new ButtonMap(joystickType, 382, OuyaSDK.KeyEnum.BUTTON_SYSTEM)); //Dowsn't Show up

        /*
         * //4 button dpad mappings
         * buttonMap.Add(new ButtonMap(joystickType, 13, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT));
         * buttonMap.Add(new ButtonMap(joystickType, 14, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT));
         * buttonMap.Add(new ButtonMap(joystickType, 15, OuyaSDK.KeyEnum.BUTTON_DPAD_UP));
         * buttonMap.Add(new ButtonMap(joystickType, 16, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN));
         */

        //controllers.Add(xbox360.name,xbox360)
        //OuyaControllerMapping.RegisterCustomControllerMapping(xbox360, buttonMap); //duplicate of existing
#endif
    }