//刷新好感度信息
    private void RefreshLastFetter(Module_Npc.NpcMessage npcInfo)
    {
        string strVal = npcInfo.lastFetterValue + "/" + npcInfo.lastToFetterValue;

        Util.SetText(m_textGoodFeelProcess, strVal);

        Util.SetText(m_textRelationLv, npcInfo.lastStageName);
        Util.SetText(m_textSubRelationLv, npcInfo.lastLvName);

        float lastFillAmount = (float)npcInfo.lastFetterValue / npcInfo.toFetterValue;
        float nowFillAmount  = (float)npcInfo.nowFetterValue / npcInfo.toFetterValue;

        if (npcInfo.lastFetterValue > npcInfo.lastToFetterValue)
        {
            m_fetterDVal  = npcInfo.lastFetterValue - npcInfo.lastToFetterValue;
            nowFillAmount = 1;
        }

        FetterRoll(m_imgGoodFeelingSlider, lastFillAmount, nowFillAmount, 1.0f, () =>
        {
            if (m_fetterDVal > 0)
            {
                RefreshRollCurFetter(npcInfo);
            }
            else
            {
                RefreshCurFetter(npcInfo);
            }
        });
    }
Пример #2
0
 private void OnClickUpWindow(Module_Npc.NpcMessage msg)
 {
     if (msg != null && msg.npcInfo != null && msg.fetterLv == msg.npcInfo.unlockLv)
     {
         Module_NPCDating.instance.DoDatingEvent(msg.npcInfo.unlockStoryID);
     }
 }
 private void OnClick(RectTransform rt, Module_Npc.NpcMessage info)
 {
     m_CurClickIndex = Module_Npc.instance.allNpcs.FindIndex((p) => p.npcId == info.npcId);
     m_Npclist.UpdateItems();
     m_curNpc = info;
     SetNpcBiography();
 }
Пример #4
0
 private void OnClickUpWindow(Module_Npc.NpcMessage obj)
 {
     if (obj != null && obj.npcInfo != null && obj.fetterLv == obj.npcInfo.unlockLv)
     {
         Module_NPCDating.instance.DoDatingEvent(obj.npcInfo.unlockStoryID);
     }
 }
Пример #5
0
 private void UpdateNpcIcon(Image img, PDatingDivinationResultData data, Module_Npc.NpcMessage npc)
 {
     if (npc == null)
     {
         return;
     }
     AtlasHelper.SetNpcDateInfo(img, npc.icon);
 }
