This commit is contained in:
Caiyanpeng committed 2022-01-11 11:18:09 +08:00
1 parent d811eb8514
commit 5bf7635f1e
23 files changed
+4654 -1486

No files matched your search

+9 -1
View File
@@ -96,7 +96,7 @@ namespace Assets.Scripts.Apis.Models
public bool IsFav { get; set; }
}
public class MapRouteAreaDetail
public class MapRouteAreaDetail
{
/// <summary>
///
@@ -141,6 +141,14 @@ namespace Assets.Scripts.Apis.Models
public bool IsFav { get; set; }
public string CreateUserHead { get; set; }
public string CreateUserName { get; set; }
public List<MapRouteAreaDetailUser> UserList { get; set; }
}
public class MapRouteAreaDetailUser
{
public int Id { get; set; }
public string NickName { get; set; }
public string WxHeadImg { get; set; }
public string Phone { get; set; }
}
public class MapRouteAreaRouteList
+4 -1
View File
@@ -19,7 +19,7 @@ public delegate void ChangeLanguageDelegate();
public static class App
{
public static string Host = "http://192.168.0.101:5083/";
public static string Host = "http://192.168.0.101:5085/";
public static string AppVersion = Application.version;
@@ -152,6 +152,9 @@ public static class App
{
language = "en";
}
#if UNITY_EDITOR
language = "en";
#endif
var a = Resources.Load<TextAsset>("UI/language");
dic = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(a.text);
if (dic.ContainsKey(language))
+14 -14
View File
@@ -251,16 +251,16 @@ public class MainController : BaseScene
}
void FinishMessageLeft()
{
#if UNITY_STANDALONE_WIN
msgIndex = 0;
if (msgs != null)
{
foreach (var item in msgs)
{
item.DOFade(0, 0.3f);
}
}
#endif
//#if UNITY_STANDALONE_WIN
// msgIndex = 0;
// if (msgs != null)
// {
// foreach (var item in msgs)
// {
// item.DOFade(0, 0.3f);
// }
// }
//#endif
}
void FinishMessageRight()
@@ -453,13 +453,13 @@ public class MainController : BaseScene
//距离50
if (item.EndDistance >= 50)
{
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"50KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"50KM"}</color> in <color=#f93086>${item.RouteName}</color>!";
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"50KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"50KM"}</color> in <color=#f93086>{item.RouteName}</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=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"100KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"100KM"}</color> in <color=#f93086>${item.RouteName}</color>!";
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"100KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"100KM"}</color> in <color=#f93086>{item.RouteName}</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}100KM");
}
////速度35
@@ -471,13 +471,13 @@ public class MainController : BaseScene
//速度50
if (item.Speed >= 50)
{
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行速度达到<color=#e3d427>{Math.Round(item.Speed,2)}KM/H</color>!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color> in <color=#f93086>${item.RouteName}</color>!";
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行速度达到<color=#e3d427>{Math.Round(item.Speed,2)}KM/H</color>!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color> in <color=#f93086>{item.RouteName}</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM/H");
}
//功体比
if (item.WeightKg >= 4)
{
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中功体比达到<color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>!" : $" riding PWR reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color> in <color=#f93086>${item.RouteName}</color>!";
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中功体比达到<color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>!" : $" riding PWR reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color> in <color=#f93086>{item.RouteName}</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}3WeightKg");
}
}
@@ -35,19 +35,24 @@ public class HomeController : PFUIPanel
protected override void Start()
{
base.Start();
UIManager.AddEvent(transform.Find("TodayData/Avatar").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
#if UNITY_ANDROID || UNITY_IOS
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
newNav = nav;
UIManager.AddEvent(transform.Find("TodayData/Avatar").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowResultListPanel();
});
#else
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
mainNav.ShowExit();
#endif
@@ -251,6 +256,10 @@ public class HomeController : PFUIPanel
//todayData.Find("Datas/Distance/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0")}";
todayData.Find("Datas/Climb/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0.0")}";
todayData.Find("Datas/Carlories/Rank").GetComponent<Text>().text = summary.CurrentTotalKcal == 0 ? "——" : $"+{summary.CurrentTotalKcal.ToString("#0")}";
#if UNITY_STANDALONE_WIN
todayData.Find("NickName").GetComponent<Text>().text = App.CurrentUser.Nickname;
todayData.Find("ID").GetComponent<Text>().text = $"ID:{App.CurrentUser.Id.ToString("000000")}";
#endif
}
}
@@ -110,7 +110,7 @@ public class MapListController : PFUIPanel
}));
newNav = nav;
#else
topContainer = transform.Find("Panel").Find("Top");
topContainer = transform.Find("Panel/Top/Container");
#endif
#if UNITY_STANDALONE_WIN
btnMapMode = this.transform.Find("SwitchMode").gameObject;
@@ -318,11 +318,13 @@ public class MapListController : PFUIPanel
mc.gameObject.SetActive(true);
mc.GetComponent<CanvasGroup>().alpha = 0;
mc.GetComponent<CanvasGroup>().DOFade(1, 0.3f);
if (isFocusSearch)
#else
var topRect = topContainer;
#endif
if (isFocusSearch)
{
topRect.Find("SearchInput").GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
}
#endif
}
void onEndEdit()
{
@@ -508,6 +510,8 @@ public class MapListController : PFUIPanel
}
#if UNITY_STANDALONE_WIN
btnMapMode.SetActive(App.CurrentRouteType == "My Upload");
topContainer.Find("line2").gameObject.SetActive(App.CurrentRouteType == "All Route");
topContainer.Find("SearchInput").gameObject.SetActive(App.CurrentRouteType == "All Route");
#else
transform.Find("Upload").gameObject.SetActive(App.CurrentRouteType == "My Upload");
#endif
@@ -43,25 +43,27 @@ public class MapListExtraController : PFUIPanel
{
typeSelector.Find("Container/Route").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
typeSelector.Find("Container1/Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
typeSelector.Find("Container/Line").gameObject.SetActive(true);
typeSelector.Find("Container1/Line").gameObject.SetActive(false);
SetImageStyle(true);
p1.DOLocalMoveX(p1originx, 0.5f);
p2.DOLocalMoveX(p2originx, 0.5f);
transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>().ShowButton("Custom");
HandleMobileNavCustom(true);
});
UIManager.AddEvent(typeSelector.Find("Container1/Collection").gameObject, EventTriggerType.PointerClick, b =>
{
typeSelector.Find("Container/Route").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
typeSelector.Find("Container1/Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
typeSelector.Find("Container/Line").gameObject.SetActive(false);
typeSelector.Find("Container1/Line").gameObject.SetActive(true);
p1.DOLocalMoveX(p1originx - 764f, 0.5f);
p2.DOLocalMoveX(p2originx - 764f, 0.5f);
transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>().HideButton("Custom");
SetImageStyle(false);
p1.DOLocalMoveX(p1originx - listWidth, 0.5f);
p2.DOLocalMoveX(p2originx - listWidth, 0.5f);
HandleMobileNavCustom(false);
});
}
#if UNITY_STANDALONE_WIN
float listWidth = 1480f;
#else
float listWidth = 764f;
#endif
protected override void Start()
{
@@ -78,6 +80,40 @@ public class MapListExtraController : PFUIPanel
}
private int pageIndex = 0;
void HandleMobileNavCustom(bool b)
{
#if !UNITY_STANDALONE_WIN
if (b)
{
transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>().ShowButton("Custom");
}
else
{
transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>().HideButton("Custom");
}
#else
transform.Find("Panel/Top/Container").gameObject.SetActive(b);
#endif
}
void SetImageStyle(bool b)
{
#if !UNITY_STANDALONE_WIN
typeSelector.Find("Container/Line").gameObject.SetActive(b);
typeSelector.Find("Container1/Line").gameObject.SetActive(!b);
#else
if (b)
{
typeSelector.Find("Container").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086ff");
typeSelector.Find("Container1").GetComponent<Image>().color = Utils.HexToColorHtml("#f9308600");
}
else
{
typeSelector.Find("Container").GetComponent<Image>().color = Utils.HexToColorHtml("#f9308600");
typeSelector.Find("Container1").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086ff");
}
#endif
}
public void HandleCollection()
{
if (App.CurrentRouteType == "My Collection")
@@ -93,9 +129,8 @@ public class MapListExtraController : PFUIPanel
p2.localPosition = new Vector3(p2originx, p2.localPosition.y, p2.localPosition.z);
typeSelector.Find("Container/Route").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
typeSelector.Find("Container1/Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
typeSelector.Find("Container/Line").gameObject.SetActive(true);
typeSelector.Find("Container1/Line").gameObject.SetActive(false);
transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>().ShowButton("Custom");
SetImageStyle(true);
HandleMobileNavCustom(true);
}
private async void GetList()
{
@@ -60,34 +60,35 @@ public class NewRouteDetailController : PFUIPanel
}
void Start()
{
UIManager.AddEvent(transform.Find("Container/Left/Fav").gameObject, EventTriggerType.PointerClick, async b =>
{
Assets.Scripts.Apis.JsonResult<object> res = null;
var p = ((PointerEventData)b).pointerEnter;
var act = ((PointerEventData)b).pointerEnter.GetComponent<Image>().sprite.name == "icon_heji_like";
if (act)
{
res = await ConfigHelper.mapApi.CancelAreaFav(area.Id);
}
else
{
res = await ConfigHelper.mapApi.AddAreaFav(area.Id);
}
if (res.result)
{
p.GetComponent<Image>().sprite = FavDict[!act];
//Utils.showToast(null, App.GetLocalString("Success"), type: 1);
}
else
{
Utils.showToast(null, res.errMsg);
}
});
#if UNITY_ANDROID || UNITY_IOS
var nav = transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 0, 3, 4, 6, 7 }, 0);
newNav = nav;
UIManager.AddEvent(transform.Find("Container/Left/Fav").gameObject, EventTriggerType.PointerClick, async b =>
{
Assets.Scripts.Apis.JsonResult<object> res = null;
var p = ((PointerEventData)b).pointerEnter;
var act = ((PointerEventData)b).pointerEnter.GetComponent<Image>().sprite.name == "icon_heji_like";
if (act)
{
res = await ConfigHelper.mapApi.CancelAreaFav(area.Id);
}
else
{
res = await ConfigHelper.mapApi.AddAreaFav(area.Id);
}
if (res.result)
{
p.GetComponent<Image>().sprite = FavDict[!act];
//Utils.showToast(null, App.GetLocalString("Success"), type: 1);
}
else
{
Utils.showToast(null, res.errMsg);
}
});
#else
transform.Find("MainNav").GetComponent<MainNav>().ShowBack();
#endif
@@ -115,18 +116,19 @@ public class NewRouteDetailController : PFUIPanel
OnEndDrag(null);
}
}
timer -= Time.deltaTime;
while (timer < 0)
{
var list = MapUDPService.GetAllOnlineUserList();
if (list.Count > 0 && routeIds != null)
{
//当前集合骑行人数
var currentUserCount = list.Where(c => routeIds.Contains(c.RouteId)).Count();
Debug.Log($"当前集合骑行人数{currentUserCount}");
}
timer += 1f;
}
//timer -= Time.deltaTime;
//while (timer < 0)
//{
// var list = MapUDPService.GetAllOnlineUserList();
// if (list.Count > 0 && routeIds != null)
// {
// var onlineUserList = list.Where(c => routeIds.Contains(c.RouteId)).ToList();
// //当前集合骑行人数
// var currentUserCount = onlineUserList.Count();
// Debug.Log($"当前集合骑行人数{currentUserCount}");
// }
// timer += 1f;
//}
}
MapRouteAreaItem area;
int pageIndex = 0, pageSize = 10;
@@ -261,6 +263,18 @@ public class NewRouteDetailController : PFUIPanel
LayoutRebuilder.ForceRebuildLayoutImmediate(transform.Find("Container/Left/DescScroll").GetComponent<ScrollRect>().content);
transform.Find("Container/Left/Fav").GetComponent<Image>().sprite = FavDict[res.data.IsFav];
LayoutRebuilder.ForceRebuildLayoutImmediate(transform.Find("Container/Left/RideContainer").GetComponent<RectTransform>());
var userinfo = Resources.Load<GameObject>("UI/Prefab/NewRoute/UserInfo");
transform.Find("Container/Left/NOData").gameObject.SetActive(res.data.UserList.Count == 0);
transform.Find("Container/Left/Users").DestroyChildren();
foreach (var item in res.data.UserList)
{
var info = Instantiate<GameObject>(userinfo);
Utils.DisplayImageTempDict(info.transform.Find("Avatar").GetComponent<Image>(), item.WxHeadImg, caches);
info.transform.Find("NickName").GetComponent<Text>().text = item.NickName;
info.transform.SetParent(transform.Find("Container/Left/Users"));
info.transform.localScale = Vector3.one;
}
}
}
@@ -21,6 +21,7 @@ public class NewRouteOverviewController: PFUIPanel
{
caches = new Dictionary<string, Texture>();
scroll = transform.Find("Container/Right/Scroll View").GetComponent<ScrollRect>();
#if !UNITY_STANDALONE_WIN
scroll.onValueChanged.RemoveAllListeners();
scroll.onValueChanged.AddListener(p=>
{
@@ -35,6 +36,7 @@ public class NewRouteOverviewController: PFUIPanel
DOTween.To(() => rect.offsetMax, x => rect.offsetMax = x, new Vector2(rect.offsetMax.x, -68), 0.5f);
}
});
#endif
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}