예제 #1
0
        /// <summary>
        /// Creates and initializes a new instance of the SourceMenu class.
        /// Create Items for Menu ScrollContainer
        /// </summary>
        /// <param name="menuSize">menu size</param>
        /// <param name="itemSize">item size</param>
        public SourceMenu(Size2D menuSize, Size2D itemSize)
        {
            _menuSize           = menuSize;
            _itemSize           = itemSize;
            _showHideMenuEffect = new Effect[2];

            _showMenuAnimation           = new Animation(Constants.ShowMenuDuration);
            _showMenuAnimation.EndAction = Animation.EndActions.Cancel;

            _menu      = new ScrollMenu();
            _menu.Name = "sourceMenu";
            _menu.WidthResizePolicy      = ResizePolicyType.Fixed;
            _menu.HeightResizePolicy     = ResizePolicyType.Fixed;
            _menu.Size2D                 = _menuSize;
            _menu.PositionUsesPivotPoint = true;
            _menu.ParentOrigin           = ParentOrigin.BottomRight;
            _menu.PivotPoint             = PivotPoint.BottomRight;
            _menu.FocusCenter            = false;
            _menu.HoldFocusWhileInactive = true;
            _menu.StartActive            = true;
            _menu.ItemDimensions         = _itemSize;
            _menu.Gap             = Constants.SourceMenuPadding;
            _menu.Margin          = Constants.SourceMenuMargin;
            _menu.FocusScale      = Constants.SourceFocusScale;
            _menu.ScrollEndMargin = Constants.SourceMenuScrollEndMargin;

            _menu.ClippingMode = ClippingModeType.ClipToBoundingBox;

            for (int i = 0; i < Constants.MenuItemsCount; ++i)
            {
                ScrollMenu.ScrollItem scrollItem = new ScrollMenu.ScrollItem();
                scrollItem.item      = new ImageView(Constants.ResourcePath + "/images/SourceMenu/mi" + i + ".png");
                scrollItem.item.Name = ("menu-item_" + _menu.ItemCount);
                _menu.AddItem(scrollItem);
            }
        }
