コード例 #1
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._showNavBarShadow   = true;
            this._isHaveTitle        = false;
            this._titlePosition      = 0.0f;
            this._playButtonPosition = 0.0f;
            this._aspectRatio        = 16.0f / 9;
            if (CCommonUtils.isAndroid)
            {
                this._aspectRatio = 3f / 2;
            }

            this._controller = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            var rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            // SchedulerBinding.instance.addPostFrameCallback(_ => {
            //     this.widget.actionModel.startFetchGameDetail();
            //     this.widget.actionModel.fetchGameDetail();
            // });
        }
コード例 #2
0
ファイル: Header.cs プロジェクト: f1x3d/LunarLambda
 public Header(RelativeRect rect, string label, int font = -1) : base(rect, ThemeManager.GetThemeAsset("ui/KeyValueBackground.png"))
 {
     FillMode    = UIFillModes.SmartStprite;
     IgnoreMouse = true;
     Font        = font;
     SetText(label);
 }
コード例 #3
0
        public static void OutlineRect(PrimitivBuffer target, RelativeRect rect, float width = 1)
        {
            var origin = rect.GetPixelOrigin();
            var size   = rect.GetPixelSize();

            OutlineRect(target, origin.X, origin.Y, origin.X + size.X, origin.Y + size.Y, width);
        }
コード例 #4
0
        protected override GUIElement GetElement(RelativeRect rect)
        {
            var btn = new MenuCheckButton(rect);

            btn.ButtonCheckChanged += ListButton_ButtonCheckChanged;
            return(btn);
        }
コード例 #5
0
        public static void TexturedRect(PrimitivBuffer target, RelativeRect rect, Vector2 uvScale, bool reverseU = false, bool revserseV = false)
        {
            var origin = rect.GetPixelOrigin();
            var size   = rect.GetPixelSize();

            TexturedRect(target, origin.X, origin.Y, origin.X + size.X, origin.Y + size.Y, uvScale, reverseU, revserseV);
        }
コード例 #6
0
        public static void FilledRect(PrimitivBuffer target, RelativeRect rect)
        {
            var origin = rect.GetPixelOrigin();
            var size   = rect.GetPixelSize();

            FilledRect(target, origin.X, origin.Y, origin.X + size.X, origin.Y + size.Y);
        }
コード例 #7
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._articleOffset     = 0;
            this._refreshController = new RefreshController();
            this._isHaveTitle       = false;
            this._hideNavBar        = true;
            this._controller        = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchTeam();
                this.widget.actionModel.fetchTeam();
                this.widget.actionModel.startFetchTeamArticle();
                this.widget.actionModel.fetchTeamArticle(0);
            });
        }
コード例 #8
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._showNavBarShadow = true;
            this._isHaveTitle      = false;
            this._titleHeight      = 0.0f;
            this._aspectRatio      = 16.0f / 9;
            if (Application.platform != RuntimePlatform.Android)
            {
                this._aspectRatio = 3f / 2;
            }

            this._controller = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.offline);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.offline);
            });
        }
コード例 #9
0
 public MenuCheckButton(RelativeRect rect, string text) : base(rect)
 {
     Font     = MenuManager.MainFont;
     FillMode = UIFillModes.StretchMiddle;
     SetText(text);
     Setup();
 }
コード例 #10
0
        public override void initState()
        {
            base.initState();
            this._refreshController = new RefreshController();
            this._isHaveTitle       = false;
            this._titleHeight       = 0.0f;
            this._controller        = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, navBarHeight, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchArticleDetail();
                this.widget.actionModel.fetchArticleDetail(this.widget.viewModel.articleId);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchArticleDetail();
                this.widget.actionModel.fetchArticleDetail(this.widget.viewModel.articleId);
            });
            this._jumpState             = _ArticleJumpToCommentState.Inactive;
            this._cachedCommentPosition = null;
        }
