public static void clearSavedData()
    {
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
        wipeSavedData();
#endif
#if UNITY_IOS
        //trigger iOS Native prompt
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            framework_setDialogueDelegate(delegateDialoguePromptAnswered);
            framework_dialoguePrompt();
        }
#endif

#if UNITY_ANDROID
        // AndroidNativePopups.
        MobileNativePopups.OpenAlertDialog(
            "Clear All Message Data?", "Warning:This will erase all previously scanned messages",
            "Continue", "Cancel",
            () =>
        {
            wipeSavedData();
        },
            () => {  });
#endif
    }
Exemple #2
0
    private void avvisoUscita()
    {
        Debug.Log("entrato in avvisoUscita");
        MobileNativePopups.OpenAlertDialog(

            ":-(", "Vuoi uscire dall'app??",
            "SI", "NO", () => { Application.Quit(); }, () => { Debug.Log("è stato premuto no"); });
    }
Exemple #3
0
    public bool CheckForErrors(string response)
    {
        bool ok = true;

        if (response.Contains("not-authorized"))
        {
            Debug.LogError("Not authorized");
            MobileNativePopups.OpenAlertDialog("Login Error", "The login credentials are incorrect", "OK", () =>
            {
                Debug.LogWarning("Incorrect login prompt dismiss");
            });
            Disconnect();
            ok = false;
        }
        return(ok);
    }
Exemple #4
0
 public static void OpenAlertDialog(string title, string message, string cancel, Action onCancel)
 {
     MobileNativePopups.OpenAlertDialog(title, message, cancel, onCancel);
 }
Exemple #5
0
 public static void OpenAlertDialog(string title, string message, string ok, string neutral, string cancel, Action onOk, Action onNeutral, Action onCancel)
 {
     MobileNativePopups.OpenAlertDialog(title, message, ok, neutral, cancel, onOk, onNeutral, onCancel);
 }
Exemple #6
0
    public void CreateFace()
    {
        Action action = new Action(Nothing);

        if (selected.Count < 3)
        {
            Debug.Log("-----ERROR MUST BELONG SAME OBJECT-----");
            MobileNativePopups.OpenAlertDialog("Error", "Please select at least 3 vertices", "Cancel", action);
            return;
        }

        CADObject cadObject = selected [0].transform.parent.GetComponent <CADObject> ();

        string            objName = selected [0].transform.parent.name;
        List <GameObject> pool    = new List <GameObject> ();

        foreach (GameObject g in selected)
        {
            pool.Add(g);
            if (!g.transform.parent.name.Equals(objName))
            {
                Debug.Log("-----ERROR MUST BELONG SAME OBJECT-----");
                MobileNativePopups.OpenAlertDialog("Error", "Please select vertices that belong to the same object", "Cancel", action);
                return;
            }
        }

        GameObject startingPoint = pool [0];
        GameObject recent        = startingPoint;

        pool.Remove(startingPoint);

        List <GameObject> orderedList        = new List <GameObject> ();
        List <Vector3>    orderListPositions = new List <Vector3> ();

        orderedList.Add(recent);
        orderListPositions.Add(recent.transform.position);

        //action += Nothing;
        int toFind = pool.Count;

        while (true)
        {
            if (pool.Count == 0)
            {
                break;
            }

            GameObject found = null;
            foreach (GameObject checkNeighbor in pool)
            {
                HashSet <GameObject> key = new HashSet <GameObject> ();
                key.Add(checkNeighbor);
                key.Add(recent);
                if (cadObject.edges.ContainsKey(key))
                {
                    found = checkNeighbor;
                    toFind--;
                    break;
                }
            }

            if (found == null)
            {
                Debug.Log("-error form loop");
                MobileNativePopups.OpenAlertDialog("Error", "Please select vertices that form a single, complete loop", "Cancel", action);
                return;
            }
            else
            {
                recent = found;
                pool.Remove(found);
                orderedList.Add(found);
                orderListPositions.Add(found.transform.position);
            }
        }

        HashSet <GameObject> keyEnd = new HashSet <GameObject> ();

        keyEnd.Add(orderedList[0]);
        keyEnd.Add(orderedList[orderedList.Count - 1]);
        if (!cadObject.edges.ContainsKey(keyEnd))
        {
            Debug.Log("-error form loop");
            MobileNativePopups.OpenAlertDialog("Error", "Please select vertices that form a single, complete loop", "Cancel", action);
            return;
        }



        if (orderedList.Count != selected.Count)
        {
            Debug.Log("-error form loop");
            MobileNativePopups.OpenAlertDialog("Error", "You need to select vertices that form a single loop", "Cancel", action);
            return;
        }



        Poly2Mesh.Polygon poly = new Poly2Mesh.Polygon();
        poly.outside = orderListPositions;
        GameObject a = Poly2Mesh.CreateGameObject(poly);

        a.transform.parent = cadObject.gameObject.transform;
        a.GetComponent <Renderer> ().material = meshTexture;
        orderListPositions.Reverse();
        Poly2Mesh.Polygon poly2 = new Poly2Mesh.Polygon();
        poly2.outside = orderListPositions;
        GameObject a2 = Poly2Mesh.CreateGameObject(poly2);

        a2.transform.parent = cadObject.gameObject.transform;
        a2.GetComponent <Renderer> ().material = meshTexture;


        Debug.Log("CREATE FACE NOW");
        Debug.Log(orderedList.Count);
    }
