public void addRandomDrawElement(DrawElementRequest request)
 {
     lock (requests)
     {
         requests.AddLast(request);
     }
 }
 private DrawElement CreateDrawStaticImage(DrawElementRequest request)
 {
     DrawElement element = CreateDrawImage(request);
     element.setX(request.getCalculatedX(element.getWidth()));
     element.setY(request.getCalculatedY(element.getHeight()));
     return element;
 }
 private DrawElement CreateDrawTeleportAnimation(DrawElementRequest request)
 {
     DrawElement element = CreateDrawStaticElement(request);
     return new DrawTeleportAnimation(request.getCalculatedX(element.getWidth()), request.getCalculatedY(element.getHeight()), screenWidth, screenHeight, element);
 }
 private DrawElement CreateDrawSpinAnimationRightSpeedMid(DrawElementRequest request)
 {
     DrawElement element = CreateDrawImage(request);
     return new DrawSpinAnimation(request.getCalculatedX(element.getWidth()), request.getCalculatedY(element.getHeight()), element, 2, true);
 }
        private DrawElement CreateDrawStaticElement(DrawElementRequest request)
        {
            int type = random.Next(staticElementGenerators.Count);
            DrawElement element = staticElementGenerators[type](request);

            // normalize to zero
            element.setX(0);
            element.setY(0);
            return element;
        }
 private DrawElement CreateDrawSpinAnimationLeftSpeedLow(DrawElementRequest request)
 {
     DrawElement element = CreateDrawImage(request);
     return new DrawSpinAnimation(request.getCalculatedX(element.getWidth()), request.getCalculatedY(element.getHeight()), element, 1, false);
 }
 private DrawElement CreateDrawPulsingImage(DrawElementRequest request)
 {
     DrawElement element = new DrawPulsingImageElement(request.getAsset().getImageFileName());
     element.setX(request.getCalculatedX(element.getWidth()));
     element.setY(request.getCalculatedY(element.getHeight()));
     return element;
 }
 private DrawElement CreateDrawImage(DrawElementRequest request)
 {
     return new DrawImageElement(request.getAsset().getImageFileName());
 }
 private DrawElement CreateDrawFallingAnimationSpeedMid(DrawElementRequest request)
 {
     DrawElement element = CreateDrawStaticElement(request);
     return new DrawFallingAnimation(request.getCalculatedX(element.getWidth()), request.getCalculatedY(element.getHeight()), screenHeight, 120, element);
 }
예제 #10
0
        private void RunEvent(int key, int posX, int posY)
        {
            // notify the element manager of current screen size
            drawElementManager.setScreenHeight(this.Height);
            drawElementManager.setScreenWidth(this.Width);

            // grab an element asset
            ElementAsset asset = elementAssetManager.getElementAsset(key);
            if (asset.getImageFileName() == null)
            {
                // elements with no images are useless
                return;
            }

            DrawElementRequest request = new DrawElementRequest(asset, posX, posY, this.Height, this.Width);
            drawElementManager.addRandomDrawElement(request);

            // play sound
            if (asset.getSoundFileName() != null)
            {
                soundManager.playSound(new SoundEvent(asset.getSoundFileName()));
            }
        }