示例#1
0
        public void PlayAnimation(
            int animationId, Movie movie, Button button = null)
        {
            int i = 0;

            int[] animations = m_data.animations[animationId];
            Movie target     = movie;

            for (;;)
            {
                switch ((Animation)animations[i++])
                {
                case Animation.END:
                    return;

                case Animation.PLAY:
                    target.Play();
                    break;

                case Animation.STOP:
                    target.Stop();
                    break;

                case Animation.NEXTFRAME:
                    target.NextFrame();
                    break;

                case Animation.PREVFRAME:
                    target.PrevFrame();
                    break;

                case Animation.GOTOFRAME:
                    target.GotoFrameInternal(animations[i++]);
                    break;

                case Animation.GOTOLABEL:
                    target.GotoFrame(SearchFrame(target, animations[i++]));
                    break;

                case Animation.SETTARGET:
                {
                    target = movie;

                    int count = animations[i++];
                    if (count == 0)
                    {
                        break;
                    }

                    for (int j = 0; j < count; ++j)
                    {
                        int instId = animations[i++];

                        switch ((Animation)instId)
                        {
                        case Animation.INSTANCE_TARGET_ROOT:
                            target = m_rootMovie;
                            break;

                        case Animation.INSTANCE_TARGET_PARENT:
                            target = target.parent;
                            if (target == null)
                            {
                                target = m_rootMovie;
                            }
                            break;

                        default:
                        {
                            target = target.SearchMovieInstanceByInstanceId(
                                instId, false);
                            if (target == null)
                            {
                                target = movie;
                            }
                            break;
                        }
                        }
                    }
                }
                break;

                case Animation.EVENT:
                {
                    int eventId = animations[i++];
#if LWF_USE_LUA
                    CallEventFunctionLua(eventId, movie, button);
#endif
                    if (m_eventHandlers[eventId] != null)
                    {
                        var handlers = new EventHandlerDictionary(
                            m_eventHandlers[eventId]);
                        foreach (var h in handlers)
                        {
                            h.Value(movie, button);
                        }
                    }
                }
                break;

                case Animation.CALL:
#if LWF_USE_LUA
                {
                    int stringId = animations[i++];
                    if (stringId < 0 || stringId >= data.strings.Length)
                    {
                        break;
                    }
                    CallFunctionLua(data.strings[stringId], target);
                }
#else
                    i++;
#endif
                    break;
                }
            }
        }
示例#2
0
	public void PlayAnimation(
		int animationId, Movie movie, Button button = null)
	{
		int i = 0;
		int[] animations = m_data.animations[animationId];
		Movie target = movie;

		for (;;) {
			switch ((Animation)animations[i++]) {
			case Animation.END:
				return;

			case Animation.PLAY:
				target.Play();
				break;

			case Animation.STOP:
				target.Stop();
				break;

			case Animation.NEXTFRAME:
				target.NextFrame();
				break;

			case Animation.PREVFRAME:
				target.PrevFrame();
				break;

			case Animation.GOTOFRAME:
				target.GotoFrameInternal(animations[i++]);
				break;

			case Animation.GOTOLABEL:
				target.GotoFrame(SearchFrame(target, animations[i++]));
				break;

			case Animation.SETTARGET:
				{
					target = movie;

					int count = animations[i++];
					if (count == 0)
						break;

					for (int j = 0; j < count; ++j) {
						int instId = animations[i++];

						switch ((Animation)instId) {
						case Animation.INSTANCE_TARGET_ROOT:
							target = m_rootMovie;
							break;

						case Animation.INSTANCE_TARGET_PARENT:
							target = target.parent;
							if (target == null)
								target = m_rootMovie;
							break;

						default:
							{
								target = target.SearchMovieInstanceByInstanceId(
									instId, false);
								if (target == null)
									target = movie;
								break;
							}
						}
					}
				}
				break;

			case Animation.EVENT:
				{
					int eventId = animations[i++];
#if LWF_USE_LUA
					CallEventFunctionLua(eventId, movie, button);
#endif
					if (m_eventHandlers[eventId] != null) {
						var handlers = new EventHandlerDictionary(
							m_eventHandlers[eventId]);
						foreach (var h in handlers)
							h.Value(movie, button);
					}
				}
				break;

			case Animation.CALL:
#if LWF_USE_LUA
				{
					int stringId = animations[i++];
					if (stringId < 0 || stringId >= data.strings.Length)
						break;
					CallFunctionLua(data.strings[stringId], target);
				}
#else
				i++;
#endif
				break;
			}
		}
	}