// execute action for every frame
        // if action is finished, return true;
        public override bool step(FrmEmulator emulator, long time)
        {
            TLayer layer = sequence.animation.layer;

            if (frames.Count > 0 && layer is TImageActor)
            {
                float elapsed = time - run_startTime;
                if (elapsed > duration)
                {
                    elapsed = duration;
                }

                long t     = 0;
                int  index = 0;
                while (t < elapsed && index < frames.Count)
                {
                    t += frames[index++].duration;
                }

                if (index > 0)
                {
                    index--;
                }

                if (index != run_currentFrame)
                {
                    run_currentFrame = index;
                    string image = frames[index].image;

                    TImageActor     target         = (TImageActor)layer;
                    TLibraryManager libraryManager = target.document.libraryManager;
                    int             libImageIndex  = libraryManager.imageIndex(image);
                    if (libImageIndex != -1)
                    {
                        target.loadImage(Image.FromFile(libraryManager.imageFilePath(libImageIndex)));
                    }
                }
            }

            return(base.step(emulator, time));
        }
示例#2
0
        public TDocument()
        {
            // create managers
            sceneManager   = new TSceneManager(this);
            libraryManager = new TLibraryManager(this);
            actionManager  = new ActionManager();

            // setting
            identifier = "";

            backgroundMusic             = "";
            backgroundMusicVolume       = 100;
            navigationButtonDelayTime   = 5;
            navigationLeftButtonRender  = true;
            navigationRightButtonRender = true;

            prevSceneButton = "";
            nextSceneButton = "";
            avatarDefault   = "";
            avatarFrame     = "";
            avatarMask      = "";

            // initialize properties
            modified  = false;
            filepath  = null;
            filename  = "Untitled";
            directory = null;

            currentTool     = TOOL_SELECT;
            currentTempTool = TOOL_NONE;
            zoom            = Program.DEFAULT_ZOOM;
            offset          = new Point(0, 0);

            selectedItems   = new List <TActor>();
            workspaceMatrix = new Matrix();

            run_avatar = null;
        }
 public TSoundEmulator(TLibraryManager libraryManager)
 {
     this.libraryManager = libraryManager;
 }