Example #1
0
    public void ClickStart()
    {
        if (BarcodeScanner == null)
        {
            Log.Warning("No valid camera - Click Start");
            return;
        }

        // Start Scanning
        BarcodeScanner.Scan((barCodeType, barCodeValue) => {
            BarcodeScanner.Stop();
            TextHeader.text = "Found: " + barCodeType + " / " + barCodeValue;

            Debug.Log("Now scanning...");
            Boot.scanAmount = Boot.scanAmount + 1;
            caller.CallAPI();

            Data.scans++;
            Data.experience    = Data.experience + UnityEngine.Random.Range(3, 8);
            Data.currentScanID = barCodeValue;
            Debug.Log("Now loading product page with ID..." + Data.currentScanID);
            SceneManager.LoadScene("ProductPage");
            // Feedback
            Audio.Play();


                        #if UNITY_ANDROID || UNITY_IOS
            Handheld.Vibrate();
                        #endif
        });
    }
        public static void JoinChannel(string channelId)
        {
            APICaller AC      = new APICaller();
            var       content = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("token", AuthToken),
                new KeyValuePair <string, string>("name", channelId)
            });

            AC.CallAPI(content, "https://slack.com/api/channels.join");
        }
        private static string GetWSConnectionString()
        {
            string ConnectionString = null;
            var    content          = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("token", AuthToken),
                new KeyValuePair <string, string>("simple_latest", ""),
                new KeyValuePair <string, string>("no_unreads", "")
            });
            APICaller AC = new APICaller();

            ConnectionString = AC.CallAPI(content, "https://slack.com/api/rtm.start")["url"].ToString();
            return(ConnectionString);
        }
Example #4
0
 /// <summary>
 /// clears the list and fetches a new list of users from slack
 /// </summary>
 public static void FetchAllUsers()
 {
     //made this thread safe for no reason
     lock (locked) {
         _Users.RemoveRange(0, _Users.Count());
         APICaller AC      = new APICaller();
         var       content = new FormUrlEncodedContent(new[] {
             new KeyValuePair <string, string>("token", SlackConnector.AuthToken)
         });
         var response = AC.CallAPI(content, "https://slack.com/api/users.list");
         var Users    = response.ToObject <RTMListOfUsers>();
         foreach (var u in Users.members)
         {
             _Users.Add(User.convertFromMember(u));
         }
     }
 }
Example #5
0
 public void WhenICallTheAPI()
 {
     apiContext.result = APICaller.CallAPI(apiContext.path);
 }