示例#1
0
    public void Searched(API_SearchContacts_Get instance)
    {
        if (instance.error == "")
        {
        }
        else
        {
            DisplayError(instance.error);
            return;
        }

        foreach (string contact in instance.results)
        {
            Debug.Log(contact);
        }



        List <API_EditContact_Set> contacts = new List <API_EditContact_Set>();

        foreach (string contact in instance.results)
        {
            int    i        = 0;
            string coord1   = "";
            string name1    = "";
            string phone1   = "";
            string email1   = "";
            string address1 = "";
            string tempS    = "";

            while (contact[i] != '|') // Name
            {
                tempS += contact[i++];
            }

            //Debug.Log(tempS);
            name1 = tempS;
            tempS = "";
            i++;

            while (contact[i] != '|') // Phone
            {
                tempS += contact[i++];
            }

            phone1 = tempS;
            tempS  = "";
            i++;

            while (contact[i] != '|') // Email
            {
                tempS += contact[i++];
            }

            email1 = tempS;
            tempS  = "";
            i++;

            while (contact[i] != '|') // Address
            {
                tempS += contact[i++];
            }

            address1 = tempS;
            tempS    = "";
            i++;

            while (contact[i] != '|') // Coord
            {
                tempS += contact[i++];
            }

            Debug.Log(tempS);
            coord1 = tempS;

            API_EditContact_Set tempContact = new API_EditContact_Set
            {
                contact     = name1,
                userId      = userID,
                address     = address1,
                email       = email1,
                coordinates = coord1,
                phoneNumber = phone1
            };

            contacts.Add(tempContact);
        }

        GM.AddPins(contacts);
    }