Пример #1
0
    void Sync()
    {
        var provinces = PlaceUtility.GetProvinces();

        foreach (var province in provinces)
        {
            var citys = PlaceUtility.GetCitys(province);
            foreach (var city in citys)
            {
                var directs = PlaceUtility.GetDistricts(province, city);
                foreach (var direct in directs)
                {
                    Debug.Log(string.Format("{0}/{1}/{2}", province.Name, city.Name, direct.Name));
                }
            }
        }
    }
Пример #2
0
    private void BindCity()
    {
        if (provinces == null || provinces.Length == 0)
        {
            return;
        }

        PlaceModel province = provinces[comboBoxProvince.value];

        if (province != null)
        {
            citys = PlaceUtility.GetCitys(province);

            this.InvokeToForm(() =>
            {
                comboBoxCity.ClearOptions();

                var list = new List <Dropdown.OptionData>();
                foreach (var item in citys)
                {
                    var option  = new Dropdown.OptionData();
                    option.text = item.Name;
                    list.Add(option);
                }
                comboBoxCity.AddOptions(list);
                if (comboBoxCity.value != 0)
                {
                    comboBoxCity.value = 0;
                }
                else
                {
                    ComboBoxCity_SelectedIndexChanged(0);
                }
            });
        }
    }