Пример #1
0
    void LaunchAction(StroyLineEvent stroyEvent)
    {
        switch (stroyEvent.Type)
        {
        case StroyActionType.DoAction:
            PlayeAction(m_stroyActionIDList[stroyEvent.ParentIndex]);
            break;

        case StroyActionType.PlayViewEffect:
            StroyAction stroyaction = m_stroyActionIDList[stroyEvent.ParentIndex];
            PlayActionEffect(stroyaction.ActionList[stroyEvent.Index]._ActionID, stroyaction.NpcID);

            break;

        case StroyActionType.PlaySoundEffect:
            PlaySoundEffect(stroyEvent.Index);

            break;

        case StroyActionType.MoveCamera:
            if (null != onCameraPlay)
            {
                onCameraPlay(m_stroyCameraList);
            }
            break;

        case StroyActionType.Dialog:
            if (null != onDialogPlay)
            {
                onDialogPlay(m_stroyDialogList);
            }
            else if (IsShowEditorUI)
            {
                m_dialogText = string.Empty;
                for (int i = 0; i < m_stroyDialogList.Count; i++)
                {
                    m_dialogText += string.Format("{0}\n", LanguageTextManager.GetString(m_stroyDialogList[i]._Content));
                }
            }
            break;

        default:
            break;
        }
    }
Пример #2
0
    public void Init(int cameraGroupID)
    {
        m_cameraGroupData = StroyLineConfigManager.Instance.GetCameraGroupConfig[cameraGroupID];
        StartCameraMask();

        if (m_cameraGroupData == null)
        {
            Debug.LogWarning("stroyline" + cameraGroupID);
            return;
        }

        if (onCameraEffectPlay != null)
        {
            onCameraEffectPlay(m_cameraGroupData._EffectGo);
        }

        int actionListCount = m_cameraGroupData._ActionList.Length;
        int cameraClipCount = m_cameraGroupData._CameraID.Count;
        int dialogCount     = m_cameraGroupData._DialogGroupID.Length;

        m_stroyActionIDList.Clear();
        sfxList.Clear();
        for (int i = 0; i < actionListCount; i++)
        {
            var npcAction = m_cameraGroupData._ActionList[i];

            int stroyActionCount = npcAction.AnimID.Count;

            m_stroyActionIDList.Add(i, new StroyAction());
            m_stroyActionIDList[i].NpcID      = npcAction.NpcID;
            m_stroyActionIDList[i].RoleType   = npcAction.RoleType;
            m_stroyActionIDList[i].RoleResID  = npcAction.RoleResID;
            m_stroyActionIDList[i].ActionList = new StroyActionConfigData[stroyActionCount];

            StroyLineEvent evt = new StroyLineEvent();

            evt.Type                 = StroyActionType.DoAction;
            evt.ParentIndex          = i;
            evt.EventTimeAfterLaunch = 0f;
            events.Add(evt);

            for (int k = 0; k < stroyActionCount; k++)
            {
                if (!StroyLineConfigManager.Instance.GetStroyActionConfig.ContainsKey(npcAction.AnimID[k]))
                {
                    m_stroyActionIDList[i].ActionList[k] = null;
                    continue;
                }
                m_stroyActionIDList[i].ActionList[k] = StroyLineConfigManager.Instance.GetStroyActionConfig[npcAction.AnimID[k]];
                if (m_stroyActionIDList[i].ActionList[k]._SoundName != "0")
                {
                    sfxList.Add(k, m_stroyActionIDList[i].ActionList[k]._SoundName);
                    StroyLineEvent sfxEvt = new StroyLineEvent();
                    sfxEvt.Type                 = StroyActionType.PlaySoundEffect;
                    sfxEvt.ParentIndex          = i;
                    sfxEvt.Index                = k;
                    sfxEvt.EventTimeAfterLaunch = m_stroyActionIDList[i].ActionList[k]._SoundTime / 1000;
                    events.Add(sfxEvt);
                }


                if (m_stroyActionIDList[i].ActionList[k]._EffectGo != null)
                {
                    StroyLineEvent efEvt = new StroyLineEvent();

                    efEvt.Type                 = StroyActionType.PlayViewEffect;
                    efEvt.ParentIndex          = i;
                    efEvt.Index                = k;
                    efEvt.EventTimeAfterLaunch = m_stroyActionIDList[i].ActionList[k]._EffectStartTime / 1000;
                    events.Add(efEvt);
                }
            }
        }
        m_stroyCameraList = new List <StroyCameraConfigData>();
        for (int i = 0; i < cameraClipCount; i++)
        {
            int cameraID = m_cameraGroupData._CameraID[i];

            if (StroyLineConfigManager.Instance.GetCameraConfig.ContainsKey(cameraID))
            {
                m_stroyCameraList.Add(StroyLineConfigManager.Instance.GetCameraConfig[cameraID]);
            }
        }

        m_eventList.Clear();
        if (m_stroyCameraList.Count > 0)
        {
            StroyLineEvent cameraEvt = new StroyLineEvent();
            cameraEvt.Type = StroyActionType.MoveCamera;
            cameraEvt.EventTimeAfterLaunch = 0;
            m_eventList.Add(cameraEvt.Type, cameraEvt);
        }

        m_stroyDialogList.Clear();
        for (int i = 0; i < dialogCount; i++)
        {
            int dialogTextID = m_cameraGroupData._DialogGroupID[i];
            if (StroyLineConfigManager.Instance.GetStroyDialogConfig.ContainsKey(dialogTextID))
            {
                m_stroyDialogList.Add(StroyLineConfigManager.Instance.GetStroyDialogConfig[dialogTextID]);
            }
        }

        //if (m_stroyDialogList.Count > 0)
        {
            StroyLineEvent dialogEvt = new StroyLineEvent();
            dialogEvt.Type = StroyActionType.Dialog;
            dialogEvt.EventTimeAfterLaunch = 0;
            m_eventList.Add(dialogEvt.Type, dialogEvt);
        }
    }