Пример #1
0
        private void InitTaskCompleteConditions()
        {
            Type[] taskCompletedTypes = ReflectionHelper.GetAssemblyCustomAttributeTypeList <TaskCompleteAttribute>();
            foreach (Type taskCompletedImplType in taskCompletedTypes)
            {
                TaskCompleteAttribute taskComplete = taskCompletedImplType.GetCustomAttributes(typeof(TaskCompleteAttribute), false)[0] as TaskCompleteAttribute;

                this.m_taskCompleteDict.Add(taskComplete.CompleteMode, taskCompletedImplType);
            }
        }
Пример #2
0
        private void ShowAcceptTaskTips()
        {
            var taskTotalCompleteMode = TaskCompleteMode.NONE;


            foreach (var cc in m_taskInfo.CompleteConditionList)
            {
                TaskCompleteAttribute taskCompleteAttribute = cc.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;
                taskTotalCompleteMode |= taskCompleteAttribute.CompleteMode;
            }

            if (TaskCompleteMode.CompletedBySceneID == (taskTotalCompleteMode & TaskCompleteMode.CompletedBySceneID))
            {
                //场景(寻物,拼图)
                TaskCompleteByScene collectDataInfo = m_taskInfo.CompleteConditionList[0] as TaskCompleteByScene;

                long scene_id = collectDataInfo.TaskCompleteData;


                if (CommonData.C_JIGSAW_SCENE_START_ID == scene_id / CommonData.C_SCENE_TYPE_ID)
                {
                    //拼图
                    m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", CommonHelper.GetModeName(scene_id));
                }
                else if (CommonData.C_SEEK_SCENE_START_ID == scene_id / CommonData.C_SCENE_TYPE_ID)
                {
                    //寻物场景
                    string scene_name = LocalizeModule.Instance.GetString(ConfScene.Get(scene_id).name);
                    m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips1", scene_name, CommonHelper.GetModeName(scene_id));
                }
            }
            else if ((TaskCompleteMode.CompletedBySceneID | TaskCompleteMode.CompletedByItem) == (taskTotalCompleteMode & (TaskCompleteMode.CompletedBySceneID | TaskCompleteMode.CompletedByItem)))
            {
                //场景+寻物(必然是场景)
                foreach (var complete_condition in m_taskInfo.CompleteConditionList)
                {
                    if (complete_condition.GetType() == typeof(TaskCompleteByScene))
                    {
                        TaskCompleteByScene collectDataInfo = complete_condition as TaskCompleteByScene;

                        long scene_id = collectDataInfo.TaskCompleteData;

                        //寻物场景
                        string scene_name = LocalizeModule.Instance.GetString(ConfScene.Get(scene_id).name);
                        m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips1", scene_name, CommonHelper.GetModeName(scene_id));

                        break;
                    }
                }
            }
            else if (TaskCompleteMode.CompleteByScanID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByScanID))
            {
                //尸检
                m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_autopsy"));
            }
            else if (TaskCompleteMode.CompleteByReasonID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByReasonID))
            {
                //推理
                m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_detective"));
            }
            else if (TaskCompleteMode.CompleteByCombinePropID == (taskTotalCompleteMode & TaskCompleteMode.CompleteByCombinePropID))
            {
                //合成
                m_tips_txt.Text = LocalizeModule.Instance.GetString("mission_UI_tips", LocalizeModule.Instance.GetString("tips_combine"));
            }
            else
            {
                this.m_tips_txt.Text = string.Empty;
            }
        }
