void OnItemClicked(PictruePage_Item item) { AudioManager.PlaySe("button"); // 如果是图片分类,则开始新游戏 //if(!isUncomplete) //{ if (item.data.status != PicturePage_ItemStatus.Locked) { //UIEngine.Forward<LevelCompletePage>(); var picId = item.data.picRow.Get <int>("id"); // GameController.EnterCore(picId); var admin = new Admission_PopupNewPage(); UIEngine.Forward <LevelSettingsPage>(picId.ToString(), admin); } RadioStation.Brodcast("SELECT_PIC"); //} // 如果是未完成的拼图, 则继续游戏 // if(isUncomplete) // { // var picId = item.data.picRow.Get<int>("id"); // var info = PlayerStatus.uncompletePuzzle[picId.ToString()]; // GameController.EnterWithInfo(info); // // GameController.EnterCore(picId); // // var admin = new Admission_PopupNewPage(); // // UIEngine.Forward<LevelSettingsPage>(picId.ToString(), admin); // } }
void SetItem(PictruePage_Item item, PictruePage_ItemData data) { item.data = data; item.name = data.picRow.TryGet <string>("id", "none-id"); if (item.name == "1") { pic1 = item; } switch (data.status) { case PicturePage_ItemStatus.Locked: item.IsShowPuzzleMask = true; item.IsShowUnlockLayer = true; item.IsShowPice = false; var unlockGold = data.picRow.Get <int>("cost"); var unlockButotnText = unlockGold + "金币解锁"; item.UnlockButtonText = unlockButotnText; break; case PicturePage_ItemStatus.Unlocked: { item.IsShowPuzzleMask = true; item.IsShowUnlockLayer = false; var picId = data.picRow.Get <int>("id"); var info = PlayerStatus.TryGetUncompleteOfPicId(picId); if (info != null) { var sliceCount = StaticDataLite.GetCell <int>("pice_slice", info.sliceId.ToString(), "count"); item.PiceCount = sliceCount; item.IsShowPice = true; } else { item.IsShowPice = false; } break; } case PicturePage_ItemStatus.Complete: { item.IsShowPuzzleMask = false; item.IsShowUnlockLayer = false; item.IsShowPice = true; var picId = data.picRow.Get <int>("id"); var info = PlayerStatus.GetCompleteInfoOfPicId(picId); if (info != null) { var sliceCount = StaticDataLite.GetCell <int>("pice_slice", info.sliceId.ToString(), "count"); item.PiceCount = sliceCount; } break; } } item.LabelText = data.picRow.Get <string>("name"); var file = data.picRow.Get <string>("file"); var sprite = PicLibrary.LoadContentSprite(file); item.Sprite = sprite; }
void OnItemUnlockButton(PictruePage_Item item) { var data = item.data; var cost = data.picRow.Get <int>("cost"); var gold = PlayerStatus.gold; if (gold >= cost) { Debug.Log("can unlock"); gold -= cost; PlayerStatus.gold = gold; var pictureId = data.picRow.Get <string>("id"); LevelStorage.SetPictureUnlocked(pictureId); PlayerStatus.Save(); // 单独处理需要修改显示状态的 item data.status = PicturePage_ItemStatus.Unlocked; SetItem(item, data); item.Flash(); AudioManager.PlaySe("button"); AudioManager.PlaySe("unlock-pic"); } else { var param = new DialogParam(); param.des = MsgList.Get("lack_of_gold"); param.button = "商城"; var popup = new Admission_PopupNewPage(); var dialog = UIEngine.Forward <DialogPage>(param, popup); dialog.Complete = result => { if (result == DialogResult.Conform) { UIEngineHelper.WateAdmissionComplete(() => { UIEngine.Forward <ShopPage>(); }); } }; AudioManager.PlaySe("lack-of-gold"); } }