예제 #2
0
        /// <summary>
        /// Create Items for Poster ScrollContainer
        /// </summary>
        /// <param name="height">height</param>
        /// <param name="imagePath">image path</param>
        /// <param name="menuDefinition">menu definition</param>
        public PosterMenu(int height, String imagePath, TVConfiguration.MenuDefinition menuDefinition)
        {
            _showHideMenuEffect = new Effect[2];

            _menu = new ScrollMenu();
            _menu.PositionUsesPivotPoint = true;
            _menu.ParentOrigin           = ParentOrigin.TopCenter;
            _menu.PivotPoint             = PivotPoint.TopCenter;
            _menu.WidthResizePolicy      = ResizePolicyType.FillToParent;
            _menu.HeightResizePolicy     = ResizePolicyType.Fixed;
            _menu.Size            = new Size(0, height);
            _menu.StartActive     = false;
            _menu.Gap             = Constants.PostersContainerPadding;
            _menu.Margin          = Constants.PostersContainerMargin;
            _menu.ScrollEndMargin = Constants.PostersContainerScrollEndMargin;
            _menu.ItemDimensions  = menuDefinition.posterDimensions;
            _menu.FocusScale      = Constants.PosterFocusScale;

            for (int i = 0; i < menuDefinition.posterTitles.Count; i++)
            {
                ScrollMenu.ScrollItem scrollItem = new ScrollMenu.ScrollItem();

                TextLabel titleText = new TextLabel(menuDefinition.posterTitles[i]);
                titleText.Name = "poster-title_" + (i + 1);
                titleText.WidthResizePolicy      = ResizePolicyType.UseNaturalSize;
                titleText.PositionUsesPivotPoint = true;
                titleText.ParentOrigin           = new Position(0.5f, 0.04f, 0.5f);
                titleText.PivotPoint             = PivotPoint.TopCenter;
                //titleText.PointSize = Constants.TVBuild ? 27.0f : 19.0f; //TODO: Set with style sheet
                //titleText.PointSize = Constants.TVBuild ? 7.0f : 19.0f;
                titleText.PointSize = DeviceCheck.PointSize7;
                if (menuDefinition.whiteText)
                {
                    titleText.TextColor = Color.White;
                }
                else
                {
                    titleText.TextColor = Color.Black;
                }

                scrollItem.title = titleText;

                scrollItem.shadow = new ImageView(Constants.ResourcePath + "/images/Effect/thumbnail_cast_shadow.png");
                scrollItem.shadow.ParentOrigin           = ParentOrigin.BottomCenter;
                scrollItem.shadow.PivotPoint             = PivotPoint.TopCenter;
                scrollItem.shadow.PositionUsesPivotPoint = true;
                scrollItem.shadow.WidthResizePolicy      = ResizePolicyType.SizeRelativeToParent;
                scrollItem.shadow.HeightResizePolicy     = ResizePolicyType.SizeRelativeToParent;
                scrollItem.shadow.SizeModeFactor         = new Vector3(1.1f, 0.4f, 0.0f);
                scrollItem.shadow.Position = new Position(0.0f, 0.0f, 0.0f);
                scrollItem.shadow.Opacity  = 0.7f;

                if (_use3D)
                {
                    VisualView item = new VisualView();
                    item.WidthResizePolicy  = ResizePolicyType.Fixed;
                    item.HeightResizePolicy = ResizePolicyType.Fixed;
                    item.Size     = new Size(400, 400);
                    item.Position = new Position(0.0f, 0.0f, 0.0f);
                    item.PositionUsesPivotPoint = true;
                    item.Focusable    = true;
                    item.ParentOrigin = ParentOrigin.Center;
                    item.PivotPoint   = PivotPoint.Center;

                    MeshVisual meshVisualMap1 = new MeshVisual();
                    meshVisualMap1.ObjectURL = Constants.ResourcePath + "/models/roundedcube-half3.obj";
                    if ((i % 3) == 0)
                    {
                        meshVisualMap1.MaterialtURL = Constants.ResourcePath + "/models/roundedcube-half2.mtl";
                    }
                    else if ((i % 3) == 1)
                    {
                        meshVisualMap1.MaterialtURL = Constants.ResourcePath + "/models/roundedcube-half3.mtl";
                    }
                    else
                    {
                        meshVisualMap1.MaterialtURL = Constants.ResourcePath + "/models/roundedcube-half4.mtl";
                    }

                    meshVisualMap1.TexturesPath   = Constants.ResourcePath + "/images/";
                    meshVisualMap1.ShadingMode    = MeshVisualShadingModeValue.TexturedWithSpecularLighting;
                    meshVisualMap1.Size           = new Size2D(445, 445);
                    meshVisualMap1.Position       = new Position2D(0, 0);
                    meshVisualMap1.PositionPolicy = VisualTransformPolicyType.Absolute;
                    meshVisualMap1.SizePolicy     = VisualTransformPolicyType.Absolute;
                    meshVisualMap1.Origin         = Visual.AlignType.Center;
                    meshVisualMap1.AnchorPoint    = Visual.AlignType.Center;
                    item.AddVisual("meshVisual1", meshVisualMap1);
                    item.Name       = "poster-item_" + (i + 1);
                    scrollItem.item = item;

                    _menu.AddItem(scrollItem);
                }
                else
                {
/*                  string itemURL = _imagePath + "/poster" + j + "/" + (i % 14) + ".jpg";
 *                  View item = new ImageView(itemURL);
 *                  View itemReflection = new ImageView(itemURL);
 *                  item.Name = ("poster-item-" + _postersContainer[j].ItemCount);
 *                  _postersContainer[j].AddItem(item, shadowBorder, itemReflection);
 */
                    string itemURL = imagePath + "/mi" + i + ".png";
                    scrollItem.item      = new ImageView(itemURL);
                    scrollItem.item.Name = "poster-item_" + (i + 1);
                    _menu.AddItem(scrollItem);
                }
            }
        }