This commit is contained in:
parent
6f3904eb04
commit
59a834e81b
|
|
@ -52,9 +52,7 @@ public class JoypacManager : MonoBehaviour
|
||||||
|
|
||||||
LocalNotificationManager.Instance.Init();//推送
|
LocalNotificationManager.Instance.Init();//推送
|
||||||
|
|
||||||
NotificationMessage(PushText(), 12, true);
|
|
||||||
|
|
||||||
NotificationMessage(PushText(), 18, true);
|
|
||||||
|
|
||||||
#if ANDROID_GP
|
#if ANDROID_GP
|
||||||
JoypacFBManager.Instance.Init();
|
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()
|
IEnumerator CrossEnumerator()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,12 @@ public sealed class LocalNotificationManager : JoypacSingleMonoBehaviour<LocalNo
|
||||||
private static readonly string ChannelId = "joypac-" + StaticStringsURLScheme.MyURLSchemes.ToLower() + "-notification";
|
private static readonly string ChannelId = "joypac-" + StaticStringsURLScheme.MyURLSchemes.ToLower() + "-notification";
|
||||||
#endif
|
#endif
|
||||||
//两个推送交替出现
|
//两个推送交替出现
|
||||||
string[] NotiStr = { "0", "1" };
|
string[] NotiStr = { "0", "1", "2" };
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
NotiStr[0] = I2.Loc.LocalizationManager.GetTermTranslation("Notification/SignIn");
|
NotiStr[0] = "客人们都想念你爆米花的味道啦~";
|
||||||
NotiStr[1] = I2.Loc.LocalizationManager.GetTermTranslation("Notification/Offline");
|
NotiStr[1] = "是时候来收玉米做一锅香喷喷的爆米花啦~";
|
||||||
|
NotiStr[2] = "新的配方,新的味道,快做来尝一尝呀~";
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -56,12 +57,49 @@ public sealed class LocalNotificationManager : JoypacSingleMonoBehaviour<LocalNo
|
||||||
{
|
{
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
AddCommonLocalNotifications(RandomString(), null, null, true);
|
AddCommonLocalNotifications(RandomString(), null, null, true);
|
||||||
|
|
||||||
|
|
||||||
|
// NotifiMessage(PushText(), 12, true);
|
||||||
|
|
||||||
|
// NotifiMessage(PushText(), 18, true);
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
AddCommonLocalNotifications(RandomString(), RandomString(), RandomString(), true);
|
AddCommonLocalNotifications(RandomString(), RandomString(), RandomString(), true);
|
||||||
#endif
|
#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)
|
private void SendLocalNotification(string title, string message, DateTime trigger, bool isRepeatDay)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue