Ejemplo n.º 1
0
    /// <summary>
    /// 设置当前引导按钮(强引导)
    /// </summary>
    /// <param name="btnID">ButtonID</param>
    public GameObject SetGuideButton(int btnID, TaskGuideExtendData newGuideConfigData)
    {
        if (m_guideBtnParam.ContainsKey(btnID))
        {
            var btnPram = m_guideBtnParam[btnID];
            SetGuideBtnStatus(btnPram, true, true);

            //Destroy all frame and focus effect
            m_guideBtnParam.Values.ApplyAllItem(P =>
            {
                if (P.BtnFrame != null)
                {
                    GameObject.Destroy(P.BtnFrame);
                }
                if (P.BtnArrow != null)
                {
                    GameObject.Destroy(P.BtnArrow);
                }
            });
            var        parScale = btnPram.GuideBtn.transform.localScale;
            GameObject arrowFrame = null, hightLightFrame = null;
            Vector3    frameOffset = Vector3.zero, arrowOffset = Vector3.zero;
            if (newGuideConfigData.NewGuideConfigDatas.BtnSignPrefab != null)
            {
                var offsetPosVal1 = newGuideConfigData.NewGuideConfigDatas.BtnSignOffset.Split('+');
                arrowOffset = new Vector3(float.Parse(offsetPosVal1[1]), float.Parse(offsetPosVal1[2]), float.Parse(offsetPosVal1[3]));
                arrowFrame  = (GameObject)GameObject.Instantiate(newGuideConfigData.NewGuideConfigDatas.BtnSignPrefab, Vector3.zero, Quaternion.identity);
                arrowFrame.transform.parent        = UIRoot;
                arrowFrame.transform.position      = btnPram.GuideBtn.transform.position;
                arrowFrame.transform.localScale    = Vector3.one;
                arrowFrame.transform.localPosition = arrowFrame.transform.localPosition + arrowOffset;

                arrowFrame.GetComponent <BtnSignPanel>().InitSignPanel(newGuideConfigData.NewGuideConfigDatas.BtnSignText);
            }
            if (newGuideConfigData.NewGuideConfigDatas.HighlightRes != null)
            {
                var offsetPosVal2 = newGuideConfigData.NewGuideConfigDatas.BtnPositionOffset.Split('+');
                frameOffset     = new Vector3(float.Parse(offsetPosVal2[1]), float.Parse(offsetPosVal2[2]), float.Parse(offsetPosVal2[3]));
                hightLightFrame = (GameObject)GameObject.Instantiate(newGuideConfigData.NewGuideConfigDatas.HighlightRes, Vector3.zero, Quaternion.identity);
                hightLightFrame.transform.parent     = UIRoot;
                hightLightFrame.transform.position   = btnPram.GuideBtn.transform.position;
                hightLightFrame.transform.localScale = new Vector3(newGuideConfigData.NewGuideConfigDatas.HighlightScale, newGuideConfigData.NewGuideConfigDatas.HighlightScale, 1);
                //偏移光圈和BoxCollider
                hightLightFrame.transform.localPosition = hightLightFrame.transform.localPosition + frameOffset;
                //jamfing 20141204//

                /*var collider = btnPram.BtnCollider;
                 * collider.center += frameOffset;*/
            }

            btnPram.BtnBehaviour.SetBtnGuideFrame(hightLightFrame, frameOffset, arrowFrame, arrowOffset);
            GuidingBtnId = btnID;
            return(m_guideBtnParam[btnID].GuideBtn);
        }
        else
        {
            Debug.LogWarning("找不到ID为" + btnID + "的引导按钮!!");
        }
        return(null);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 引导完成
 /// </summary>
 /// <param name="newGuideConfigData"></param>
 public void GuideFinish(TaskGuideExtendData newGuideConfigData, bool isFinishGuide)
 {
     if (isFinishGuide)
     {
         if (m_finishTaskGuides == null || m_finishTaskGuides.Count <= m_fishGuideIndex)
         {
             return;
         }
         if (m_finishTaskGuides[m_fishGuideIndex] == newGuideConfigData)
         {
             newGuideConfigData.FinishFlag = true;
             m_fishGuideIndex++;
         }
         else
         {
             TraceUtil.Log(SystemModel.Rocky, "想完成的引导与引导管理中的当前引导不一致");
         }
     }
     else
     {
         if (m_currentTaskGuides == null || m_currentTaskGuides.Count <= m_guideIndex)
         {
             return;
         }
         if (m_currentTaskGuides[m_guideIndex].NewGuideConfigDatas == newGuideConfigData.NewGuideConfigDatas)
         {
             newGuideConfigData.FinishFlag = true;
             m_guideIndex++;
         }
         else
         {
             TraceUtil.Log(SystemModel.Rocky, "想完成的引导与引导管理中的当前引导不一致");
         }
     }
 }
Ejemplo n.º 3
0
    /// <summary>
    /// 弱引导其他按钮点击监听处理
    /// </summary>
    /// <param name="btnIdObj"></param>
    private void ClickOtherButtonHandle(object btnIdObj)
    {
        if (m_newGuideConfigData != null)
        {
            if (TaskModel.Instance.isNpcTalking)
            {
                return;
            }
            //jamfing20141204//
            //如果正在进行剧情对话,取消对话恢复镜头

            /*
             * if (m_skipStoryBtn != null)
             * {
             * m_skipStoryBtn.OnClick(true);
             * }*/
            PlayerManager.Instance.HeroAgent.enabled = false;
            TaskBtnManager.Instance.BreakGuide();
            TaskModel.Instance.BreakTask(m_newGuideConfigData.NewGuideConfigDatas.TaskNewConfigData.TaskID);
            m_newGuideConfigData.GuideBtnUIReadyAct = null;
            m_newGuideConfigData = null;
//            m_taskPanel.ShowOrHideTips();
            m_taskGuidePanel.ShowPanel();
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 任务完成后续引导检查处理
    /// </summary>
    /// <param name="args"></param>
    private void TaskFinishGuideInvokeHandle(INotifyArgs args)
    {
        if (m_newGuideConfigData != null)
        {
            m_newGuideConfigData.GuideBtnUIReadyAct = null;
        }
        m_newGuideConfigData = TownGuideManager.Instance.GetNextFinishGuideConfigData();
        if (m_newGuideConfigData != null)
        {
            if (m_newGuideConfigData.IsGuideUIReady)
            {
                ReadyToExecuteTaskGuid(true);
            }
            //else
            {
                if (m_newGuideConfigData != null)
                {
                    m_newGuideConfigData.GuideBtnUIReadyAct = ReadyToExecuteTaskGuid;
                }
            }
            //TaskGuideType taskGuideType = m_newGuideConfigData.NewGuideConfigDatas.TaskNewConfigData.GuideType;
            //if (taskGuideType == TaskGuideType.Enforce)
            //{
            //    TaskBtnManager.Instance.ResetAllButtonStatus(false);
            //}
            //switch (m_newGuideConfigData.NewGuideConfigDatas.GuideType)
            //{
            //    case GuideConfigType.NormalArrow:
            //    TaskBtnManager.Instance.SetGuideButton(m_newGuideConfigData);
            //        break;
            //    case GuideConfigType.FindMaterial:
            //        FindMaterial(m_newGuideConfigData);
            //        break;
            //    case GuideConfigType.TownStory:
            //        TownStory(m_newGuideConfigData);
            //        break;
            //}
        }
        else     //没有finish 引导,尝试执行缓存任务
        {
            //开启新功能
            if (m_taskFinishAppearButton != 0)
            {
                UIType uiType = (UIType)m_taskFinishAppearButton;
                UIEventManager.Instance.TriggerUIEvent(UIEventType.EnableMainButton, uiType);
                m_taskFinishAppearButton = 0;
            }
            //没有缓存要触发的任务则把所有禁用的引导激活
            if (TaskModel.Instance.CacheNextExecuteTaskState == null)
            {
                TaskBtnManager.Instance.ResetAllButtonStatus(true);
            }
            TaskModel.Instance.ManualTriggerCacheTask();
//            m_taskPanel.ShowOrHideTips();
            m_taskGuidePanel.ShowPanel();
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 根据TaskConfig的GroupIds,找到NewGuideConfigData列表
    /// </summary>
    /// <param name="groupIds"></param>
    /// <returns></returns>
    public TaskGuideExtendData[] GetNewGuideConfigDataByGroup(int[] groupIds)
    {
        if (groupIds == null)
        {
            return(null);
        }

        TaskGuideExtendData[] taskGuideExtendData = new TaskGuideExtendData[groupIds.Length];

        for (int i = 0; i < groupIds.Length; i++)
        {
            taskGuideExtendData[i] = new TaskGuideExtendData(Datas.Single(P => P.GuideID == groupIds[i]));
        }
        return(taskGuideExtendData);
    }
Ejemplo n.º 6
0
    private void FindEctype(TaskGuideExtendData newGuideConfigData)
    {
        int mappingId      = newGuideConfigData.MappingId;
        var guideBtnParams = TaskBtnManager.Instance.FindGuideBtnParamViaMappingId(mappingId);

        if (guideBtnParams != null)
        {
            TaskBtnManager.Instance.SetGuideButton(guideBtnParams.BtnBehaviour.BtnId, newGuideConfigData);
            guideBtnParams.BtnBehaviour.DragAmountSlerp();   //移动到指定
        }
        else
        {
            TraceUtil.Log(SystemModel.Rocky, TraceLevel.Error, "Can't found ectype diff button at taskbtnmanager" + mappingId.ToString());
        }
    }
Ejemplo n.º 7
0
 /// <summary>
 /// 启动引导(来源:1.开始任务时入口,2.点击完成任务某步骤执行下一步)
 /// </summary>
 private void ExecuteTaskGuide()
 {
     if (m_newGuideConfigData != null)
     {
         m_newGuideConfigData.GuideBtnUIReadyAct = null;
     }
     m_newGuideConfigData = TownGuideManager.Instance.GetNextGuideConfigData();
     if (m_newGuideConfigData != null)
     {
         //引导终止和跳过条件判定
         if (OverRuleCheck() || SkipRuleCheck())
         {
             TaskGuideFinish();
             //ClickOtherButtonHandle(null);
         }
         else
         {
             //如果引导的UI已经装备完毕,直接执行,否则监听UI完成Action
             //TaskBtnManager.Instance.ResetNextGuideMapping(m_newGuideConfigData);
             if (m_newGuideConfigData.IsGuideUIReady)
             {
                 ReadyToExecuteTaskGuid(true);
             }
             //会有递归//
             if (m_newGuideConfigData != null)
             {
                 m_newGuideConfigData.GuideBtnUIReadyAct = ReadyToExecuteTaskGuid;
             }
         }
     }
     else
     {
         if (TownGuideManager.Instance.IsLastGuideOfTask())
         {
             TaskModel.Instance.SendTaskMessageToServer(0, 2, 2, TaskModel.Instance.CurrentTaskId.Value);
         }
     }
 }
Ejemplo n.º 8
0
    /// <summary>
    /// 城镇副本剧情
    /// </summary>
    /// <param name="newGuideConfigData"></param>
    private void TownStory(TaskGuideExtendData newGuideConfigData)
    {
        if (TaskModel.Instance.isNpcTalking)
        {
            return;
        }
        //close all the ui panel
        UIEventManager.Instance.TriggerUIEvent(UIEventType.OpentMainUI, UIType.Empty);
        //send event to joystick of TownUI
        UIEventManager.Instance.TriggerUIEvent(UIEventType.OnNpcGuideStartEvent, null);
        //保存UI按钮状态并隐藏
        TaskBtnManager.Instance.SaveAndResetAllButtonStatus(false);
        TaskBtnManager.Instance.RemoveGuideFrame();
        //找到剧情NPC,根据配置的偏移和角度。寻路过去指定点
        string[] targetPosVal = newGuideConfigData.NewGuideConfigDatas.StroyPos.Split('+');
        Vector3  targetPos    = Vector3.zero;

        targetPos = targetPos.GetFromServer(float.Parse(targetPosVal[0]), float.Parse(targetPosVal[1]));
        //开启剧情播放
        var playerBehaviour = (PlayerBehaviour)PlayerManager.Instance.FindHeroEntityModel().Behaviour;
        var nav             = PlayerManager.Instance.HeroAgent;

        nav.enabled = true;
        nav.ResetPath();
        nav.speed          = playerBehaviour.WalkSpeed;
        nav.updateRotation = true;
        nav.updatePosition = true;
        nav.SetDestination(targetPos);

        playerBehaviour.FSMSystem.PerformTransition(Transition.PlayerToNpc);
        var     camLookAt    = newGuideConfigData.NewGuideConfigDatas.StroyCamera.Split('+');
        Vector3 camLookAtPos = Vector3.zero;

        camLookAtPos   = camLookAtPos.GetFromServer(float.Parse(camLookAt[0]), float.Parse(camLookAt[1]));
        camLookAtPos.y = float.Parse(camLookAt[2]) * 0.1f;
        StartCoroutine(PathFinding(nav, camLookAtPos, newGuideConfigData, playerBehaviour));
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 获得BtnId对应的UIType,用于打开指定UI
    /// </summary>
    /// <returns></returns>
    public UIType GetUITypeByBtnId(TaskGuideExtendData newGuideConfigData)
    {
        int btnID = int.Parse(newGuideConfigData.NewGuideConfigDatas.GuideBtnID);

        return((UIType)(btnID / 1000000));
    }
Ejemplo n.º 10
0
 public GameObject SetGuideButton(TaskGuideExtendData newGuideConfigData)
 {
     return(SetGuideButton(newGuideConfigData.MappingId, newGuideConfigData));
 }
Ejemplo n.º 11
0
    /// <summary>
    /// 寻路到剧情人物
    /// </summary>
    /// <param name="navAgent"></param>
    /// <param name="npcTransform"></param>
    /// <param name="newGuideConfigData"></param>
    /// <param name="playerBehaviour"></param>
    /// <returns></returns>
    IEnumerator PathFinding(NavMeshAgent navAgent, Vector3 targetPos, TaskGuideExtendData newGuideConfigData, PlayerBehaviour playerBehaviour)
    {
        if (m_autoWalkEffObj == null)
        {
            //寻路特效
            m_autoWalkEffObj = NGUITools.AddChild(AutoWalkEffPoint, AutoWalkEffPrefab);
        }
        else
        {
            m_autoWalkEffObj.SetActive(true);
        }
        while (true)
        {
            yield return(null);

            if (navAgent.pathPending)
            {
                continue;
            }
            //点击屏幕,中断寻路
            if (!navAgent.enabled)
            {
                if (TaskModel.Instance.isNpcTalking)
                {
                    break;
                }
                //其实这下面的都不需要//
                if (m_autoWalkEffObj != null)
                {
                    m_autoWalkEffObj.SetActive(false);
                }
                //navAgent.Stop();
                playerBehaviour.FSMSystem.PerformTransition(Transition.PlayerToIdle);
                //点击其他按钮,中断引导
                ClickOtherButtonHandle(null);
                //send event to joystick of TownUI
                UIEventManager.Instance.TriggerUIEvent(UIEventType.OnNpcGuideStopEvent, null);
                break;
            }
            if (!navAgent.hasPath)
            {
                TaskModel.Instance.isNpcTalking = true;
                if (m_autoWalkEffObj != null)
                {
                    m_autoWalkEffObj.SetActive(false);
                }
                navAgent.enabled = false;
                UIEventManager.Instance.TriggerUIEvent(UIEventType.NpcTalkTaskDealUI, false);
                playerBehaviour.FSMSystem.PerformTransition(Transition.PlayerToIdle);
                var cameraOffset             = Vector3.zero;
                var cameraOffsetConfigString = newGuideConfigData.NewGuideConfigDatas.StroyCameraTarget;
                if (cameraOffsetConfigString != "0")
                {
                    var offset = cameraOffsetConfigString.Split('+');//A+-125+15+25
                    cameraOffset   = cameraOffset.GetFromServer(float.Parse(offset[1]), float.Parse(offset[2]));
                    cameraOffset.y = float.Parse(offset[3]) * 0.1f;
                    BattleManager.Instance.FollowCamera.SetSmoothMoveTarget(targetPos, cameraOffset);
                }
                //转向
                StartCoroutine(UpdateRotation(playerBehaviour, newGuideConfigData.NewGuideConfigDatas));
                while (BattleManager.Instance.FollowCamera.IsInSmoothMove)
                {
                    yield return(null);
                }
                //开始剧情对话
                var guideConfigData = newGuideConfigData.NewGuideConfigDatas;
                if (guideConfigData.TalkIdConfigDatas != null && guideConfigData.TalkIdConfigDatas.Length > 0)
                {
                    if (guideConfigData.TaskNewConfigData.TownStroyMusic != "0")
                    {
                        SoundManager.Instance.StopBGM();
                        SoundManager.Instance.PlayBGM(guideConfigData.TaskNewConfigData.TownStroyMusic);
                    }
                    //隐藏其他玩家
                    PlayerManager.Instance.HideAllPlayerButHero(true);
                    ShowDialog(guideConfigData);
                    if (m_skipStoryBtn == null)
                    {
                        m_skipStoryBtn = NGUITools.AddChild(gameObject, SkipStoryPrefab).GetComponent <LocalButtonCallBack>();
                    }
                    else
                    {
                        m_skipStoryBtn.gameObject.SetActive(false);
                        m_skipStoryBtn.gameObject.SetActive(true);
                    }
                    m_skipStoryBtn.GetComponent <UIAnchor>().uiCamera = BattleManager.Instance.UICamera;
                    m_skipStoryBtn.SetCallBackFuntion((obj) =>
                    {
                        if (m_newGuideConfigData != null)
                        {
                            StoryDialogFinish(m_newGuideConfigData.NewGuideConfigDatas, (bool)obj);
                        }
                        else
                        {
                            StartCoroutine(CameraSmoothBackFinish(false));
                        }
                        m_skipStoryBtn.gameObject.SetActive(false);
                        TaskModel.Instance.isNpcTalking = false;
                        //Destroy(m_skipStoryBtn.gameObject);
                    }, false);
                }
                break;
            }
        }
    }
Ejemplo n.º 12
0
 private void FindIntellJumpSiren(TaskGuideExtendData newGuideConfigData)
 {
     UIEventManager.Instance.TriggerUIEvent(UIEventType.IntellJumpSiren, newGuideConfigData.MappingId);
 }