Пример #1
0
 public void Add(int key,
                 MovieEventHandler l  = null, MovieEventHandler p = null,
                 MovieEventHandler u  = null, MovieEventHandler e = null,
                 MovieEventHandler up = null, MovieEventHandler r = null)
 {
     if (l != null)
     {
         load.Add(key, l);
     }
     if (p != null)
     {
         postLoad.Add(key, p);
     }
     if (u != null)
     {
         unload.Add(key, u);
     }
     if (e != null)
     {
         enterFrame.Add(key, e);
     }
     if (up != null)
     {
         update.Add(key, up);
     }
     if (r != null)
     {
         render.Add(key, r);
     }
     UpdateEmpty();
 }
Пример #2
0
 public void Remove(
     MovieEventHandler l  = null, MovieEventHandler p = null,
     MovieEventHandler u  = null, MovieEventHandler e = null,
     MovieEventHandler up = null, MovieEventHandler r = null)
 {
     if (l != null)
     {
         load.RemoveAll(h => h == l);
     }
     if (p != null)
     {
         postLoad.RemoveAll(h => h == p);
     }
     if (u != null)
     {
         unload.RemoveAll(h => h == u);
     }
     if (e != null)
     {
         enterFrame.RemoveAll(h => h == e);
     }
     if (up != null)
     {
         update.RemoveAll(h => h == up);
     }
     if (r != null)
     {
         render.RemoveAll(h => h == r);
     }
 }
Пример #3
0
        public int AddMovieEventHandler(int instId,
                                        MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                        MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                        MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            if (instId < 0 || instId >= m_instances.Length)
            {
                return(-1);
            }

            MovieEventHandlers handlers = m_movieEventHandlers[instId];

            if (handlers == null)
            {
                handlers = new MovieEventHandlers();
                m_movieEventHandlers[instId] = handlers;
            }

            handlers.Add(load, postLoad, unload, enterFrame, update, render);

            Movie movie = SearchMovieInstanceByInstanceId(instId);

            if (movie != null)
            {
                movie.SetHandlers(handlers);
            }
            return(++m_eventOffset);
        }
Пример #4
0
 public void Add(
     MovieEventHandler l  = null, MovieEventHandler p = null,
     MovieEventHandler u  = null, MovieEventHandler e = null,
     MovieEventHandler up = null, MovieEventHandler r = null)
 {
     if (l != null)
     {
         load.Add(l);
     }
     if (p != null)
     {
         postLoad.Add(p);
     }
     if (u != null)
     {
         unload.Add(u);
     }
     if (e != null)
     {
         enterFrame.Add(e);
     }
     if (up != null)
     {
         update.Add(up);
     }
     if (r != null)
     {
         render.Add(r);
     }
 }
Пример #5
0
        public void SetMovieEventHandler(int instId,
                                         MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                         MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                         MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            if (instId < 0 || instId >= m_instances.Length)
            {
                return;
            }

            MovieEventHandlers handlers;

            if (load != null || postLoad != null || unload != null ||
                enterFrame != null || update != null || render != null)
            {
                handlers = new MovieEventHandlers(
                    load, postLoad, unload, enterFrame, update, render);
            }
            else
            {
                handlers = null;
            }
            m_movieEventHandlers[instId] = handlers;

            if (instId == m_rootMovie.instanceId)
            {
                m_rootMovie.SetHandlers(handlers);
            }
        }
Пример #6
0
        public void RemoveMovieEventHandler(string instanceName,
                                            MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                            MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                            MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));

            if (instId >= 0)
            {
                RemoveMovieEventHandler(
                    instId, load, postLoad, unload, enterFrame, update, render);
                return;
            }

            if (m_movieEventHandlersByFullName == null)
            {
                return;
            }

            MovieEventHandlers handlers;

            if (!m_movieEventHandlersByFullName.TryGetValue(
                    instanceName, out handlers))
            {
                return;
            }

            handlers.Remove(load, postLoad, unload, enterFrame, update, render);
        }
