Ejemplo n.º 1
0
    public void SetData(List <AppointmentRuleVo> appointmentRuleVos, AppointmentModel appointmentModel)
    {
        //参考GamePlay并且看看CMD的协议
        //第一步,读取拉下来的恋爱对象数据
        //第二步点击不同的角色进入不同的日记UI。
        int[] ids =
        {
            PropConst.CardEvolutionPropChi, PropConst.CardEvolutionPropQin, PropConst.CardEvolutionPropTang,
            PropConst.CardEvolutionPropYan
        };

        //要优化一下算法了,因为有三重循环在,效率非常低下!
        if (ids.Length <= 4)
        {
            for (int i = 0; i < ids.Length; i++)
            {
                //_rolesContent.GetChild(i).gameObject.Show();
                Image image = _rolesContent.GetChild(i).GetComponent <Image>();
                image.alphaHitTestMinimumThreshold = 0.1f;
                GameObject redpoint = _rolesContent.GetChild(i).Find("RedPoint").gameObject;

                PointerClickListener.Get(_rolesContent.GetChild(i).gameObject).parameter = ids[i];//appointmentRuleVos[i];
                PointerClickListener.Get(_rolesContent.GetChild(i).gameObject).onClick   = GoToJournal;

                //GetTargetData.先获取到AppointmentRule,然后在判断是否有userAppintment在其中,然后每个appointment是否有可解锁的。
                //最好的办法就是做一个全局的可解锁条件和全部通关未拍照的条件。

                var  roleAppointmentRule = appointmentModel.GetTargetData(ids[i]);
                bool showredpoint        = false;
                foreach (var ruleVo in roleAppointmentRule)
                {
                    var userappointment = appointmentModel.GetUserAppointment(ruleVo.Id);
                    //这个要抽出来做成全局通用的判断!!
                    if (userappointment == null)
                    {
                        continue;
                    }
                    //有这张卡并且有红点的时候有两种情况:1.没有激活这张卡。2.有可以解锁的关卡。3.有新的卡
                    foreach (var v in ruleVo.ActiveCards)
                    {
                        showredpoint = appointmentModel.NeedSetRedPoint(userappointment, v);
                        //Debug.LogError("WHY NO SHOW?");
                        if (showredpoint)
                        {
                            break;
                        }
                    }
                    if (showredpoint)
                    {
                        break;
                    }
                }
                redpoint.gameObject.SetActive(showredpoint);
            }
        }
        else
        {
            Debug.LogError(appointmentRuleVos.Count);
        }
    }
Ejemplo n.º 2
0
    public void SetOnePageData(List <AppointmentRuleVo> vo)
    {
        //_title.text = GlobalData.AppointmentModel.SpliceCardName(roleId) + "·好感度为10";
//         Debug.LogError(vo.Count);
        _bgImage.texture = ResourceManager.Load <Texture>("Background/JournalBG" + (_roleId - 10000), ModuleName);

        for (int i = 0; i < _journalList.transform.childCount; i++)
        {
            _journalList.transform.GetChild(i).gameObject.Hide();
        }


        for (int i = 0; i < vo.Count; i++)
        {
            _journalList.transform.GetChild(i).gameObject.Show();
            Text text     = _journalList.transform.GetChild(i).Find("TitleName").GetComponent <Text>();
            var  cardname = vo[i].Name;      //GlobalData.CardModel.GetCardBase(vo[i].Id).CardName;
            text.text = cardname;            //cardname;//
            RawImage notepic = _journalList.transform.GetChild(i).Find("NotePic").GetComponent <RawImage>();
            var      card    = GlobalData.CardModel.GetUserCardById(vo[i].ActiveCards[0]);
            //card?.CardVo.SquareCardPath(card?.UseEvo==EvolutionPB.Evo1&&card?.Evolution==EvolutionPB.Evo1)
            notepic.texture = ResourceManager.Load <Texture>(card != null && card.Evolution >= EvolutionPB.Evo2?vo[i].EvoSmallPicPath:vo[i].SmallPicPath, ModuleName);     //这个应该要放Vo.ID读卡牌的图。
            if (notepic.texture == null)
            {
                //Debug.LogError("No this pic "+card?.CardVo.SquareCardPath(card.UseEvo==EvolutionPB.Evo1&&card.Evolution==EvolutionPB.Evo1));
                notepic.texture = ResourceManager.Load <Texture>(card != null && card.Evolution >= EvolutionPB.Evo2?vo[i].EvoSmallPicPath:vo[i].SmallPicPath, ModuleName);
            }

            GameObject redpoint     = _journalList.transform.GetChild(i).Find("Redpoint").gameObject;
            bool       showredpoint = false;

            if (card == null)
            {
                notepic.color = Color.grey;
            }
            else
            {
                var userappointment = _appointmentModel.GetUserAppointment(vo[i].Id);
                if (userappointment != null)
                {
                    showredpoint = _appointmentModel.NeedSetRedPoint(userappointment, card.CardId);
                }


                notepic.color = Color.white;
            }
            redpoint.SetActive(showredpoint);
            PointerClickListener.Get(_journalList.transform.GetChild(i).gameObject).parameter = vo[i];
            PointerClickListener.Get(_journalList.transform.GetChild(i).gameObject).onClick   = GoToJournal;
        }
    }