public void NotifyMessage() { //定义要推送的内容 if (list == null) { list = new List <int>(); } list.Clear(); randInt(); TextAsset ta = Resources.Load <TextAsset>("pushStr"); PushStr pStr = PushStr.LoadFromJson(ta); realNotify.NotificationMessage(pStr.GetStr(list[0]), 6, true); realNotify.NotificationMessage(pStr.GetStr(list[1]), 12, true); realNotify.NotificationMessage(pStr.GetStr(list[2]), 18, true); realNotify.NotificationMessage(pStr.GetStr(list[3]), 20, true); //test realNotify.NotificationMessage(pStr.GetStr(list[0]), System.DateTime.Now.AddSeconds(10), false); realNotify.NotificationMessage(pStr.GetStr(list[1]), System.DateTime.Now.AddSeconds(10), false); realNotify.NotificationMessage(pStr.GetStr(list[2]), System.DateTime.Now.AddSeconds(10), false); realNotify.NotificationMessage(pStr.GetStr(list[3]), System.DateTime.Now.AddSeconds(10), false); }
public static void LoadJsonFromExcel_pushStr() { string epath = Application.streamingAssetsPath + "/pushStrConfig.xlsx"; string jpath = Application.dataPath + "/Resources/pushStr.json"; PushStr ps = null; Dictionary <string, string[]> strs = ExcelTool.ToArrayListFromExcel(epath); if (strs != null) { ps = new PushStr(); foreach (var tem in strs) { Debug.Log(tem.Value.Length + " str = " + tem.Value[0] + " key = " + tem.Key); ps.Add(tem.Key); } } if (ps != null) { try { string str = JsonMapper.ToJson(ps); Debug.Log("json str = " + str); if (System.IO.File.Exists(jpath)) { System.IO.File.Delete(jpath); } System.IO.FileStream fs = new System.IO.FileStream(jpath, System.IO.FileMode.CreateNew); System.IO.StreamWriter sw = new System.IO.StreamWriter(fs); sw.WriteLine(str); sw.Close(); fs.Close(); } catch (System.Exception ex) { Debug.LogError("ex = " + ex.ToString()); } } }