Esempio n. 1
0
    /// <summary>
    /// 根据类型查询对话数据
    /// </summary>
    /// <param name="userId"></param>
    /// <param name="textTalkType"></param>
    public void GetTextForTalkByType(long userId, TextTalkTypeEnum textTalkType, Action <List <TextInfoBean> > action)
    {
        List <TextInfoBean> listData = GetModel().GetTextForTalkByType(userId, textTalkType);

        if (listData != null)
        {
            GetView().GetTextInfoForTalkByTypeSuccess(textTalkType, listData, action);
        }
        else
        {
            GetView().GetTextInfoFail();
        }
    }
Esempio n. 2
0
 /// <summary>
 /// 通过对话类型查询指定用户对话
 /// </summary>
 /// <param name="textEnum"></param>
 /// <param name="talkType"></param>
 /// <param name="userId"></param>
 /// <returns></returns>
 public List <TextInfoBean> QueryDataByTalkType(TextEnum textEnum, TextTalkTypeEnum talkType, long userId)
 {
     InitTableByTextType(textEnum);
     return(BaseQueryData <TextInfoBean>("text_id", tableNameForMain + ".user_id", userId + "", tableNameForMain + ".talk_type", (int)talkType + ""));
 }
Esempio n. 3
0
 public void GetTextInfoForTalkByTypeSuccess(TextTalkTypeEnum textTalkType, List <TextInfoBean> listData, Action <List <TextInfoBean> > action)
 {
     listTextData = listData;
     action?.Invoke(listData);
 }
Esempio n. 4
0
 /// <summary>
 /// 获取捣乱对话
 /// </summary>
 /// <param name="userId"></param>
 public void GetTextForTalkType(long userId, TextTalkTypeEnum textTalkType, Action <List <TextInfoBean> > action)
 {
     textInfoController.GetTextForTalkByType(userId, textTalkType, action);
 }
