コード例 #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);
        }
    }
コード例 #2
0
ファイル: JournalChooseView.cs プロジェクト: linxscc/LoveGame
    private void GoToJournal(GameObject go)
    {
        AppointmentRuleVo vo = (AppointmentRuleVo)PointerClickListener.Get(go).parameter;
        //要先判断这张卡片有没有。
        var card = GlobalData.CardModel.GetUserCardById(vo.ActiveCards[0]);

        if (card == null)
        {
            SendMessage(new Message(MessageConst.CMD_APPOINTMENT_SHOW_NOCARD, vo));
        }
        else
        {
            //发送解锁协议,判断这个User是否已经激活了这个约会
            var user = _appointmentModel.GetUserAppointment(vo.Id);
            //Debug.LogError("activeState"+user?.ActiveState);
            SendMessage(user?.ActiveState == 1
                                ? new Message(MessageConst.CMD_APPOINTMENT_SHOW_LOVESTORY, Message.MessageReciverType.DEFAULT, vo)
                                : new Message(MessageConst.CMD_APPOINTMENT_ACTIVE_LOVESTORY, Message.MessageReciverType.DEFAULT, vo));
        }
    }
コード例 #3
0
    public void SetData(AppointmentRuleVo vo, AppointmentModel appointmentModel)
    {
        UserAppointmentVo uservo = appointmentModel.GetUserAppointment(vo.Id);

        appointmentModel.SetCurAppointmentRule(vo);
        _jumpFromCard = true;
        if (uservo == null || uservo.ActiveState == 0)
        {
            if (uservo == null)
            {
                Debug.LogError("uservo null");
            }

            _loveStoryView.SetEmptyTexture();
            _loveStoryController.SetData(vo);
        }
        else
        {
            _loveStoryView.SetData(vo, appointmentModel);
        }
    }