public void PurchaseApp() { // A new store implementation is now available - see the online docs for details WSANativeStore.PurchaseApp((string response) => { if (!string.IsNullOrEmpty(response)) { WSANativeDialog.ShowDialog("Purchased", response); } else { WSANativeDialog.ShowDialog("Not Purchased", "NAY"); } }); }
public void CreatePopupMenu() { WSANativePopupMenu.ShowPopupMenu(Screen.width / 2, Screen.height / 2, new List <WSADialogCommand>() { new WSADialogCommand("Option 1"), new WSADialogCommand("Option 2"), new WSADialogCommand("Option 3"), new WSADialogCommand("Option 4"), new WSADialogCommand("Option 5"), new WSADialogCommand("Option 6") }, WSAPopupMenuPlacement.Above, (WSADialogResult result) => { if (result.ButtonPressed == "Yes") { WSANativeDialog.ShowDialog("Yes Pressed", "Yes was pressed!"); } else if (result.ButtonPressed == "No") { WSANativeDialog.ShowDialog("No Pressed", "No was pressed!"); } else if (result.ButtonPressed == "Cancel") { WSANativeDialog.ShowDialog("Cancel Pressed", "Cancel was pressed!"); } }); }
public void CreateDialog() { WSANativeDialog.ShowDialogWithOptions("This is a title", "This is a message", new List <WSADialogCommand>() { new WSADialogCommand("Yes"), new WSADialogCommand("No"), new WSADialogCommand("Cancel") }, 0, 2, (WSADialogResult result) => { if (result.ButtonPressed == "Yes") { WSANativeDialog.ShowDialog("Yes Pressed", "Yes was pressed!"); } else if (result.ButtonPressed == "No") { WSANativeDialog.ShowDialog("No Pressed", "No was pressed!"); } else if (result.ButtonPressed == "Cancel") { WSANativeDialog.ShowDialog("Cancel Pressed", "Cancel was pressed!"); } }); }
public void PurchaseProduct() { // A new store implementation is now available - see the online docs for details WSANativeStore.GetProductListings((List <WSAProduct> products) => { if (products != null && products.Count > 0) { WSANativeStore.PurchaseProduct(products[0].Id, (WSAPurchaseResult result) => { if (result.Status == WSAPurchaseResultStatus.Succeeded) { WSANativeDialog.ShowDialog("Purchased", "YAY"); } else { WSANativeDialog.ShowDialog("Not Purchased", "NAY"); } }); } }); }
IEnumerator Start() { cs = Extensions.CloudSync(); // First, check if user has location service enabled if (!Input.location.isEnabledByUser) { txt.text = "Location service disabled! Enable location in settings!"; #if UNITY_EDITOR world.Initialize(currentPos); #endif // Windows store implementation here #if NETFX_CORE WSANativeDialog.ShowDialog("Wrong settings!", "Enable localization in settings!"); #endif #if UNITY_ANDROID AndroidNativeFunctions.ShowAlert("Please enable localization in settings.", "Alert!", "OK", null, null, null); #endif yield break; } // Start service before querying location Input.location.Start(0.5f, 0.5f); txt.text = "Initializing"; // Wait until service initializes while (Input.location.status == LocationServiceStatus.Initializing) { txt.text += "."; if (txt.text.Contains("....")) { txt.text = "Initializing"; } yield return(new WaitForSeconds(1)); } if (Input.location.status == LocationServiceStatus.Failed) { txt.text = "Positioning failed, check settings and relaunch application!"; // Windows store implementation here #if NETFX_CORE WSANativeDialog.ShowDialog("GPS error!", "Please check Your settings!"); #endif #if UNITY_ANDROID AndroidNativeFunctions.ShowAlert("Localization failed, please check Your settings.", "Alert!", "OK", null, null, null); #endif yield break; } // Wait for fix while (Input.location.lastData.horizontalAccuracy > 70) { txt.text = "Waiting for GPS fix..., " + "current GPS accuracy (needed < 70): " + Input.location.lastData.horizontalAccuracy + ", if it takes too long, try restarting MiCity!"; yield return(new WaitForSeconds(1)); } if (Input.location.status == LocationServiceStatus.Running) { world.Initialize(new Vector2(Input.location.lastData.longitude, Input.location.lastData.latitude)); currentPosLONLAT = new Vector2(Input.location.lastData.longitude, Input.location.lastData.latitude); cs.UserPathCoordinates.Add(new Vector2(Input.location.lastData.longitude, Input.location.lastData.latitude)); lastTimestamp = System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1)).TotalSeconds; txt.text = "Initialized!"; yield break; } }