// Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Mouse0))
     {
         //On left-mouse click set random value on applet's progress bar
         System.Random random = new System.Random();
         int           val    = random.Next(0, 100);
         LogitechGSDK.LogiArxSetTagPropertyById("progressbarProgress", "style.width", "" + val + "%");
     }
     ///Switch index file on right-mouse down and up
     if (Input.GetKey(KeyCode.I))
     {
         LogitechGSDK.LogiArxSetIndex("applet.html");
     }
     if (Input.GetKey(KeyCode.G))
     {
         LogitechGSDK.LogiArxSetIndex("gameover.html");
     }
 }
Exemplo n.º 2
0
    void ArxSDKCallback(int eventType, int eventValue, String eventArg, IntPtr context)
    {
        Marshal.WriteInt32(context, 1);
        Debug.Log("CALLBACK: type:" + eventType + ", value:" + eventValue + ", arg:" + eventArg);
        if (eventType == LogitechGSDK.LOGI_ARX_EVENT_MOBILEDEVICE_ARRIVAL)
        {
            if (!LogitechGSDK.LogiArxAddFileAs("Assets//Logitech SDK//AppletData//applet.html", "applet.html", ""))
            {
                Debug.Log("Could not send applet.html : " + LogitechGSDK.LogiArxGetLastError());
            }
            if (!LogitechGSDK.LogiArxAddFileAs("Assets//Logitech SDK//AppletData//background.png", "background.png", ""))
            {
                Debug.Log("Could not send background.png : " + LogitechGSDK.LogiArxGetLastError());
            }
            if (!LogitechGSDK.LogiArxAddUTF8StringAs(getHtmlString(), "gameover.html"))
            {
                Debug.Log("Could not send gameover.html  : " + LogitechGSDK.LogiArxGetLastError());
            }

            byte[] gameoverImageBytes = File.ReadAllBytes("Assets//Logitech SDK//AppletData//gameover.png");
            if (!LogitechGSDK.LogiArxAddContentAs(gameoverImageBytes, gameoverImageBytes.Length, "gameover.png"))
            {
                Debug.Log("Could not send gameover.png  : " + LogitechGSDK.LogiArxGetLastError());
            }

            if (!LogitechGSDK.LogiArxSetIndex("applet.html"))
            {
                Debug.Log("Could not set index : " + LogitechGSDK.LogiArxGetLastError());
            }
        }
        else if (eventType == LogitechGSDK.LOGI_ARX_EVENT_MOBILEDEVICE_REMOVAL)
        {
            Debug.Log("NO DEVICES");
        }
        else if (eventType == LogitechGSDK.LOGI_ARX_EVENT_TAP_ON_TAG)
        {
            Debug.Log("Tap on tag with id :" + eventArg);
            pc.attackingF();
        }
    }