Exemplo n.º 1
0
        public override void OnSuccess(string pchCurrencyName)
        {
            Action action = () => { myApiResultText.text = string.Format("The Currency is: {0}", pchCurrencyName); };

            // Main thread dispatcher will let the action be called from main thread.
            MainThreadDispatcher.Instance().Enqueue(action);
        }
 public override void OnFailure(int errorCode, string errorMessage)
 {
     // the response of Api.GetLicense() is DRM fail, user is not allowed to use the content
     Debug.LogError("Viveport DRM fail:" + errorCode + " Message :" + errorMessage);
     curErrorCode    = errorCode;
     curErrorMessage = errorMessage;
     MainThreadDispatcher.Instance().Enqueue(FailAction());
 }
 public override void OnSuccess(string pchCurrencyName)
 {
     _iapIsReady = true;
     MainThreadDispatcher.Instance().Enqueue(() => {
         Debug.Log("IAP IsReady Success");
         onIAPIsReadySuccess_s.Invoke(pchCurrencyName);
     });
 }
Exemplo n.º 4
0
            public override void OnScanResult(int callbackType, /* ScanResult */ AndroidJavaObject result)
            {
                Device device = new Device(result.Call <AndroidJavaObject>("getDevice"));

                MainThreadDispatcher.Instance().Enqueue(() => {
                    m_source.OnDeviceDetected(device);
                });
            }
Exemplo n.º 5
0
            public override void OnLeScan(AndroidJavaObject androidDevice, int rssi)
            {
                Device device = new Device(androidDevice);

                MainThreadDispatcher.Instance().Enqueue(() =>
                {
                    m_source.OnDeviceDetected(device);
                });
            }
Exemplo n.º 6
0
        // Token: 0x060028FC RID: 10492 RVA: 0x000C591C File Offset: 0x000C3B1C
        public override void OnSuccess(string pchCurrencyName)
        {
            Action action = delegate()
            {
                ViveportDemo_MainThreadDispatcher.myApiResultText.text = string.Format("The Currency is: {0}", pchCurrencyName);
            };

            MainThreadDispatcher.Instance().Enqueue(action);
        }
Exemplo n.º 7
0
            public override void OnCharacteristicChanged(/* BluetoothGatt */ AndroidJavaObject gatt,
                                                         /* BluetoothGattCharacteristic */ AndroidJavaObject androidCharacteristic)
            {
                Uuid serviceID = Uuid.FromJavaObject(androidCharacteristic.Call <AndroidJavaObject>("getService").Call <AndroidJavaObject>("getUuid"));
                GattCharacteristic characteristic = m_source.FindService(serviceID).FindCharacteristic(Uuid.FromJavaObject(androidCharacteristic.Call <AndroidJavaObject>("getUuid")));

                MainThreadDispatcher.Instance().Enqueue(() => {
                    characteristic.TriggerOnValueChanged();
                });
            }
    private void IsReadyHandler(int code)
    {
        if (code != SUCCESS)
        {
            MainThreadDispatcher.Instance().Enqueue(FailAction());
            return;
            // Handle error
        }

        MainThreadDispatcher.Instance().Enqueue(SuccessAction());
        // Do more things
    }
Exemplo n.º 9
0
 private void IsReadyHandler(int code, string message)
 {
     if (code == SUCCESS)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.Log("Subscription IsReady success ");
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.LogError("Subscription IsReady failure ");
         });
     }
 }
Exemplo n.º 10
0
 private void DownloadStatsHandler(int code)
 {
     if (code == 0)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onDownloadStatsComplete.Invoke(code, null);
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onDownloadStatsComplete.Invoke(code, "DownloadStats failure.");
         });
     }
 }
 private void GetSessionTokenHandler(int code, string message)
 {
     if (code == SUCCESS)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onSessionTokenComplete.Invoke(code, message);
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onSessionTokenComplete.Invoke(code, message);
         });
     }
 }
Exemplo n.º 12
0
 private void UploadLeaderboardHandler(int code)
 {
     if (code == SUCCESS)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onUploadLeaderboardComplete.Invoke(code, null);
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onUploadLeaderboardComplete.Invoke(code, "UploadLeaderboard failure.");
         });
     }
 }
Exemplo n.º 13
0
 private static void GoToAppOrGoToStoreHandler(int errorCode, string message)
 {
     if (errorCode == 0)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.Log("GoToAppOrGoToStore is successful");
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.Log("GoToAppOrGoToStore errorCode : " + errorCode + " ErrorMessage : " + message);
         });
     }
 }
Exemplo n.º 14
0
 private void GoToAppHandler(int code, string message)
 {
     if (code == SUCCESS)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onDeeplinkComplete.Invoke(code, message);
         });
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             onDeeplinkComplete.Invoke(code, message);
         });
     }
 }
 public override void OnSuccess(long issueTime, long expirationTime, int latestVersion, bool updateRequired)
 {
     // the response of Api.GetLicense() is DRM success, user is allowed to use the content and continue with content flow
     Debug.Log("Viveport DRM pass");
     Debug.Log("issueTime: " + issueTime);
     Debug.Log("expirationTime: " + expirationTime);
     curInfo = new DRMInfo()
     {
         IssueTime      = issueTime,
         ExpirationTime = expirationTime,
         LatestVersion  = latestVersion,
         UpdateRequired = updateRequired
     };
     MainThreadDispatcher.Instance().Enqueue(SuccessAction());
 }
 private void IsReadyHandler(int code)
 {
     if (code == SUCCESS)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.Log("DLC IsDlcReady success ");
         });
         UpdateDLCList();
     }
     else
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             Debug.LogError("DLC IsDlcReady failure ");
         });
     }
 }
