消息通知逻辑

This commit is contained in:
CaiYanPeng 2022-01-26 10:32:21 +08:00
parent 28487b295b
commit 5edd784080
5 changed files with 37 additions and 10 deletions

View File

@ -63,6 +63,8 @@ public static class App
//全局用 输入框或者下拉框修改标志位
public static bool isChanged { get; set; }
public static string notifyContent { get; internal set; }
//全局用,如果弹多条消息用这个队列
public static Queue<string> multiNotifyContent;
public static RideSetting RideSetting = new RideSetting();
public static string pageName { get; set; }
@ -229,6 +231,7 @@ public static class App
}
//App.ChangeLanguage("en");
globalMessageQueue = new Queue<LinkedMessageEvent>();
multiNotifyContent = new Queue<string>();
Screen.sleepTimeout = SleepTimeout.NeverSleep;
}
}

View File

@ -622,12 +622,21 @@ public class LoginController : BaseScene
//#endif
App.notifyContent = r.data.Value<string>("Content");
if (r.data.Value<int>("Id") != notifyId && r.data.Value<int>("Id") != 0)//r.data.Value<int>("Id") != notifyId
if (r.data.Value<int>("Id") > 1)//r.data.Value<int>("Id") != notifyId
{
UIManager.ShowNewsModal();
PlayerPrefs.SetInt("notifyId", r.data.Value<int>("Id"));
}
#else
if (r.data.Value<int>("Id") > 1)
{
App.notifyContent = r.data.Value<string>("Content");
UIManager.ShowNewsModal();
}
else
{
App.notifyContent = null;
}
var rr = await ConfigHelper.userApi.GetVersions();
if (rr.result)
{
@ -643,18 +652,24 @@ public class LoginController : BaseScene
if (ver.UpdateLog.Count + 1 != notifyId) //ver.UpdateLog.Count != notifyId
{
var log = ver.UpdateLog.FirstOrDefault();
if (log != null)
if (App.notifyContent == null)
{
App.notifyContent = log.Desc;
if (log != null)
{
App.notifyContent = log.Desc;
}
else
{
App.notifyContent = r.data.Value<string>("Content");
}
UIManager.ShowNewsModal();
}
else
else
{
App.notifyContent = r.data.Value<string>("Content");
App.multiNotifyContent.Enqueue(log != null ? log.Desc : r.data.Value<string>("Content"));
}
PlayerPrefs.SetInt("notifyId", ver.UpdateLog.Count + 1);
UIManager.ShowNewsModal();
}
#endif
}
GetRotateImage();

View File

@ -17,10 +17,19 @@ public class NewsController : PFUIPanel
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
{
Close();
if (App.multiNotifyContent.Count > 0)
{
transform.Find("Main").Find("Inner").Find("Content").GetComponent<Text>().text = App.multiNotifyContent.Dequeue();
Invoke("Open", 0.3f);
}
});
}
Get();
}
void Open()
{
gameObject.SetActive(true);
}
Transform content,exit;
void Get()
{

View File

@ -326,7 +326,7 @@ public class MapListController : PFUIPanel
mc.GetComponent<CanvasGroup>().alpha = 0;
mc.GetComponent<CanvasGroup>().DOFade(1, 0.3f);
#else
var topRect = topContainer;
var topRect = transform.Find("Panel/Top/Container");
#endif
if (isFocusSearch)
{

View File

@ -6,8 +6,8 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/Login-Mobile.unity
guid: 4be878da00cf764499988cf403faf94d
path: Assets/Scenes/Login.unity
guid: 6dce3e17997730b4492f91dd8fede429
- enabled: 1
path: Assets/Scenes/MainScene.unity
guid: ab586a3c1bacd4a48a55178eb06fe0cc