Exemplo n.º 1
0
        public void OnClick_3()
        {
            if (taskListDM.List.Count < 3)
            {
                return;
            }

            /*
             *      if (-1 != mDataModel.List[2].MissionId)
             *      {
             *              MissionManager.Instance.GoToMissionPlace(mDataModel.List[2].MissionId);
             *      }
             */

            var missionId = taskListDM.List[2].MissionId;

            if (missionId == MissionManager.Instance.CurrentDoingCircleMission)
            {
                //如果当前任务是正在追踪的环任务那就GoTo
                MissionManager.Instance.GoToMissionPlace(missionId);
                return;
            }

            var arg = new MissionListArguments();

            arg.Tab       = 3;
            arg.MissionId = missionId;
            EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
        }
Exemplo n.º 2
0
        public void OnClick_5()
        {
            var missionId = taskListDM.List2[0].MissionId;

            if (missionId == MissionManager.Instance.CurrentDoingCircleMission)
            {
                //如果当前任务是正在追踪的环任务那就GoTo
                MissionManager.Instance.GoToMissionPlace(missionId);
                return;
            }

            var arg = new MissionListArguments();

            arg.Tab       = 4;
            arg.MissionId = missionId;
            EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
        }
Exemplo n.º 3
0
        public void OnClick_4()
        {
            if (taskListDM.List[3].MissionId > 5000 && PlayerDataManager.Instance.GetExData(eExdataDefine.e282) <= 0)
            {
                EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(220989));
                return;
            }
            var missionId = taskListDM.List[3].MissionId;

            if (missionId == MissionManager.Instance.CurrentDoingCircleMission)
            {
                //如果当前任务是正在追踪的环任务那就GoTo
                MissionManager.Instance.GoToMissionPlace(missionId);
                return;
            }

            var arg = new MissionListArguments();

            arg.Tab       = 3;
            arg.MissionId = missionId;
            EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
        }
