예제 #1
0
    /// <summary>
    /// 显示剧情对话内容
    /// </summary>
    /// <param name="newGuideConfigData"></param>
    private void StartPicStep(EctGuideStepConfigData stepItem)
    {
        if (stepItem.GuidePicture == null)
        {
            return;
        }
        m_stepItem = stepItem;
        m_picIndex = 0;
        if (m_picIndex < stepItem.GuidePicture.Length)
        {
            var picPrefab = m_stepItem.GuidePicture[m_picIndex];
            if (picPrefab != null)
            {
                m_picIndex    = 1;
                m_guidePicBtn = CreatObjectToNGUI.InstantiateObj(picPrefab, this.transform).GetComponent <LocalButtonCallBack>();
                m_guidePicBtn.SetCallBackFuntion((obj) =>
                {
                    if (m_guidePicBtn != null)
                    {
                        Destroy(m_guidePicBtn.gameObject);
                    }
                    m_picIndex++;
                    StartPicStep(stepItem);
                });
            }
        }
        else
        {
            if (m_guidePicBtn != null)
            {
                Destroy(m_guidePicBtn.gameObject);
            }
            m_picIndex = 0;
            SMsgInteractCOMMON_CS msgInteract;
            msgInteract.dwNPCID       = 0;
            msgInteract.byOperateType = 2;
            msgInteract.dwParam1      = 2;
            msgInteract.dwParam2      = 0;
            msgInteract.byIsContext   = 0;

            SMsgInteractCOMMONContext_CS msgContext;
            msgContext.szContext = new byte[32];
            NetServiceManager.Instance.InteractService.SendInteractCOMMON(msgInteract, msgContext);
        }
    }
예제 #2
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;
            }
        }
    }
예제 #3
0
        IEnumerator ChangeButtonEnable(LocalButtonCallBack button, bool isFlag)
        {
            yield return(new WaitForEndOfFrame());

            button.SetEnabled(isFlag);
        }