private static void OnCoreGameCompelte() { var sliceRow = StaticDataLite.GetRow("pice_slice", lastSliceId.ToString()); var gold = sliceRow.Get <int>("gold"); var exp = sliceRow.Get <int>("exp"); HeadBarFloating.instance.AutoRefresh = false; PlayerStatus.exp += 10; PlayerStatus.gold += 10; PlayerStatus.completeCount++; // 更新记录 var record = PlayerStatus.GetCompleteInfoOfPicId(lastPicId); if (record == null || record.sliceId < lastSliceId) { var info = new CompleteInfo(); info.pid = lastPicId; info.sliceId = lastSliceId; PlayerStatus.completeDic[lastPicId.ToString()] = info; } // 如果这张图有中途存档,则删除存档 PlayerStatus.RemoveUncompleteInfoOfPicId(lastPicId); PlayerStatus.Save(); LevelCompletePage.goldParam = gold; LevelCompletePage.expParam = exp; var admin = new Admission_FadeInNewPage(); UIEngine.Forward <LevelCompletePage>(null, admin); }
public static void Pay(int goodsId, Action <bool> onComplete = null) { var row = StaticDataLite.GetRow("shop", goodsId.ToString()); var productName = row.Get <string>("product_name"); var productDesc = row.Get <string>("product_desc"); var price_yuan = row.Get <float>("price"); var gold = row.Get <int>("gold"); var func = row.Get <string>("func"); var itemId = goodsId; var price_fen = price_yuan * 100; var jd = new JsonData(); jd["productName"] = productName; jd["productDesc"] = productDesc; jd["price_fen"] = price_fen; jd["price_yuan"] = price_yuan; jd["itemId"] = itemId; jd["gold"] = gold; var json = jd.ToJson(); // NativeBridge.InvokeCall("NativeSDKManager", "Pay", json, result => // { // if(result == "SUCCESS") // { // Log.Scrren("SUCCESS"); // Helper.AddGold(gold); // if(!string.IsNullOrEmpty(func)) // { // if(func == "REMOVE_AD") // { // PlayerStatus.removeAd = true; // } // } // PlayerStatus.Save(); // if(onComplete != null) // { // onComplete(true); // } // } // else if(result == "FAIL") // { // Log.Scrren("FAIL"); // if(onComplete != null) // { // onComplete(false); // } // } // else if(result == "CANCEL") // { // Log.Scrren("CANCEL"); // if(onComplete != null) // { // onComplete(false); // } // } // }); }
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); } }
void SetData(MainPage_Item item, MainPage_ItemData data) { // var sw = new Stopwatch(); // sw.Start(); item.data = data; item.gameObject.SetActive(data.visible); if (data.pageType == PicturePageType.Uncomplete) { uncompleteItem = item; } else if (data.pageType == PicturePageType.Complete) { completeItem = item; } if (!data.visible) { return; } // 如果是一个图片分类 if (data.pageType == PicturePageType.Pictype) { item.label.text = data.row.Get <string>("display_name"); var picType = data.row.Get <string>("id"); var row = PicLibrary.FindFirstRowOfType(picType); var file = row?.Get <string>("file"); var sprite = PicLibrary.LoadContentSprite(file); item.Facade = sprite; item.name = data.row.TryGet <string>("id", "no_id"); if (item.name == "animal") { animal = item; } } // 如果是未完成的拼图 if (data.pageType == PicturePageType.Uncomplete) { item.label.text = "未完成"; if (PlayerStatus.uncompletePuzzle.Count > 0) { var firstCoreInfo = PlayerStatus.FirstUncompletePuzzleInfo; var picId = firstCoreInfo.picId; var picRow = StaticDataLite.GetRow("pic", picId.ToString()); var fileName = picRow.Get <string>("file"); var sprite = PicLibrary.LoadContentSprite(fileName); item.Facade = sprite; } } // 如果是已完成的拼图 if (data.pageType == PicturePageType.Complete) { item.label.text = "已完成"; CompleteInfo firstInfo = null; foreach (var kv in PlayerStatus.completeDic) { firstInfo = kv.Value; break; } var picId = firstInfo.pid; var picRow = StaticDataLite.GetRow("pic", picId.ToString()); var fileName = picRow.Get <string>("file"); var sprite = PicLibrary.LoadContentSprite(fileName); item.Facade = sprite; } // sw.Stop(); // Debug.Log("set item: " + sw.Elapsed.TotalSeconds); }
public static JsonData LoadDataRow(int id) { return(StaticDataLite.GetRow("pic", id.ToString())); }