Beispiel #1
0
    public IEnumerator matching(string url)
    {
        key  = new List <Information>();
        pair = new List <match>();
        //Debug.Log("findlatlng");
        preparat preparat = GameObject.Find("test").GetComponent <preparat>();

        preparat.Starts(url);
        keypredicted keypredicted = GameObject.Find("test").GetComponent <keypredicted>();

        yield return(new WaitForSecondsRealtime(0.7f));

        Information keypath = new Information();
        bool        same;

        for (int i = 0; i < preparat.data.Count; i++)
        {
            if (preparat.data[i].myType != "geolocation-lat" && preparat.data[i].myType != "geolocation-long")
            {
                same    = false;
                keypath = preparat.data[i];
                for (int j = 0; j < key.Count; j++)
                {
                    if (key[j].path == preparat.data[i].path)
                    {
                        same = true;
                        break;
                        //key.Add(preparat.data[i]);
                    }
                }
                //Debug.Log(preparat.data[i].path);
                if (!same)
                {
                    key.Add(keypath);
                }
            }
        }
        for (int i = 0; i < key.Count; i++)
        {
            //Debug.Log(key[i].path);
            geolocation location = keypredicted.checklatlng(preparat.data, key[i].path);
            temp.lat = location.lat;
            temp.lng = location.lng;
            temp.key = key[i];
            pair.Add(temp);
        }
        pair = pair.OrderBy(sel => sel.lat.path).ToList();
    }
Beispiel #2
0
    IEnumerator showconfigwait(keypredicted kp)
    {
        listkey  listkey = GameObject.Find("test").GetComponent <listkey>();
        show_Key shkey   = GameObject.Find("test").GetComponent <show_Key>();

        //List<geolocation> location = new List<geolocation>();
        StartCoroutine(listkey.matching(temp.url));
        yield return(new WaitForSecondsRealtime(1.2f));

        int    check = 0;
        string path  = "99";

        for (int i = 0; i < listkey.pair.Count + 1; i++)
        {
            if (i == listkey.pair.Count)
            {
                if (i == 0)
                {
                    shkey.createNewGroup(kp.path.lat.path, i - check + 1);
                    shkey.setLatLong(kp.path.lat.path, kp.path.lat.name, kp.path.lng.name, kp.path.lat.path, kp.path.lng.path);
                    shkey.addKey(kp.path.lat.path, "none", "none");
                    Information ikey     = new Information();
                    geolocation location = new geolocation();
                    location.lat = kp.path.lat;
                    location.lng = kp.path.lng;
                    Button button = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/" + kp.path.lat.path + "/defaultGroup(Clone)/key/none").GetComponent <Button>();
                    button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
                }
                else
                {
                    shkey.createNewGroup(path, i - check + 1);
                    shkey.setLatLong(path, listkey.pair[i - 1].lat.name, listkey.pair[i - 1].lng.name, listkey.pair[i - 1].lat.path, listkey.pair[i - 1].lng.path);
                    shkey.addKey(path, "none", "none");
                    Information ikey     = new Information();
                    geolocation location = new geolocation();
                    location.lat = listkey.pair[i - 1].lat;
                    location.lng = listkey.pair[i - 1].lng;
                    Button button = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/" + path + "/defaultGroup(Clone)/key/none").GetComponent <Button>();
                    button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
                }
            }
            else if (path != listkey.pair[i].lat.path)
            {
                if (path != "99")
                {
                    if (path == "")
                    {
                        shkey.createNewGroup("none", i - check + 1);
                        // Debug.Log(i - check);
                        shkey.setLatLong("none", "", "", "", "");
                        shkey.addKey("none", "none", "none");
                        Information ikey     = new Information();
                        geolocation location = new geolocation();
                        Button      button   = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/none/defaultGroup(Clone)/key/none").GetComponent <Button>();
                        button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
                    }
                    else
                    {
                        shkey.createNewGroup(path, i - check + 1);
                        // Debug.Log(i - check);
                        shkey.setLatLong(path, listkey.pair[i].lat.name, listkey.pair[i].lng.name, listkey.pair[i].lat.path, listkey.pair[i].lng.path);
                        shkey.addKey(path, "none", "none");
                        Information ikey     = new Information();
                        geolocation location = new geolocation();
                        location.lat = listkey.pair[i].lat;
                        location.lng = listkey.pair[i].lng;
                        Button button = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/" + path + "/defaultGroup(Clone)/key/none").GetComponent <Button>();
                        button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
                    }
                    path  = listkey.pair[i].lat.path;
                    check = i;
                }
                else
                {
                    path  = listkey.pair[i].lat.path;
                    check = i;
                }
            }
        }
        //Debug.Log(listkey.pair.Count);
        for (int i = 0; i < listkey.pair.Count; i++)
        {
            //Debug.Log(i+" "+listkey.pair[i].lat.path);
            if (listkey.pair[i].lat.path != "")
            {
                shkey.addKey(listkey.pair[i].lat.path, listkey.pair[i].key.name, listkey.pair[i].key.path);
                geolocation location = new geolocation();
                location.lat = listkey.pair[i].lat;
                location.lng = listkey.pair[i].lng;
                Information ikey   = listkey.pair[i].key;
                Button      button = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/" + listkey.pair[i].lat.path + "/defaultGroup(Clone)/key/" + listkey.pair[i].key.path).GetComponent <Button>();
                button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
            }
            else
            {
                shkey.addKey("none", listkey.pair[i].key.name, listkey.pair[i].key.path);
                geolocation location = new geolocation();
                location.lat = listkey.pair[i].lat;
                location.lng = listkey.pair[i].lng;
                Information ikey   = listkey.pair[i].key;
                Button      button = GameObject.Find("16_9_sub/16_9_configure/maskPanel/container2/none/defaultGroup(Clone)/key/" + listkey.pair[i].key.path).GetComponent <Button>();
                button.onClick.AddListener(() => { closeconfig(); showselectedkey(ikey, location); });
            }
        }
    }