Пример #6
0
    public void OpenAnswerWindow(int answerId, Action callBack)
    {
        DialogueAnswersConfig dac = ConfigManager.Get <DialogueAnswersConfig>(answerId);

        if (dac == null)
        {
            Logger.LogError("Dating::  在DialogueAnswersConfig表中,找不到 id={0} 的配置,请检查配置", answerId);
            return;
        }
        CurDialogueAnswersData = dac;
        m_OnCompleteCallBack   = callBack;
        var listAllAnswerItems = new List <DialogueAnswersConfig.AnswerItem>();
        //检查有无问题选项
        bool bHaveAnswerItem = CheckAnserItems(dac.answerItems);

        if (bHaveAnswerItem)
        {
            Module_Npc.NpcMessage npc = null;
            if (moduleNpc.curNpc == null)
            {
                npc = moduleNpc.GetTargetNpc((NpcTypeID)moduleNPCDating.curDatingNpc?.npcId);
            }
            else
            {
                npc = moduleNpc.curNpc;
            }

            //有问题选项,判断每个问题是否符合限制条件
            for (int i = 0; i < dac.answerItems.Length; i++)
            {
                bool bGoodFeeling = CheckGoodFeelingLimit(npc.nowFetterValue, dac.answerItems[i].goodFeelingLimits);
                bool bMotion      = CheckMotionLimit(npc.mood, dac.answerItems[i].motionLimit);
                if (bGoodFeeling && bMotion)
                {
                    listAllAnswerItems.Add(dac.answerItems[i]);
                }
            }

            //如果有符合条件的选项,进一步筛选
            if (listAllAnswerItems.Count > 0)
            {
                AllAnswerItemDataList = GetFinalAnswerItemsList(listAllAnswerItems, dac);
                if (AllAnswerItemDataList.Count > 0)
                {
                    OpenAnswerWindow();
                }
            }
            else
            {
                Logger.LogError("Dating::  answerId={0} 的配置中,符合条件的问题选项为空,请检查配置条件", answerId);
            }
        }
        else
        {
            OnChooseAnswerCallBack();
        }
    }
    private void HidePanel()
    {
        Hide <Window_DatingSelectNpc>();

        m_curIndex        = 0;
        m_curClickNpcData = null;
        m_itemDataDic.Clear();
        m_tfFetterTipPanel.SafeSetActive(false);
    }
    private void RefreshCurFetter(Module_Npc.NpcMessage npcInfo)
    {
        string strVal = npcInfo.nowFetterValue + "/" + npcInfo.toFetterValue;

        Util.SetText(m_textGoodFeelProcess, strVal);
        Util.SetText(m_textRelationLv, npcInfo.curStageName);
        Util.SetText(m_textSubRelationLv, npcInfo.curLvName);

        float nowFillAmount = (float)npcInfo.nowFetterValue / npcInfo.toFetterValue;
    }
 public override bool Initialize(params object[] p)
 {
     m_Npclist.SetItems(Module_Npc.instance.allNpcs);
     //默认取第一个NPC的信息
     if (m_CurClickIndex == -1)
     {
         m_curNpc = Module_Npc.instance.allNpcs[0];
     }
     SetNpcBiography();
     return(base.Initialize(p));
 }
Пример #10
0
 private void UpdateTextMood(Text t, int id, PDatingDivinationResultData data, Module_Npc.NpcMessage npc = null)
 {
     if (npc == null)
     {
         Util.SetText(t, id, data.addMood.ToString(), data.addMood.ToString());
     }
     else
     {
         Util.SetText(t, id, npc.name, data.addMood.ToString(), data.addMood.ToString());
     }
 }
 private void SetTel(Text t, Module_Npc.NpcMessage data)
 {
     if (data.isUnlockEngagement)
     {
         Util.SetText(t, data.npcInfo.telephone);
     }
     else
     {
         Util.SetText(t, ConfigText.GetDefalutString(TextForMatType.SelectDatingNpc, 18));
     }
 }
 private void SetDesc(Text t, Module_Npc.NpcMessage data)
 {
     if (data.isUnlockEngagement)
     {
         Util.SetText(t, data.npcInfo.descID);
     }
     else
     {
         Util.SetText(t, Util.Format(ConfigText.GetDefalutString(TextForMatType.SelectDatingNpc, 8), data.name));
     }
 }
