Пример #1
0
    public void showselectedkey(Information key, geolocation location)
    {
        showkeypanel.SetActive(true);
        keypredicted kp = GameObject.Find("test").GetComponent <keypredicted>();
        GameObject   panel;
        Text         txt;

        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/KeypathDetails");
        txt          = panel.GetComponent <Text>();
        txt.text     = key.path;
        temp.keypath = key.path;
        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/locationpathDetails");
        txt          = panel.GetComponent <Text>();
        txt.text     = location.lat.path + " , " + location.lng.path;
        temp.latpath = location.lat.path;
        temp.lngpath = location.lng.path;
        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/exampleDetails");
        txt          = panel.GetComponent <Text>();
        txt.text     = key.value;
        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/locationsDetails");
        txt          = panel.GetComponent <Text>();
        txt.text     = location.lat.value + " , " + location.lng.value;
        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/KeyName");
        txt          = panel.GetComponent <Text>();
        txt.text     = key.name;
        panel        = GameObject.Find("16_9_showKey/showKey_panel/EdibleText/LocationName");
        txt          = panel.GetComponent <Text>();
        txt.text     = location.lat.name + " , " + location.lng.name;
        temp.myclass = kp.findClass(key, location).ToString();
    }
Пример #2
0
    public IEnumerator checkMachineKey(List <Information> data)
    {
        yield return(StartCoroutine(waitCheckMachineKey(data, testurl, 1)));//new WaitForSecondsRealtime(0.9f);

        //Debug.Log("k : "+key.path);
        path    = checklatlng(data, key.path);
        myclass = findClass(key, path);
    }
Пример #3
0
    public geolocation checklatlng(List <Information> data, string keypath)
    {
        geolocation result = new geolocation();

        result.lat.path = "";
        result.lng.path = "";
        int index = findArray(keypath);

        if (keypath == "")
        {
            for (int i = 0; i < data.Count; i++)
            {
                if (data[i].myType == "geolocation-long")
                {
                    result.lng = data[i];
                }
                else if (data[i].myType == "geolocation-lat")
                {
                    result.lat = data[i];
                }
                if (result.lat.path != "" && result.lng.path != "")
                {
                    break;
                }
            }
        }
        else
        {
            for (int i = 0; i < data.Count; i++)
            {
                if (data[i].myType == "geolocation-long")
                {
                    //Debug.Log(data[i].myType + " " + data[i].path);
                    if (checkSamePath(index, keypath, data[i].path))
                    {
                        result.lng = data[i];
                    }
                }
                else if (data[i].myType == "geolocation-lat")
                {
                    if (checkSamePath(index, keypath, data[i].path))
                    {
                        result.lat = data[i];
                    }
                }
                if (result.lat.path != "" && result.lng.path != "")
                {
                    break;
                }
            }
        }

        return(result);
    }
Пример #4
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();
    }
Пример #5
0
 public int findClass(Information key, geolocation location)
 {
     Debug.Log("keytype : " + key.myType);
     if (location.lat.path != "" && location.lng.path != "")
     {
         if (key.myType == "nominal")
         {
             return(1);
         }
         else if (key.myType == "number")
         {
             return(2);
         }
         else if (key.myType == "text")
         {
             return(3);
         }
         else
         {
             return(4);
         }
     }
     else
     {
         if (key.myType == "nominal")
         {
             return(5);
         }
         else if (key.myType == "number")
         {
             return(6);
         }
         else if (key.myType == "text")
         {
             return(7);
         }
         else
         {
             return(0);
         }
     }
 }
Пример #6
0
    public IEnumerator waitCheckMachineKey(List <Information> data, string url, int Case)
    {
        json = "[";
        int    number = 0;
        string path   = "";

        data = data.OrderBy(dat => dat.path).ToList();
        for (int i = 0; i < data.Count + 1; i++)
        {
            if (i == 0)
            {
                path = data[i].path;
                number++;
            }
            else if (i == data.Count)
            {
                int mt = 0, t = 0;
                if (data[i - 1].myType == "text")
                {
                    mt = 1;
                }
                else if (data[i - 1].myType == "geolocation-long" || data[i - 1].myType == "geolocation-lat")
                {
                    mt = 2;
                }
                else if (data[i - 1].myType == "nominal")
                {
                    mt = 3;
                }
                else if (data[i - 1].myType == "number")
                {
                    mt = 4;
                }
                else if (data[i - 1].myType == "time")
                {
                    mt = 5;
                }
                if (data[i - 1].dataType == "boolean")
                {
                    t = 1;
                }
                else if (data[i - 1].dataType == "float")
                {
                    t = 2;
                }
                else if (data[i - 1].dataType == "int")
                {
                    t = 3;
                }
                else if (data[i - 1].dataType == "string")
                {
                    t = 4;
                }
                json   = json + "{\"Name\":\"" + data[i - 1].name + "\",\"path\":\"" + data[i - 1].path + "\",\"Number\":" + number + ",\"myType\":" + mt.ToString() + ",\"Type\":" + t.ToString() + "},";
                number = 1;
            }
            else if (path != data[i].path)
            {
                int mt = 0, t = 0;
                if (data[i - 1].myType == "text")
                {
                    mt = 1;
                }
                else if (data[i - 1].myType == "geolocation-long" || data[i - 1].myType == "geolocation-lat")
                {
                    mt = 2;
                }
                else if (data[i - 1].myType == "nominal")
                {
                    mt = 3;
                }
                else if (data[i - 1].myType == "number")
                {
                    mt = 4;
                }
                else if (data[i - 1].myType == "time")
                {
                    mt = 5;
                }
                if (data[i - 1].dataType == "boolean")
                {
                    t = 1;
                }
                else if (data[i - 1].dataType == "float")
                {
                    t = 2;
                }
                else if (data[i - 1].dataType == "int")
                {
                    t = 3;
                }
                else if (data[i - 1].dataType == "string")
                {
                    t = 4;
                }
                json   = json + "{\"Name\":\"" + data[i - 1].name + "\",\"path\":\"" + data[i - 1].path + "\",\"Number\":" + number + ",\"myType\":" + mt.ToString() + ",\"Type\":" + t.ToString() + "},";
                number = 1;
                path   = data[i].path;
            }
            else
            {
                number++;
            }
        }
        json = json.Substring(0, json.Length - 1) + "]";

        var       encoding   = new System.Text.UTF8Encoding();
        Hashtable postHeader = new Hashtable();

        postHeader.Add("Content-Type", "application/json");

        byte[] formData = System.Text.Encoding.ASCII.GetBytes(json.ToCharArray());

        WWW www = new WWW(url, formData, postHeader);

        yield return(www);

        if (Case == 1)
        {
            //test set
            StartCoroutine(WaitForRequest(www, data, json));
        }
    }
Пример #7
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); });
            }
        }
    }