Exemple #7
0
    private void OnGUI()
    {
        if (GUI.Button(new Rect(xOffset, yOffset, 150, 50), "Open alert dialog"))
        {
            MobileNativePopups.OpenAlertDialog(
                "Hello!", "Welcome to Mobile Native Popups",
                "Cancel", () => { Debug.Log("Cancel was pressed"); });
        }

        if (GUI.Button(new Rect(xOffset, yOffset * 2, 150, 50), "Open alert dialog with 2 buttons"))
        {
            MobileNativePopups.OpenAlertDialog(
                "Hello!", "Welcome to Mobile Native Popups",
                "Accept", "Cancel",
                () => { Debug.Log("Accept was pressed"); }, () => { Debug.Log("Cancel was pressed"); });
        }

        if (GUI.Button(new Rect(xOffset, yOffset * 3, 150, 50), "Open alert dialog with 3 buttons"))
        {
            MobileNativePopups.OpenAlertDialog(
                "Hello!", "Welcome to Mobile Native Popups",
                "Accept", "Neutral", "Cancel",
                () => { Debug.Log("Accept was pressed"); },
                () => { Debug.Log("Neutral was pressed"); },
                () => { Debug.Log("Cancel was pressed"); });
        }

#if UNITY_IOS
        if (GUI.Button(new Rect(xOffset, yOffset * 4, 150, 50), "Open alert dialog with many buttons"))
        {
            IosNativePopups.OpenAlertDialog(
                "Hello!", "Welcome to Mobile Native Popups",
                "Cancel", new String[] { "First Button", "Second Button", "Third Button" },
                (buttonIndex) => {
                switch (buttonIndex)
                {
                case 0:
                    Debug.Log("Cancel was pressed");
                    break;

                case 1:
                    Debug.Log("First button was pressed");
                    break;

                case 2:
                    Debug.Log("Second button was pressed");
                    break;

                default:
                    Debug.Log("Third button was pressed");
                    break;
                }
            });
        }
#elif UNITY_ANDROID
        if (GUI.Button(new Rect(xOffset, yOffset * 4, 150, 50), "Open date picker dialog"))
        {
            AndroidNativePopups.OpenDatePickerDialog(
                1986, 10, 14,
                (year, month, day) => { Debug.Log("Date set: " + year + "/" + month + "/" + day); });
        }

        if (GUI.Button(new Rect(xOffset * 4, yOffset, 150, 50), "Open time picker dialog"))
        {
            AndroidNativePopups.OpenTimePickerDialog(
                10, 9, false,
                (hour, minute) => { Debug.Log("Time set: " + hour + ":" + minute); });
        }

        if (GUI.Button(new Rect(xOffset * 4, yOffset * 2, 150, 50), "Open progress dialog"))
        {
            StartCoroutine(OpenFakeProgressDialog());
        }


        if (GUI.Button(new Rect(xOffset * 4, yOffset * 3, 150, 50), "Open toast"))
        {
            AndroidNativePopups.OpenToast("Welcome to Mobile Native Popups", AndroidNativePopups.ToastDuration.Short);
        }
#endif
    }