Пример #13
0
    public static void ShowUpWindow(Module_Npc.NpcMessage msg, Action <Module_Npc.NpcMessage> callback)
    {
        if (msg == null)
        {
            return;
        }

        m_msg      = msg;
        m_callback = callback;

        ShowAsync <Window_NpcUpLv>();
    }
    private void OnNpcTogValueChanged(Toggle toggle, bool isOn)
    {
        if (!isOn)
        {
            return;
        }
        int togIndex = toggle.transform.GetSiblingIndex();

        if (m_itemDataDic.ContainsKey(togIndex))
        {
            m_curClickNpcData = m_itemDataDic[togIndex];
        }
    }
    private void SetItemData(Transform node, Module_Npc.NpcMessage data)
    {
        if (data == null)
        {
            return;
        }
        PropItemInfo pinfo = new PropItemInfo();

        pinfo.ID = data.npcId;
        BaseRestrain.SetRestrainData(node.gameObject, pinfo, 0, 0);
        node.name = data.npcId.ToString();
        Text   textName        = node.Find("Text").GetComponent <Text>();
        Image  imgRelationShip = node.Find("dateLevelBg/fill").GetComponent <Image>();
        Text   textTel         = node.Find("phoneNumberBg/phoneNumber").GetComponent <Text>();
        Text   textDesc        = node.Find("intro").GetComponent <Text>();
        Text   textLabel       = node.Find("labelBg/label").GetComponent <Text>();
        Image  icon            = node.Find("avatar_back/mask/head_icon").GetComponent <Image>();
        Image  pledge          = node.Find("pledgeState").GetComponent <Image>();//誓约状态
        Text   textFetterStage = node.Find("goodfeelingLevel").GetComponent <Text>();
        Toggle toggle          = node.GetComponent <Toggle>();

        toggle.group = m_togGroup;

        //名字
        Util.SetText(textName, data.name);
        //设置关系
        SetRelationShip(imgRelationShip, data);
        //设置Npc标签
        Util.SetText(textLabel, data.npcInfo.labelMark);
        //电话
        SetTel(textTel, data);
        //描述
        SetDesc(textDesc, data);
        //头像
        AtlasHelper.SetAvatar(icon, data.icon);
        //AtlasHelper.SetNpcDateInfo(icon, data.npcInfo.datingAvatar);
        //誓约状态
        pledge.SafeSetActive(data.fetterStage == data.maxFetterStage);

        //羁绊等级名称
        Util.SetText(textFetterStage, data.curStageName);

        int togIndex = toggle.transform.GetSiblingIndex();

        if (m_itemDataDic.ContainsKey(togIndex))
        {
            m_itemDataDic.Remove(togIndex);
        }
        m_itemDataDic.Add(togIndex, data);
    }
    private void RefreshRollCurFetter(Module_Npc.NpcMessage npcInfo)
    {
        m_imgGoodFeelingSlider.fillAmount = 0;

        string strVal = m_fetterDVal + "/" + npcInfo.toFetterValue;

        Util.SetText(m_textGoodFeelProcess, strVal);
        Util.SetText(m_textRelationLv, npcInfo.curStageName);
        Util.SetText(m_textSubRelationLv, npcInfo.curLvName);

        float nowFillAmount = (float)npcInfo.nowFetterValue / npcInfo.toFetterValue;

        m_fetterDVal = 0;//把差值重置一下
        FetterRoll(m_imgGoodFeelingSlider, 0, nowFillAmount);
    }
 private void SetRelationShip(Image img, Module_Npc.NpcMessage data)
 {
     if (data.toFetterValue == 0)
     {
         img.fillAmount = 0;
     }
     else if (data.fetterLv >= data.maxFetterLv)
     {
         img.fillAmount = 1;
     }
     else
     {
         img.fillAmount = (float)data.nowFetterValue / data.toFetterValue;
     }
 }
Пример #18
0
    private void OnSetData(RectTransform rt, Module_Npc.NpcMessage info)
    {
        Transform no     = rt.Find("noImage");
        Transform have   = rt.Find("haveImage");
        Transform select = rt.Find("selectBox");

        if (!no || !have || !select)
        {
            return;
        }

        no.gameObject.SetActive(false);
        have.gameObject.SetActive(true);

        int index = Module_Npc.instance.allNpcs.FindIndex((p) => p.npcId == info.npcId);

        //设置默认选中已有的 第一个符文
        if (m_CurClickIndex == -1)
        {
            m_CurClickIndex = index;
        }

        select.gameObject.SetActive(index == m_CurClickIndex);

        if (index == m_CurClickIndex)
        {
            AtlasHelper.SetShared(m_NpcIcon, info.icon);
            Util.SetText(m_NpcName, info.npcInfo.name);
            Util.SetText(m_NpcNation, info.npcInfo.nation);
            Util.SetText(m_NpcFaith, info.npcInfo.belief);
            //UIDynamicImage.LoadImage(m_NpcFullImage.transform, info.npcInfo.allbobyicon, null, true); //这里需要全身像数据
            Util.SetText(m_NpcFetterValue, info.nowFetterValue);
            Util.SetText(m_NpcFetterLevel, info.fetterLv);
            Util.SetText(m_NpcFetterState, info.curLvName);
            int c = info.fetterLv % 3;
            m_NpcFetterStage_0_Flag.SafeSetActive(c == 1);
            m_NpcFetterStage_0_Flag.SafeSetActive(c == 2);
            m_NpcFetterStage_0_Flag.SafeSetActive(c == 0);

            if (info.belongStageName.Length >= 3)
            {
                Util.SetText(m_NpcFetterStage_0, info.belongStageName[0]);
                Util.SetText(m_NpcFetterStage_1, info.belongStageName[1]);
                Util.SetText(m_NpcFetterStage_2, info.belongStageName[2]);
            }
        }
    }