Пример #3
0
        //private static void OnExcuteTask(NormalTask taskInfo)
        //{

        //    if (taskInfo.CompleteConditionList.Count <= 1)
        //    { //目录没有组合条件
        //        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
        //        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;
        //        switch (taskCompleteAttribute.CompleteMode)
        //        {
        //            case TaskCompleteMode.CompletedByDialog:
        //                TalkUIHelper.OnStartTalk((long)taskCompleteCondition.TaskCompleteData);

        //                break;
        //            case TaskCompleteMode.CompletedBySceneID:
        //                long sceneID = (long)taskCompleteCondition.TaskCompleteData;
        //                ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
        //                CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID);
        //                break;

        //            //case TaskCompleteMode.CompletedByEvents:
        //            //    EventGameUIAssist.BeginEventGame((long)taskCompleteCondition.TaskCompleteData);
        //            //    break;

        //            case TaskCompleteMode.CompletedByItem:
        //                GameEvents.TaskEvents.OnShowCollectionTaskDetail.SafeInvoke(taskInfo, ShowSceneInBigWorld);
        //                break;
        //            case TaskCompleteMode.CompleteByReasonID:
        //                ReasoningUILogic.ShowReasonUIById((long)taskCompleteCondition.TaskCompleteData);
        //                break;
        //            case TaskCompleteMode.CompleteByScanID:
        //                long scanID = (long)taskCompleteCondition.TaskCompleteData;
        //                ChapterInfo scanTaskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
        //                CommonHelper.OpenEnterGameSceneUI(scanID, scanTaskBelongChapterInfo, taskInfo.TaskConfID);
        //                break;
        //            default:
        //                break;
        //        }
        //    }
        //    else
        //    {
        //        TaskCompleteCondition c_items = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteItems));

        //        if (null != c_items)
        //        {
        //            TaskCompleteCondition c_scene = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteByScene));

        //            Action<long> close_act = null;

        //            if (null != c_scene)
        //            {
        //                close_act = (task_conf_id) =>
        //                {
        //                    long task_config_id = task_conf_id;
        //                    long sceneID = (long)c_scene.TaskCompleteData;
        //                    ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
        //                    CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID);
        //                };
        //            }

        //            GameEvents.TaskEvents.OnShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
        //        }
        //    }


        //}


        private static void OnExcuteTask(NormalTask taskInfo)
        {
            if (taskInfo.CompleteConditionList.Count <= 1)
            { //目录没有组合条件
                TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;
                switch (taskCompleteAttribute.CompleteMode)
                {
                case TaskCompleteMode.CompletedByDialog:
                {
                    TalkUIHelper.OnStartTalk((long)taskCompleteCondition.TaskCompleteData);
                }

                break;

                case TaskCompleteMode.CompletedBySceneID:
                {
                    Action <long> close_act = null;

                    close_act = (task_conf_id) =>
                    {
                        long        sceneID = (long)taskCompleteCondition.TaskCompleteData;
                        ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
                        CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID);
                    };


                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
                }
                break;

                //case TaskCompleteMode.CompletedByEvents:
                //    EventGameUIAssist.BeginEventGame((long)taskCompleteCondition.TaskCompleteData);
                //    break;

                case TaskCompleteMode.CompletedByItem:
                {
                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, ShowSceneInBigWorld);
                }
                break;

                case TaskCompleteMode.CompleteByReasonID:
                {
                    Action <long> close_act = null;

                    close_act = (task_conf_id) =>
                    {
                        ReasoningUILogic.ShowReasonUIById((long)taskCompleteCondition.TaskCompleteData);
                    };

                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
                }
                break;

                case TaskCompleteMode.CompleteByCombinePropID:
                {
                    Action <long> close_act = null;

                    close_act = (task_conf_id) =>
                    {
                        long[] ids = ConfTask.Get(task_conf_id).conditionPropExIds;

                        if (ids.Length > 0)
                        {
                            FrameMgr.OpenUIParams uiParams = new FrameMgr.OpenUIParams(UIDefine.UI_COMBINE);
                            uiParams.Param = ids[0];

                            EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(uiParams);
                        }
                        else
                        {
                            EngineCoreEvents.UIEvent.ShowUIEvent.SafeInvoke(UIDefine.UI_COMBINE);
                        }
                    };

                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
                }
                break;

                case TaskCompleteMode.CompleteByScanID:

                {
                    Action <long> close_act = null;

                    close_act = (task_conf_id) =>
                    {
                        long        scanID = (long)taskCompleteCondition.TaskCompleteData;
                        ChapterInfo scanTaskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
                        CommonHelper.OpenEnterGameScanUI(scanID, scanTaskBelongChapterInfo, taskInfo.TaskConfID);
                    };

                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
                }
                break;

                default:
                    break;
                }
            }
            else
            {
                TaskCompleteCondition c_items = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteItems));

                if (null != c_items)
                {
                    TaskCompleteCondition c_scene = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteByScene));

                    Action <long> close_act = null;

                    if (null != c_scene)
                    {
                        close_act = (task_conf_id) =>
                        {
                            long        task_config_id        = task_conf_id;
                            long        sceneID               = (long)c_scene.TaskCompleteData;
                            ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID);
                            CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID);
                        };
                    }

                    GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act);
                }
            }
        }
Пример #4
0
        private void OnRes(object obj)
        {
            if (obj is SCChatFinishResponse)
            {
                SCChatFinishResponse res = (SCChatFinishResponse)obj;
                if (res.Status == null)
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSChatFinishRequest req_msg = req as CSChatFinishRequest;
                    long chat_id = req_msg.ChatId;

                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompletedByDialog != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }

                        long task_dialog_id = (long)taskCompleteCondition.TaskCompleteData;

                        if (chat_id != task_dialog_id)
                        {
                            continue;
                        }

                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }

                    GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
                }
            }
            else if (obj is SCCombineResponse)
            {
                SCCombineResponse res = (SCCombineResponse)obj;
                if (res.Success)
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSCombineRequest req_msg      = req as CSCombineRequest;
                    long             combine_id   = req_msg.CombineId;
                    long             prop_id      = ConfCombineFormula.Get(combine_id).outputId;
                    bool             tsk_finished = false;
                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompleteByCombinePropID != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }
                        long[] all_tsk_combine_prop_id = (long[])taskCompleteCondition.TaskCompleteData;

                        if (0 == all_tsk_combine_prop_id.Length)
                        {
                            Debug.LogError($"合成任务{taskInfo.TaskConfID}没有配置完成物件");
                            continue;
                        }

                        long task_combine_prop_id = all_tsk_combine_prop_id[0];

                        if (prop_id != task_combine_prop_id)
                        {
                            continue;
                        }

                        tsk_finished = true;
                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }
                    if (tsk_finished)
                    {
                        GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
                        EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_COMBINE);
                    }
                }
            }
            else if (obj is SCCartoonEnterResponse)
            {
                SCCartoonEnterResponse res = obj as SCCartoonEnterResponse;
                if (!MsgStatusCodeUtil.OnError(res.Result))
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSCartoonEnterRequest req_msg = req as CSCartoonEnterRequest;
                    long cur_scene_id             = req_msg.SceneId;

                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompletedBySceneID != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }

                        long scene_id = (long)taskCompleteCondition.TaskCompleteData;

                        if (CommonData.C_CARTOON_SCENE_START_ID != scene_id / CommonData.C_SCENE_TYPE_ID)
                        {
                            continue;
                        }

                        if (cur_scene_id != scene_id)
                        {
                            continue;
                        }

                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }
                }
            }
            else if (obj is SCCartoonRewardReqsponse)
            {
                GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
            }
        }