コード例 #1
0
ファイル: RouterManager.cs プロジェクト: wuhuolong/MaxBooks
//         public bool GotoOpenRide(params object[] args)
//         {
//             if (!SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_RIDE, true))
//             {
//                 return false;
//             }
//             if (!CheckSysDownloaded(GameConst.SYS_OPEN_RIDE))
//             {
//                 return false;
//             }
//
//             if (LuaScriptMgr.Instance != null)
//             {
//                 XLua.LuaFunction func = LuaScriptMgr.Instance.GetLuaFunction(LuaScriptMgr.Instance.Lua.Global, "GotoSysRouter");
//                 if (func != null)
//                 {
//                     func.Action(GameConst.SYS_OPEN_RIDE);
//                 }
//                 return true;
//             }
//             return false;
//         }

        public bool GotoBountyTask(params object[] args)
        {
            if (!SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_REC_SG, true))
            {
                return(false);
            }
            if (!CheckSysDownloaded(GameConst.SYS_OPEN_REC_SG))
            {
                return(false);
            }

            if (args.Length == 1 && (bool)args[0] == true)
            {
                UIManager.Instance.ShowSysWindow("UITaskWindow", GameConst.QUEST_SG, null);
                return(true);
            }

            // 记录当弹出退出提示的时候是否要继续自动战斗
            if (SceneHelp.Instance.IsInInstance == true || SceneHelp.Instance.IsCanExitBtnInWild == true)
            {
                SceneHelp.Instance.IsAutoFightingWhenShowExitTips = InstanceManager.Instance.IsAutoFighting || SceneHelp.Instance.IsAutoFightingWhenShowExitTips;
            }

            //UIManager.GetInstance().ShowSysWindow("UITaskWindow", xc.GameConst.QUEST_SG, null);
            BountyTaskInfo bountyTaskInfo = TaskManager.Instance.BountyTaskInfo;
            List <Task>    tasks          = TaskManager.Instance.VisibleBountyTasks;
            bool           isGoto         = false;

            if (bountyTaskInfo == null)
            {
                isGoto = false;
            }
            else
            {
                if (tasks.Count > 0)
                {
                    isGoto = true;
                }
                else
                {
                    isGoto = false;
                }
            }
            if (isGoto == true)
            {
                TaskHelper.TaskGuide(tasks[0]);
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null);
            }
            else
            {
                if (bountyTaskInfo == null)
                {
                    TaskHelper.AcceptBountyTaskGuide();
                }
                else
                {
                    uint maxTimes = TaskHelper.GetBountyTaskMaxTimes();
                    if (bountyTaskInfo.num >= maxTimes)
                    {
                        UIManager.Instance.ShowSysWindow("UITaskWindow", GameConst.QUEST_SG, null);
                    }
                    else
                    {
                        TaskHelper.AcceptBountyTaskGuide();
                    }
                }
            }
            UIManager.Instance.CloseSysWindow("UITowerClimbWindow");

            return(true);
        }