Пример #19
0
    private void RefreshSliderAndLv(Module_Npc.NpcMessage npcInfo)
    {
        //已满级
        if (npcInfo.fetterLv >= npcInfo.maxFetterLv)
        {
            Util.SetText(lv, npcInfo.fetterLv.ToString());
            topImage.fillAmount = 1;
            Util.SetText(exp_text, (int)TextForMatType.RuneUIText, 16);
            return;
        }

        //未满级
        topImage.fillAmount = npcInfo.fetterProgress;

        Util.SetText(exp_text, Util.Format("{0}/{1}", npcInfo.nowFetterValue, npcInfo.toFetterValue));
        Util.SetText(lv, npcInfo.fetterLv.ToString());
    }
Пример #20
0
    private void RefreshWindow(Module_Npc.NpcMessage msg)
    {
        if (msg == null)
        {
            return;
        }

        if (msg.npcInfo != null)
        {
            AtlasHelper.SetNpcDateInfo(m_npcName, msg.npcInfo.artNameTwo);
            UIDynamicImage.LoadImage(m_npcIcon, msg.npcInfo.bigBodyIcon);
            Util.SetText(m_cvName, msg.npcInfo.voiceActor);
        }
        Util.SetText(m_curStage, msg.curStageName);

        //当前阶段刷新
        if (msg.belongStageName != null && msg.belongStageName.Length >= 3)
        {
            Util.SetText(m_lvName1, msg.belongStageName[0]);
            Util.SetText(m_lvName2, msg.belongStageName[1]);
            Util.SetText(m_lvName3, msg.belongStageName[2]);
        }

        int remainder = msg.fetterLv % 3;

        m_curImage1.SafeSetActive(remainder == 1);
        m_curImage2.SafeSetActive(remainder == 2);
        m_curImage3.SafeSetActive(remainder == 0);

        //下一阶段刷新
        m_nextStage.SafeSetActive(msg.fetterStage < msg.maxFetterStage);

        if (msg.fetterStage < msg.maxFetterStage)
        {
            Util.SetText(m_nextStage, msg.GetStageName(msg.fetterStage + 1));
        }

        //解锁系统刷新
        m_unlockSystem.SafeSetActive(msg.isUnlockEngagement);
        if (msg.isUnlockEngagement)
        {
            Util.SetText(m_unlockSystem, 177);
        }
    }
    private void Refresh()
    {
        Module_NPCDatingSettlement.SettlementData data = moduleNPCDatingSettlement.datingSettlement;
        if (data == null)
        {
            return;
        }

        AtlasHelper.SetNpcDateInfo(m_imgDatingLevel, data.lvIconName);
        Util.SetText(m_textMoodValue, Util.Format("×{0}", data.moodValue.ToString()));

        Module_Npc.NpcMessage npcInfo = moduleNpc.GetTargetNpc((NpcTypeID)moduleNPCDating.curDatingNpc.npcId);
        if (npcInfo != null)
        {
            AtlasHelper.SetAvatar(m_npcIcon, npcInfo.icon);
            Util.SetText(m_textNpcName, npcInfo.name);
            RefreshLastFetter(npcInfo);
        }
        string preStr = data.addGoodFeelValue == 0 ? "" : "+";

        Util.SetText(m_textAddGoodFeelValue, preStr + data.addGoodFeelValue.ToString());

        //刷新事件列表
        List <string> sourcedataList = new List <string>();

        if (data.finishedEventIds != null)
        {
            for (int i = 0; i < data.finishedEventIds.Length; i++)
            {
                sourcedataList.Add(Util.GetString(data.finishedEventIds[i]));
            }
            sourcedataList.Distinct();//去除相同元素的值
        }

        m_dataSource.SetItems(sourcedataList);

        CreateNpcModel(npcInfo.npcId);

        //显示约会完成标记
        m_tfDatingFinishedMark.SafeSetActive(true);
    }
