Merge branch 'dev_language' into dev_release
# Conflicts: # Assets/Resources/UI/Prefab/Panel/Mobile/MapListPanel.prefab # Assets/Resources/UI/Prefab/Panel/Mobile/RaceListPanel.prefab
This commit is contained in:
commit
134dc76ec5
94 files changed
+10234
-2610
No files matched your search
@@ -45,6 +45,13 @@ namespace Assets.Scripts.Apis
|
||||
httpClient = new System.Net.Http.HttpClient(httpClientHandler);
|
||||
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
HandleHeaders(httpClient.DefaultRequestHeaders);
|
||||
App.ChangeLanguageEvent += App_ChangeLanguageEvent;
|
||||
}
|
||||
//语言切换
|
||||
private static void App_ChangeLanguageEvent()
|
||||
{
|
||||
httpClient.DefaultRequestHeaders.Remove("Language");
|
||||
httpClient.DefaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
||||
}
|
||||
|
||||
protected async Task<bool> GetAsFileSync(string url, string fileName)
|
||||
@@ -96,7 +103,7 @@ namespace Assets.Scripts.Apis
|
||||
//yield return request.Send();
|
||||
|
||||
var client = new HttpClient(httpClientHandler);
|
||||
client.DefaultRequestHeaders.Add("Language", "en");
|
||||
//client.DefaultRequestHeaders.Add("Language", "en");
|
||||
HandleHeaders(client.DefaultRequestHeaders);
|
||||
|
||||
var result = await client.GetByteArrayAsync(_url).ConfigureAwait(false);
|
||||
@@ -116,6 +123,8 @@ namespace Assets.Scripts.Apis
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||
#endif
|
||||
defaultRequestHeaders.Add("deviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier);
|
||||
defaultRequestHeaders.Remove("Language");
|
||||
defaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
||||
}
|
||||
|
||||
protected async Task<byte[]> GetUrlAsync(string url)
|
||||
@@ -487,7 +496,7 @@ namespace Assets.Scripts.Apis
|
||||
private void AddLanguage()
|
||||
{
|
||||
httpClient.DefaultRequestHeaders.Remove("Language");
|
||||
httpClient.DefaultRequestHeaders.Add("Language", "en");
|
||||
httpClient.DefaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,6 +15,10 @@ namespace Assets.Scripts.Apis
|
||||
//public dynamic data { get; set; }
|
||||
public string errMsg { get; set; }
|
||||
public JArray errFieldMsg { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonResult<T> : JsonResult
|
||||
|
||||
+56
-1
@@ -12,6 +12,9 @@ using Assets.Scripts;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public delegate void ChangeLanguageDelegate();
|
||||
|
||||
public static class App
|
||||
{
|
||||
@@ -101,9 +104,61 @@ public static class App
|
||||
public static string WorkoutsUrl { get; internal set; }
|
||||
public static long delayTime { get; set; }
|
||||
public static List<OnlineUser> userList = new List<OnlineUser>();
|
||||
private static string language { get; set; }
|
||||
|
||||
public static Dictionary<string, string> LanguageManager { get; set; }
|
||||
#region 语言改变事件
|
||||
public static event ChangeLanguageDelegate ChangeLanguageEvent;
|
||||
static Dictionary<string, Dictionary<string, string>> dic;
|
||||
public static string GetLocalLanguage()
|
||||
{
|
||||
return language;
|
||||
}
|
||||
public static void ChangeLanguage(string lan)
|
||||
{
|
||||
language = lan;
|
||||
if (dic.ContainsKey(language))
|
||||
{
|
||||
LanguageManager = dic[language];
|
||||
}
|
||||
if (ChangeLanguageEvent != null)
|
||||
{
|
||||
ChangeLanguageEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLocalString(string value)
|
||||
{
|
||||
if (LanguageManager != null && LanguageManager.ContainsKey(value))
|
||||
{
|
||||
return LanguageManager[value];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void InitLanguage()
|
||||
{
|
||||
var systemLanguage = Application.systemLanguage.ToString().ToLower();
|
||||
if (systemLanguage.Contains("chinese"))
|
||||
{
|
||||
language = "zh";
|
||||
}
|
||||
else
|
||||
{
|
||||
language = "en";
|
||||
}
|
||||
var a = Resources.Load<TextAsset>("UI/language");
|
||||
dic = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(a.text);
|
||||
if (dic.ContainsKey(language))
|
||||
{
|
||||
LanguageManager = dic[language];
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
static App()
|
||||
{
|
||||
|
||||
InitLanguage();
|
||||
#if !UNITY_EDITOR
|
||||
//Host = "http://pf.juze.pro/";
|
||||
//Host = "http://192.168.0.101:5087/";
|
||||
@@ -120,7 +175,7 @@ public static class App
|
||||
{
|
||||
App._IsRowerMode = bool.Parse(isRower);
|
||||
}
|
||||
//App.ChangeLanguage("en");
|
||||
Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
||||
Debug.Log(SystemInfo.deviceUniqueIdentifier);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace Assets.Scripts.Scenes
|
||||
{
|
||||
isNetWorkLose = false;
|
||||
App.delayTime = ping.time;
|
||||
Debug.Log(App.delayTime);
|
||||
//Debug.Log(App.delayTime);
|
||||
ping.DestroyPing();
|
||||
ping = null;
|
||||
}
|
||||
|
||||
@@ -187,9 +187,9 @@ public class LoginController : BaseScene
|
||||
years.options = regOptions.years;
|
||||
months.options = regOptions.months;
|
||||
days.options = regOptions.days;
|
||||
years.captionText.text = "Year";
|
||||
months.captionText.text = "Month";
|
||||
days.captionText.text = "Day";
|
||||
years.captionText.text = App.GetLocalString("Year");
|
||||
months.captionText.text = App.GetLocalString("Month");
|
||||
days.captionText.text = App.GetLocalString("Day");
|
||||
years.onValueChanged.AddListener((int index) =>
|
||||
{
|
||||
if (index != -1 && months.value != -1)
|
||||
@@ -207,7 +207,7 @@ public class LoginController : BaseScene
|
||||
}
|
||||
});
|
||||
genders.options = regOptions.genders;
|
||||
genders.captionText.text = "Gender";
|
||||
genders.captionText.text = App.GetLocalString("Gender");
|
||||
countrys.options = regOptions.countrys;
|
||||
countrys.value = regOptions.countryDefaultValue;
|
||||
countrys.onValueChanged.AddListener((int index) =>
|
||||
@@ -215,7 +215,7 @@ public class LoginController : BaseScene
|
||||
countrys.transform.Find("RawImage").GetComponent<RawImage>().texture = regOptions.GetCountryImage(index);
|
||||
});
|
||||
units.options = regOptions.units;
|
||||
units.captionText.text = "Display Units";
|
||||
units.captionText.text = App.GetLocalString("Display Units");
|
||||
signForm = new SignForm()
|
||||
{
|
||||
email = email,
|
||||
@@ -631,7 +631,9 @@ public class LoginController : BaseScene
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxBrowser.EvalJSCSP(@"
|
||||
if (App.GetLocalLanguage() == "en")
|
||||
{
|
||||
wxBrowser.EvalJSCSP(@"
|
||||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||||
document.getElementById('wx_default_tip').childNodes[3].innerHTML = `""PowerFun""`;
|
||||
@@ -640,6 +642,20 @@ public class LoginController : BaseScene
|
||||
document.body.style.transformOrigin = 'top left';
|
||||
document.body.style.transform = 'scale(0.85106382978)';
|
||||
document.body.style.padding = '0';").Done();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBrowser.EvalJSCSP(@"
|
||||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||||
document.getElementById('wx_default_tip').childNodes[1].innerHTML = `请使用微信扫描二维码登录`;
|
||||
document.body.style.background = '#272732';
|
||||
document.body.style.overflow = 'hidden';
|
||||
document.body.style.transformOrigin = 'top left';
|
||||
document.body.style.transform = 'scale(0.85106382978)';
|
||||
document.body.style.padding = '0';").Done();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
//浏览器加载回调
|
||||
@@ -782,16 +798,16 @@ public class LoginController : BaseScene
|
||||
{
|
||||
var btn = signPage1.Find("Captcha").Find("BtnGet");
|
||||
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
|
||||
btnText.text = $"Again({time--})";
|
||||
btnText.text = $"{App.GetLocalString("Again")}({time--})";
|
||||
if (time < 0)
|
||||
{
|
||||
btnText.text = "Get";
|
||||
btnText.text = App.GetLocalString("Get");
|
||||
btn.GetComponent<Button>().enabled = true;
|
||||
btn.GetComponent<Button>().interactable = true;
|
||||
startCaptcha = false;
|
||||
//timer.Stop();
|
||||
}
|
||||
timer = 1.0f;
|
||||
timer += 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1184,7 +1200,7 @@ public class LoginController : BaseScene
|
||||
if (type == 0)
|
||||
{
|
||||
pageNums = 4;
|
||||
signContainer.Find("signText").GetComponent<Text>().text = "SIGN UP";
|
||||
signContainer.Find("signText").GetComponent<Text>().text = App.GetLocalString("SIGN UP");
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(true);
|
||||
signPage1.Find("BtnModiPass").gameObject.SetActive(false);
|
||||
@@ -1197,7 +1213,7 @@ public class LoginController : BaseScene
|
||||
else
|
||||
{
|
||||
pageNums = 4;
|
||||
signContainer.Find("signText").GetComponent<Text>().text = "RESET PASSWORD";
|
||||
signContainer.Find("signText").GetComponent<Text>().text = App.GetLocalString("RESET PASSWORD");
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(false);
|
||||
signPage1.Find("BtnModiPass").gameObject.SetActive(true);
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//比赛状态
|
||||
CompetitionStatus.text = competition.StatusVlaue.ToString();
|
||||
//参赛选手
|
||||
Contestant.text = competition.UserList.Count.ToString() + "Riders";
|
||||
Contestant.text = competition.UserList.Count.ToString() + App.GetLocalString("Riders");
|
||||
ShowPlayers(competition.UserList);
|
||||
//路书描述
|
||||
mapDescText.text = GetMaxString(competition.Dec, 400);
|
||||
@@ -335,7 +335,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
_raceStart = competition.Status == 3;
|
||||
_canEnter = competition.CanEnter;
|
||||
|
||||
Contestant.text = competition.UserList.Count.ToString() + "Riders";
|
||||
Contestant.text = competition.UserList.Count.ToString() + App.GetLocalString("Riders");
|
||||
ShowPlayers(competition.UserList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//比赛开始前倒计时
|
||||
if (count >= 0 && !competitionModel.recorderData.Saved)
|
||||
{
|
||||
ShowCountDown(count, "Get Ready!");//显示倒计时面板信息
|
||||
ShowCountDown(count, App.GetLocalString("Get Ready!"));//显示倒计时面板信息
|
||||
Timer.gameObject.SetActive(false);
|
||||
TimerTitle.gameObject.SetActive(false);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
//显示倒计时面板信息
|
||||
ShowCountDown(s.Item1, "Time Limit");
|
||||
ShowCountDown(s.Item1, App.GetLocalString("Time Limit"));
|
||||
#else
|
||||
ShowCountDown(s.Item1, "Get The First Place. Time Limit");
|
||||
#endif
|
||||
@@ -63,7 +63,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
//显示倒计时面板信息
|
||||
//ShowCountDown(s.Item1, "remaining");
|
||||
ShowCountDown(s.Item1, "Remaining Time");
|
||||
ShowCountDown(s.Item1, App.GetLocalString("Remaining Time"));
|
||||
}
|
||||
//显示当前选手骑行时间
|
||||
Timer.gameObject.SetActive(true);
|
||||
|
||||
@@ -410,7 +410,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
heartRate.text = (currentPlayer.HeartRate ?? 0).ToString();
|
||||
candance.text = $"{Math.Round(currentPlayer.Cadance, 0)}";
|
||||
preSlopeText.text = $"{Math.Round(currentPlayer.PreSlope, 1)}%";
|
||||
currentSlopeToatalDistanceText.text = $"Total:{Math.Round(currentPlayer.CurrentDistance, 0)}M";
|
||||
currentSlopeToatalDistanceText.text = $"{App.GetLocalString("Total")}:{Math.Round(currentPlayer.CurrentDistance, 0)}M";
|
||||
//坡度相关数据
|
||||
nextSlopeText.text = Math.Round(currentPlayer.NextSlope, 1).ToString() + "%";
|
||||
//nextSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.NextSlopeDistance, 0, "-{0}M");
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Assets.Scripts.UI.Control
|
||||
|
||||
isSelected = false;
|
||||
this.mInnerInputField.OnDeselect(eventData);
|
||||
transform.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
transform.Find("Placeholder").GetComponent<Text>().text = App.GetLocalString(placeHolderText);
|
||||
//var image = this.transform.GetComponent<Image>();
|
||||
//var png1 = Resources.Load<Sprite>("Images/ipt-0");
|
||||
//image.sprite = png1;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Assets.Scripts.UI.Control
|
||||
[RequireComponent(typeof(Text))]
|
||||
public class PFUIText : PFUIComponentBase
|
||||
{
|
||||
public string key;
|
||||
private Text text;
|
||||
|
||||
public string Text
|
||||
@@ -27,6 +28,28 @@ namespace Assets.Scripts.UI.Control
|
||||
protected void Awake()
|
||||
{
|
||||
text = this.transform.GetComponent<Text>();
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
key = text.text;//默认英文内容为key值
|
||||
}
|
||||
}
|
||||
protected void Start()
|
||||
{
|
||||
//Debug.Log(text.text);
|
||||
if (App.LanguageManager != null && App.LanguageManager.ContainsKey(key))
|
||||
{
|
||||
//Debug.Log(text.text);
|
||||
text.text = App.LanguageManager[key];
|
||||
}
|
||||
App.ChangeLanguageEvent += App_ChangeLanguageEvent;
|
||||
}
|
||||
|
||||
private void App_ChangeLanguageEvent()
|
||||
{
|
||||
if (App.LanguageManager != null && App.LanguageManager.ContainsKey(text.text))
|
||||
{
|
||||
text.text = App.LanguageManager[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,8 +71,8 @@ public class Confirm : PFUIPanel
|
||||
// return;
|
||||
//}
|
||||
//text.text = txt;
|
||||
_title.Text = title;
|
||||
_content.Text = content;
|
||||
_title.Text = App.GetLocalString(title);
|
||||
_content.Text = App.GetLocalString(content);
|
||||
_callback = callback;
|
||||
_cancelCallback = cancelCallback;
|
||||
}
|
||||
@@ -85,6 +85,9 @@ public class Confirm : PFUIPanel
|
||||
ok = "Yes";
|
||||
cancel = "No";
|
||||
}
|
||||
ok = App.GetLocalString(ok);
|
||||
cancel = App.GetLocalString(cancel);
|
||||
|
||||
_ok.transform.Find("Text").GetComponent<Text>().text = ok;
|
||||
_cancel.transform.Find("Text").GetComponent<Text>().text = cancel;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
UIManager.AddEvent(connectBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
if (!connectBtnText.text.Equals("DISCONNECT"))
|
||||
if (!connectBtnText.text.Equals(App.GetLocalString("DISCONNECT")))
|
||||
{
|
||||
foreach (var item in deviceList)
|
||||
{
|
||||
@@ -208,11 +208,13 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
var nontrainer = deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
|
||||
if (trainer || nontrainer)
|
||||
{
|
||||
connectBtnText.text = "DISCONNECT";
|
||||
connectBtnText.text = App.GetLocalString("DISCONNECT");
|
||||
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
|
||||
}
|
||||
else
|
||||
{
|
||||
connectBtnText.text = "CONNECT";
|
||||
connectBtnText.text = App.GetLocalString("CONNECT");
|
||||
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
|
||||
}
|
||||
|
||||
foreach (var item in deviceList)
|
||||
@@ -247,11 +249,13 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
var nontrainer = firstDevice.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
|
||||
if(trainer || nontrainer)
|
||||
{
|
||||
connectBtnText.text = "DISCONNECT";
|
||||
connectBtnText.text = App.GetLocalString("DISCONNECT");
|
||||
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
|
||||
}
|
||||
else
|
||||
{
|
||||
connectBtnText.text = "CONNECT";
|
||||
connectBtnText.text = App.GetLocalString("CONNECT");
|
||||
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
|
||||
}
|
||||
//connectBtn.text.text = "DISCOUNECT";
|
||||
noDevice.text = firstDevice.DeviceInfo.Name;
|
||||
|
||||
@@ -276,8 +276,8 @@ public class DeviceView : MonoBehaviour
|
||||
connectionPanel.SetActive(false);
|
||||
|
||||
logo.sprite = sprite0;
|
||||
noDevice.text = "NO DEVICE";
|
||||
searchState.text = "Searching...";
|
||||
noDevice.text = App.GetLocalString("NO DEVICE");
|
||||
searchState.text = App.GetLocalString("Searching...");
|
||||
|
||||
var hasDevice = false;
|
||||
if (SensorType == SensorType.SpeedCadence) {
|
||||
@@ -286,7 +286,7 @@ public class DeviceView : MonoBehaviour
|
||||
else {
|
||||
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
|
||||
}
|
||||
Debug.Log(hasDevice);
|
||||
//Debug.Log(hasDevice);
|
||||
if (hasDevice)
|
||||
{
|
||||
mSearchButton.SetActive(false);
|
||||
|
||||
@@ -54,13 +54,14 @@ namespace Assets.Scripts.UI.Prefab.Login
|
||||
{
|
||||
months.Add(new Dropdown.OptionData(m.ToString()));
|
||||
}
|
||||
|
||||
days = new List<Dropdown.OptionData>();
|
||||
genders = new List<Dropdown.OptionData>() {new Dropdown.OptionData("Male"), new Dropdown.OptionData("FeMale") };
|
||||
genders = new List<Dropdown.OptionData>() {new Dropdown.OptionData(App.GetLocalString("Male")), new Dropdown.OptionData(App.GetLocalString("FeMale")) };
|
||||
var countryJson = Resources.Load<TextAsset>("UI/flags-mini").text;
|
||||
countryList = JsonConvert.DeserializeObject<List<CountryModel>>(countryJson);
|
||||
countrys = countryList.Select(x => new Dropdown.OptionData(x.country)).ToList();
|
||||
countryDefaultValue = countryList.FindIndex(x => x.country == "中国");
|
||||
units = new List<Dropdown.OptionData>() { new Dropdown.OptionData("Metric"), new Dropdown.OptionData("Imperial") };
|
||||
units = new List<Dropdown.OptionData>() { new Dropdown.OptionData(App.GetLocalString("Metric")), new Dropdown.OptionData(App.GetLocalString("Imperial")) };
|
||||
}
|
||||
public Texture GetCountryImage(int index)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Assets.Scripts.UI.Prefab.MapList
|
||||
{
|
||||
public class MapFilterOptions
|
||||
{
|
||||
public static List<Dropdown.OptionData> distances = new string[] {"All",
|
||||
public static List<Dropdown.OptionData> distances = new string[] {App.GetLocalString("All"),
|
||||
"0-5KM",
|
||||
"5-10KM",
|
||||
"10-20KM",
|
||||
@@ -20,7 +20,7 @@ namespace Assets.Scripts.UI.Prefab.MapList
|
||||
"Over 200KM", }.Select(x=>new Dropdown.OptionData(x)).ToList();
|
||||
public static Dictionary<string, string> distanceDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"All","" },
|
||||
{App.GetLocalString("All"),"" },
|
||||
{"0-5KM","0-5" },
|
||||
{"5-10KM","5-10" },
|
||||
{"10-20KM","10-20" },
|
||||
@@ -32,7 +32,7 @@ namespace Assets.Scripts.UI.Prefab.MapList
|
||||
};
|
||||
public static Dictionary<string,string> diffDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"FLAT","0-100" },
|
||||
{App.GetLocalString("FLAT"),"0-100" },
|
||||
{"LV.4","100-250" },
|
||||
{"LV.3","250-350" },
|
||||
{"LV.2","350-550" },
|
||||
@@ -40,11 +40,22 @@ namespace Assets.Scripts.UI.Prefab.MapList
|
||||
{"HC","750-99999" },
|
||||
};
|
||||
public static List<Dropdown.OptionData> sorts = new string[] {
|
||||
"Near", "Trend","Name","Distance","Difficulty","Time"
|
||||
App.GetLocalString("Near"), App.GetLocalString("Trend"), App.GetLocalString("Name"), App.GetLocalString("Distance"), App.GetLocalString("Difficulty"), App.GetLocalString("Time")
|
||||
}.Select(x => new Dropdown.OptionData(x)).ToList();
|
||||
|
||||
public static Dictionary<string, string> sortsDict = new Dictionary<string, string>()
|
||||
{
|
||||
{App.GetLocalString("Near"),"Near" },
|
||||
{App.GetLocalString("Trend"),"Trend" },
|
||||
{App.GetLocalString("Name"),"Name" },
|
||||
{App.GetLocalString("Distance"),"Distance" },
|
||||
{App.GetLocalString("Difficulty"),"Difficulty" },
|
||||
{App.GetLocalString("Time"),"Time" },
|
||||
};
|
||||
|
||||
public static Dictionary<string, string> diffDisplayDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"FLAT","0-100" },
|
||||
{App.GetLocalString("FLAT"),"0-100" },
|
||||
{"LV.4","100-250" },
|
||||
{"LV.3","250-350" },
|
||||
{"LV.2","350-550" },
|
||||
|
||||
@@ -128,6 +128,7 @@ public class EarthController : PFUIPanel
|
||||
map.OnCountryEnter += (int countryIndex, int regionIndex) =>
|
||||
{
|
||||
map.autoRotationSpeed = 0f;
|
||||
|
||||
var country = map.countries[countryIndex];
|
||||
if (country.name.ToLower().Contains("taiwan"))
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
||||
mSexDropdown.ClearOptions();
|
||||
mSexDropdown.AddOptions(new List<string>
|
||||
{
|
||||
"Male","Female"
|
||||
App.GetLocalString("Male"),App.GetLocalString("Female")
|
||||
});
|
||||
mUnitDropdown.ClearOptions();
|
||||
mUnitDropdown.AddOptions(UIManager.Instance.loginRegOptions.units);
|
||||
|
||||
@@ -226,7 +226,9 @@ public class MapListController : PFUIPanel
|
||||
drop.value = 0;
|
||||
drop.onValueChanged.AddListener((int index)=>
|
||||
{
|
||||
sort = drop.options[index].text;
|
||||
var text = drop.options[index].text;
|
||||
|
||||
sort = MapFilterOptions.sortsDict[text];
|
||||
if (sort == "Trend")
|
||||
{
|
||||
sort = "Hot";
|
||||
|
||||
@@ -85,10 +85,10 @@ public class RaceScript : PFUIPanel
|
||||
var map = currentItem.GetComponent<RaceItemScript>().mapCompetition;
|
||||
if (map.Status == 1)
|
||||
{
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Start for Registration";
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = App.GetLocalString("Start for Registration");
|
||||
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
|
||||
map.StartApplyTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
|
||||
currentItem.Find("GetReadyContainer-2/Title").GetComponent<Text>().text = "Deadline for Registration";
|
||||
currentItem.Find("GetReadyContainer-2/Title").GetComponent<Text>().text = App.GetLocalString("Deadline for Registration");
|
||||
currentItem.Find("GetReadyContainer-2/Value").GetComponent<Text>().text =
|
||||
map.EndApplyTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
|
||||
|
||||
@@ -104,7 +104,7 @@ public class RaceScript : PFUIPanel
|
||||
}
|
||||
else if (map.Status == 3)
|
||||
{
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Start Time";
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = App.GetLocalString("Start Time");
|
||||
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
|
||||
map.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class RaceScript : PFUIPanel
|
||||
{
|
||||
currentItem.Find("GetReadyContainer").GetComponent<CanvasGroup>().alpha = 1;
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text
|
||||
= map.HasJoin ? "Get Ready" : "Start Time";
|
||||
= App.GetLocalString(map.HasJoin ? "Get Ready" : "Start Time");
|
||||
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text
|
||||
= map.HasJoin ? Utils.GetCountDown(time): map.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
|
||||
}
|
||||
|
||||
@@ -970,11 +970,16 @@ public class UIManager : MonoBehaviour
|
||||
Confirm confirm = null;
|
||||
public static void ShowConfirm(string title, string content, UnityAction action,int type = 2,UnityAction cancel = null)
|
||||
{
|
||||
|
||||
if (UIManager.Instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(UIManager.Instance.confirm == null)
|
||||
|
||||
title = App.GetLocalString(title);
|
||||
content = App.GetLocalString(content);
|
||||
|
||||
if (UIManager.Instance.confirm == null)
|
||||
{
|
||||
UIManager.Instance.confirm = UIManager.Instance.GetInstance<Confirm>("Confirm", ref UIManager.Instance.confirm);
|
||||
UIManager.Show(UIManager.Instance.confirm, null, true);
|
||||
|
||||
Reference in new issue
Block a user