public static void ResetNotification() { LocalNotification.ClearNotifications(); var now = DateTime.Now; var sheet = StaticDataLite.GetSheet("push"); var dataList = new List <PushData>(); foreach (string key in sheet.Keys) { var row = sheet[key]; var data = new PushData(); data.row = row; var h = row.Get <int>("h"); var m = row.Get <int>("m"); var s = row.Get <int>("s"); data.shike = new DateTime(now.Year, now.Month, now.Day, h, m, s); dataList.Add(data); } for (int i = 0; i < 5; i++) { foreach (var data in dataList) { data.shike = data.shike.AddDays(1); var delay = data.shike - now; var title = data.row.Get <string>("title"); var text = data.row.Get <string>("text"); LocalNotification.SendNotification(delay, title, text, new Color32(0xff, 0x44, 0x44, 255)); Debug.Log("set notification at: " + data.shike); } } }
public static JsonData FindFirstRowOfType(string findType) { var sheet = StaticDataLite.GetSheet("pic"); foreach (string id in sheet.Keys) { var row = sheet[id]; var type = row.Get <string>("type"); if (findType == type) { return(row); } } return(null); }
public override void OnPush() { // read slice type from static data var sheet = StaticDataLite.GetSheet("pice_slice"); var rowList = new List <JsonData>(); foreach (string id in sheet.Keys) { var row = sheet[id]; rowList.Add(row); //dataList.Add("x" + row["cell_size"]); } sampleizeScrollRect.ChangeData(rowList.ToArray()); // resize content var layout = sampleizeScrollRect.layout as HorizontalLayoutGroup; var ItemListLength = rowList.Count * sampleizeScrollRect.sample.rect.width + (rowList.Count - 1) * layout.spacing; var preExtra = 500; var postExtra = 500; var contentLength = preExtra + ItemListLength + postExtra; sampleizeScrollRect.Content.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, contentLength); OnRotateSelection(); lostTime = 0; first = true; // 检查是否有已经开始的拼图 // var picId = PicId; // var b = HasUncompleteGame(picId); // if(b) // { // } // if(info == null) // { // button_continue.gameObject.SetActive(false); // } // else // { // button_continue.gameObject.SetActive(true); // } }
private void Refresh() { // rebuild item list itemList.Clear(); TransformUtil.DestroyAllChildren(transform_listRoot); // add ad item first { var tr = GameObject.Instantiate(prefab_ad_item); tr.parent = transform_listRoot; tr.transform.localScale = Vector2.one; tr.gameObject.SetActive(true); var item = tr.GetComponent <ShopPage_Item>(); itemList.Add(item); adItem = item as ShopPage_AdItem; } // add iap items var sheet = StaticDataLite.GetSheet("shop"); foreach (string id in sheet.Keys) { var row = sheet[id]; var tr = GameObject.Instantiate(prefab_ipa_item); tr.parent = transform_listRoot; tr.transform.localScale = Vector2.one; tr.gameObject.SetActive(true); var item = tr.GetComponent <ShopPage_IapItem>(); item.Init(row); itemList.Add(item); } var itemHeight = prefab_ad_item.GetComponent <RectTransform>().rect.height; var gl = transform_listRoot.GetComponent <UnityEngine.UI.VerticalLayoutGroup>(); var spaceingY = gl.spacing; var listInset = 487; var extra = 200; var rowCount = itemList.Count; var scrollContentHeight = itemHeight * rowCount + (rowCount - 1) * spaceingY + listInset + extra; var rt = scrollViewContent.GetComponent <RectTransform>(); rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollContentHeight); }
private void Refrehs() { // create data list form static data var sheet = StaticDataLite.GetSheet("pictype"); var dataList = new List <MainPage_ItemData>(); foreach (string key in sheet.Keys) { var row = sheet[key]; var data = new MainPage_ItemData { row = row, visible = true, }; dataList.Add(data); } // 检查是否有未完成拼图 { var count = PlayerStatus.uncompletePuzzle.Count; var data = new MainPage_ItemData() { pageType = PicturePageType.Uncomplete, visible = count > 0, }; dataList.Insert(0, data); } // 检查是否有已完成的拼图 { var count = PlayerStatus.completeDic.Count; var data = new MainPage_ItemData() { pageType = PicturePageType.Complete, visible = count > 0, }; dataList.Insert(0, data); } SetDataList(dataList); }
public override void OnPush() { // 如果要显示的是某个图片分类 if (p.pageType == PicturePageType.Pictype) { // 从 pic 表中找出所有 type 是 param 的数据行 // 并且包装成 PicturePage_ItemData var sheet = StaticDataLite.GetSheet("pic"); var pictype = this.p.picTypeId; var dataList = new List <PictruePage_ItemData>(); foreach (string key in sheet.Keys) { var row = sheet[key]; if (row.Get <string>("type") == pictype) { var data = new PictruePage_ItemData { picRow = row, }; // check unlock info var unlocked = LevelStorage.IsPictureUnlocked(key); var complete = PlayerStatus.IsPictureComplete(int.Parse(key)); var status = PicturePage_ItemStatus.Locked; if (complete) { status = PicturePage_ItemStatus.Complete; } else if (unlocked) { status = PicturePage_ItemStatus.Unlocked; } data.status = status; dataList.Add(data); } } this.setDataList(dataList); // set picture count var completePictureCount = 0; var pictureCount = dataList.Count; foreach (var data in dataList) { if (data.status == PicturePage_ItemStatus.Complete) { completePictureCount++; } } text_pictureCount.text = completePictureCount + "/" + pictureCount; } // 如果要显示的是未完成的拼图 if (p.pageType == PicturePageType.Uncomplete) { var dataList = new List <PictruePage_ItemData>(); foreach (var kv in PlayerStatus.uncompletePuzzle) { var info = kv.Value; var picRow = StaticDataLite.GetRow("pic", info.picId.ToString()); var data = new PictruePage_ItemData { picRow = picRow, }; data.status = PicturePage_ItemStatus.Unlocked; dataList.Add(data); } this.setDataList(dataList); text_pictureCount.text = PlayerStatus.uncompletePuzzle.Count.ToString(); } // 如果要显示已完成的图片 if (p.pageType == PicturePageType.Complete) { var dataList = new List <PictruePage_ItemData>(); foreach (var kv in PlayerStatus.completeDic) { var info = kv.Value; var picId = info.pid; var picRow = StaticDataLite.GetRow("pic", picId.ToString()); var data = new PictruePage_ItemData { picRow = picRow, }; data.status = PicturePage_ItemStatus.Complete; dataList.Add(data); } text_pictureCount.text = dataList.Count.ToString(); this.setDataList(dataList); } }