// void imagePickerChoseImage(string imagePath) { #if UNITY_IPHONE this.imagePath = imagePath; StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed)); #endif }
void OnChooseImageDoneIos(string url) { #if UNITY_IPHONE StartCoroutine (EtceteraManager.textureFromFileAtPath ( "file://" + url, delegate(Texture2D texture) { onChooseImageDone(texture); }, delegate(string error) { NotificationView.ShowMessage("Lỗi cập nhật ảnh", 3f); GameObject.Destroy(gameObject); }) ); #endif }
// Texture loading delegates public void textureLoaded(Texture2D texture) { #if UNITY_IPHONE //testPlane.renderer.material.mainTexture = texture; texs[j].mainTexture = texture; j++; if (j < texs.Count) { StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + paths [j], textureLoaded, textureLoadFailed)); } else { j = 0; } #endif }
public void LoadPhotoImage() { //Load Image if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons); return; } // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to // Resize the image so that we dont end up trying to load a gigantic image //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 ); // Add 'file://' to the imagePath so that it is accessible via the WWW class StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed)); }
public void listAll() { Transform [] rows = table.children.ToArray(); if (rows.Length > 0) { for (int i = 0; i < rows.Length; i++) { if (rows[i] != null) { DestroyImmediate(rows[i].gameObject); } } } if (PlayerPrefs.HasKey("users") && PlayerPrefs.GetString("users").Length > 1) { string [] users = PlayerPrefs.GetString("users").Split(','); Debug.Log(PlayerPrefs.GetString("users")); foreach (string user in users) { string [] prefs = PlayerPrefs.GetString(user).Split(','); GameObject row = NGUITools.AddChild(GameObject.Find("Table"), Resources.Load("UserRow") as GameObject); row.transform.localScale = new Vector3(240f, 240f, 1f); row.name = prefs[0]; UILabel ime = row.transform.FindChild("lblIme").GetComponent <UILabel>(); ime.text = row.name = prefs[0]; // UILabel god = row.transform.FindChild ("lblGod").GetComponent<UILabel>(); // god.text = row.name=prefs[3]; if (prefs.Length > 4 && prefs[4].Length > 2) { _texture = row.transform.FindChild("Texture").GetComponent <UITexture>(); texs.Add(_texture); paths.Add(prefs[4]); // StartCoroutine (EtceteraManager.textureFromFileAtPath ("file://" + prefs[4], textureLoaded, textureLoadFailed)); } } table.Reposition(); #if UNITY_IPHONE StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + paths[0], textureLoaded, textureLoadFailed)); #endif StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + paths[0], textureLoaded, textureLoadFailed)); } }
void OnGUI() { beginColumn(); if (GUILayout.Button("Show Activity View")) { EtceteraBinding.showActivityView(); // hide the activity view after a short delay StartCoroutine(hideActivityView()); } if (GUILayout.Button("Show Bezel Activity View")) { EtceteraBinding.showBezelActivityViewWithLabel("Loading Stuff..."); // hide the activity view after a short delay StartCoroutine(hideActivityView()); } if (GUILayout.Button("Prompt to Review This App")) { EtceteraBinding.askForReview("Do you like this game?", "Please review the game if you do!", "572395608"); } if (GUILayout.Button("Open App Store to Review Page")) { EtceteraBinding.openAppStoreReviewPage("572395608"); } if (GUILayout.Button("Register for Push")) { EtceteraBinding.registerForRemoteNotifcations(P31RemoteNotificationType.Alert | P31RemoteNotificationType.Badge | P31RemoteNotificationType.Sound); } if (GUILayout.Button("Get Registered Push Types")) { P31RemoteNotificationType types = EtceteraBinding.getEnabledRemoteNotificationTypes(); if ((types & P31RemoteNotificationType.Alert) != P31RemoteNotificationType.None) { Debug.Log("registered for alerts"); } if ((types & P31RemoteNotificationType.Sound) != P31RemoteNotificationType.None) { Debug.Log("registered for sounds"); } if ((types & P31RemoteNotificationType.Badge) != P31RemoteNotificationType.None) { Debug.Log("registered for badges"); } } if (GUILayout.Button("Register with GameThrive")) { // registerDeviceWithGameThrive must be called in a couroutine since it makes a WWW request // Make sure you use your own appId and that you pass the actual deviceToken that the remoteRegistrationSucceededEvent // provides! StartCoroutine(EtceteraBinding.registerDeviceWithGameThrive("13aa4c98-1931-11e4-aefc-5bf05f62f703", "token", null, www => { // check for an error or success. If www.error is not null then an error occured if (www.error == null) { // success! Lets dump the data to the console so we can see what was returned Debug.Log("GameThrive registration success: " + www.text); } else { Debug.Log("Error registering with GameThrive: " + www.error); } })); } // Second row endColumn(true); if (GUILayout.Button("Set Urban Airship Credentials")) { // enter your own Urban Airship credentials here! EtceteraBinding.setUrbanAirshipCredentials("S8Tf2CiUQSuh2A4NVdD2CA", "J6O97Dm2QK2-GGXZsPMlEA", "optional alias"); } if (GUILayout.Button("Set Push.IO Credentials")) { // enter your own Push.IO credentials here! EtceteraBinding.setPushIOCredentials("5VRVDMujew_a9UQ"); // optinally, pass in categories //EtceteraBinding.setPushIOCredentials( "5VRVDMujew_a9UQ", new string[] { "BaseballPlayers", "Gamers" } ); } if (GUILayout.Button("Prompt for Photo")) { EtceteraBinding.promptForPhoto(0.25f, PhotoPromptType.CameraAndAlbum); } if (GUILayout.Button("Prompt for Multiple Photos")) { EtceteraBinding.promptForMultiplePhotos(3, 0.25f); } if (GUILayout.Button("Load Photo Texture")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons); return; } // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to // Resize the image so that we dont end up trying to load a gigantic image //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 ); // Add 'file://' to the imagePath so that it is accessible via the WWW class StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed)); } if (GUILayout.Button("Save Photo to Album")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons); return; } EtceteraBinding.saveImageToPhotoAlbum(imagePath); } if (GUILayout.Button("Get Image Size")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Getting Image Size", "You have to choose a photo before checking it's size", buttons); return; } var size = EtceteraBinding.getImageSize(imagePath); Debug.Log("image size: " + size); } endColumn(); // Next scene button if (bottomRightButton("Next")) { Application.LoadLevel("EtceteraTestSceneThree"); } }
void imagePickerChoseImage(string imagePath) { this.imagePath = imagePath; StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + this.imagePath, textureLoaded, textureLoadFailed)); }
void OnGUI() { beginColumn(); if (GUILayout.Button("Show Activity View")) { EtceteraBinding.showActivityView(); // hide the activity view after a short delay StartCoroutine(hideActivityView()); } if (GUILayout.Button("Show Bezel Activity View")) { EtceteraBinding.showBezelActivityViewWithLabel("Loading Stuff..."); // hide the activity view after a short delay StartCoroutine(hideActivityView()); } if (GUILayout.Button("Rate This App")) { EtceteraBinding.askForReview("Do you like this game?", "Please review the game if you do!", "366238041"); } if (GUILayout.Button("Register for Push")) { EtceteraBinding.registerForRemoteNotifcations(P31RemoteNotificationType.Alert | P31RemoteNotificationType.Badge | P31RemoteNotificationType.Sound); } if (GUILayout.Button("Get Registered Push Types")) { P31RemoteNotificationType types = EtceteraBinding.getEnabledRemoteNotificationTypes(); if ((types & P31RemoteNotificationType.Alert) != P31RemoteNotificationType.None) { Debug.Log("registered for alerts"); } if ((types & P31RemoteNotificationType.Sound) != P31RemoteNotificationType.None) { Debug.Log("registered for sounds"); } if ((types & P31RemoteNotificationType.Badge) != P31RemoteNotificationType.None) { Debug.Log("registered for badges"); } } // Second row endColumn(true); if (GUILayout.Button("Set Urban Airship Credentials")) { // enter your own Urban Airship credentials here! EtceteraBinding.setUrbanAirshipCredentials("S8Tf2CiUQSuh2A4NVdD2CA", "J6O97Dm2QK2-GGXZsPMlEA", "optional alias"); } if (GUILayout.Button("Set Push.IO Credentials")) { // enter your own Push.IO credentials here! EtceteraBinding.setPushIOCredentials("5VRVDMujew_a9UQ"); // optinally, pass in categories //EtceteraBinding.setPushIOCredentials( "5VRVDMujew_a9UQ", new string[] { "BaseballPlayers", "Gamers" } ); } if (GUILayout.Button("Prompt for Photo")) { EtceteraBinding.promptForPhoto(0.25f, PhotoPromptType.CameraAndAlbum); } if (GUILayout.Button("Load Photo Texture")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons); return; } // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to // Resize the image so that we dont end up trying to load a gigantic image //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 ); // Add 'file://' to the imagePath so that it is accessible via the WWW class StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed)); } if (GUILayout.Button("Save Photo to Album")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons); return; } EtceteraBinding.saveImageToPhotoAlbum(imagePath); } if (GUILayout.Button("Get Image Size")) { if (imagePath == null) { var buttons = new string[] { "OK" }; EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Getting Image Size", "You have to choose a photo before checking it's size", buttons); return; } var size = EtceteraBinding.getImageSize(imagePath); Debug.Log("image size: " + size); } endColumn(); // Next scene button if (bottomRightButton("Next")) { Application.LoadLevel("EtceteraTestSceneThree"); } }