Пример #7
0
        public void RemoveMovieEventHandler(int instId,
                                            MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                            MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                            MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            if (instId < 0 || instId >= m_instances.Length)
            {
                return;
            }

            MovieEventHandlers handlers = m_movieEventHandlers[instId];

            if (handlers == null)
            {
                return;
            }

            handlers.Remove(load, postLoad, unload, enterFrame, update, render);
            Movie movie = SearchMovieInstanceByInstanceId(instId);

            if (movie != null)
            {
                movie.SetHandlers(handlers);
            }
        }
Пример #8
0
        public Movie AttachMovie(string linkageName, string attachName,
                                 int attachDepth          = -1, bool reorder = false,
                                 MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                 MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                 MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            int movieId = m_lwf.SearchMovieLinkage(m_lwf.GetStringId(linkageName));

            if (movieId == -1)
            {
                return(null);
            }

            MovieEventHandlers handlers = new MovieEventHandlers();

            handlers.Add(load, postLoad, unload, enterFrame, update, render);
            Movie movie = new Movie(m_lwf, this, movieId, -1, 0, 0, true, handlers);

            if (m_attachMovieExeced)
            {
                movie.Exec();
            }
            if (m_attachMoviePostExeced)
            {
                movie.PostExec(true);
            }

            return(AttachMovieInternal(movie, attachName, attachDepth, reorder));
        }
Пример #9
0
 public void SetMovieEventHandler(string instanceName,
                                  MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                  MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                  MovieEventHandler update = null, MovieEventHandler render     = null)
 {
     ClearMovieEventHandler(instanceName);
     AddMovieEventHandler(instanceName,
                          load, postLoad, unload, enterFrame, update, render);
 }
Пример #10
0
 public void SetMovieEventHandler(int instId,
                                  MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                  MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                  MovieEventHandler update = null, MovieEventHandler render     = null)
 {
     ClearMovieEventHandler(instId);
     AddMovieEventHandler(instId,
                          load, postLoad, unload, enterFrame, update, render);
 }
Пример #11
0
 public Movie AttachEmptyMovie(string attachName,
                               int attachDepth          = -1, bool reorder = false,
                               MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                               MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                               MovieEventHandler update = null, MovieEventHandler render     = null)
 {
     return(AttachMovie("_empty", attachName, attachDepth, reorder,
                        load, postLoad, unload, enterFrame, update, render));
 }
Пример #12
0
 public MovieEventHandlers(MovieEventHandler l,
                           MovieEventHandler p, MovieEventHandler u,
                           MovieEventHandler e, MovieEventHandler up, MovieEventHandler r)
 {
     load       = l;
     postLoad   = p;
     unload     = u;
     enterFrame = e;
     update     = up;
     render     = r;
 }
Пример #13
0
	public void SetMoviePostLoadCommand(
		string instanceName, MovieEventHandler handler)
	{
		Movie movie = SearchMovieInstance(instanceName);
		if (movie != null) {
			handler(movie);
		} else {
			HandlerWrapper w = new HandlerWrapper();
			MovieEventHandler h = (m) => {
				RemoveMovieEventHandler(instanceName, w.id);
				handler(m);
			};
			w.id = AddMovieEventHandler(instanceName, postLoad:h);
		}
	}
Пример #14
0
        public Movie AttachMovie(Movie movie, string attachName,
                                 int attachDepth          = -1, bool reorder = false,
                                 MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                 MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                 MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            DeleteAttachedMovie(movie.parent, movie, false);

            MovieEventHandlers handlers = new MovieEventHandlers();

            handlers.Add(load, postLoad, unload, enterFrame, update, render);
            movie.SetHandlers(handlers);

            return(AttachMovieInternal(movie, attachName, attachDepth, reorder));
        }
Пример #15
0
        public int AddMovieEventHandler(string instanceName,
                                        MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                        MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                        MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));

            if (instId >= 0)
            {
                return(AddMovieEventHandler(
                           instId, load, postLoad, unload, enterFrame, update, render));
            }

            if (!instanceName.Contains("."))
            {
                return(-1);
            }

            if (m_movieEventHandlersByFullName == null)
            {
                m_movieEventHandlersByFullName = new MovieEventHandlersDictionary();
            }

            MovieEventHandlers handlers;

            if (!m_movieEventHandlersByFullName.TryGetValue(
                    instanceName, out handlers))
            {
                handlers = new MovieEventHandlers();
                m_movieEventHandlersByFullName[instanceName] = handlers;
            }

            int id = GetEventOffset();

            handlers.Add(id, load, postLoad, unload, enterFrame, update, render);

            Movie movie = SearchMovieInstance(instanceName);

            if (movie != null)
            {
                movie.SetHandlers(handlers);
            }
            return(id);
        }
