//显示选项按钮 void ShowOption() { Option.gameObject.SetActive(true); option1.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(12000026); option2.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(12000027); option1.onClick.AddListener(() => { //增加好感 ImpulseHelper.OptionAddFavorable(12000026); Option.gameObject.SetActive(false); _dialogueFive.SetStartDialogueId(12000026); _dialogueFive.Initial(() => { _dialogueFive.Close(); NextStep(); }, SpeakAeforeAction_Five); _dialogueFive.Show(); }); option2.onClick.AddListener(() => { Option.gameObject.SetActive(false); _dialogueFive.SetStartDialogueId(12000027); _dialogueFive.Initial(() => { _dialogueFive.Close(); NextStep(); }, SpeakAeforeAction_Five); _dialogueFive.Show(); }); }
private void ClickFiveBtnOne() { _fiveBtnOne.transform.gameObject.SetActive(false); _fiveBtnTwo.transform.gameObject.SetActive(false); //增加好感 ImpulseHelper.OptionAddFavorable(12000063); _dialogueBaseFive.SetStartDialogueId(12000063); _dialogueBaseFive.Initial(() => { _dialogueBaseFive.Close(); //下一章显示请求保存 ChapterModuleManager._Instance.RequestPassChapter(); _fiveBtnTherr.gameObject.SetActive(true); Debug.Log("对话4完毕"); }, EndSceneSpeakBeforeAction); _dialogueBaseFive.Show(); }
//打开界面 调用一次 public void OpenView(List <Favorable> favorableList) { for (int i = 0; i < favorableList.Count; i++) { int index = i; GameObject NpcItem = GameObject.Instantiate(NpcHeadItem); var npcitem = NpcItem.GetComponent <NPCItem>(); //setParent ChapterHelper.SetParent(npcitem.gameObject, scrollRect.content); favorableList = ImpulseHelper.ImpulseSort(favorableList); //set bool isUnlock = false; var roleInfo = StaticData.configExcel.GetHallRoleByID(favorableList[i].NPCId); if (StaticData.playerInfoData.userInfo.SectionId >= roleInfo.UnlockChapter) { isUnlock = true; } //根据男主id 随机一句话 NPCDialogue nPCDialogue = UIImpulseComponent.npcId.Find((f) => { return(f.NPCID == favorableList[i].NPCId); }); int ind = Random.Range(0, nPCDialogue.dialogue.Count); //for (int j = 0; j < UIImpulseComponent.npcId.Count; j++) //{ // if (UIImpulseComponent.npcId[j].NPCID == favorableList[i].NPCId) // { // Random.Range(0,) // } //} npcitem.Set(favorableList[i].NPCId, favorableList[i].headPortrait, favorableList[i].NPC2PlayerValue, favorableList[i].Player2NPCValue, favorableList[i].cardiacValue, ImpulseHelper.GetNPCDialogue(nPCDialogue.dialogue[ind]), isUnlock); npcitem.dateBtn.onClick.AddListener(() => OnClick(favorableList[index])); NpcItemList.Add(npcitem); } }
//刷新 void Reshf(List <Favorable> favorableList) { //排序 favorableList = ImpulseHelper.ImpulseSort(favorableList); for (int i = 0; i < favorableList.Count; i++) {//直接全部重新刷新 int index = i; bool isUnlock = false; var roleInfo = StaticData.configExcel.GetHallRoleByID(favorableList[i].NPCId); if (StaticData.playerInfoData.userInfo.SectionId >= roleInfo.UnlockChapter) { isUnlock = true; } //根据男主id 随机一句话 //根据男主id 随机一句话 NPCDialogue nPCDialogue = UIImpulseComponent.npcId.Find((f) => { return(f.NPCID == favorableList[i].NPCId); }); int ind = Random.Range(0, nPCDialogue.dialogue.Count); NpcItemList[i].Set(favorableList[i].NPCId, favorableList[i].headPortrait, favorableList[i].NPC2PlayerValue, favorableList[i].Player2NPCValue, favorableList[i].cardiacValue, ImpulseHelper.GetNPCDialogue(nPCDialogue.dialogue[ind]), isUnlock); NpcItemList[i].dateBtn.onClick.AddListener(() => OnClick(favorableList[index])); } }
public override void Initial() { _nextStepBtn = transform.GetComponent <Button>(); _nextStepBtn.onClick.RemoveAllListeners(); _nextStepBtn.onClick.AddListener(ClickBtn); _oneScene = transform.Find("One") as RectTransform; dialogueBoxBubble_one = transform.Find("DialogueBox_Bubble_One").GetComponent <DialogueBoxBubbleComponent>(); _twoScene = transform.Find("Two") as RectTransform; dialogueBoxBubble_two = transform.Find("DialogueBox_Bubble_Two").GetComponent <DialogueBoxBubbleComponent>(); dialogueBoxBubble_three = transform.Find("DialogueBox_Bubble_Three").GetComponent <DialogueBoxBubbleComponent>(); nan_face1 = _twoScene.Find("nanzhu/nanzhu_1").GetComponent <Image>(); nan_face2 = _twoScene.Find("nanzhu/nanzhu_2").GetComponent <Image>(); nan_face3 = _twoScene.Find("nanzhu/nanzhu_3").GetComponent <Image>(); nv_face1 = _twoScene.Find("nvzhu/nvzhu_1").GetComponent <Image>(); nv_face2 = _twoScene.Find("nvzhu/nvzhu_2").GetComponent <Image>(); nv_face3 = _twoScene.Find("nvzhu/nvzhu_3").GetComponent <Image>(); nv_face = _twoScene.Find("nvzhu/nvzhu_face").GetComponent <Image>(); option1 = transform.Find("btns/option1").GetComponent <Button>(); option2 = transform.Find("btns/option2").GetComponent <Button>(); var data1 = ChapterTool.GetChapterData(15000038); var data2 = ChapterTool.GetChapterData(15000039); option1.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(data1); option2.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(data2); option1.onClick.AddListener(() => { option1.gameObject.SetActive(false); option2.gameObject.SetActive(false); ImpulseHelper.OptionAddFavorable(15000038); SetNextIndex(2); dialogueBoxBubble_three.SetStartDialogueId(15000038); dialogueBoxBubble_three.Initial(() => { dialogueBoxBubble_three.Close(); NextStep(); }, AfterThreeDialogue); dialogueBoxBubble_three.Show(); }); option2.onClick.AddListener(() => { option1.gameObject.SetActive(false); option2.gameObject.SetActive(false); ImpulseHelper.OptionAddFavorable(15000039); SetNextIndex(3); dialogueBoxBubble_three.SetStartDialogueId(15000039); dialogueBoxBubble_three.Initial(() => { dialogueBoxBubble_three.Close(); NextStep(); }, AfterThreeDialogue); dialogueBoxBubble_three.Show(); }); ClickBtn(); base.Initial(); }
void GetUserInfo() { //获取玩家等级 //level = StaticData.GetPlayerLevelAndCurrExp().level; _curVersionsMaxCount = StaticData.configExcel.GetVertical().CurVersionsChapterMaxCount; this._mainMaxCount = StaticData.configExcel.Section.Count;//做一章敬请期待 this._OADMaxCount = StaticData.configExcel.ExtraStory.Count; this._passChapterID = StaticData.playerInfoData.userInfo.SectionId; this._unlockMaxChapterID = StaticData.playerInfoData.userInfo.UnlockSectionId; this.OADid.AddRange(StaticData.playerInfoData.userInfo.ExtraStory.Split(',')); this.ADList = StaticData.playerInfoData.userInfo.AdvInfo; //localChapterID = PlayerPrefs.GetString("LocalChapterID"); //localOADID = PlayerPrefs.GetString("LocalOADID"); ShowOADinfoListCount.Clear(); OADinfoList.Clear(); foreach (var item in StaticData.configExcel.ExtraStory) { if (item.ExtraStoryId > StaticData.configExcel.GetVertical().CurVersionsOADMaxCount) { break; } #if UNITY_EDITOR if (isTest) { if (!ShowOADinfoListCount.Contains(item)) { ShowOADinfoListCount.Add(item); } } else { if (item.PassChapterID <= _passChapterID) { if (!ShowOADinfoListCount.Contains(item)) { ShowOADinfoListCount.Add(item); } } } if (!OADinfoList.Contains(item)) { OADinfoList.Add(item); } #else if (item.PassChapterID <= _passChapterID) { if (!ShowOADinfoListCount.Contains(item)) { ShowOADinfoListCount.Add(item); } } if (!OADinfoList.Contains(item)) { OADinfoList.Add(item); } #endif } ShowOADinfoListCount.Reverse(); ChangeList(ShowOADinfoListCount.Count); //前端等级解锁 int level = StaticData.GetPlayerLevelByExp(); int maxChapterID = 0; foreach (var item in StaticData.configExcel.Section) { if (item.SectionGrade <= level) { maxChapterID = item.SectionId; continue; } else { break; } } if (this._unlockMaxChapterID <= maxChapterID) { StaticData.playerInfoData.userInfo.UnlockSectionId = maxChapterID; this._unlockMaxChapterID = maxChapterID; } if (StaticData.playerInfoData.favorableData.Count <= 0) { ImpulseHelper.CacheFavorable(); } else { Debug.Log("本地已缓存好感数据"); } }