Пример #1
0
    /// <summary>
    /// 处理View消息
    /// </summary>
    /// <param name="message"></param>
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.CMD_APPOINTMENT_ENSUREOPENGATE:
            _usergate        = (AppointmentGateRuleVo)body[0];
            _appointmentrule = (AppointmentRuleVo)body[1];

            //这里要判断卡牌和星级啊。从appointment中获取到。
            var cardvo = GlobalData.CardModel.GetUserCardById(_appointmentrule.ActiveCards[0]);
            if (cardvo.Star < _usergate.Star)
            {
                //Debug.LogError("cstar"+cardvo.Star+"  userstar"+_usergate.Star);
                FlowText.ShowMessage(I18NManager.Get("LoveAppointment_Hint3"));    //("星缘心级不足");
                return;
            }

            if ((int)cardvo.Evolution < _usergate.Evo)
            {
//					Debug.LogError("(int)cardvo.Evolution"+(int)cardvo.Evolution+" _usergate.Evo"+_usergate.Evo);
                FlowText.ShowMessage(I18NManager.Get("LoveAppointment_Hint4"));                        //("星缘未进化");
                return;
            }



            if (_ensureOpenGateWindow == null)
            {
                _ensureOpenGateWindow = PopupManager.ShowWindow <EnsureOpenGateWindow>("LoveAppointment/Prefabs/EnsureOpenGateWindow");
            }
            _ensureOpenGateWindow.SetData(_usergate, _appointmentrule.Id);

            //bug 这个事件监听在Start的时候无法执行。
            EventDispatcher.AddEventListener(EventConst.OpenGate, OpenGate);

            break;

//			case MessageConst.CMD_APPOINTMENT_UPDATE_LOVESTORY:
//
//				UpdateAppointmentData();
//				break;
        case MessageConst.CMD_APPOINTMENT_ACTIVE_PHOTOCLEARUP:
            PhotoNickUpReq((int)body[0], (int)body[1]);
            break;

        case MessageConst.CMD_APPOINTMENT_JUMPTODAILY:

            if (!GuideManager.IsOpen(ModulePB.Love, FunctionIDPB.LoveDiary))
            {
                string desc = GuideManager.GetOpenConditionDesc(ModulePB.Love, FunctionIDPB.LoveDiary);
                FlowText.ShowMessage(desc);
                return;
            }
            ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_LOVEDIARY, false);
            break;
        }
    }
Пример #2
0
 public override void SetData(params object[] paramsObjects)
 {
     if (paramsObjects.Length > 0)
     {
         _AppointmentVo = (AppointmentRuleVo)paramsObjects[0];
     }
 }
Пример #3
0
    public void SetData(AppointmentRuleVo vo)
    {
        _appointmentRuleVo = vo;
        LoadingOverlay.Instance.Show();
        var buff = NetWorkManager.GetByteData(new ActiveReq()
        {
            AppointmentId = vo.Id
        });

        NetWorkManager.Instance.Send <ActiveRes>(CMD.APPOINTMENT_ACTIVE, buff, ActiveAppointment);
    }
Пример #4
0
 public void SetData(AppointmentRuleVo vo, AppointmentModel appointmentModel, bool needactive = false)
 {
     appointmentModel.SetCurAppointmentRule(vo);
     if (needactive)
     {
         _loveStoryView.SetEmptyTexture();
         _loveStoryController.SetData(vo);
     }
     else
     {
         _loveStoryView.SetData(vo, appointmentModel);
     }
     //_loveStoryView.Show();
 }