Пример #16
0
        public void SetMoviePostLoadCommand(
            string instanceName, MovieEventHandler handler)
        {
            Movie movie = SearchMovieInstance(instanceName);

            if (movie != null)
            {
                handler(movie);
            }
            else
            {
                HandlerWrapper    w = new HandlerWrapper();
                MovieEventHandler h = (m) => {
                    RemoveMovieEventHandler(instanceName, w.id);
                    handler(m);
                };
                w.id = AddMovieEventHandler(instanceName, postLoad: h);
            }
        }
Пример #17
0
        public void AddMovieEventHandler(string instanceName,
                                         MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                         MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                         MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));

            if (instId >= 0)
            {
                AddMovieEventHandler(
                    instId, load, postLoad, unload, enterFrame, update, render);
                return;
            }

            if (!instanceName.Contains("."))
            {
                return;
            }

            if (m_movieEventHandlersByFullName == null)
            {
                m_movieEventHandlersByFullName = new MovieEventHandlersDictionary();
            }

            MovieEventHandlers handlers =
                m_movieEventHandlersByFullName[instanceName];

            if (handlers == null)
            {
                handlers = new MovieEventHandlers();
                m_movieEventHandlersByFullName[instanceName] = handlers;
            }

            Movie movie = SearchMovieInstance(instId);

            if (movie != null)
            {
                movie.SetHandlers(handlers);
            }

            handlers.Add(load, postLoad, unload, enterFrame, update, render);
        }
Пример #18
0
        public void SetMovieEventHandler(string instanceName,
                                         MovieEventHandler load   = null, MovieEventHandler postLoad   = null,
                                         MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
                                         MovieEventHandler update = null, MovieEventHandler render     = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));

            if (instId >= 0)
            {
                SetMovieEventHandler(
                    instId, load, postLoad, unload, enterFrame, update, render);
                return;
            }

            if (!instanceName.Contains("."))
            {
                return;
            }

            if (m_movieEventHandlersByFullName == null)
            {
                m_movieEventHandlersByFullName = new MovieEventHandlersDictionary();
            }

            if (load != null || postLoad != null || unload != null ||
                enterFrame != null || update != null || render != null)
            {
                m_movieEventHandlersByFullName[instanceName] =
                    new MovieEventHandlers(
                        load, postLoad, unload, enterFrame, update, render);
            }
            else
            {
                m_movieEventHandlersByFullName.Remove(instanceName);
            }
        }
Пример #19
0
	public void RemoveMovieEventHandler(string instanceName,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		int instId = SearchInstanceId(GetStringId(instanceName));
		if (instId >= 0) {
			RemoveMovieEventHandler(
				instId, load, postLoad, unload, enterFrame, update, render);
			return;
		}

		if (m_movieEventHandlersByFullName == null)
			return;

		MovieEventHandlers handlers;
		if (!m_movieEventHandlersByFullName.TryGetValue(
				instanceName, out handlers))
			return;

		handlers.Remove(load, postLoad, unload, enterFrame, update, render);
		Movie movie = SearchMovieInstance(instanceName);
		if (movie != null)
			movie.SetHandlers(handlers);
	}
Пример #20
0
	public void SetMovieEventHandler(string instanceName,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		ClearMovieEventHandler(instanceName);
		AddMovieEventHandler(instanceName,
			load, postLoad, unload, enterFrame, update, render);
	}
Пример #21
0
	public int AddEventHandler(string eventName, MovieEventHandler handler)
	{
		int id = m_lwf.GetEventOffset();
		switch (eventName) {
		case "load": m_handler.Add(id, l:handler); return id;
		case "postLoad": m_handler.Add(id, p:handler); return id;
		case "unload": m_handler.Add(id, u:handler); return id;
		case "enterFrame": m_handler.Add(id, e:handler); return id;
		case "update": m_handler.Add(id, up:handler); return id;
		case "render": m_handler.Add(id, r:handler); return id;
		default: return -1;
		}
	}
