Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public void Emit(CubeTransitionEffect arg)
 {
     Interop.TextField.TextFieldSignalEmit(swigCPtr, CubeTransitionEffect.getCPtr(arg));
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionEffect obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public void Deactivate()
        {
            if (mTitle)
            {
                tool_bar.Remove(mTitle);
                mTitle.Dispose();
                mTitle = null;
            }

            if (mSlideshowButton)
            {
                tool_bar.Remove(mSlideshowButton);
                mSlideshowButton.Clicked -= OnPushButtonClicked;
                mSlideshowButton.Dispose();
                mSlideshowButton = null;
            }

            if (toggle_button)
            {
                tool_bar.Remove(toggle_button);
                toggle_button.Clicked -= OnToggleButtonClicked;
                toggle_button.Dispose();
                toggle_button = null;
            }

            if (tool_bar)
            {
                Window.Instance.GetDefaultLayer().Remove(tool_bar);
                tool_bar.Dispose();
                tool_bar = null;
            }

            if (mCubeWaveEffect)
            {
                mCubeWaveEffect.TransitionCompleted -= OnCubeEffectCompleted;
                mCubeWaveEffect.Dispose();
                mCubeWaveEffect = null;
            }

            if (mCubeCrossEffect)
            {
                mCubeCrossEffect.TransitionCompleted -= OnCubeEffectCompleted;
                mCubeCrossEffect.Dispose();
                mCubeCrossEffect = null;
            }

            if (mCubeFoldEffect)
            {
                mCubeFoldEffect.TransitionCompleted -= OnCubeEffectCompleted;
                mCubeFoldEffect.Dispose();
                mCubeFoldEffect = null;
            }

            if (mPanGestureDetector)
            {
                mPanGestureDetector.Detected -= OnPanGesture;
                mPanGestureDetector.Dispose();
                mPanGestureDetector = null;
            }

            if (mContent)
            {
                if (null != mCurrentEffect)
                {
                    mContent.Remove(mCurrentEffect);
                }

                content_layer.Remove(mContent);
                mContent.Dispose();
                mContent = null;
            }

            if (content_layer)
            {
                Window.Instance.RemoveLayer(content_layer);
                content_layer.Dispose();
                content_layer = null;
            }
        }