Пример #5
0
        //假设其他模块会传规则过来了
        public void LoveSetp2(List <AppointmentRuleVo> data)
        {
            //首先要引导翻页,看要翻几次的意思!
            viewcontent.gameObject.SetActive(false);
            loveappointindex = 0;
            for (int i = 0; i < data.Count; i++)
            {
                if (data[i].ActiveCards.Contains(_userCardVo.CardId))
                {
                    loveappointindex   = i;
                    _appointmentRuleVo = data[i];
                }
            }

            pos       = loveappointindex % 15;
            page      = loveappointindex / 15 + 1; //所在第几页?!
            stroyList = transform.Find("BG/List");
            pageArrow = transform.Find("BG/PageArrow");
            stroyList.gameObject.SetActive(true);
            //是第二页的话就要不断的引导点击下一页!
            if (page - 1 > 0)
            {
                pageArrow.gameObject.SetActive(true);
                GuideArrow.DoAnimation(pageArrow.Find("Right"));
//                var arrow = pageArrow.Find("Right/Arrow").GetComponent<Image>();
//                RectTransform rect = arrow.rectTransform;
//                rect.DOLocalMove(new Vector2(rect.localPosition.x - 30.0f,
//                    rect.localPosition.y + 30.0f), 0.5f).SetLoops(-1, LoopType.Yoyo);
                PointerClickListener.Get(pageArrow.Find("Right/ClickArea").gameObject).onClick = go =>
                {
                    //先发送协议要换页显示!sendmessage
                    SendMessage(new Message(MessageConst.CMD_APPOINTMENT_GUIDE_NEXTPAGE,
                                            Message.MessageReciverType.UnvarnishedTransmission));
                    page--;
                    NextPage();
                };
            }
            else
            {
                ChooseStory();
            }
        }
Пример #6
0
    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));
        }
    }
Пример #7
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);
        }
    }