コード例 #11
0
ファイル: OptionsMenu.cs プロジェクト: f1x3d/LunarLambda
        protected void SetupMusicSamples()
        {
            RelativeRect rect = new RelativeRect(RelativeLoc.XFirstThird + RelativeLoc.BorderOffset, RelativeLoc.YUpperBorder + RelativeLoc.BorderOffset, RelativeSize.ThirdWidth * 1.75f, RelativeSize.BorderInsetHeight, OriginLocation.UpperLeft);

            Columns[1] = new VerticalLayoutGroup(rect);
            Columns[1].ChildSpacing    = ButtonSpacing.Paramater;
            Columns[1].MaxChildSize    = ButtonHeight.Paramater;
            Columns[1].TopDown         = true;
            Columns[1].FitChildToWidth = true;

            Columns[1].AddChild(new Header(new RelativeRect(), MenuRes.PreviewSoundtrack));

            foreach (var file in AssetManager.FindAssets(string.Empty))
            {
                string ext = Path.GetExtension(file).ToUpperInvariant();
                if (ext == ".OGG" || ext == ".MP3")
                {
                    MenuButton songButton = new MenuButton(new RelativeRect(), Path.GetFileNameWithoutExtension(file));
                    songButton.Tag      = file;
                    songButton.Clicked += SongButton_Clicked;
                    Columns[1].AddChild(songButton);
                }
            }

            AddElement(Columns[1], 2);
        }
コード例 #12
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._favoriteInfoHeight    = 0;
            this._favoriteArticleOffset = 0;
            this._isHaveTitle           = false;
            this._controller            = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(parent: this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchFavoriteDetail();
                this.widget.actionModel.fetchFavoriteDetail(arg1: this.widget.viewModel.tagId, 0);
            });
            WidgetsBinding.instance.addPostFrameCallback(_ => {
                var renderBox        = (RenderBox)this._favoriteInfoKey.currentContext.findRenderObject();
                var favoriteInfoSize = renderBox.size;
                if (this._favoriteInfoHeight != favoriteInfoSize.height)
                {
                    this.setState(() => this._favoriteInfoHeight = favoriteInfoSize.height);
                }
            });
        }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TileBrushCalculator"/> class.
        /// </summary>
        /// <param name="tileMode">The brush's tile mode.</param>
        /// <param name="stretch">The brush's stretch.</param>
        /// <param name="alignmentX">The brush's horizontal alignment.</param>
        /// <param name="alignmentY">The brush's vertical alignment.</param>
        /// <param name="sourceRect">The brush's source rect</param>
        /// <param name="destinationRect">The brush's destination rect.</param>
        /// <param name="contentSize">The size of the content of the tile brush.</param>
        /// <param name="targetSize">The size of the control to which the brush is being rendered.</param>
        public TileBrushCalculator(
            TileMode tileMode,
            Stretch stretch,
            AlignmentX alignmentX,
            AlignmentY alignmentY,
            RelativeRect sourceRect,
            RelativeRect destinationRect,
            Size contentSize,
            Size targetSize)
        {
            _imageSize = contentSize;

            SourceRect      = sourceRect.ToPixels(_imageSize);
            DestinationRect = destinationRect.ToPixels(targetSize);

            var scale     = stretch.CalculateScaling(DestinationRect.Size, SourceRect.Size);
            var translate = CalculateTranslate(alignmentX, alignmentY, SourceRect, DestinationRect, scale);

            IntermediateSize      = tileMode == TileMode.None ? targetSize : DestinationRect.Size;
            IntermediateTransform = CalculateIntermediateTransform(
                tileMode,
                SourceRect,
                DestinationRect,
                scale,
                translate,
                out _drawRect);
        }
コード例 #14
0
 public UITextEntry(RelativeRect rect, string initalText) : base(rect)
 {
     FillMode = UIFillModes.StretchMiddle;
     SetCurrentText(initalText);
     IgnoreMouse = false;
     Setup();
 }
コード例 #15
0
        public override void initState()
        {
            base.initState();
            this._showNavBarShadow = true;
            this._titleHeight      = 0.0f;
            this._isHaveTitle      = false;
            this._controller       = new AnimationController(
                duration: new TimeSpan(0, 0, 0, 0, 300),
                vsync: this
                );
            this._titleAnimationController = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._titleAnimation = rectTween.animate(this._titleAnimationController);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.showChatWindow(false);
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
        }
