static int set_CutscenePaused(IntPtr L)
    {
        try
        {
            CinemaDirector.Cutscene obj  = (CinemaDirector.Cutscene)ToLua.CheckObject(L, 1, typeof(CinemaDirector.Cutscene));
            EventObject             arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'CinemaDirector.Cutscene.CutscenePaused' can only appear on the left hand side of += or -= when used outside of the type 'CinemaDirector.Cutscene'"));
            }

            if (arg0.op == EventOp.Add)
            {
                CinemaDirector.CutsceneHandler ev = (CinemaDirector.CutsceneHandler)arg0.func;
                obj.CutscenePaused += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                CinemaDirector.CutsceneHandler ev = (CinemaDirector.CutsceneHandler)arg0.func;
                obj.CutscenePaused -= ev;
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int get_State(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         pushEnum(l, (int)self.State);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_IsLooping(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         pushValue(l, self.IsLooping);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int PreviewPlay(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         self.PreviewPlay();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int GetTrackGroups(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         var ret = self.GetTrackGroups();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        /// <summary>
        /// Show the "Add Track Group" context menu.
        /// </summary>
        /// <param name="cutscene">The current Cutscene that the track group will be added to.</param>
        public static void ShowAddTrackGroupContextMenu(Cutscene cutscene)
        {
            GenericMenu createMenu = new GenericMenu();
            foreach (Type type in DirectorHelper.GetAllSubTypes(typeof(TrackGroup)))
            {
                TrackGroupContextData userData = getContextDataFromType(cutscene, type);
                string text = string.Format(userData.Label);
                createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddTrackGroup), userData);
            }

            createMenu.ShowAsContext();
        }
 static public int set_RunningTime(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.RunningTime = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_IsLooping(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.IsLooping = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int UpdateCutscene(IntPtr l)
 {
     try {
         CinemaDirector.Cutscene self = (CinemaDirector.Cutscene)checkSelf(l);
         System.Single           a1;
         checkType(l, 2, out a1);
         self.UpdateCutscene(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 private static TrackGroupContextData getContextDataFromType(Cutscene cutscene, Type type)
 {
     string label = string.Empty;
     foreach (TrackGroupAttribute attribute in type.GetCustomAttributes(typeof(TrackGroupAttribute), true))
     {
         if (attribute != null)
         {
             label = attribute.Label;
             break;
         }
     }
     TrackGroupContextData userData = new TrackGroupContextData { Cutscene = cutscene, Type = type, Label = label };
     return userData;
 }
 static int Skip(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)ToLua.CheckObject <CinemaDirector.Cutscene>(L, 1);
         obj.Skip();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetTrackGroups(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         CinemaDirector.Cutscene     obj = (CinemaDirector.Cutscene)ToLua.CheckObject <CinemaDirector.Cutscene>(L, 1);
         CinemaDirector.TrackGroup[] o   = obj.GetTrackGroups();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SetRunningTime(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)ToLua.CheckObject <CinemaDirector.Cutscene>(L, 1);
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.SetRunningTime(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #14
0
 static int PlayCutscene(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LuaFramework.CutsceneManager obj  = (LuaFramework.CutsceneManager)ToLua.CheckObject <LuaFramework.CutsceneManager>(L, 1);
         CinemaDirector.Cutscene      arg0 = (CinemaDirector.Cutscene)ToLua.CheckObject <CinemaDirector.Cutscene>(L, 2);
         obj.PlayCutscene(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #15
0
        /// <summary>
        /// Resume playing audio clips after calling a Pause.
        /// </summary>
        public override void Resume()
        {
            Cutscene cutscene = base.GetCutScene();
            var      items    = GetAllTimelineItems();

            for (int i = 0; i < items.Count; i++)
            {
                CinemaAudio cinemaAudio = items[i] as CinemaAudio;
                if (cinemaAudio != null)
                {
                    if (((cutscene.RunningTime > cinemaAudio.Firetime)) && (cutscene.RunningTime < (cinemaAudio.Firetime + cinemaAudio.Duration)))
                    {
                        cinemaAudio.Resume();
                    }
                }
            }
        }
Exemple #16
0
    static int get_CurCutscene(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaFramework.CutsceneManager obj = (LuaFramework.CutsceneManager)o;
            CinemaDirector.Cutscene      ret = obj.CurCutscene;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CurCutscene on a nil value"));
        }
    }
    static int set_IsLooping(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.IsLooping = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsLooping on a nil value"));
        }
    }
    static int set_RunningTime(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.RunningTime = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index RunningTime on a nil value"));
        }
    }
    static int get_IsLooping(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)o;
            bool ret = obj.IsLooping;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsLooping on a nil value"));
        }
    }
    static int get_DirectorGroup(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene      obj = (CinemaDirector.Cutscene)o;
            CinemaDirector.DirectorGroup ret = obj.DirectorGroup;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index DirectorGroup on a nil value"));
        }
    }
    static int get_TrackGroups(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene     obj = (CinemaDirector.Cutscene)o;
            CinemaDirector.TrackGroup[] ret = obj.TrackGroups;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index TrackGroups on a nil value"));
        }
    }
    static int get_RunningTime(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)o;
            float ret = obj.RunningTime;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index RunningTime on a nil value"));
        }
    }
    static int get_State(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CinemaDirector.Cutscene obj = (CinemaDirector.Cutscene)o;
            CinemaDirector.Cutscene.CutsceneState ret = obj.State;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index State on a nil value"));
        }
    }
Exemple #24
0
        /// <summary>
        /// The Cutscene that this TrackGroup is associated with. Will return null if TrackGroup does not have a Cutscene as a parent.
        /// </summary>
        public Cutscene GetCutScene()
        {
#if IN_GAME
            return(CGManager.Instance.CurCutscene);
#else
            Cutscene cutscene = null;
            if (transform.parent != null)
            {
                cutscene = transform.parent.GetComponentInParent <Cutscene>();
                if (cutscene == null)
                {
                    Debug.LogError("No Cutscene found on parent!", this);
                }
            }
            else
            {
                Debug.LogError("TrackGroup has no parent!", this);
            }
            return(cutscene);
#endif
        }
        /// <summary>
        /// Bake the Mecanim preview data.
        /// </summary>
        public void Bake()
        {
            if (Actor == null || Application.isPlaying)
            {
                return;
            }
            Animator animator = Actor.GetComponent <Animator>();

            if (animator == null)
            {
                return;
            }

            AnimatorCullingMode cullingData = animator.cullingMode;

            animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;

            List <RevertInfo> revertCache = new List <RevertInfo>();

            // Build the cache of revert info.
            MonoBehaviour[] mb = this.GetComponentsInChildren <MonoBehaviour>();
            for (int i = 0; i < mb.Length; i++)
            {
                IRevertable revertable = mb[i] as IRevertable;
                if (revertable != null)
                {
                    revertCache.AddRange(revertable.CacheState());
                }
            }

            Vector3    position = Actor.transform.localPosition;
            Quaternion rotation = Actor.transform.localRotation;
            Vector3    scale    = Actor.transform.localScale;

            Cutscene cutScene   = GetCutScene();
            float    frameRate  = 30;
            int      frameCount = (int)((cutScene.Duration * frameRate) + 2);

            animator.StopPlayback();
            animator.recorderStartTime = 0;
            animator.StartRecording(frameCount);

            base.SetRunningTime(0);

            for (int i = 0; i < frameCount - 1; i++)
            {
                List <TimelineTrack> tracks = GetTracks();
                for (int j = 0; j < tracks.Count; j++)
                {
                    tracks[j].UpdateTrack(i * (1.0f / frameRate), (1.0f / frameRate));
                }
                animator.Update(1.0f / frameRate);
            }
            animator.recorderStopTime = frameCount * (1.0f / frameRate);
            animator.StopRecording();
            animator.StartPlayback();

            hasBeenBaked = true;

            // Return the Actor to his initial position.
            Actor.transform.localPosition = position;
            Actor.transform.localRotation = rotation;
            Actor.transform.localScale    = scale;

            for (int i = 0; i < revertCache.Count; i++)
            {
                RevertInfo revertable = revertCache[i];
                if (revertable != null)
                {
                    if ((revertable.EditorRevert == RevertMode.Revert && !Application.isPlaying) ||
                        (revertable.RuntimeRevert == RevertMode.Revert && Application.isPlaying))
                    {
                        revertable.Revert();
                    }
                }
            }
            animator.cullingMode = cullingData;
            base.Initialize();
        }
 public CutsceneEventArgs(Cutscene _targetscene)
 {
     targetScene = _targetscene;
 }