void Awake()
 {
     OuyaSDK.registerJoystickCalibrationListener(this);
     OuyaSDK.registerMenuButtonUpListener(this);
     OuyaSDK.registerMenuAppearingListener(this);
     OuyaSDK.registerPauseListener(this);
     OuyaSDK.registerResumeListener(this);
 }
Esempio n. 2
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();
        }
    }