一波小改动

This commit is contained in:
Caiyanpeng committed 2021-12-30 16:51:04 +08:00
1 parent c5500c269f
commit 333c99fb46
18 files changed
+480 -137

No files matched your search

+6 -1
View File
@@ -193,7 +193,12 @@ public static class App
//Host = "http://192.168.0.101:5085/";
//UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
//TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
//Debug.unityLogger.logEnabled = false;
Debug.unityLogger.logEnabled = false;
#else
//Host = "http://pf.juze.pro/";
//Host = "http://192.168.0.101:5087/";
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
#endif
if (!FB.IsInitialized)
{
+41 -25
View File
@@ -37,6 +37,7 @@ public class MainController : BaseScene
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = Vector2.zero;
rectTransform.offsetMax = Vector2.zero;
transform.Find("GameObject/Version").gameObject.SetActive(false);
//var rect1 = transform.Find("GameObject").GetComponent<RectTransform>();
//rect1.anchorMin = Vector2.zero;
//rect1.anchorMax = Vector2.one;
@@ -175,15 +176,16 @@ public class MainController : BaseScene
if (msgIndex >= 6) //
{
//msgIndex = 0;
//m.transform.DOLocalMoveY(m.transform.localPosition.y - 38, 0.5f);
foreach (var item in msgs)
{
item.transform.DOLocalMoveY(item.transform.localPosition.y - 38, 0.5f);
}
m.DOFade(0, 0.5f).onComplete = () =>
{
SetMessage(m, e);
m.transform.localPosition = 1 * msgLocation;
m.DOFade(1, 0.5f);
foreach (var item in msgs.Where((x, i) => i != selectIndex))
{
item.transform.DOLocalMoveY(item.transform.localPosition.y - 38, 0.5f);
}
};
}
else
@@ -197,6 +199,7 @@ public class MainController : BaseScene
}
m.DOFade(1, 0.5f);
}
m.transform.SetAsLastSibling();
msgIndex++;
}
@@ -214,7 +217,12 @@ public class MainController : BaseScene
#else
if (!(bool)sender)
{
FinishMessage6();
//FinishMessage6();
transform.Find("GameObject").SetAsFirstSibling();
}
else
{
transform.Find("GameObject").SetSiblingIndex(1);
}
#endif
}
@@ -253,15 +261,23 @@ public class MainController : BaseScene
{
if (e.routeId > 0)
{
App.RouteIdParam = e.routeId;
SceneManager.LoadScene("Ride");
UIManager.ShowConfirm(App.GetLocalString("RIDE NOW"), App.GetLocalLanguage() == "zh"? $"<color=#fff>是否要加入</color><color=#f93086>{e.routeName}</color><color=#fff>骑行?</color>" :$"<color=#fff>Join</color> <color=#f93086>{e.routeName}</color><color=#fff>?</color>", () =>
{
App.RouteIdParam = e.routeId;
SceneManager.LoadScene("Ride");
});
}
//Debug.Log(e.routeId);
});
m.transform.Find("Avatar").GetComponent<RawImage>().texture = null;
Utils.DisplayHead(m.transform.Find("Avatar").GetComponent<RawImage>(), e.avatar);
m.transform.Find("Nickname").GetComponent<Text>().text = e.nickname;
m.transform.Find("Content").GetComponent<Text>().text = e.content;
var txt = m.transform.Find("TextContainer/Content").GetComponent<RectTransform>();
txt.GetComponent<Text>().text = e.content;
LayoutRebuilder.ForceRebuildLayoutImmediate(txt);
Debug.Log(e.content + txt.sizeDelta.x);
m.GetComponent<HomeMessageController>().isAnimated = false;
m.GetComponent<HomeMessageController>().textWidth = txt.sizeDelta.x;
}
CanvasGroup msg;
void fade0()
@@ -387,51 +403,51 @@ public class MainController : BaseScene
var message = "";
if (item.TotalTicks == 0)
{
message = lang=="zh"?$"发起了对<color=#ff2742>{item.RouteName}</color>的挑战": $"start a challenge to the<color=#ff2742>{item.RouteName}</color>";
message = lang=="zh"?$"发起了对<color=#f93086>{item.RouteName}</color>的挑战!" : $"started riding <color=#f93086>{item.RouteName}</color>!";
}
if (item.IsCompleted)
{
message = lang == "zh" ? $"完成了<color=#ff2742>{item.RouteName}</color>的挑战": $"completed the challenge of the<color=#ff2742>{item.RouteName}</color>";
message = lang == "zh" ? $"完成了<color=#f93086>{item.RouteName}</color>的挑战!" : $"completed <color=#f93086>{item.RouteName}</color> ride!";
}
if (!string.IsNullOrEmpty(message))
{
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}");
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name,item.RouteName), $"{item.RouteId}{item.Name}");
}
}
if (item.Point[0] == -1d)
if (item.Point!=null && item.Point.Length>0 && item.Point[0] == -1d)
{
var message = $"{item.Name}上线了";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.Id}{item.LastActiveTime}{item.Point}");
var message = lang == "zh" ? $"{item.Name}进入了 运动地球" : "entered PowerFun";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.Id}{item.LastActiveTime}{item.Point}");
}
//距离50
if (item.EndDistance >= 50)
{
var message = lang == "zh" ? $"在骑行过程中突破了<color=#00ff00>{"50KM"}</color>的挑战" : $"distance up to <color=#00ff00>{"50KM"}</color> during riding!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM");
var message = lang == "zh" ? $"骑行里程突破<color=#e3d427>{"50KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"50KM"}</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM");
}
//距离100
if (item.EndDistance >= 100)
{
var message = lang == "zh" ? $"在骑行过程中突破了<color=#00ff00>{"100KM"}</color>的挑战": $"distance up to <color=#00ff00>{"100KM"}</color> during riding!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM");
var message = lang == "zh" ? $"骑行里程突破<color=#e3d427>{"100KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"100KM"}</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}100KM");
}
//速度35
if (item.Speed >= 35)
{
var message = lang == "zh" ? $"在骑行过程中速度达到了惊人的<color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H": $"speed up to <color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H during riding!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}35KM/H");
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}35KM/H");
}
//速度50
if (item.Speed >= 50)
{
var message = lang == "zh" ? $"在骑行过程中速度达到了惊人的<color=#ff0000>{Math.Round(item.Speed,2)}</color>KM/H" : $"speed up to <color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H during riding!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM/H");
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed,2)}</color>KM/H!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM/H");
}
//功体比
if (item.WeightKg >= 3)
{
var message = lang == "zh" ? $"在骑行过程中功体比达到了惊人的<color=#0000ff>{Math.Round(item.WeightKg, 2)}</color>w/kg": $"w/kg up to <color=#0000ff>{Math.Round(item.WeightKg, 2)}</color>w/kg during riding!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}3WeightKg");
var message = lang == "zh" ? $"骑行功体比突破<color=#e3d427>{Math.Round(item.WeightKg, 2)}</color>w/kg!" : $" riding w/kg reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}</color>w/kg!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}3WeightKg");
}
}
}
@@ -451,7 +467,7 @@ public class MainController : BaseScene
{
foreach (var item in res.data)
{
EventQueueSystem.QueueEvent(new LinkedMessageEvent(-1, item.Message, item.WxHeadImg, item.NickName));
EventQueueSystem.QueueEvent(new LinkedMessageEvent(-1, item.Message, item.WxHeadImg, item.NickName,null));
}
}
}
@@ -90,6 +90,7 @@ namespace Assets.Scenes.Ride.Scripts
public class LinkedMessageEvent : GameEvent
{
public int routeId;//线路Id
public string routeName;
public string content;//消息
public string avatar;
public string nickname;
@@ -98,12 +99,13 @@ namespace Assets.Scenes.Ride.Scripts
this.routeId = routeId;
this.content = content;
}
public LinkedMessageEvent(int routeId, string content,string avatar,string nickname)
public LinkedMessageEvent(int routeId, string content,string avatar,string nickname,string routeName)
{
this.routeId = routeId;
this.content = content;
this.avatar = avatar;
this.nickname = nickname;
this.routeName = routeName;
}
private void CreateContent()
+15 -4
View File
@@ -176,9 +176,20 @@ public class NewMainNav : MonoBehaviour
#if UNITY_ANDROID || UNITY_IOS
UIManager.AddEvent(transform.Find("Delay").gameObject, EventTriggerType.PointerClick, b =>
{
delayTime = 3;
transform.Find("Delay/Tooltips").gameObject.SetActive(true);
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
if (delayTime <= 0)
{
delayTime = 3;
transform.Find("Delay/Tooltips").gameObject.SetActive(true);
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
}
else
{
delayTime = 0;
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
transform.Find("Delay/Tooltips").gameObject.SetActive(false);
};
}
});
#endif
//transform.Find("Delay").GetComponent<PfUIButton>().showTooltip = true;
@@ -246,7 +257,7 @@ public class NewMainNav : MonoBehaviour
isTouch = false;
hideTime += 5;
}
Debug.Log(Input.touchCount);
//Debug.Log(Input.touchCount);
if (delayTime < 0)
{
Debug.Log("小时");
@@ -100,7 +100,7 @@ public class MapListController : PFUIPanel
nav.SetButtonActive(new List<int> { 0, 3, 4, 6, 7 }, 0,
new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/Mobile/map_筛选"), () =>
{
OpenFilter();
OpenFilter(false);
}));
newNav = nav;
#else
@@ -286,7 +286,7 @@ public class MapListController : PFUIPanel
}
caches = new Dictionary<string, Texture>();
}
public void OpenFilter()
public void OpenFilter(bool isFocusSearch = true)
{
#if UNITY_ANDROID || UNITY_IOS
var topRect = transform.Find("Top").GetComponent<RectTransform>();
@@ -300,7 +300,10 @@ public class MapListController : PFUIPanel
mc.GetComponent<CanvasGroup>().alpha = 0;
mc.GetComponent<CanvasGroup>().DOFade(1, 0.3f);
#endif
topRect.Find("SearchInput").GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
if (isFocusSearch)
{
topRect.Find("SearchInput").GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
}
}
void onEndEdit()
{
@@ -80,7 +80,7 @@ public class NewRouteDetailController : PFUIPanel
if (res.result)
{
p.GetComponent<Image>().sprite = FavDict[!act];
Utils.showToast(null, App.GetLocalString("Success"), type: 1);
//Utils.showToast(null, App.GetLocalString("Success"), type: 1);
}
else
{
+1 -1
View File
@@ -12,7 +12,7 @@ using Assets.Scripts;
//{
public class PFUIPanel : UIBehaviour
{
public NewMainNav newNav = null;
[HideInInspector]public NewMainNav newNav = null;
public void OpenURL(string url)
{
Application.OpenURL(url);
@@ -115,22 +115,22 @@ public class UserInfoController : PFUIPanel
infoPanel.Find("Container/Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
infoPanel.Find("Container/BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
infoPanel.Find("Container/WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
infoPanel.Find("Container/Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToString("dd-MM-yyyy");
infoPanel.Find("Container/MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToString("dd-MM-yyyy");
infoPanel.Find("Container/Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("Container/Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("Container/BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("Container/WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToLocalString("dd-MM-yyyy");
infoPanel.Find("Container/MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToLocalString("dd-MM-yyyy");
#else
infoPanel.Find("Ftp").Find("Value").GetComponent<Text>().text = user.FTP.ToString();
infoPanel.Find("MHR").Find("Value").GetComponent<Text>().text = user.MaxHeartRate.ToString();
infoPanel.Find("Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
infoPanel.Find("BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
infoPanel.Find("WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
infoPanel.Find("Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("dd-MM-yyyy");
infoPanel.Find("Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToString("dd-MM-yyyy");
infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToString("dd-MM-yyyy");
infoPanel.Find("Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToLocalString("dd-MM-yyyy");
infoPanel.Find("WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToLocalString("dd-MM-yyyy");
infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToLocalString("dd-MM-yyyy");
#endif
if (user.Sex == 2)
{
@@ -78,7 +78,7 @@ public class LocalRouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterH
}
Name.text = record.RouteName;
Time.text = record.StartTime.ToString("HH:mm:ss dd-MM-yyyy");
Time.text = record.StartTime.ToLocalString("HH:mm:ss dd-MM-yyyy");
RidingTime.text = $"<color={titleColor}>{App.GetLocalString("Riding time")}:</color>{Helper.FormatTicks(record.Ticks)}";
RidingDistance.text = $"<color={titleColor}>{App.GetLocalString("Mileage")}:</color>{record.EndDistance.ToString("#0.00")}KM";
Device.text = $"<color={titleColor}>{App.GetLocalString("Cycling equipment")}:</color>{record.ManufacturerName}";
@@ -135,7 +135,7 @@ public class RouteItem : MonoBehaviour
//Utils.DisplayImage(transform.Find("BigLeft/CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToString("HH:mm:ss dd-MM-yyyy");
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToLocalString("HH:mm:ss dd-MM-yyyy");
row1.Find("Time").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Riding Time")}:</color>{result.TrainingTime}";
row1.Find("Distance").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Mileage")}:</color>{result.EndDistance.ToString("#0.00")}KM";
row1.Find("Times").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Times")}:</color>{result.Count}";
+14
View File
@@ -808,5 +808,19 @@ namespace Assets.Scripts
// Stops the location service if there is no need to query location updates continuously.
Input.location.Stop();
}
public static string ToLocalString(this DateTime time, string format)
{
if (App.GetLocalLanguage() == "en")
{
return time.ToString(format);
}
else
{
if(format == "HH:mm:ss dd-MM-yyyy")
return time.ToString("yyyy-MM-dd HH:mm:ss");
else
return time.ToString("yyyy-MM-dd");
}
}
}
}