This commit is contained in:
Caiyanpeng committed 2021-04-19 14:11:53 +08:00
1 parent f4cbad819b
commit 0346b650aa
64 files changed
+12634 -12935

No files matched your search

@@ -65,23 +65,44 @@ namespace Assets.Scripts.UI.Prefab.Login
public Texture GetCountryImage(int index)
{
var c = countryList[index];
if (c == null) return null;
if (c == null) return Resources.Load<Texture>(countryList[countryDefaultValue].source);
return Resources.Load<Texture>(c.source);
}
public Texture GetCountryImage(string code)
{
return GetCountryImage(GetCountryIndexByCode(code));
}
public Texture GetCountryImageByName(string name)
{
var c = countryList.Find(x=>x.country == name);
if (c == null) return Resources.Load<Texture>(countryList[countryDefaultValue].source);
return Resources.Load<Texture>(c.source);
}
public int GetCountryIndexByCode(string code)
{
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
if (c == -1) return countryDefaultValue;
return c;
}
public int GetCountryIndexByName(string country)
{
var c = countryList.FindIndex(x => x.country == country);
if (c == -1) return countryDefaultValue;
return c;
}
public List<Dropdown.OptionData> GetDayOptions(int year,int month)
{
int day = DateTime.DaysInMonth(year, month);
return DayOptions.dayOption[day];
}
public string GetCountryName(int index)
{
var c = countryList[index];
if (c == null) return countryList[countryDefaultValue].country;
return c.country;
}
}
}