Esempio n. 1
0
    /// <summary>
    /// 获取交流对话选项
    /// </summary>
    public void GetTextForTalkOptions(GameDataBean gameData, NpcInfoBean npcInfo, Action <List <TextInfoBean> > action)
    {
        //如果不是第一次对话则有以下选项
        listTextData = new List <TextInfoBean>();

        List <NpcTalkTypeEnum> npcTalkTypes = npcInfo.GetTalkTypes();

        listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 0, TextHandler.Instance.manager.GetTextById(99101)));
        foreach (NpcTalkTypeEnum itemType in npcTalkTypes)
        {
            switch (itemType)
            {
            case NpcTalkTypeEnum.Talk:
                listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99102)));
                break;

            case NpcTalkTypeEnum.OneTalk:
                if (!GameCommonInfo.DailyLimitData.CheckIsTalkNpc(npcInfo.id))
                {
                    listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99102)));
                }
                break;

            case NpcTalkTypeEnum.Recruit:
                if (!gameData.CheckHasWorker(npcInfo.id + ""))
                {
                    listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99104)));
                }
                break;

            case NpcTalkTypeEnum.Gift:
                if (!GameCommonInfo.DailyLimitData.CheckIsGiftNpc(npcInfo.id))
                {
                    listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99105)));
                }
                break;

            case NpcTalkTypeEnum.GuildCoinExchange:
                listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99201)));
                break;

            case NpcTalkTypeEnum.TrophyExchange:
                listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99202)));
                break;

            case NpcTalkTypeEnum.EquipExchange:
                listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99203)));
                break;

            case NpcTalkTypeEnum.ItemsExchange:
                listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99204)));
                break;
            }
        }

        CharacterFavorabilityBean characterFavorability = gameData.GetCharacterFavorability(npcInfo.id);
        FamilyDataBean            familyData            = gameData.GetFamilyData();

        //如果满足了结婚条件。添加结婚对话
        if (
            //该角色是否可以结婚
            npcInfo.CheckCanMarry()
            //好感是否达到要求
            && characterFavorability.CheckCanMarry()
            //是否已经向其他人求婚或者已经结婚
            && (familyData.timeForMarry == null || familyData.timeForMarry.year == 0))
        {
            listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99205)));
        }
        //离开选项
        listTextData.Add(new TextInfoBean(TextInfoTypeEnum.Talk, 1, TextHandler.Instance.manager.GetTextById(99103)));

        //继续查询该人物的所有对话
        GetTextForTalkByMinFavorability(npcInfo.id, characterFavorability.favorabilityLevel, action);
        action?.Invoke(listTextData);
    }