コード例 #1
0
        private bool OnToggleButtonClicked(object sender, global::System.EventArgs args)
        {
            mContent.Remove(mCurrentEffect);
            if (mCurrentEffect == mCubeWaveEffect)
            {
                mCurrentEffect = mCubeCrossEffect;
                mTitle.Text    = APPLICATION_TITLE_CROSS;
            }
            else if (mCurrentEffect == mCubeCrossEffect)
            {
                mCurrentEffect = mCubeFoldEffect;
                mTitle.Text    = APPLICATION_TITLE_FOLD;
            }
            else
            {
                mCurrentEffect = mCubeWaveEffect;
                mTitle.Text    = APPLICATION_TITLE_WAVE;
            }
            mContent.Add(mCurrentEffect);

            // Set the current image to cube transition effect
            // only need to set at beginning or change from another effect
            mCurrentEffect.SetCurrentTexture(mCurrentTexture);
            return(true);
        }
コード例 #2
0
        public void Activate()
        {
            Window.Instance.BackgroundColor = Color.Black;
            // tool bar
            tool_bar = new View();
            tool_bar.BackgroundColor        = Color.White;
            tool_bar.Size2D                 = new Size2D(Window.Instance.WindowSize.Width, 100);
            tool_bar.PositionUsesPivotPoint = true;
            tool_bar.ParentOrigin           = ParentOrigin.TopLeft;
            tool_bar.PivotPoint             = PivotPoint.TopLeft;

            Window.Instance.GetDefaultLayer().Add(tool_bar);
            Window.Instance.GetDefaultLayer().RaiseToTop();

            // title of tool bar
            mTitle                        = new TextLabel();
            mTitle.Text                   = APPLICATION_TITLE_WAVE;
            mTitle.FontFamily             = "SamsungOneUI 400C";
            mTitle.PointSize              = 20;
            mTitle.Position2D             = new Position2D(400, 42);
            mTitle.ParentOrigin           = ParentOrigin.TopLeft;
            mTitle.PositionUsesPivotPoint = true;
            mTitle.PivotPoint             = PivotPoint.TopLeft;
            tool_bar.Add(mTitle);

            // push button of tool bar
            mSlideshowButton = new PushButton();
            PropertyMap unselected_bg_map = new PropertyMap();

            unselected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
            unselected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON));
            mSlideshowButton.UnselectedBackgroundVisual = unselected_bg_map;

            PropertyMap selected_bg_map = new PropertyMap();

            selected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
            selected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON_SELECTED));
            mSlideshowButton.SelectedBackgroundVisual = selected_bg_map;

            mSlideshowButton.ParentOrigin = ParentOrigin.TopLeft;
            mSlideshowButton.PivotPoint   = PivotPoint.TopLeft;
            mSlideshowButton.Position2D   = new Position2D(800, 32);
            mSlideshowButton.Clicked     += OnPushButtonClicked;

            mSlideshowButton.RaiseToTop();

            tool_bar.Add(mSlideshowButton);

            // toggle button of tool bar
            toggle_button = new ToggleButton();
            PropertyArray array = new PropertyArray();

            array.Add(new PropertyValue(EFFECT_WAVE_IMAGE));
            array.Add(new PropertyValue(EFFECT_CROSS_IMAGE));
            array.Add(new PropertyValue(EFFECT_FOLD_IMAGE));
            toggle_button.StateVisuals = array;

            toggle_button.ParentOrigin            = ParentOrigin.TopLeft;
            toggle_button.PivotPoint              = PivotPoint.TopLeft;
            toggle_button.CellHorizontalAlignment = HorizontalAlignmentType.Right;
            toggle_button.Position2D              = new Position2D(900, 42);

            toggle_button.Clicked += OnToggleButtonClicked;

            tool_bar.Add(toggle_button);

            // load image
            mCurrentTexture = LoadStageFillingTexture(IMAGES[mIndex]);

            // content layer is 3D.
            content_layer          = new Layer();
            content_layer.Behavior = Layer.LayerBehavior.Layer3D;
            Window.Instance.AddLayer(content_layer);

            //use small cubes
            mCubeWaveEffect = new CubeTransitionWaveEffect(NUM_ROWS_WAVE, NUM_COLUMNS_WAVE);
            mCubeWaveEffect.SetTransitionDuration(ANIMATION_DURATION_WAVE);
            mCubeWaveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_WAVE);
            mCubeWaveEffect.TransitionCompleted += OnCubeEffectCompleted;

            mCubeWaveEffect.Position2D   = new Position2D(0, tool_bar.Size2D.Height);
            mCubeWaveEffect.Size2D       = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
            mCubeWaveEffect.PivotPoint   = PivotPoint.TopLeft;
            mCubeWaveEffect.ParentOrigin = ParentOrigin.TopLeft;
            mCubeWaveEffect.SetCurrentTexture(mCurrentTexture);

            // use big cubes
            mCubeCrossEffect = new CubeTransitionCrossEffect(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS);
            mCubeCrossEffect.SetTransitionDuration(ANIMATION_DURATION_CROSS);
            mCubeCrossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_CROSS);
            mCubeCrossEffect.TransitionCompleted += OnCubeEffectCompleted;

            mCubeCrossEffect.Position2D   = new Position2D(0, tool_bar.Size2D.Height);
            mCubeCrossEffect.Size2D       = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
            mCubeCrossEffect.PivotPoint   = PivotPoint.TopLeft;
            mCubeCrossEffect.ParentOrigin = ParentOrigin.TopLeft;
            mCubeCrossEffect.SetCurrentTexture(mCurrentTexture);

            mCubeFoldEffect = new CubeTransitionFoldEffect(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD);
            mCubeFoldEffect.SetTransitionDuration(ANIMATION_DURATION_FOLD);
            mCubeFoldEffect.TransitionCompleted += OnCubeEffectCompleted;

            mCubeFoldEffect.Position2D   = new Position2D(0, tool_bar.Size2D.Height);
            mCubeFoldEffect.Size2D       = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
            mCubeFoldEffect.PivotPoint   = PivotPoint.TopLeft;
            mCubeFoldEffect.ParentOrigin = ParentOrigin.TopLeft;
            mCubeFoldEffect.SetCurrentTexture(mCurrentTexture);

            mViewTimer       = new Timer(VIEWINGTIME);
            mViewTimer.Tick += OnTimerTick;

            // content
            mCurrentEffect = mCubeWaveEffect;

            mContent                        = new View();
            mContent.Size2D                 = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
            mContent.ParentOrigin           = ParentOrigin.TopLeft;
            mContent.PositionUsesPivotPoint = true;
            mContent.PivotPoint             = PivotPoint.TopLeft;

            mContent.Add(mCurrentEffect);

            content_layer.Add(mContent);

            mPanGestureDetector           = new PanGestureDetector();
            mPanGestureDetector.Detected += OnPanGesture;
            mPanGestureDetector.Attach(mContent);
        }