Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo

This commit is contained in:
lishuo committed 2022-01-25 09:28:20 +08:00
commit 5340d3d58b
17 files changed
+1341 -99

No files matched your search

+6 -1
View File
@@ -14,12 +14,13 @@ using System.Threading.Tasks;
using System.Timers;
using Newtonsoft.Json;
using Facebook.Unity;
using Assets.Scenes.Ride.Scripts;
public delegate void ChangeLanguageDelegate();
public static class App
{
public static string Host = "http://192.168.0.101:5087/";
public static string Host = "http://192.168.0.101:5084/";
public static string AppVersion = Application.version;
@@ -114,6 +115,9 @@ public static class App
#region 语言改变事件
public static event ChangeLanguageDelegate ChangeLanguageEvent;
static Dictionary<string, Dictionary<string, string>> dic;
//全局队列保留最后5条消息
public static Queue<LinkedMessageEvent> globalMessageQueue = null;
public static string GetLocalLanguage()
{
return language;
@@ -224,6 +228,7 @@ public static class App
App._IsRowerMode = bool.Parse(isRower);
}
//App.ChangeLanguage("en");
globalMessageQueue = new Queue<LinkedMessageEvent>();
Screen.sleepTimeout = SleepTimeout.NeverSleep;
}
}
+1 -1
View File
@@ -622,7 +622,7 @@ public class LoginController : BaseScene
//#endif
App.notifyContent = r.data.Value<string>("Content");
if (r.data.Value<int>("Id") != notifyId)//r.data.Value<int>("Id") != notifyId
if (r.data.Value<int>("Id") != notifyId && r.data.Value<int>("Id") != 0)//r.data.Value<int>("Id") != notifyId
{
UIManager.ShowNewsModal();
PlayerPrefs.SetInt("notifyId", r.data.Value<int>("Id"));
+29 -69
View File
@@ -71,6 +71,7 @@ public class MainController : BaseScene
CanvasGroup rightMessage;
private void InitialMessage()
{
Debug.Log("初始化组件");
#if UNITY_STANDALONE_WIN
msgLocation = 1 * msg.transform.localPosition;
var go = transform.Find("GameObject");
@@ -100,7 +101,6 @@ public class MainController : BaseScene
DestroyImmediate(transform.Find("GameObject/Message").gameObject);
var m = Resources.Load<GameObject>("UI/Prefab/NewRoute/Mobile/Message");
rightMessage = Instantiate<GameObject>(m).GetComponent<CanvasGroup>();
rightMessage.transform.SetParent(go);
rightMessage.transform.localScale = Vector3.one;
rightMessage.transform.localPosition = 1 * msgLocation;
@@ -121,63 +121,38 @@ public class MainController : BaseScene
#endif
}
private void ShowQueueMessage()
{
int i = 0,count = App.globalMessageQueue.Count;
while (App.globalMessageQueue.Count != 0)
{
//SetMessage(msgs[i], App.globalMessageQueue.Dequeue());
var v = 1 * msgLocation;
// 0 1 2
// 2 1 0
msgs[i].transform.localPosition = new Vector3(v.x, v.y - (count - 1 - i) * moveOffset, v.z);
msgs[i].alpha = 1;
msgs[i].gameObject.SetActive(true);
SetMessage(msgs[i], App.globalMessageQueue.Dequeue());
i++;
}
msgIndex = i;
}
private void LinkedMessageHandler(LinkedMessageEvent e)
{
//msg.transform.Find("Content")
if (App.globalMessageQueue.Count == 5)
{
App.globalMessageQueue.Dequeue();
}
App.globalMessageQueue.Enqueue(e);
emptyt = 0;
//#if UNITY_STANDALONE_WIN
// Debug.Log(e.content);
// if (App.currentPageIsHome)
// {
// DoMessage(e);
// }
// else
// {
// DoMessageRight(e);
// }
//#else
// if (App.currentPageIsHome)
// {
// DoMessage6(e);
// }
//#endif
if (App.currentPageIsHome)
{
DoMessage6(e);
}
}
private void DoMessageRight(LinkedMessageEvent e)
{
SetMessage(rightMessage, e);
rightMessage.DOFade(1, 0.5f).onComplete = () => Invoke("fade0", 0.8f);
}
private void DoMessage(LinkedMessageEvent e)
{
var selectIndex = msgIndex % 3;
var m = msgs[selectIndex];
if (msgIndex >= 3) //
{
//msgIndex = 0;
m.DOFade(0, 0.5f).onComplete = ()=>
{
SetMessage(m, e);
m.transform.localPosition = new Vector3(msgLocation.x, msgLocation.y - 54 * 2, msgLocation.z);
m.DOFade(1, 0.5f);
foreach (var item in msgs.Where((x, i) => i != selectIndex))
{
item.transform.DOLocalMoveY(item.transform.localPosition.y + 54, 0.5f);
}
};
}
else
{
SetMessage(m, e);
m.transform.localPosition = new Vector3(msgLocation.x, msgLocation.y - 54 * (msgIndex % 3), msgLocation.z);
m.DOFade(1, 0.5f);
}
msgIndex++;
}
#if UNITY_STANDALONE_WIN
float moveOffset = 74;
#else
@@ -187,6 +162,7 @@ public class MainController : BaseScene
{
//Resources.UnloadUnusedAssets();
//GC.Collect();
Debug.Log(msgIndex);
var selectIndex = msgIndex % 5;
var m = msgs[selectIndex];
if (msgIndex >= 5) //
@@ -208,7 +184,6 @@ public class MainController : BaseScene
}
else
{
Debug.Log(191);
SetMessage(m, e);
Sequence se = DOTween.Sequence();
for (int i = 0; i < msgIndex; i++)
@@ -264,20 +239,6 @@ public class MainController : BaseScene
//#endif
}
void FinishMessageRight()
{
msgIndex = 0;
rightMessage.DOFade(0, 0.3f);
}
void FinishMessage6()
{
msgIndex = 0;
foreach (var m in msgs)
{
m.alpha = 0;
m.GetComponent<RectTransform>().localPosition = 1 * msgLocation;
}
}
private void SetMessage(CanvasGroup m,LinkedMessageEvent e)
{
m.GetComponent<Button>().onClick.RemoveAllListeners();
@@ -304,9 +265,8 @@ public class MainController : BaseScene
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>().Initial();
m.GetComponent<HomeMessageController>().textWidth = txt.sizeDelta.x;
//Debug.Log(e.content + txt.sizeDelta.x);
m.GetComponent<HomeMessageController>().Initial(txt.sizeDelta.x);
}
CanvasGroup msg;
void fade0()
@@ -317,7 +277,6 @@ public class MainController : BaseScene
// Start is called before the first frame update
async void Start()
{
UIManager.Instance.Root = root;
UIManager.Instance.MainPanel = this.transform.Find("Panel").GetComponent<PFUIPanel>();
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
@@ -325,6 +284,7 @@ public class MainController : BaseScene
$"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%";
transform.Find("MobileInfo/TimeText").GetComponent<Text>().text =
DateTime.Now.ToString("HH:mm");
ShowQueueMessage();
#if UNITY_EDITOR
if (App.CurrentUser == null) //App.CurrentUser == null
{
@@ -99,7 +99,7 @@ namespace Assets.Scenes.Ride.Scripts
this.routeId = routeId;
this.content = content;
}
public LinkedMessageEvent(int routeId, string content,string avatar,string nickname,string routeName)
public LinkedMessageEvent(int routeId, string content, string avatar, string nickname, string routeName)
{
this.routeId = routeId;
this.content = content;
@@ -107,6 +107,14 @@ namespace Assets.Scenes.Ride.Scripts
this.nickname = nickname;
this.routeName = routeName;
}
public LinkedMessageEvent(LinkedMessageEvent data)
{
this.routeId = data.routeId;
this.content = data.content;
this.avatar = data.avatar;
this.nickname = data.nickname;
this.routeName = data.routeName;
}
private void CreateContent()
{
@@ -364,8 +364,7 @@ public class HomeController : PFUIPanel
var txt = m.transform.Find("TextContainer/Content").GetComponent<RectTransform>();
txt.GetComponent<Text>().text = e.Message;
LayoutRebuilder.ForceRebuildLayoutImmediate(txt);
m.GetComponent<HomeMessageController>().Initial();
m.GetComponent<HomeMessageController>().textWidth = txt.sizeDelta.x;
m.GetComponent<HomeMessageController>().Initial(txt.sizeDelta.x);
}
public override void Show()
@@ -373,6 +372,26 @@ public class HomeController : PFUIPanel
base.Show();
transform.MyDOFade();
GetSummary();
GetNotify();
//transform.Find("Panel (1)").GetComponent<test>().startPage();
}
private async Task GetNotify()
{
var r = await ConfigHelper.userApi.GetNotify();
if (r.result)
{
var lm = transform.Find("LongMessage");
if (r.data.Value<int>("Id") != 0)
{
lm.gameObject.SetActive(true);
lm.GetComponent<LongMessageScript>().Initial(r.data["Content"].ToString().Replace("\r\n"," "));
}
else
{
lm.gameObject.SetActive(false);
}
}
}
}
@@ -8,6 +8,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Threading.Tasks;
public class NewRouteDetailController : PFUIPanel
{
@@ -131,7 +132,7 @@ public class NewRouteDetailController : PFUIPanel
//}
}
MapRouteAreaDetail area;
int pageIndex = 0, pageSize = 10;
int pageIndex = 0, pageSize = 12;
bool isEnd = false, startMouse = false;
public async void Initial(int areaId)
{
@@ -152,7 +153,7 @@ public class NewRouteDetailController : PFUIPanel
.text = string.Empty;
GetData(areaId);
await GetData(areaId);
GetList();
}
@@ -205,7 +206,7 @@ public class NewRouteDetailController : PFUIPanel
GetList();
}
}
private async void GetData(int areaId)
private async Task GetData(int areaId)
{
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetail(areaId);
if (res.result)