void OnTriggerEnter(Collider obj) { if (obj.gameObject.name == "Shark") { //reset shark obj.gameObject.transform.rotation = Quaternion.identity; obj.gameObject.transform.position = new Vector3(18f, -3f, 8f); Destroy(this.gameObject); Instantiate(explosionPrefab, transform.position, Quaternion.identity); UserDisplayClass.sharksDestroyedCount++; PostMetricRequest ur = new PostMetricRequest(UserSessionUtils.getApiKey(), 24, 43); PostMetricRequest ul = new PostMetricRequest(UserSessionUtils.getApiKey(), 24, 43, 1); // Use a delegate call to run PostMetricRequest and doPostMetric async new Action <PostMetricRequest> (PostMetric).BeginInvoke(ur, null, null); new Action <PostMetricRequest> (PostMetric).BeginInvoke(ul, null, null); DateTime time = DateTime.Now; // Use current time string format = "MMM ddd d HH:mm:ss.fff yyyy"; // Use this format PostUserOptionsRequest userInsert = new PostUserOptionsRequest(UserSessionUtils.getApiKey(), "116", 43, "BOMBED!", time.ToString(format)); userInsert.postUserInfo("insert"); } else if (obj.gameObject.name == "ClownFish") { //reset fish obj.gameObject.transform.rotation = Quaternion.identity; obj.gameObject.transform.position = new Vector3(18f, 0.5f, 7f); Destroy(this.gameObject); Instantiate(explosionPrefab, transform.position, Quaternion.identity); } }
void login() { LoginRequest login = new LoginRequest(loginView.data.login, loginView.data.password); //yield return login.doLogin(); /* TODO */ if (login.doLogin()) { m_Key = login.getKey(); UserSessionUtils.setUserSession(login.getUserId(), login.getUsername(), login.getKey()); Application.LoadLevel(2); } else { loginView.error = true; loginView.errorMessage = login.getErrorMessage(); } blockUI = false; }
// Use this for initialization void Start() { productId = 43; sharksDestroyedCount = 0; leaderboardId = 6; bombsLeft = 30; avatar_url = "http://www.avatarist.com/avatars/Cartoons/Family-Guy/Brian-small.gif"; lang = "ar"; // Change to Arabic levelId = 1; Currency = GameObject.Find("Currency").guiText; BombCounter = GameObject.Find("BombCounter").guiText; Debug.Log("Grabbing User Info"); userGet = new UserInfoRequest(UserSessionUtils.getApiKey(), productId); Debug.Log("Grabbing Product Info"); product = new ProductInfoRequest(UserSessionUtils.getApiKey(), productId); product_result = product.doGetInfo(); userGet_result = userGet.doGetInfo(); Debug.Log("User ID: " + userGet.id); userPut = new UserInfoRequest(UserSessionUtils.getApiKey(), userGet.id, avatar_url, lang); Debug.Log("Getting Leaderboard Info"); leaderboard = new LeaderboardRequest(UserSessionUtils.getApiKey(), leaderboardId); leaderboard_result = leaderboard.doGetInfo(); Debug.Log("Leaderboard Result: " + leaderboard_result); Debug.Log("Are we gonna print it?"); foreach (string key in leaderboard.user_results.Keys) { Debug.Log("User Results Key: " + key + ", User Results Value: " + leaderboard.user_results[key]); } // Debug.Log ("Sending User Options Info"); // userUpdate = new PostUserOptionsRequest(UserSessionUtils.getApiKey(), user.id, productId, "GG", "NNN"); // userUpdate.postUserInfo("update"); Debug.Log("Sending User Update Info"); mode = "avatar"; userPut_result = userPut.putUserInfo(mode); Debug.Log("User Put Result for Avatar: " + userPut_result); mode = "lang"; userPut_result = userPut.putUserInfo(mode); Debug.Log("User Put Result for Lang: " + userPut_result); }
void onRegisterClick() { if (registrationView.data.password != registrationView.data.passwordConfirm) { registrationView.error = true; registrationView.errorMessage = "Password and Confirm password don't match!"; return; } LoginRequest lr = new LoginRequest(); if (!lr.doLoginAsGuest()) { registrationView.error = true; registrationView.errorMessage = lr.getErrorMessage(); return; } Debug.Log("Guest session key: lr.getKey()"); RegisterRequest ur = new RegisterRequest(lr.getKey(), registrationView.data.login, registrationView.data.password, registrationView.data.email, registrationView.data.login); if (!ur.doRegister()) { registrationView.error = true; registrationView.errorMessage = ur.getErrorMessage(); return; } m_Key = lr.getKey(); UserSessionUtils.setUserSession(0, registrationView.data.login, lr.getKey()); Application.LoadLevel(1); }