Пример #8
0
    private void ShowCardAwardPreview(UserCardVo userCardVo)
    {
        List <CardAwardPreInfo> infos = new List <CardAwardPreInfo>();
        var vo     = userCardVo;
        int cardId = userCardVo.CardId;
        int NpcId  = (int)userCardVo.CardVo.Player;

        var userFavorabilityVo = GlobalData.FavorabilityMainModel.GetUserFavorabilityVo(NpcId);//用户NPC的好感度信息

        Debug.LogError("CardId " + cardId + "  NpcId " + NpcId);

        PlayerPB playerPB = userCardVo.CardVo.Player;

        var cardPd = GlobalData.CardModel.GetCardBase(cardId);

        for (int i = 0; i < cardPd.GainSceneIds.Count; i++)
        {
            int phonesceneId = cardPd.GainSceneIds[i];
            if (phonesceneId == 0)
            {
                continue;
            }
            bool isUnlock = true;

            var userCard = GlobalData.CardModel.GetUserCardById(cardId);
            isUnlock = userCard != null;

            //   Debug.LogError("phonesceneId" + phonesceneId+ "GetSceneName"+ GetSceneName(phonesceneId));

            CardAwardPreInfo info = CreateCardAwardPreInfo(GetSceneName(phonesceneId), isUnlock, GetCardAwardPreType(phonesceneId));

            info.StartTips = "1心解锁.";
//            Debug.LogError(isUnlock+" "+info.content);
            infos.Add(info);
        }



        int sceneId = 0;

        //解锁手机事件
        for (int i = 0; i < vo.MaxStars; i++)
        {
            var targetStarUpPb = GlobalData.CardModel.GetCardStarUpRule(vo.CardId, (StarPB)i);
            if (targetStarUpPb == null)
            {
                //Debug.LogError("no i" + i);
                continue;
            }
            for (int j = 0; j < targetStarUpPb.SceneIds.Count; j++)
            {
                if (targetStarUpPb.SceneIds[j] == 0)
                {
                    continue;
                }
                sceneId = targetStarUpPb.SceneIds[j];
                bool isUnlock = false;
                SceneUnlockRulePB curscenePb = GlobalData.FavorabilityMainModel.GetUnlockRulePb(sceneId);
                if (curscenePb == null)
                {
                    continue;
                }
                if (curscenePb.FavorabilityLevel <= userFavorabilityVo.Level && (int)targetStarUpPb.Star <= vo.Star)
                {
                    isUnlock = true;
                }
                if (curscenePb != null)
                {
                    //SmsInfo info = JsonConvert.DeserializeObject<SmsInfo>(text);
                    CardAwardPreInfo info        = CreateCardAwardPreInfo(GetSceneName(sceneId), isUnlock, GetCardAwardPreType(sceneId));
                    PhoneUnlockInfo  phoneUnlock = ClientData.GetPhoneUnlockInfoById(sceneId);
                    if (phoneUnlock != null)
                    {
                        info.UnlockDescription = phoneUnlock.UnlcokDes;
                        info.StartTips         = phoneUnlock.StartTips + ".";
                        Debug.LogError(info.content);
                        infos.Add(info);
                    }
                }
                Debug.Log("Star  level " + i + "  sceneID  " + sceneId + "  isUnlock " + isUnlock);
            }
        }


        //恋爱剧情
        UserAppointmentVo userAppointmentVo = GlobalData.AppointmentData.GetCardAppointmentVo(cardId);

        if (userAppointmentVo != null)
        {
            int appointmentId = userAppointmentVo.AppointmentId;
            AppointmentRuleVo appointmentRuleVo = GlobalData.AppointmentData.GetAppointmentRule(appointmentId);

            string cotent = appointmentRuleVo.Name;

            foreach (var v in appointmentRuleVo.GateInfos)
            {
                //cotent = cotent + v.Gate.ToString();

                bool isUnlock = userAppointmentVo.ActiveGateInfos.Contains(v.Gate);
                if (v.Star == 0 && v.Evo == 0)
                {
                    isUnlock = true;
                }


                string key  = "Common_Number" + v.Gate.ToString();
                var    info = CreateCardAwardPreInfo(cotent + I18NManager.Get(key), isUnlock, CardAwardPreType.LoveStory);

                if (v.Star == 0 && v.Evo == 0)
                {
                    info.StartTips = "1心解锁.";
                }


                if (v.Star > 0)
                {
                    info.StartTips         = (v.Star + 1) + "心解锁.";
                    info.UnlockDescription = I18NManager.Get("Card_PreviewStarUnlock", (v.Star + 1));
                }

                if (v.Evo > 0)
                {
                    info.StartTips         = "进化" + v.Evo + "解锁.";
                    info.UnlockDescription = I18NManager.Get("Card_PreviewEvoUnlock", v.Evo);
                }

                infos.Add(info);
            }
        }

        //日记语音
        List <ElementPB> elementPBs = GlobalData.DiaryElementModel.GetDialogsByCardId(cardId);

        foreach (var elementPB in elementPBs)
        {
            if (elementPB.ElementType == ElementTypePB.Sound)
            {
                string cotent   = elementPB.Name;
                bool   isUnlock = GlobalData.DiaryElementModel.IsCanUseElement(elementPB.Id);
                var    info     = CreateCardAwardPreInfo(cotent, isUnlock, CardAwardPreType.LoveDiaryLabelVoice);
                info.StartTips         = "进化1解锁.";
                info.UnlockDescription = I18NManager.Get("Card_PreviewEvoUnlock", 1);
                infos.Add(info);
            }
        }

//        var drawcards = ClientData.GetDrawCardExpressionInfos(NpcId, EXPRESSIONTRIGERTYPE.DRAWCARD);
//        //抽卡语音
//        foreach (var v in drawcards)
//        {
//            string cotent = v.DialogName;
//            bool isUnlock = true;
//            infos.Add(CreateCardAwardPreInfo(cotent, isUnlock, CardAwardPreType.DrawCardVioce));
//        }

        infos.Sort();

        string cardName = userCardVo.CardVo.CardName;
        var    win      = PopupManager.ShowWindow <CardAwardPreviewWindow>("Card/Prefabs/CardDetail/CardAwardPreviewWindow");

        win.SetData(cardName, infos);

        //string path = "FavorabilityMain/Prefabs/VoiceWindow";
        //var voiceWin = PopupManager.ShowWindow<VoiceWindow>(path);
        //voiceWin.SetData("111", infos);
    }
Пример #9
0
 public void SetCurAppointmentRule(AppointmentRuleVo vo)
 {
     _curAppointmentRuleVo = vo;
 }
