Esempio n. 1
0
    IEnumerator Search(string Search_Keyword)
    {
        string[] contact_store  = new string[1000];
        int[]    location_store = new int[1000];
        Debug.Log(Search_Keyword);

        prefab.SetActive(true);
        prefab2.SetActive(true);

        int index = 0;

        for (int i = 0; i < professor_bag.Length; i++)
        {
            Destroy(professor_bag[i]);
            Debug.Log("DESTROY");
        }
        Debug.Log("SEARCH!!!");
        Debug.Log("교수님 수: " + proflist["name"].Count);

        for (var i = 0; i < proflist["name"].Count - 1; i++)
        {
            Debug.Log("SEARCH!!!");
            if (proflist["name"][i].ToString().Contains(Search_Keyword) || proflist["major"][i].ToString().Contains(Search_Keyword) || proflist["location"][i].ToString().Contains(Search_Keyword) || proflist["contact"][i].ToString().Contains(Search_Keyword) || proflist["category"][i].ToString().Contains(Search_Keyword))
            {
                if (proflist["major"][i].Equals("&nbsp;") || proflist["location"][i].Equals("&nbsp;") || proflist["contact"][i].Equals("&nbsp;"))
                {
                    continue;
                }

                contact_store[index] += "이름  " + proflist["name"][i] + "\n" + "전공  " + proflist["major"][i] + "\n" + "주소  " + proflist["location"][i] + "\n" + "번호  " + proflist["contact"][i] + "\n";
                Debug.Log(contact_store[index]);
                var name    = 1;
                var address = proflist["location"][i].ToString().Split(' ');
                if (address[0] == "대양홀")
                {
                    name = 1;
                }
                else if (address[0] == "집현관")
                {
                    name = 2;
                }
                else if (address[0] == "학생회관")
                {
                    name = 3;
                }
                else if (address[0] == "군자관")
                {
                    name = 4;
                }
                else if (address[0] == "세종관")
                {
                    name = 5;
                }
                else if (address[0] == "광개토관")
                {
                    name = 6;
                }
                else if (address[0] == "이당관")
                {
                    name = 7;
                }
                else if (address[0] == "애지헌")
                {
                    name = 8;
                }
                else if (address[0] == "진관홀")
                {
                    name = 9;
                }
                else if (address[0] == "용덕관")
                {
                    name = 10;
                }
                else if (address[0] == "대양AI")
                {
                    name = 11;
                }
                else if (address[0] == "박물관")
                {
                    name = 12;
                }
                else if (address[0] == "우정당")
                {
                    name = 13;
                }
                else if (address[0] == "학술정보원")
                {
                    name = 14;
                }
                else if (address[0] == "율곡관")
                {
                    name = 15;
                }
                else if (address[0] == "충무관")
                {
                    name = 16;
                }
                else if (address[0] == "영실관")
                {
                    name = 17;
                }
                else if (address[0] == "다산관")
                {
                    name = 18;
                }
                else if (address[0] == "모차르트홀")
                {
                    name = 19;
                }
                Debug.Log(address[0]);

                location_store[index] = name;
                Debug.Log(location_store[index]);
                index++;
            }
        }
        professor_bag = new GameObject[index];
        int cnt = 0;

        for (var i = 0; i < index; i = i + 2)
        {
            var obj = Instantiate(prefab);
            obj.transform.parent = prefab.transform.parent;
            obj.GetComponent <RectTransform>().anchoredPosition = new Vector3(328, -80 - (142 * cnt), 0);
            obj.name = "TEXT" + i;
            obj.transform.GetChild(0).GetComponent <Text>().text = contact_store[i];
            obj.transform.GetChild(1).gameObject.name            = location_store[i] + "";

            var name = location_store[i];

            Debug.Log(location_store[i]);
            obj.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => {
                MapOnOff();
                mapAPI.SetLocation(name);
            });

            professor_bag[i] = obj;
            cnt++;
        }
        cnt = 0;
        for (var i = 1; i < index; i = i + 2)
        {
            var obj2 = Instantiate(prefab2);
            obj2.transform.parent = prefab2.transform.parent;
            obj2.GetComponent <RectTransform>().anchoredPosition = new Vector3(700.5f, -80 - (142 * cnt), 0);
            obj2.name = "TEXT" + i;
            obj2.transform.GetChild(0).GetComponent <Text>().text = contact_store[i];
            obj2.transform.GetChild(1).gameObject.name            = location_store[i] + "";

            var name = location_store[i];

            Debug.Log(location_store[i]);
            obj2.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => {
                MapOnOff();
                mapAPI.SetLocation(name);
            });
            professor_bag[i] = obj2;
            cnt++;
        }
        info_obj.GetComponent <RectTransform>().sizeDelta = new Vector2(948.2f, 143 * ((index + 1) / 2));


        prefab.SetActive(false);
        prefab2.SetActive(false);
        yield return(new WaitForSeconds(0));
    }