コード例 #16
0
 public UILabel(int font, string text, RelativeRect rect, Color color, TextFittingModes mode = TextFittingModes.ByHeightExtend) : base(rect, color)
 {
     IgnoreMouse = true;
     FittingMode = mode;
     Text        = text;
     Font        = font;
 }
コード例 #17
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._articlePageNumber     = 1;
            this._favoriteArticleOffset = 0;
            this._refreshController     = new RefreshController();
            this._isHaveTitle           = false;
            this._hideNavBar            = true;
            this._isShowTop             = false;
            this._selectedIndex         = 0;
            this._controller            = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, top: navBarHeight, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(parent: this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchUserProfile();
                this.widget.actionModel.fetchUserProfile();
                this.widget.actionModel.startFetchUserArticle();
                this.widget.actionModel.startFetchUserFavorite();
            });
        }
コード例 #18
0
ファイル: JoinGameMenu.cs プロジェクト: JeffM2501/LunarLambda
        protected int SetupShipInfo(int layerIndex)
        {
            // right side group
            RelativeRect rect = new RelativeRect(RelativeLoc.XCenter, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.ThreeColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperCenter);

            GridLayoutGroup shipInfo = new GridLayoutGroup(rect, 15, 1);

            Columns[1] = shipInfo;

            shipInfo.MaxChildSize = ButtonHeight.Paramater;

            shipInfo.SetColSpan(4, 5);

            // Scenario header
            shipInfo.AddChild(new Header(new RelativeRect(), MenuRes.ShipInfoHeader));

            ShipNameLabel = MakeGridLabel(MenuRes.ShipNameLabel, true);
            shipInfo.AddChild(ShipNameLabel);

            ShipTypeLabel = MakeGridLabel(MenuRes.ShipTypeLabel, true);
            shipInfo.AddChild(ShipTypeLabel);

            shipInfo.AddChild(new Header(new RelativeRect(), MenuRes.ShipStatsLabel));

            ShipStatsTextArea = new TextArea(RelativeRect.Full, string.Empty, MenuManager.MainFont, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png"));
            ShipStatsTextArea.DefaultMaterial.Color = Color.Gray;
            ShipStatsTextArea.DesiredRows           = 9;
            ShipStatsTextArea.BorderPadding         = 4;
            ShipStatsTextArea.MiniumElementHeight   = 12;

            shipInfo.AddChild(ShipStatsTextArea);

            AddElement(Columns[1], layerIndex + 1);
            return(layerIndex + 1);
        }
コード例 #19
0
 public _PopupMenuRoute(
     RelativeRect position            = null,
     List <PopupMenuEntry <T> > items = null,
     T initialValue  = default,
     float?elevation = 8.0f,
     ThemeData theme = null,
     PopupMenuThemeData popupMenuTheme = null,
     string barrierLabel          = null,
     ShapeBorder shape            = null,
     Color color                  = null,
     BuildContext showMenuContext = null,
     bool?captureInheritedThemes  = null
     )
 {
     this.position               = position;
     this.items                  = items;
     this.initialValue           = initialValue;
     this.elevation              = elevation;
     this.theme                  = theme;
     this.popupMenuTheme         = popupMenuTheme;
     this.barrierLabel           = barrierLabel;
     this.shape                  = shape;
     this.color                  = color;
     this.showMenuContext        = showMenuContext;
     this.captureInheritedThemes = captureInheritedThemes;
     itemSizes = new List <Size>(new Size[items.Count]);
 }
コード例 #20
0
 public _PopupMenuRouteLayout(RelativeRect position, List <Size> itemSizes, int selectedItemIndex,
                              TextDirection?textDirection)
 {
     this.position          = position;
     this.itemSizes         = itemSizes;
     this.selectedItemIndex = selectedItemIndex;
     this.textDirection     = textDirection;
 }
コード例 #21
0
ファイル: HSlider.cs プロジェクト: JeffM2501/LunarLambda
        public HSlider(RelativeRect rect, string labelPrefix, int value, int font = -1, int min = 0, int max = 100) : base(rect, value, min, max, ThemeManager.GetThemeAsset("ui/SliderBackground.png"))
        {
            Vertical    = false;
            IgnoreMouse = false;
            SetLabels(labelPrefix);

            ValueChanged += HSlider_ValueChanged;
        }
コード例 #22
0
        Widget _buildOverlay(BuildContext context)
        {
            D.assert(manifest != null);
            shuttle = shuttle ?? manifest.shuttleBuilder(
                context,
                manifest.animation,
                manifest.type,
                manifest.fromHero.context,
                manifest.toHero.context);
            D.assert(shuttle != null);

            return(new AnimatedBuilder(
                       animation: _proxyAnimation,
                       child: shuttle,
                       builder: (BuildContext _, Widget child) => {
                RenderBox toHeroBox = manifest.toHero.context?.findRenderObject() as RenderBox;
                if (_aborted || toHeroBox == null || !toHeroBox.attached)
                {
                    if (_heroOpacity.isCompleted)
                    {
                        _heroOpacity = _proxyAnimation.drive(
                            _reverseTween.chain(
                                new CurveTween(curve: new Interval(_proxyAnimation.value, 1.0f)))
                            );
                    }
                }
                else if (toHeroBox.hasSize)
                {
                    RenderBox finalRouteBox = manifest.toRoute.subtreeContext?.findRenderObject() as RenderBox;
                    Offset toHeroOrigin = toHeroBox.localToGlobal(Offset.zero, ancestor: finalRouteBox);
                    if (toHeroOrigin != heroRectTween.end.topLeft)
                    {
                        Rect heroRectEnd = toHeroOrigin & heroRectTween.end.size;
                        heroRectTween = _doCreateRectTween(heroRectTween.begin, heroRectEnd);
                    }
                }

                Rect rect = heroRectTween.evaluate(_proxyAnimation);
                Size size = manifest.navigatorRect.size;
                RelativeRect offsets = RelativeRect.fromSize(rect, size);

                return new Positioned(
                    top: offsets.top,
                    right: offsets.right,
                    bottom: offsets.bottom,
                    left: offsets.left,
                    child: new IgnorePointer(
                        child: new RepaintBoundary(
                            child: new Opacity(
                                opacity: _heroOpacity.value,
                                child: child
                                )
                            )
                        )
                    );
            }
                       ));
        }
コード例 #23
0
 public UILabel(int font, string text, TextFittingModes mode = TextFittingModes.ByHeightExtend) : base()
 {
     IgnoreMouse           = true;
     FittingMode           = mode;
     Text                  = text;
     Font                  = font;
     DefaultMaterial.Color = Color.White;
     Rect                  = new RelativeRect(RelativeLoc.XCenter, RelativeLoc.YCenter, RelativeSize.FullWidth, RelativeSize.FullWidth, OriginLocation.Center);
 }
コード例 #24
0
        protected virtual void SetupStartServerButton(int layerIndex)
        {
            RelativeRect rect = new RelativeRect(RelativeLoc.XRightBorder + RelativeLoc.BorderOffset, RelativeLoc.YLowerBorder + RelativeLoc.BorderOffset, ButtonWidth, ButtonHeight, OriginLocation.LowerRight);

            MenuButton start = new MenuButton(rect, MenuRes.StartScenario);

            start.Clicked += Start_Clicked;
            AddElement(start, layerIndex);
        }
コード例 #25
0
        protected ControlScrollList(RelativeRect rect, string texture = null) : base(rect, texture)
        {
            NoDraw      = true;
            IgnoreMouse = false;
            FillMode    = UIFillModes.SmartStprite;
            NoDraw      = string.IsNullOrEmpty(texture);

            SetupButtons();
        }
コード例 #26
0
ファイル: MenuCommon.cs プロジェクト: f1x3d/LunarLambda
        protected virtual void SetupBackButton(int layerIndex)
        {
            RelativeRect rect = new RelativeRect(RelativeLoc.XLeftBorder + RelativeLoc.BorderOffset, RelativeLoc.YLowerBorder + RelativeLoc.BorderOffset, ButtonWidth, ButtonHeight, OriginLocation.LowerLeft);

            MenuButton back = new MenuButton(rect, MenuRes.Back);

            back.Clicked += Back_Clicked;
            AddElement(back, layerIndex);
        }
コード例 #27
0
ファイル: SpinSelector.cs プロジェクト: f1x3d/LunarLambda
        public SpinSelector(RelativeRect rect, IEnumerable <string> labels, int defaultIndex, int font = -1) : base(rect, ThemeManager.GetThemeAsset("ui/SelectorBackground.png"))
        {
            IgnoreMouse   = false;
            FillMode      = UIFillModes.SmartStprite;
            Font          = font;
            SelectedIndex = defaultIndex;
            SetLabels(labels);

            SetupButtons();
        }
コード例 #28
0
ファイル: TextArea.cs プロジェクト: f1x3d/LunarLambda
        public TextArea(RelativeRect rect, string text, int font = -1, string backgroundTexture = null) : base(rect, backgroundTexture)
        {
            Font               = font;
            IgnoreMouse        = false;
            CurrentText        = text;
            LeaveRoomForScroll = true;
            BorderPadding      = 5;

            MiniumScrollSize = 45;
        }
コード例 #29
0
        public static void paintOverflowIndicator(
            RenderObject renderObject,
            PaintingContext context,
            Offset offset,
            Rect containerRect,
            Rect childRect,
            string overflowHints = null
            )
        {
            RelativeRect overflow = RelativeRect.fromRect(containerRect, childRect);

            if (overflow.left <= 0.0f &&
                overflow.right <= 0.0f &&
                overflow.top <= 0.0f &&
                overflow.bottom <= 0.0f)
            {
                return;
            }

            List <_OverflowRegionData> overflowRegions = _calculateOverflowRegions(overflow, containerRect);

            foreach (_OverflowRegionData region in overflowRegions)
            {
                context.canvas.drawRect(region.rect.shift(offset), _indicatorPaint);

                if (_indicatorLabel[(int)region.side].text?.text != region.label)
                {
                    _indicatorLabel[(int)region.side].text = new TextSpan(
                        text: region.label,
                        style: _indicatorTextStyle
                        );
                    _indicatorLabel[(int)region.side].layout();
                }

                Offset labelOffset        = region.labelOffset + offset;
                Offset centerOffset       = new Offset(-_indicatorLabel[(int)region.side].width / 2.0f, 0.0f);
                Rect   textBackgroundRect = centerOffset & _indicatorLabel[(int)region.side].size;
                context.canvas.save();
                context.canvas.translate(labelOffset.dx, labelOffset.dy);
                context.canvas.rotate(region.rotation);
                context.canvas.drawRect(textBackgroundRect, _labelBackgroundPaint);
                _indicatorLabel[(int)region.side].paint(context.canvas, centerOffset);
                context.canvas.restore();
            }

            bool containsKey = _overflowReportNeeded.TryGetValue(renderObject, out var overflowReportNeeded);

            overflowReportNeeded |= !containsKey;
            if (overflowReportNeeded)
            {
                _overflowReportNeeded[renderObject] = false;
                _reportOverflow(renderObject, overflow, overflowHints);
            }
        }
コード例 #30
0
ファイル: MenuCommon.cs プロジェクト: f1x3d/LunarLambda
        public static VerticalLayoutGroup SetupCommonColumn(RelativeRect rect)
        {
            VerticalLayoutGroup column = new VerticalLayoutGroup(rect);

            column.ChildSpacing    = ButtonSpacing.Paramater;
            column.MaxChildSize    = ButtonHeight.Paramater;
            column.TopDown         = true;
            column.FitChildToWidth = true;

            return(column);
        }