Пример #10
0
    /// <summary>
    /// 赋值主通道
    /// </summary>
    /// <param name="userCardVo"></param>
    /// <param name="propModel"></param>
    /// <param name="addExp"></param>
    /// <param name="starupsuccess"></param>
    public void SetData(UserCardVo userCardVo, PropModel propModel, bool addExp = false, bool starupsuccess = false)
    {
        GlobalData.CardModel.CurCardVo = userCardVo;
        _callTimes     = 0;
        _userCardVo    = userCardVo;
        _starUpSuccess = starupsuccess;
        ChangeCondiction(_userCardVo);
        SetCardBg(_userCardVo);


        _curLevelExp = userCardVo.CurrentLevelExp;
        _needExp     = userCardVo.NeedExp;

        //Debug.LogWarning("cardDetailView SetData:" + addExp + "oldLevel:"+ oldLevel + " userCard lv:"+ _userCardVo.Level);
        if (!addExp || _userCardVo.Level <= oldLevel)
        {
            ChangePropView(userCardVo, addExp);
        }
        //经验信息
        UpdateExpInfo(addExp);

        //升星道具
        UpdateStarPropNum(userCardVo, addExp);

        //升级道具

        //Debug.LogError(userCardVo.Level+" "+ _userCardVo.UpgradeRequireLevel);
        if (userCardVo.Level < _userCardVo.UpgradeRequireLevel)
        {
            _upgradeLevelProps.gameObject.SetActive(true);
            _upgradeOneLevel.gameObject.SetActive(true);
            _leveluplimittext.gameObject.SetActive(false);
            Text expText;
            for (int i = 0; i < _propsTran.childCount; i++)
            {
                expText      = _propsTran.GetChild(i).Find("ExpText").GetComponent <Text>();
                expText.text = "+" + propModel.GetPropBase(PropConst.CardUpgradePropSmall + i).Exp;
            }

            _upgradeTips.text = I18NManager.Get("Card_LevelUptoStarUp");
        }
        else
        {
            _upgradeLevelProps.gameObject.SetActive(userCardVo.Level < _userCardVo.CardVo.MaxLevel);
            _upgradeOneLevel.gameObject.SetActive(userCardVo.Level < _userCardVo.CardVo.MaxLevel);
            _leveluplimittext.gameObject.SetActive(userCardVo.Level >= _userCardVo.CardVo.MaxLevel);
            //等级达到上限的Text!只有切换到升星的时候才会显示。
            _leveluplimittext.GetComponent <Text>().text = I18NManager.Get("Card_HasMaxLevel");//"+"userCardVo.Level < _userCardVo.CardVo.MaxLevel ? I18NManager.Get("Card_StarupTips") :

            _upgradeTips.text = I18NManager.Get("Card_NeedMoreLevel");
        }
        UpdatePropNum(propModel);
        _levelOneBtn.image.color = userCardVo.Level < _userCardVo.UpgradeRequireLevel ? Color.white : Color.gray;

        SetStarEffectIndex(starupsuccess);
        //_evolutionBtn.gameObject.SetActive(userCardVo.Star>=3);

        ShowEvoSelect();

        hassignature = _userCardVo.SignatureCard != null;
        _signature.gameObject.SetActive(hassignature);
        if (hassignature)
        {
            _signature.texture = ResourceManager.Load <Texture>("Prop/Signature/sign" + (int)_userCardVo.CardVo.Player);
            _signature.SetNativeSize();
        }

        starUpPreviewBtn.gameObject.SetActive(GuideManager.IsPass1_9());

        _starupRedPoint.gameObject.SetActive(userCardVo.ShowUpgradeStarRedpoint);
        _evolutionRedPoint.gameObject.SetActive(userCardVo.ShowEvolutionRedPoint);


        _loveBtn.gameObject.SetActive(userCardVo.CardVo.Credit != CreditPB.R);
        _AppointmentVo = userCardVo.CardAppointmentRuleVo;
        _loveRedPoint.gameObject.SetActive(userCardVo.ShowLovePoint);
    }