Esempio n. 5
0
    /// <summary>
    /// NPC 对话ITEM
    /// </summary>
    /// <param name="textInfoService"></param>
    /// <param name="markId"></param>
    /// <param name="listTextData"></param>
    public static void GUINpcTextInfoItemForMarkId(TextInfoService textInfoService,
                                                   long userId, TextTalkTypeEnum talkType, long markId, List <TextInfoBean> listTextData,
                                                   out List <TextInfoBean> outListTextData)
    {
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        GUILayout.Label("markId:" + markId, GUILayout.Width(150), GUILayout.Height(20));
        if (listTextData.Count > 0)
        {
            GUILayout.Label("对话类型:", GUILayout.Width(120), GUILayout.Height(20));
            listTextData[0].talk_type = (int)(TextTalkTypeEnum)EditorGUILayout.EnumPopup((TextTalkTypeEnum)listTextData[0].talk_type, GUILayout.Width(100), GUILayout.Height(20));
            GUILayout.Label("条件-好感对话:", GUILayout.Width(120), GUILayout.Height(20));
            listTextData[0].condition_min_favorability = int.Parse(EditorGUILayout.TextArea(listTextData[0].condition_min_favorability + "", GUILayout.Width(50), GUILayout.Height(20)));
        }
        if (listTextData != null)
        {
            foreach (TextInfoBean itemTalkInfo in listTextData)
            {
                itemTalkInfo.talk_type = listTextData[0].talk_type;
                itemTalkInfo.condition_min_favorability = listTextData[0].condition_min_favorability;
            }
        }
        if (GUILayout.Button("添加对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            TextInfoBean addText = new TextInfoBean();
            addText.mark_id    = markId;
            addText.id         = addText.mark_id * 1000 + (listTextData.Count + 1);
            addText.text_id    = addText.id;
            addText.user_id    = listTextData.Count > 0 ? listTextData[0].user_id : userId;
            addText.valid      = 1;
            addText.text_order = 1;
            addText.talk_type  = listTextData.Count > 0 ? listTextData[0].talk_type : (int)talkType;
            listTextData.Add(addText);
        }
        if (GUILayout.Button("保存当前所有对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            foreach (TextInfoBean itemTalkInfo in listTextData)
            {
                textInfoService.UpdateDataById(TextEnum.Talk, itemTalkInfo.id, itemTalkInfo);
            }
        }
        GUILayout.EndHorizontal();
        TextInfoBean removeTalkInfo = null;

        foreach (TextInfoBean itemTalkInfo in listTextData)
        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("更新", GUILayout.Width(120), GUILayout.Height(20)))
            {
                textInfoService.UpdateDataById(TextEnum.Talk, itemTalkInfo.id, itemTalkInfo);
            }
            if (GUILayout.Button("删除对话", GUILayout.Width(120), GUILayout.Height(20)))
            {
                removeTalkInfo = itemTalkInfo;
                textInfoService.DeleteDataById(TextEnum.Talk, itemTalkInfo.id);
            }
            GUILayout.Label("talkId:", GUILayout.Width(100), GUILayout.Height(20));
            itemTalkInfo.id      = long.Parse(EditorGUILayout.TextArea(itemTalkInfo.id + "", GUILayout.Width(150), GUILayout.Height(20)));
            itemTalkInfo.text_id = itemTalkInfo.id;
            GUILayout.Label("对话顺序:", GUILayout.Width(100), GUILayout.Height(20));
            itemTalkInfo.text_order = int.Parse(EditorGUILayout.TextArea(itemTalkInfo.text_order + "", GUILayout.Width(50), GUILayout.Height(20)));
            GUILayout.Label("说话者ID:", GUILayout.Width(100), GUILayout.Height(20));
            itemTalkInfo.user_id = EditorUI.GUIEditorText(itemTalkInfo.user_id, 150);
            itemTalkInfo.type    = (int)(TextInfoTypeEnum)EditorGUILayout.EnumPopup((TextInfoTypeEnum)itemTalkInfo.type, GUILayout.Width(100), GUILayout.Height(20));
            if (itemTalkInfo.type == (int)TextInfoTypeEnum.Select)
            {
                GUILayout.Label("选择类型:", GUILayout.Width(100), GUILayout.Height(20));
                itemTalkInfo.select_type = int.Parse(EditorGUILayout.TextArea(itemTalkInfo.select_type + "", GUILayout.Width(50), GUILayout.Height(20)));
            }
            else
            {
                if (itemTalkInfo.type == (int)TextInfoTypeEnum.Behind)
                {
                    GUILayout.Label("黑屏时间:", GUILayout.Width(100), GUILayout.Height(20));
                    itemTalkInfo.wait_time = EditorUI.GUIEditorText(itemTalkInfo.wait_time, 50);
                }
                GUILayout.Label("增加的好感:", GUILayout.Width(100), GUILayout.Height(20));
                itemTalkInfo.add_favorability = int.Parse(EditorGUILayout.TextArea(itemTalkInfo.add_favorability + "", GUILayout.Width(50), GUILayout.Height(20)));
            }
            GUILayout.Label("指定下一句对话:", GUILayout.Width(120), GUILayout.Height(20));
            itemTalkInfo.next_order = int.Parse(EditorGUILayout.TextArea(itemTalkInfo.next_order + "", GUILayout.Width(50), GUILayout.Height(20)));
            GUILayout.Label("触发条件-最低好感:", GUILayout.Width(120), GUILayout.Height(20));
            itemTalkInfo.condition_min_favorability = int.Parse(EditorGUILayout.TextArea(itemTalkInfo.condition_min_favorability + "", GUILayout.Width(50), GUILayout.Height(20)));
            GUILayout.Label("预设名字:", GUILayout.Width(100), GUILayout.Height(20));
            itemTalkInfo.name = EditorGUILayout.TextArea(itemTalkInfo.name + "", GUILayout.Width(50), GUILayout.Height(20));
            GUILayout.Label("对话内容:", GUILayout.Width(100), GUILayout.Height(20));
            itemTalkInfo.content     = EditorGUILayout.TextArea(itemTalkInfo.content + "", GUILayout.Width(500), GUILayout.Height(20));
            itemTalkInfo.reward_data = EditorUI.GUIListData <RewardTypeEnum>("奖励", itemTalkInfo.reward_data);
            if (itemTalkInfo.type == (int)TextInfoTypeEnum.Select && itemTalkInfo.select_type == 1)
            {
                itemTalkInfo.pre_data          = EditorUI.GUIListData <PreTypeEnum>("付出", itemTalkInfo.pre_data);
                itemTalkInfo.pre_data_minigame = EditorUI.GUIListData <PreTypeForMiniGameEnum>("小游戏数据", itemTalkInfo.pre_data_minigame);
            }

            if (GUILayout.Button("更新", GUILayout.Width(120), GUILayout.Height(20)))
            {
                textInfoService.UpdateDataById(TextEnum.Talk, itemTalkInfo.id, itemTalkInfo);
            }
            if (GUILayout.Button("删除对话", GUILayout.Width(120), GUILayout.Height(20)))
            {
                removeTalkInfo = itemTalkInfo;
                textInfoService.DeleteDataById(TextEnum.Talk, itemTalkInfo.id);
            }
            GUILayout.EndHorizontal();
        }
        if (removeTalkInfo != null)
        {
            listTextData.Remove(removeTalkInfo);
            removeTalkInfo = null;
        }
        outListTextData = listTextData;
    }
