private void _loading() { RingVisibility = Visibility.Visible; Task.Factory.StartNew(() => { DatabaseHelper.Open(); SystemHelper.Open(); var reader = DatabaseHelper.Select <ChapterItem>("Id,Name,Url", $"WHERE BookId = {_book.Id}"); while (reader.Read()) { if (reader.HasRows) { var item = new ChapterItem(reader); Application.Current.Dispatcher.Invoke(() => { ChaptersList.Add(item); }); } } reader.Close(); _setConent(); DatabaseHelper.Close(); RingVisibility = Visibility.Collapsed; }); }
public void UpdateList(int unlockMaxChapterID, int passMaxChapterID) {//i[0]为默认章节 Clear(); for (int i = 0; i < _mainCount; i++) {//判断每个章节是否已经解锁 ChapterItem ci = Instantiate(item).GetComponent <ChapterItem>(); chapterItems.Add(ci); //敬请期待 if (i == _mainCount - 1) { SetParent(ci.gameObject.transform, scrollRect.content); //SetParent(ci.gameObject.transform, loop.content); ci.Set(998, $"敬请期待", $"敬请期待", null, false, false, false, false, 9999, UnlockChapter); return; } var section = StaticData.configExcel.GetSectionBySectionId(StaticData.configExcel.Section[0].SectionId + i); //是否显示为解锁状态 配置表里的章节id与服务器记录的最大解锁章节id 比较 bool isUnlock = section.SectionId <= unlockMaxChapterID || section.SectionGrade <= StaticData.GetPlayerLevelByExp() ? true : false; //已解锁章节ID必定 >= 已通过章节ID //是否观看完毕 配置表里的章节id与服务器记录的最大已观看章节id 比较 bool isWatchOver = section.SectionId <= passMaxChapterID ? true : false; bool isBeforeUnlock = section.SectionId - 1 <= unlockMaxChapterID ? true : false; bool isBeforeWatchOver = section.SectionId <= passMaxChapterID + 1 || section.SectionId == StaticData.configExcel.Section[0].SectionId ? true : false; //设置Item基础属性 ci.Set(section.SectionId, ChapterTool.GetChapterFunctionString(section.SectionNumber), ChapterTool.GetChapterFunctionString(section.SectionNameId), section.Icon, isUnlock, isWatchOver, isBeforeUnlock, isBeforeWatchOver, section.SectionGrade, UnlockChapter); SetParent(ci.gameObject.transform, scrollRect.content); ci.name = $"Chapter{i}"; } }
public MainVoiceListViewModel(ChapterItem item) { Title = AppResources.Main_MenuPage_RecordList; currentChapterItem = item; CreateItems(); }
//将章节列表导入viewmodel中 public void add(List <string> list) { for (int i = 0; i < list.Count; i++) { ChapterItem chapter = new ChapterItem(i + 1, list[i]); Debug.WriteLine(list[i]); this.chapterItems.Add(chapter); } }
public void onBackButtonClick() { GameObject.Destroy(questionObject.gameObject); questionObject = null; currentChapter = null; SoundManager.ChoosePlayMusic(0); screensManager.ShowMainScreen(); }
private void LoadChapter() { int index = 0; foreach (var chapter in this.book.Chapters) { ChapterItem item = new ChapterItem(); chapter.ChapterNo = index; item.DataContext = chapter; clist.Items.Add(item); index++; } }
private ChapterItem CreateChapterItem(config_chapter_item config_chapter, int index) { GameObject item = chapterList.NewItem(); ChapterItem itemCtr = item.GetComponent <ChapterItem>(); itemCtr.viewIndex = index; itemCtr.toggle.group = chapterToggleGroup; itemCtr.SetConfig(config_chapter); itemCtr.toggle.onValueChanged.AddListener(itemCtr.OnSelect); return(itemCtr); }
//(来源为书库的书)点击目录,跳转到对应章节 private async void ListView_ItemClick(object sender, ItemClickEventArgs e) { try { ChapterItem selectedChapter = e.ClickedItem as ChapterItem; int chapterNum = selectedChapter.Num; nowChapter = chapterNum.ToString(); content = await BookService.GetChapterContent(bookId, nowChapter); numOfPage = content.Length / wordsOnePage + 1; currentPage = 1; string result = content.Substring((currentPage - 1) * wordsOnePage, wordsOnePage); B1.Text = result; } catch (Exception) { MessageDialog message = new MessageDialog("无法获取对应章节!", "提示"); await message.ShowAsync(); } }
public void InitQuestionsListObject(ChapterItem currentChapter) { GameObject newObject = null; newObject = Instantiate(questionsTemplate) as GameObject; questionObject = newObject.GetComponent <QuestionsObject>(); questionObject.InitList(currentChapter); questionObject.buttonClickEvent += onQuestionClick; newObject.transform.SetParent(questContainer); newObject.transform.localScale = new Vector3(1, 1, 1); RectTransform rctr = newObject.GetComponent <RectTransform>(); rctr.offsetMax = new Vector2(0, 0); rctr.offsetMin = new Vector2(0, 0); rctr.anchoredPosition3D = new Vector3(0, 0, 0); }
void AddButtons() { for (int i = 0; i < chapters.Count; i++) { Button bt = Instantiate(btn); bt.transform.SetParent(transform, true); //bt.GetComponent<RectTransform> ().SetPositionAndRotation (new Vector3(0, -i*150, 0), Quaternion.identity); bt.GetComponent <RectTransform> ().localPosition = new Vector3(0, -i * 150, 0); RectTransform rt = bt.GetComponent <RectTransform> (); // rt.SetInsetAndSizeFromParentEdge (RectTransform.Edge.Left, 0, 750); rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, i * 150, 150); ChapterItem item = bt.GetComponent <ChapterItem> (); ChapterModel model = chapters[i]; item.Bind(model, this); } RectTransform rootRt = GetComponent <RectTransform> (); rootRt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, screenW); rootRt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, chapters.Count * 150); }
public void InitList(ChapterItem pChapter) { currentChapter = pChapter; questionsList = new List <QuestionButtonTemplate> (); //int i = 1; foreach (var c in Utility.getQuestionsFromRes(pChapter.questions, currentChapter.StoreItemID)) { GameObject newButtonItem = null; newButtonItem = Instantiate(questionButton) as GameObject; QuestionButtonTemplate button1 = newButtonItem.GetComponent <QuestionButtonTemplate>(); button1.questionItem = c; button1.InitQuestion(); button1.button.onClick.RemoveAllListeners(); button1.button.onClick.AddListener(() => onQuestionClick(button1)); newButtonItem.transform.SetParent(QuestionsListPanel); newButtonItem.transform.localScale = new Vector3(1, 1, 1); RectTransform rctr = newButtonItem.GetComponent <RectTransform>(); rctr.offsetMax = new Vector2(0, 0); rctr.offsetMin = new Vector2(0, 0); rctr.anchoredPosition3D = new Vector3(0, 0, 0); questionsList.Add(button1); //i++; Debug.Log("ADD QUESTION"); } Canvas.ForceUpdateCanvases(); scroll.verticalNormalizedPosition = 1f; }
private void SwitchChapter() { ChapterItem.ForceSelect = true; List <config_chapter_item> datas = ResModel.Instance.config_chapter.data; int totalChapterCount = datas.Count; if (MapModel.Instance.selectChapter == null) { MapModel.Instance.selectChapter = datas[datas.Count - 1]; } if (MapModel.Instance.selectChapter.GetIndex() <= 3) { chapterRect.anchoredPosition = new Vector2(-500, chapterRect.anchoredPosition.y); } else if (MapModel.Instance.selectChapter.GetIndex() > (totalChapterCount - 5)) { chapterRect.anchoredPosition = new Vector2(-500 - (totalChapterCount - 5) * 200, chapterRect.anchoredPosition.y); } else { chapterRect.anchoredPosition = new Vector2(-500 - (MapModel.Instance.selectChapter.GetIndex() - 1) * 200, chapterRect.anchoredPosition.y); } int i; int count = chapterList.items.Count; for (i = 0; i < count; i++) { GameObject item = chapterList.items[i]; ChapterItem itemCtr = item.GetComponent <ChapterItem>(); if (itemCtr.viewIndex == MapModel.Instance.selectChapter.GetIndex()) { itemCtr.toggle.isOn = true; break; } } }
public void StartGame() { panelTopStart = new Vector3(questionPanel.transform.localPosition.x, questionPanel.transform.localPosition.y); panelTopEnd = new Vector3(panelTopStart.x, panelTopStart.y - 560); chapter = Utility.getChapter(currentQuestion.chaper); Utility.setImage(backGround, chapter.QuestionBackGroundImagePath); Utility.setImage(keyBoard, chapter.QuestionKeyBoardImagePath); Utility.setImage(line, chapter.QuestionGreenLineElement); gameObject.SetActive(true); rightAnswerPanel.SetActive(false); finalPanel.SetActive(false); reReadButton.gameObject.SetActive(false); okButton.gameObject.SetActive(false); InitQuestionScreen(); InitGameScreen(); //ShowQuestionPanel (); }
public FirstVoiceSetListPage(ChapterItem item) { InitializeComponent(); BindingContext = new FirstVoiceSetListViewModel(item); }
public MainVoiceListPage(ChapterItem item) { InitializeComponent(); BindingContext = new MainVoiceListViewModel(item); }
public ChapterStruct (int id) { this.id = id; this.currentLevel = ChapterLevel.Normal; passedDic = new Dictionary<int, bool> (); passedDic [(int)ChapterLevel.Normal - 1] = true; //默认普通难度章节的上一级副本是应该通关的 passedDic [(int)ChapterLevel.Normal] = false; passedDic [(int)ChapterLevel.NightMare] = false; baseData = new ChapterItem (id); possessDungeonDic = new Dictionary<int, Dictionary<int, DungeonStruct>> (); LoadFromLocalData (); award = new Award (); award.totalChapterStars = baseData.starCount; }