Exemplo n.º 4
0
    //根据任务状态去往任务所需地点
    public void GoToMissionPlace(int id)
    {
        MissionBaseModel data = null;

        if (!MissionData.Datas.TryGetValue(id, out data))
        {
            return;
        }
        GameControl.Executer.Stop();
        var table = Table.GetMissionBase(id);

        if (null == table)
        {
            Logger.Error("GoToMissionPlace({0})  null == table", id);
            return;
        }
        var type  = (eMissionMainType)table.ViewType;
        var state = (eMissionState)data.Exdata[0];

        if (eMissionState.Acceptable == state)
        {
            if (-1 == table.NpcStart)
            {
                var arg = new MissionListArguments();
                arg.Tab       = 2;
                arg.MissionId = id;

                EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
                //GameLogic.Instance.StartCoroutine(ShowMissionById(2,id));
                return;
            }
            ObjManager.Instance.MyPlayer.LeaveAutoCombat();

            var e = new MapSceneDrawPath(new Vector3(table.PosX, 0, table.PosY), 1.0f);
            EventDispatcher.Instance.DispatchEvent(e);

            var command = GameControl.GoToCommand(table.NpcScene, table.PosX, table.PosY, 1.0f);
            GameControl.Executer.PushCommand(command);

            var command1 = new FuncCommand(() => { Instance.OpenMissionById(id, table.NpcStart); });
            GameControl.Executer.PushCommand(command1);
        }
        else if (eMissionState.Finished == state)
        {
            //如果是日常任务就直接弹界面

            if (eMissionMainType.Daily == type ||
                eMissionMainType.Circle == type)
            {
                var arg = new MissionListArguments();
                arg.Tab       = 3;
                arg.MissionId = id;
                EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
                //GameLogic.Instance.StartCoroutine(ShowMissionById(3,id));
                return;
            }
            if (eMissionMainType.SubStoryLine == type && -1 == table.FinishNpcId)
            {
                var arg = new MissionListArguments();
                arg.Tab       = 2;
                arg.MissionId = id;
                EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionList, arg));
                return;
            }
            ObjManager.Instance.MyPlayer.LeaveAutoCombat();

            var e = new MapSceneDrawPath(new Vector3(table.FinishPosX, 0, table.FinishPosY), 1.0f);
            EventDispatcher.Instance.DispatchEvent(e);

            var command = GameControl.GoToCommand(table.FinishSceneId, table.FinishPosX, table.FinishPosY, 1.0f);
            GameControl.Executer.PushCommand(command);

            var command1 = new FuncCommand(() => { Instance.OpenMissionById(id, table.FinishNpcId); });
            GameControl.Executer.PushCommand(command1);
        }
        else if (eMissionState.Unfinished == state)
        {
            if (eMissionMainType.Circle == type)
            {
//记录一下当前正在做的环任务
                CurrentDoingCircleMission = id;
            }
            else
            {
                CurrentDoingCircleMission = -1;
            }

            EventDispatcher.Instance.DispatchEvent(new UIEvent_DoMissionGoTo());

            if (0 == table.TrackType)
            {
//到地图某一地方
                ObjManager.Instance.MyPlayer.LeaveAutoCombat();
                var e = new MapSceneDrawPath(new Vector3(table.TrackParam[1], 0, table.TrackParam[2]), 1.0f);
                EventDispatcher.Instance.DispatchEvent(e);

                var command = GameControl.GoToCommand(table.TrackParam[0], table.TrackParam[1], table.TrackParam[2]);
                GameControl.Executer.ExeCommand(command);
            }
            else if (1 == table.TrackType)
            {
//直接开某个界面
                if (13 == table.TrackParam[0])
                {
                    var arg = new MissionListArguments();
                    arg.IsFromMisson = true;
                    arg.Tab          = table.TrackParam[1];
                    var e = new Show_UI_Event(UIConfig.MissionList, arg);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    GameUtils.GotoUiTab(table.TrackParam[0], table.TrackParam[1], table.TrackParam[2]);
                }


                return;
            }

            switch ((eMissionType)table.FinishCondition)
            {
            case eMissionType.KillMonster:
            case eMissionType.CheckItem:
            {
                //计算下和该任务完成地点相同的其他任务
                var missionList = new List <int>();
                missionList.Add(id);
                {
                    // foreach(var tempData in MissionData.Datas)
                    var __enumerator3 = (MissionData.Datas).GetEnumerator();
                    while (__enumerator3.MoveNext())
                    {
                        var tempData = __enumerator3.Current;
                        {
                            var missionData = tempData.Value;

                            if (missionData.MissionId == id)
                            {
                                continue;
                            }

                            //正在做的任务
                            if (eMissionState.Unfinished != (eMissionState)missionData.Exdata[0])
                            {
                                continue;
                            }

                            //只检查杀怪和获得物品的任务
                            var tableTemp = Table.GetMissionBase(missionData.MissionId);
                            var typeTemp  = (eMissionType)tableTemp.FinishCondition;
                            if (eMissionType.KillMonster != typeTemp &&
                                eMissionType.CheckItem != typeTemp)
                            {
                                continue;
                            }

                            //检查任务完成地点
                            if (tableTemp.TrackParam[0] != table.TrackParam[0] ||
                                tableTemp.TrackParam[1] != table.TrackParam[1] ||
                                tableTemp.TrackParam[2] != table.TrackParam[2])
                            {
                                continue;
                            }

                            missionList.Add(missionData.MissionId);
                        }
                    }
                }


                var command1 = new FuncCommand(() =>
                    {
                        GameControl.Instance.TargetObj = null;
                        ObjManager.Instance.MyPlayer.EnterAutoCombat(missionList);
                    });
                GameControl.Executer.PushCommand(command1);
            }
            break;

            case eMissionType.AcceptProgressBar:
            case eMissionType.AreaProgressBar:
            {
                var command1 = new FuncCommand(() =>
                    {
                        if (OBJ.CHARACTER_STATE.IDLE != ObjManager.Instance.MyPlayer.GetCurrentStateName())
                        {
                            return;
                        }

                        var dicId = table.FinishParam[1];
                        var e     = new ShowMissionProgressEvent(GameUtils.GetDictionaryText(dicId));
                        EventDispatcher.Instance.DispatchEvent(e);
                        Logger.Info("FuncCommand CallBackFun.......................1");

                        Action endCallback = () =>
                        {
                            ObjManager.Instance.MyPlayer.PlayAnimation(OBJ.CHARACTER_ANI.STAND);
                            CompleteMission(id);
                            if (-1 != table.FinishParam[2])
                            {
                                GameLogic.Instance.SceneEffect.StopEffect(table.FinishParam[2]);
                            }
                            var e1 = new HideMissionProgressEvent(id);
                            EventDispatcher.Instance.DispatchEvent(e1);
                        };

                        Action interruptCallback = () =>
                        {
                            if (-1 != table.FinishParam[2])
                            {
                                GameLogic.Instance.SceneEffect.StopEffect(table.FinishParam[2]);
                            }
                            var e1 = new HideMissionProgressEvent(id);
                            EventDispatcher.Instance.DispatchEvent(e1);
                        };
                        GameLogic.Instance.StopCoroutine("LaunchAction");
                        var animationId = -1;
                        if (!int.TryParse(table.PlayCollectionAct, out animationId))
                        {
                            Logger.Error("int.TryParse(table.PlayCollectionAct) failed [{0}]", table.Id);
                        }

                        if (-1 == animationId)
                        {
                            animationId = 11;
                        }

                        GameLogic.Instance.StartCoroutine(GameUtils.LaunchAction(animationId, table.FinishParam[0],
                                                                                 endCallback, interruptCallback));
                        if (-1 != table.FinishParam[2])
                        {
                            GameLogic.Instance.SceneEffect.PlayEffect(table.FinishParam[2]);
                        }
                    });
                GameControl.Executer.PushCommand(command1);
            }
            break;

            case eMissionType.EquipItem:
            case eMissionType.EnhanceEquip:
            {
            }
            break;

            case eMissionType.AreaStroy:
            {
//播放剧情
                if (-1 != CurrentMissionTableData.FinishParam[0])
                {
                    var storyId = CurrentMissionTableData.FinishParam[0];

                    Action endCallback = () => { CompleteMission(id); };

                    PlayCG.PlayById(storyId, endCallback);
                }
            }
            break;

            case eMissionType.BuyItem:
            case eMissionType.DepotTakeOut:
            {
                var command1 = new FuncCommand(() => { OpenMissionByNpcId(table.FinishParam[2]); });
                GameControl.Executer.PushCommand(command1);
            }
            break;

            case eMissionType.Dungeon:
            {
                var sceneId = table.FinishParam[0];

                var currentSceneId = GameLogic.Instance.Scene.SceneTypeId;
                if (sceneId != currentSceneId)
                {
                    UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                                   GameUtils.GetDictionaryText(220507),
                                                   GameUtils.GetDictionaryText(1503),
                                                   () => { ChangedSceneByMission(sceneId, id); });
                }
                else
                {
                    var player = ObjManager.Instance.MyPlayer;
                    if (null != player)
                    {
                        player.EnterAutoCombat();
                    }
                }
            }
            break;

            default:
            {
                EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(210118));
            }
            break;
            }
        }
        EventDispatcher.Instance.DispatchEvent(new Close_UI_Event(UIConfig.MissionList));
    }