Esempio n. 6
0
    /// <summary>
    /// Npc对话查询 UI
    /// </summary>
    public static void GUINpcTalkFind(TextInfoService textInfoService,
                                      long npcId, TextTalkTypeEnum talkType, Dictionary <long, List <TextInfoBean> > mapNpcTalkInfoForFind,
                                      out TextTalkTypeEnum outTalkType)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("NpcID:" + npcId, GUILayout.Width(120));
        bool isFind = false;

        if (GUILayout.Button("查询普通对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Normal;
        }
        if (GUILayout.Button("查询第一次对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.First;
        }
        if (GUILayout.Button("查询招募对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Recruit;
        }
        if (GUILayout.Button("查询礼物对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Gift;
        }
        if (GUILayout.Button("查询后续事件对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Subsequent;
        }
        if (GUILayout.Button("查询捣乱事件对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Rascal;
        }
        if (GUILayout.Button("查询杂项事件对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Sundry;
        }
        if (GUILayout.Button("查询喊话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Shout;
        }
        if (GUILayout.Button("查询交换对话", GUILayout.Width(120), GUILayout.Height(20)))
        {
            isFind   = true;
            talkType = TextTalkTypeEnum.Exchange;
        }
        if (isFind)
        {
            List <TextInfoBean> listNpcTalkInfo = textInfoService.QueryDataByTalkType(TextEnum.Talk, talkType, npcId);
            HandleTalkInfoDataByMarkId(listNpcTalkInfo, mapNpcTalkInfoForFind);
        }
        GUILayout.EndHorizontal();
        outTalkType = talkType;
        if (mapNpcTalkInfoForFind == null)
        {
            return;
        }
        long deleteMarkId = 0;

        foreach (var mapItemTalkInfo in mapNpcTalkInfoForFind)
        {
            long markId = mapItemTalkInfo.Key;
            List <TextInfoBean> listTextData = mapItemTalkInfo.Value;
            if (GUILayout.Button("删除markId下所有对话", GUILayout.Width(150), GUILayout.Height(20)))
            {
                textInfoService.DeleteDataByMarkId(TextEnum.Talk, markId);
                deleteMarkId = markId;
            }
            GUINpcTextInfoItemForMarkId(textInfoService, npcId, talkType, markId, listTextData, out listTextData);
        }
        if (deleteMarkId != 0)
        {
            mapNpcTalkInfoForFind.Remove(deleteMarkId);
            deleteMarkId = 0;
        }
    }
Esempio n. 7
0
 public List <TextInfoBean> GetTextForTalkByType(long userId, TextTalkTypeEnum textTalkType)
 {
     return(mTextInfoService.QueryDataByTalkType(TextEnum.Talk, textTalkType, userId));
 }