Esempio n. 2
0
    IEnumerator Search(string Search_Keyword)
    {
        string[] contact_store  = new string[500];
        int[]    location_store = new int[500];
        Debug.Log(Search_Keyword);
        List <Dictionary <string, object> > data = CSVReader.Read("Contact");

        prefab.SetActive(true);
        prefab2.SetActive(true);

        int index = 0;

        for (int i = 0; i < contact_bag.Length; i++)
        {
            Destroy(contact_bag[i]);
            Debug.Log("DESTROY");
        }
        for (var i = 0; i < data.Count; i++)
        {
            if (data[i]["부서"].ToString().Contains(Search_Keyword) || data[i]["부"].ToString().Contains(Search_Keyword) || data[i]["주소"].ToString().Contains(Search_Keyword) || data[i]["번호"].ToString().Contains(Search_Keyword))
            {
                contact_store[index] += "부서  " + data[i]["부서"] + "\n" + "부      " + data[i]["부"] + "\n" + "주소  " + data[i]["주소"] + "\n" + "번호  " + data[i]["번호"] + "\n";

                var name    = 1;
                var address = data[i]["주소"].ToString().Split(' ');
                if (address[0] == "대양홀")
                {
                    name = 1;
                }
                else if (address[0] == "집현관")
                {
                    name = 2;
                }
                else if (address[0] == "학생회관")
                {
                    name = 3;
                }
                else if (address[0] == "군자관")
                {
                    name = 4;
                }
                else if (address[0] == "세종관")
                {
                    name = 5;
                }
                else if (address[0] == "광개토관")
                {
                    name = 6;
                }
                else if (address[0] == "이당관")
                {
                    name = 7;
                }
                else if (address[0] == "애지헌")
                {
                    name = 8;
                }
                else if (address[0] == "진관홀")
                {
                    name = 9;
                }
                else if (address[0] == "용덕관")
                {
                    name = 10;
                }
                else if (address[0] == "대양AI센터")
                {
                    name = 11;
                }
                else if (address[0] == "박물관")
                {
                    name = 12;
                }
                else if (address[0] == "우정당")
                {
                    name = 13;
                }
                else if (address[0] == "학술정보원")
                {
                    name = 14;
                }
                else if (address[0] == "율곡관")
                {
                    name = 15;
                }
                else if (address[0] == "충무관")
                {
                    name = 16;
                }
                else if (address[0] == "영실관")
                {
                    name = 17;
                }
                else if (address[0] == "다산관")
                {
                    name = 18;
                }
                else if (address[0] == "모차르트홀")
                {
                    name = 19;
                }
                Debug.Log(address[0]);

                location_store[index] = name;
                Debug.Log(location_store[index]);
                index++;
                //info_btn.transform.GetChild(index).gameObject.name = name + "";
                //info_btn.transform.GetChild(index).GetComponent<Button>().onClick.AddListener(() => {
                //mapAPI.SetLocation(name);
                //MapOnOff();
                //});
            }
        }
        contact_bag = new GameObject[index];
        int cnt = 0;

        for (var i = 0; i < index; i = i + 2)
        {
            var obj = Instantiate(prefab);
            obj.transform.parent = prefab.transform.parent;
            obj.GetComponent <RectTransform>().anchoredPosition = new Vector3(328, -80 - (142 * cnt), 0);
            obj.name = "TEXT" + i;
            obj.transform.GetChild(0).GetComponent <Text>().text = contact_store[i];
            obj.transform.GetChild(1).gameObject.name            = location_store[i] + "";

            var name = location_store[i];

            Debug.Log(obj.GetComponent <RectTransform>().anchoredPosition.x);

            obj.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => {
                MapOnOff();
                mapAPI.SetLocation(name);
            });

            contact_bag[i] = obj;
            cnt++;
        }
        cnt = 0;
        for (var i = 1; i < index; i = i + 2)
        {
            var obj2 = Instantiate(prefab2);
            obj2.transform.parent = prefab2.transform.parent;
            obj2.GetComponent <RectTransform>().anchoredPosition = new Vector3(700.5f, -80 - (142 * cnt), 0);
            obj2.name = "TEXT" + i;
            obj2.transform.GetChild(0).GetComponent <Text>().text = contact_store[i];
            obj2.transform.GetChild(1).gameObject.name            = location_store[i] + "";

            var name = location_store[i];

            obj2.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => {
                MapOnOff();
                mapAPI.SetLocation(name);
            });
            contact_bag[i] = obj2;
            cnt++;
        }
        info_obj.GetComponent <RectTransform>().sizeDelta = new Vector2(948.2f, 143 * ((index + 1) / 2));


        prefab.SetActive(false);
        prefab2.SetActive(false);
        yield return(new WaitForSeconds(0));
    }