예제 #1
0
        /// <summary>
        /// Sets the screen up (UI components, multimedia content, etc.)
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            SetBackground(ResourceManager.CreateImage("Background"), Adjustment.CENTER);

            #region Moi
            aiMoi = ResourceManager.CreateAnimatedImage("MoiWalkingStripAnimation");

            int width = aiMoi.Width;
            int height = aiMoi.Height;

            StripAnimation saMoiWalkingFrontRight = new StripAnimation(width, height, width / 4, height / 4, 4);
            aiMoi.AddAnimation("MoiWalkingFrontRight", saMoiWalkingFrontRight);
            StripAnimation saMoiWalkingFrontLeft = new StripAnimation(width, height, width / 4, height / 4, 4, 0, height / 4);
            aiMoi.AddAnimation("MoiWalkingFrontLeft", saMoiWalkingFrontLeft);
            StripAnimation saMoiWalkingRearRight = new StripAnimation(width, height, width / 4, height / 4, 4, 0, height / 4 * 2);
            aiMoi.AddAnimation("MoiWalkingRearRight", saMoiWalkingRearRight);
            StripAnimation saMoiWalkingRearLeft = new StripAnimation(width, height, width / 4, height / 4, 4, 0, height / 4 * 3);
            aiMoi.AddAnimation("MoiWalkingRearLeft", saMoiWalkingRearLeft);
            lMoi = new Sprite("Moi", aiMoi) { Pivot = Vector2.One / 2, BringToFront = false };
            AddComponent(lMoi, Preferences.ViewportManager.MiddleCenterAnchor);
            #endregion Moi

            #region Game pad

            thumbStick = new ThumbStick();
            thumbStick.Pivot = new Vector2(0, 1);
            Vector2 margin = new Vector2(5, -5);
            AddComponent(thumbStick, Preferences.ViewportManager.BottomLeftAnchor + margin);

            Buttons buttons = new Buttons();
            margin = new Vector2(-5, -5) - buttons.Size;
            AddComponent(buttons, Preferences.ViewportManager.BottomRightAnchor + margin);
            #endregion Game pad
        }
예제 #2
0
        /// <summary>
        /// Sets the screen up (UI components, multimedia content, etc.)
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            SetBackground(ResourceManager.CreateImage("bg_mobile"), Adjustment.CENTER);

            StripAnimation animation = new StripAnimation(1020, 868, 204, 217, 19);
            animation.FramesPerSecond = 40;
            img = ResourceManager.CreateAnimatedImage("ball");

            img.AddAnimation("bounce", animation);
            img.EndedCurrentStripAnimation += new EventHandler(img_EndedCurrentStripAnimation);
            numberPlayed = 0;
            AddComponent(new Label(img), 10, 100);
            Button play = new Button("Play");
            Button stop = new Button("Stop");
            Button pause = new Button("Pause");
            play.Released += new Component.ComponentEventHandler(play_Released);
            stop.Released += new Component.ComponentEventHandler(stop_Released);
            pause.Released += new Component.ComponentEventHandler(pause_Released);

            playNumbers = new Label("0");

            AddComponent(play, 150, 100);
            AddComponent(stop, 150, 150);
            AddComponent(pause, 150, 200);
            AddComponent(playNumbers, 10, 50);
        }