Пример #22
0
    private void SetNpcProperty(Module_Npc.NpcMessage npc, bool bRoll)
    {
        //心情值
        int lastMood = npc.lastMood;
        int curMood  = npc.mood;
        int maxMood  = GeneralConfigInfo.defaultConfig.datingNpcMaxMood;

        //体力值
        int lastPower = npc.lastBodyPower;
        int curPower  = npc.bodyPower;
        int maxPower  = npc.maxBodyPower;

        //滚动
        if (bRoll)
        {
            //心情
            var fromMoodNum = m_rtfMoodSliderBg.sizeDelta.x * (maxMood <= 0 ? 0 : (float)lastMood / maxMood > 1 ? 1 : (float)lastMood / maxMood);
            var toMoodNum   = m_rtfMoodSliderBg.sizeDelta.x * (maxMood <= 0 ? 0 : (float)curMood / maxMood > 1 ? 1 : (float)curMood / maxMood);
            AddRollNumber(m_rtfNpcMoodProgress, fromMoodNum, toMoodNum);

            //体力值
            AddRollNumber(m_textNpcPower, lastPower, curPower, 2.0f);
            float fromPowerProNum = maxPower <= 0 ? 0 : (float)lastPower / npc.maxBodyPower;
            float toPowerProNum   = maxPower <= 0 ? 0 : (float)curPower / npc.maxBodyPower;
            AddRollNumber(m_imgNpcPowerProgress, fromPowerProNum, toPowerProNum, 2.0f);
        }
        else
        {
            //心情
            var toMoodNum = m_rtfMoodSliderBg.sizeDelta.x * (maxMood <= 0 ? 0 : (float)curMood / maxMood > 1 ? 1 : (float)curMood / maxMood);
            AddRollNumber(m_rtfNpcMoodProgress, toMoodNum, toMoodNum);

            //体力值
            AddRollNumber(m_textNpcPower, curPower, curPower);
            float toPowerProNum = maxPower <= 0 ? 0 : (float)curPower / npc.maxBodyPower;
            AddRollNumber(m_imgNpcPowerProgress, toPowerProNum, toPowerProNum);
        }
    }
Пример #23
0
    private void UpdateResult(PDatingDivinationResultData data, EnumDivinationType divType)
    {
        if (data == null)
        {
            return;
        }
        int curDatingNpcId = moduleNPCDating.curDatingNpc != null ? moduleNPCDating.curDatingNpc.npcId : 0;

        Module_Npc.NpcMessage npc = moduleNpc.GetTargetNpc((NpcTypeID)curDatingNpcId);

        if (divType == EnumDivinationType.CrystalDevine)
        {
            UpdateTextResult(m_textCrystalDevineResult, data);
            UpdateTextMood(m_textCrystalDevineMood, 275, data);
            UpdateNpcIcon(m_CrystalDevineMoodNpcIcon, data, npc);
        }
        else if (divType == EnumDivinationType.LotDevine)
        {
            UpdateTextResult(m_textLotDevineResult, data);
            UpdateTextMood(m_textLotDevineMood, 276, data, npc);
            UpdateNpcIcon(m_LotDevineMoodNpcIcon, data, npc);
        }
    }
Пример #24
0
    private void SetNpcIcon(Module_Npc.NpcMessage npc)
    {
        m_NpcAvatar.SafeSetActive(true);

        UIDynamicImage.LoadImage(m_NpcAvatar.transform, npc.npcInfo.datingAvatar);
    }
Пример #25
0
 private void SetCurNpc()
 {
     Module_Npc.instance.SetCurNpc(npc_Type);
     currentNpc = Module_Npc.instance.curNpc ?? Module_Npc.instance.GetTargetNpc(npc_Type);
 }