This commit is contained in:
xiaohui.wang 2022-04-01 21:31:58 +08:00
parent 6f3904eb04
commit 59a834e81b
2 changed files with 43 additions and 39 deletions

View File

@ -52,9 +52,7 @@ public class JoypacManager : MonoBehaviour
LocalNotificationManager.Instance.Init();//推送
NotificationMessage(PushText(), 12, true);
NotificationMessage(PushText(), 18, true);
#if ANDROID_GP
JoypacFBManager.Instance.Init();
@ -69,39 +67,7 @@ public class JoypacManager : MonoBehaviour
}
public string PushText()
{
int temp= Random.Range(1,3);
string text = "";
switch (temp)
{
case 1:
text = "客人们都想念你爆米花的味道啦~";
break;
case 2:
text = "是时候来收玉米做一锅香喷喷的爆米花啦~";
break;
case 3:
text = "新的配方,新的味道,快做来尝一尝呀~";
break;
default:
Debug.Log("temp"+ temp);
break;
}
return text;
}
public void NotificationMessage(string message, int hour, bool isRepeatDay)
{
int year = System.DateTime.Now.Year;
int month = System.DateTime.Now.Month;
int day = System.DateTime.Now.Day;
System.DateTime newDate = new System.DateTime(year, month, day, hour, 0, 0);
LocalNotificationManager.NotificationMessage(message, newDate, isRepeatDay);
}
IEnumerator CrossEnumerator()
{

View File

@ -22,11 +22,12 @@ public sealed class LocalNotificationManager : JoypacSingleMonoBehaviour<LocalNo
private static readonly string ChannelId = "joypac-" + StaticStringsURLScheme.MyURLSchemes.ToLower() + "-notification";
#endif
//两个推送交替出现
string[] NotiStr = { "0", "1" };
string[] NotiStr = { "0", "1", "2" };
void Awake()
{
NotiStr[0] = I2.Loc.LocalizationManager.GetTermTranslation("Notification/SignIn");
NotiStr[1] = I2.Loc.LocalizationManager.GetTermTranslation("Notification/Offline");
NotiStr[0] = "客人们都想念你爆米花的味道啦~";
NotiStr[1] = "是时候来收玉米做一锅香喷喷的爆米花啦~";
NotiStr[2] = "新的配方,新的味道,快做来尝一尝呀~";
#if UNITY_EDITOR
return;
#endif
@ -56,12 +57,49 @@ public sealed class LocalNotificationManager : JoypacSingleMonoBehaviour<LocalNo
{
#if UNITY_IOS
AddCommonLocalNotifications(RandomString(), null, null, true);
// NotifiMessage(PushText(), 12, true);
// NotifiMessage(PushText(), 18, true);
#elif UNITY_ANDROID
AddCommonLocalNotifications(RandomString(), RandomString(), RandomString(), true);
#endif
}
}
public string PushText()
{
int temp = UnityEngine.Random.Range(1, 3);
string text = "";
switch (temp)
{
case 1:
text = "客人们都想念你爆米花的味道啦~";
break;
case 2:
text = "是时候来收玉米做一锅香喷喷的爆米花啦~";
break;
case 3:
text = "新的配方,新的味道,快做来尝一尝呀~";
break;
default:
Debug.Log("temp" + temp);
break;
}
return text;
}
public void NotifiMessage(string message, int hour, bool isRepeatDay)
{
int year = System.DateTime.Now.Year;
int month = System.DateTime.Now.Month;
int day = System.DateTime.Now.Day;
System.DateTime newDate = new System.DateTime(year, month, day, hour, 0, 0);
LocalNotificationManager.NotificationMessage(message, newDate, isRepeatDay);
}
private void SendLocalNotification(string title, string message, DateTime trigger, bool isRepeatDay)
{