Пример #1
0
 //刷新
 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]));
     }
 }
Пример #2
0
    //打开界面 调用一次
    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);
        }
    }