Пример #22
0
	public void RequestCalculateBounds(MovieEventHandler callback = null)
	{
		m_requestedCalculateBounds = true;
		m_calculateBoundsCallbacks.Add(callback);
		m_bounds = null;
		return;
	}
Пример #23
0
	public void Remove(
		MovieEventHandler l = null, MovieEventHandler p = null,
		MovieEventHandler u = null, MovieEventHandler e = null,
		MovieEventHandler up = null, MovieEventHandler r = null)
	{
		if (l != null)
			load.RemoveAll(h => h == l);
		if (p != null)
			postLoad.RemoveAll(h => h == p);
		if (u != null)
			unload.RemoveAll(h => h == u);
		if (e != null)
			enterFrame.RemoveAll(h => h == e);
		if (up != null)
			update.RemoveAll(h => h == up);
		if (r != null)
			render.RemoveAll(h => h == r);
		UpdateEmpty();
	}
Пример #24
0
	public void Add(int key,
		MovieEventHandler l = null, MovieEventHandler p = null,
		MovieEventHandler u = null, MovieEventHandler e = null,
		MovieEventHandler up = null, MovieEventHandler r = null)
	{
		if (l != null)
			load.Add(key, l);
		if (p != null)
			postLoad.Add(key, p);
		if (u != null)
			unload.Add(key, u);
		if (e != null)
			enterFrame.Add(key, e);
		if (up != null)
			update.Add(key, up);
		if (r != null)
			render.Add(key, r);
		UpdateEmpty();
	}
Пример #25
0
	public void RemoveMovieEventHandler(int instId,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		if (instId < 0 || instId >= m_instances.Length)
			return;

		MovieEventHandlers handlers = m_movieEventHandlers[instId];
		if (handlers == null)
			return;

		handlers.Remove(load, postLoad, unload, enterFrame, update, render);
		Movie movie = SearchMovieInstanceByInstanceId(instId);
		if (movie != null)
			movie.SetHandlers(handlers);
	}
Пример #26
0
	public int SetMovieEventHandler(int instId,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		ClearMovieEventHandler(instId);
		return AddMovieEventHandler(instId,
			load, postLoad, unload, enterFrame, update, render);
	}
Пример #27
0
	public int AddMovieEventHandler(int instId,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		if (instId < 0 || instId >= m_instances.Length)
			return -1;

		MovieEventHandlers handlers = m_movieEventHandlers[instId];
		if (handlers == null) {
			handlers = new MovieEventHandlers();
			m_movieEventHandlers[instId] = handlers;
		}

		int id = GetEventOffset();
		handlers.Add(id, load, postLoad, unload, enterFrame, update, render);

		Movie movie = SearchMovieInstanceByInstanceId(instId);
		if (movie != null)
			movie.SetHandlers(handlers);
		return id;
	}
Пример #28
0
	public int AddMovieEventHandler(string instanceName,
		MovieEventHandler load = null, MovieEventHandler postLoad = null,
		MovieEventHandler unload = null, MovieEventHandler enterFrame = null,
		MovieEventHandler update = null, MovieEventHandler render = null)
	{
		int instId = SearchInstanceId(GetStringId(instanceName));
		if (instId >= 0) {
			return AddMovieEventHandler(
				instId, load, postLoad, unload, enterFrame, update, render);
		}

		if (!instanceName.Contains("."))
			return -1;

		if (m_movieEventHandlersByFullName == null)
			m_movieEventHandlersByFullName = new MovieEventHandlersDictionary();

		MovieEventHandlers handlers;
		if (!m_movieEventHandlersByFullName.TryGetValue(
				instanceName, out handlers)) {
			handlers = new MovieEventHandlers();
			m_movieEventHandlersByFullName[instanceName] = handlers;
		}

		int id = GetEventOffset();
		handlers.Add(id, load, postLoad, unload, enterFrame, update, render);

		Movie movie = SearchMovieInstance(instanceName);
		if (movie != null)
			movie.SetHandlers(handlers);
		return id;
	}