Exemplo n.º 17
0
 public override void OnConnectionStateChange(/* BluetoothGatt */ AndroidJavaObject gatt,
                                              int status,
                                              int newState)
 {
     if (newState == 2)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             m_source.OnConnected(m_source);
         });
     }
     else if (newState == 0)
     {
         MainThreadDispatcher.Instance().Enqueue(() => {
             m_source.OnDisconnected(m_source);
         });
     }
 }
Exemplo n.º 18
0
    //-- FILE SEARCH

    public void SearchFiles(string s)
    {
        Searching = s.Length > 0;

        if (!Searching)
        {
            // Search done
            Invoke("HideProgress", 0.01f);
            SourceFolder.Initialize();
        }
        else
        {
            // Reset results
            sDirs  = new List <String> ();
            sFiles = new List <String> ();

            // Dispose current thread
            if (thread != null && thread.IsBusy)
            {
                thread.Abort();
                // thread.Dispose ();
            }

            // Initalize thread
            thread = new BackgroundThread();
            thread.WorkerSupportsCancellation = true;
            thread.DoWork += delegate {
                // Destroy elements
                MainThreadDispatcher.Instance().Enqueue(SourceFolder.DestroyAll);

                // Get search results
                GetResults(s);

                // Display search results
                MainThreadDispatcher.Instance().Enqueue(delegate {
                    SourceFolder.Display(sDirs, sFiles, true);
                });

                // Hide progress
                MainThreadDispatcher.Instance().Enqueue(HideProgress);
            };

            // Run thread
            thread.RunWorkerAsync();
        }
    }
Exemplo n.º 19
0
 // Token: 0x06000E4C RID: 3660 RVA: 0x0005C000 File Offset: 0x0005A200
 private static void GoToAppOrGoToStoreHandler(int errorCode, string message)
 {
     if (errorCode == 0)
     {
         MainThreadDispatcher.Instance().Enqueue(delegate()
         {
             Debug.Log("GoToAppOrGoToStore is successful");
         });
         return;
     }
     MainThreadDispatcher.Instance().Enqueue(delegate()
     {
         Debug.Log(string.Concat(new object[]
         {
             "GoToAppOrGoToStore errorCode : ",
             errorCode,
             " ErrorMessage : ",
             message
         }));
     });
 }
Exemplo n.º 20
0
    private void ListenForData()
    {
        try
        {
            socketConnection = new TcpClient();
            IPEndPoint ip = new IPEndPoint(IPAddress.Parse(serverIP), serverPort);
            socketConnection.Connect(ip);

            while (socketConnection.Connected)
            {
                using (NetworkStream stream = socketConnection.GetStream())
                {
                    int length;
                    while ((length = stream.Read(buffer, 0, buffer.Length)) != 0)
                    {
                        Byte[] incomingData = new Byte[length];
                        Array.Copy(buffer, 0, incomingData, 0, length);
                        Byte[]   decodingData = GameProtocol.Encoder.Decode(incomingData);
                        Protocol protocol     = ProtocolHelper.ConvertBytesToProtocol(decodingData);
                        if (protocol != null)
                        {
                            Debug.Log("收到协议类型" + protocol.GetType().ToString());
                            MainThreadDispatcher.Instance().Enqueue(InvokeCallbackInMainThread(protocol));
                        }
                        else
                        {
                            Debug.Log("收到协议反序列化失败");
                        }
                    }
                }
            }
        }
        catch (SocketException socketException)
        {
            Debug.Log("套接字异常:" + socketException.ToString());
        }
    }
 public override void OnBalanceSuccess(string pchBalance)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPBalanceSuccess_s.Invoke(pchBalance);
     });
 }
 public override void OnFailure(int nCode, string pchMessage)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPFailure_s.Invoke(nCode, pchMessage);
     });
 }
Exemplo n.º 23
0
 // Token: 0x060028FE RID: 10494 RVA: 0x000C594C File Offset: 0x000C3B4C
 public override void OnSuccess(string pchCurrencyName)
 {
     MainThreadDispatcher.Instance().Enqueue(this.ShowResult(pchCurrencyName));
 }
Exemplo n.º 24
0
 public override void OnFailure(int errorCode, string errorMessage)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         Debug.Log("GoToAppOrGoToStore errorCode : " + errorCode + " ErrorMessage : " + errorMessage);
     });
 }
 public override void OnSubscribeSuccess(string pchSubscriptionId)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPSubscribeSuccess_s.Invoke(pchSubscriptionId);
     });
 }
 public override void OnQuerySubscriptionListSuccess(IAPurchase.Subscription[] subscriptionlist)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPQuerySubscriptionSuccess_s.Invoke(subscriptionlist);
     });
 }
 public override void OnQuerySuccess(IAPurchase.QueryListResponse response)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPQueryListSuccess_s.Invoke(response.purchaseList);
     });
 }
 public override void OnRequestSubscriptionWithPlanIDSuccess(string pchSubscriptionId)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPRequestSubscriptionSuccess_s.Invoke(pchSubscriptionId);
     });
 }
Exemplo n.º 29
0
 public override void OnSuccess()
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         Debug.Log("GoToAppOrGoToStore is successful");
     });
 }
 public override void OnCancelSubscriptionSuccess(bool bCanceled)
 {
     MainThreadDispatcher.Instance().Enqueue(() => {
         onIAPCancelSubscriptionSuccess_s.Invoke(bCanceled);
     });
 }