Exemplo n.º 1
0
 protected internal override Widget build(BuildContext context)
 {
     return(Positioned.fromRelativeRect(
                rect: this.rect.value,
                child: this.child
                ));
 }
Exemplo n.º 2
0
        void _createTipMenu(BuildContext context, ArrowDirection arrowDirection, Offset position, Size size)
        {
            dismiss();
            float triangleY = arrowDirection == ArrowDirection.up
                ? position.dy
                : position.dy - CustomTextSelectionControlsUtils._kToolbarTriangleSize.height
                              - this._getTipMenuHeight(context: context);

            _overlayState = Overlay.of(context: context);
            _overlayEntry = new OverlayEntry(
                _context => Positioned.fill(
                    new GestureDetector(
                        onTap: dismiss,
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Stack(
                                children: new List <Widget> {
                new Positioned(
                    top: triangleY,
                    left: size.width / 2.0f + position.dx - 25 * this.tipMenuItems.Count,
                    child: new _TipMenuContent(
                        tipMenuItems: this.tipMenuItems,
                        arrowDirection: arrowDirection
                        )
                    )
            }
                                )
                            )
                        )
                    )
                );
            _isVisible = true;
            _overlayState.insert(entry: _overlayEntry);
        }
Exemplo n.º 3
0
 protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx)
 {
     return(Positioned.fill(
                new LayoutBuilder(builder: (_context, constraints) => {
         var widgets = new List <Widget>();
         ctx.buildActions(_context).ForEach(item => {
             var widget = new Expanded(child: item);
             widgets.Add(widget);
         });
         return new Stack(
             children: new List <Widget> {
             ctx.createPositioned(
                 position: 0,
                 extent:
                 ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent,
                 child: new Flex(
                     ctx.state.widget.direction,
                     children: widgets
                     )
                 )
         }
             );
     })
                ));
 }
Exemplo n.º 4
0
 protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx)
 {
     return(Positioned.fill(
                new LayoutBuilder(builder: (_context, constraints) => {
         var totalExtent =
             ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent;
         var animation = new FloatTween(-totalExtent, 0).animate(ctx.state.actionsMoveAnimation);
         return new AnimatedBuilder(
             animation: ctx.state.actionsMoveAnimation,
             builder: (cxt, child) => {
             var widgets = new List <Widget>();
             ctx.buildActions(cxt).ForEach(item => {
                 var widget = new Expanded(child: item);
                 widgets.Add(widget);
             });
             return new Stack(
                 children: new List <Widget> {
                 ctx.createPositioned(
                     position: animation.value,
                     extent: totalExtent,
                     child: new Flex(
                         ctx.state.widget.direction,
                         children: widgets
                         )
                     )
             }
                 );
         }
             );
     })
                ));
 }
Exemplo n.º 5
0
        public override Widget build(BuildContext context)
        {
            if (this.header == null && this.footer == null)
            {
                return(this.child);
            }

            List <Widget> children = new List <Widget> {
                Positioned.fill(
                    child: this.child)
            };

            if (this.header != null)
            {
                children.Add(new Positioned(
                                 top: 0.0,
                                 left: 0.0,
                                 right: 0.0,
                                 child: this.header));
            }

            if (this.footer != null)
            {
                children.Add(new Positioned(
                                 left: 0.0,
                                 bottom: 0.0,
                                 right: 0.0,
                                 child: this.footer));
            }

            return(new Stack(
                       children: children));
        }
Exemplo n.º 6
0
        public override Widget buildTransitions(BuildContext context, Animation <float> animation,
                                                Animation <float> secondaryAnimation, Widget child)
        {
            Widget result = new Align(
                alignment: Alignment.bottomCenter,
                child: new FractionalTranslation(
                    translation: this._offsetTween.evaluate(animation: this._animation),
                    child: child
                    )
                );

            if (this.overlayBuilder != null)
            {
                result = new Stack(
                    children: new List <Widget> {
                    Positioned.fill(
                        child: new Opacity(
                            opacity: this._opacityTween.evaluate(animation: this._animation),
                            child: this.overlayBuilder(context)
                            )
                        ),
                    result
                });
            }

            return(result);
        }
Exemplo n.º 7
0
 Widget _buildMoreBlogger(List <string> bloggerIds)
 {
     return(new GestureDetector(
                onTap: () => this.onPressMore?.Invoke(),
                child: new Container(
                    width: 160,
                    margin: EdgeInsets.only(right: 16),
                    decoration: new BoxDecoration(
                        color: CColors.White,
                        borderRadius: BorderRadius.all(6)
                        ),
                    child: new ClipRRect(
                        borderRadius: BorderRadius.all(6),
                        child: new Stack(
                            fit: StackFit.expand,
                            children: new List <Widget> {
         Image.asset(
             "image/blogger-more-pattern",
             fit: BoxFit.fill
             ),
         Positioned.fill(
             new Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: this._buildAvatars(bloggerIds)
                 )
             )
     }
                            )
                        )
                    )
                ));
 }
Exemplo n.º 8
0
 public override Widget build(BuildContext context)
 {
     return(Positioned.fill(
                child: new IgnorePointer(
                    child: new CustomSingleChildLayout(
                        layoutDelegate: new _TooltipPositionDelegate(
                            target: target,
                            verticalOffset: verticalOffset,
                            preferBelow: preferBelow),
                        child: new FadeTransition(
                            opacity: animation,
                            child: new ConstrainedBox(
                                constraints: new BoxConstraints(minHeight: height.Value),
                                child: new DefaultTextStyle(
                                    style: Theme.of(context).textTheme.bodyText2,
                                    child: new Container(
                                        decoration: decoration,
                                        padding: padding,
                                        margin: margin,
                                        child: new Center(
                                            widthFactor: 1.0f,
                                            heightFactor: 1.0f,
                                            child: new Text(message, style: textStyle)
                                            )
                                        ))
                                )
                            )
                        )
                    )
                ));
 }
Exemplo n.º 9
0
        Widget _buildGradientScreen()
        {
            if (this.widget.backgroundColor != null && this.widget.backgroundColor.alpha < 255)
            {
                return(new Container());
            }

            Color widgetBackgroundColor = this.widget.backgroundColor ?? new Color(0xFFFFFFFF);

            return(Positioned.fill(
                       child: new IgnorePointer(
                           child: new Container(
                               decoration: new BoxDecoration(
                                   gradient: new LinearGradient(
                                       colors: new List <Color> {
                widgetBackgroundColor,
                widgetBackgroundColor.withAlpha(0xF2),
                widgetBackgroundColor.withAlpha(0xDD),
                widgetBackgroundColor.withAlpha(0),
                widgetBackgroundColor.withAlpha(0),
                widgetBackgroundColor.withAlpha(0xDD),
                widgetBackgroundColor.withAlpha(0xF2),
                widgetBackgroundColor,
            },
                                       stops: new List <float> {
                0.0f, 0.05f, 0.09f, 0.22f, 0.78f, 0.91f, 0.95f, 1.0f
            },
                                       begin: Alignment.topCenter,
                                       end: Alignment.bottomCenter
                                       )
                                   )
                               )
                           )
                       ));
        }
Exemplo n.º 10
0
        public static Positioned <FIRRTLNode>?[] GetPlacementInNodeOrder(PlacementInfo placeInfo, FIRRTLNode[] nodeOrder)
        {
            Dictionary <FIRRTLNode, Positioned <FIRRTLNode> > unordered = new Dictionary <FIRRTLNode, Positioned <FIRRTLNode> >();

            foreach (var posNode in placeInfo.NodePositions)
            {
                unordered.Add(posNode.Value, posNode);
            }

            Positioned <FIRRTLNode>?[] ordered = new Positioned <FIRRTLNode>?[nodeOrder.Length];

            for (int i = 0; i < ordered.Length; i++)
            {
                //Not all nodes in a module is placed. Those that are not placed
                //are replaced with null, so the node order is preserved.
                //Conversion can then use null to know that it should not convert
                //that node.
                if (unordered.TryGetValue(nodeOrder[i], out var nodePos))
                {
                    ordered[i] = nodePos;
                }
                else
                {
                    ordered[i] = null;
                }
            }

            return(ordered);
        }
Exemplo n.º 11
0
        private Positioned PositionRouter(IRouter router)
        {
            var lines = new List <string>
            {
                "Router",
                router.Name ?? "<anonymous>"
            };

            var positioned = new Positioned
            {
                Width      = 120,
                Height     = TextHeight * 4,
                DrawAction = (d, p) =>
                {
                    if (p.Children.Count > 0)
                    {
                        var maxChildY = p.Children.Select(c => c.Y.Value).Max();
                        DrawLine(d, p.X + ChildHorizontalOffset * 2, p.Y + TextHeight, p.X + ChildHorizontalOffset * 2, maxChildY, "route");
                    }
                    DrawBox(d, p.X, p.Y, p.Width, lines, "router", 2f);
                }
            };

            if (router.Segments != null)
            {
                positioned.Children = router
                                      .Segments
                                      .Select(PositionSegment)
                                      .ToList();
            }

            return(positioned);
        }
Exemplo n.º 12
0
        private Positioned PositionSegment(IRoutingSegment segment)
        {
            var lines = new List <string>
            {
                "Route: " + (segment.Name ?? "<anonymous>")
            };

            var longestLine = lines.Select(l => l.Length).Max();

            var positioned = new Positioned
            {
                Width      = longestLine * 6.5f,
                Height     = TextHeight * (lines.Count + 2),
                DrawAction = (d, p) =>
                {
                    if (p.Siblings.Count > 0)
                    {
                        var maxSiblingX = p.Siblings.Select(s => s.X.Value).Max();
                        DrawLine(d, p.X + p.Width, p.Y + TextHeight, maxSiblingX, p.Y + TextHeight, "segment");
                    }
                    DrawBox(d, p.X, p.Y, p.Width, lines, "segment", 2f);
                }
            };

            if (segment.Middleware != null)
            {
                positioned.Siblings = segment
                                      .Middleware
                                      .Select(PositionMiddleware)
                                      .ToList();
            }

            return(positioned);
        }
Exemplo n.º 13
0
 public Orbit(Positioned center, Vector3 localPostion, float rotationSpeed)
 {
     _center = center;
     _localPostion = localPostion;
     _rotationAxis = OrtagonalFromRandom(localPostion);
     _rotationAxis.Normalize();
     _rotationSpeed = rotationSpeed;
 }
Exemplo n.º 14
0
 public static void SendNearExceptMe(Positioned me, IPacket responce)
 {
     foreach(Player player in ObjectManager.GetPlayersNear(me)) {
         if(player.Session != null && player != me) {
             player.Session.Send(responce);
         }
     }
 }
Exemplo n.º 15
0
 public ProcedureDeclaration(Positioned <string> importedName, Identifier name, TypeSpecifier?returnTypeAnnotation, List <TypeAnnotatedName> parameters, FileLocation location) : base(location)
 {
     EntryPoint           = null;
     ImportedName         = importedName;
     Name                 = name;
     ReturnTypeAnnotation = returnTypeAnnotation;
     Parameters           = parameters;
 }
Exemplo n.º 16
0
 public AccessExpression(IExpression accessee, AccessOperationType accessOperator, Positioned <string> accessor, ValueFlags flags, ITypeInfo returnType)
 {
     Accessee       = accessee;
     AccessOperator = accessOperator;
     Accessor       = accessor;
     Flags          = flags;
     ReturnType     = returnType;
 }
Exemplo n.º 17
0
 Widget _buildOfflineHeaderView()
 {
     return(this._buildHeadImage(
                Positioned.fill(
                    new Container()
                    )
                ));
 }
Exemplo n.º 18
0
 public override Widget buildTransitions(BuildContext context1, Animation <float> animation, Animation <float> secondaryAnimation, Widget child)
 {
     return(new OrientationBuilder(
                builder: (BuildContext context2, Orientation orientation) => {
         _lastOrientation = orientation;
         if (!animation.isCompleted)
         {
             bool reverse = animation.status == AnimationStatus.reverse;
             Rect rect = reverse
                     ? _rectAnimatableReverse.evaluate(animation)
                     : _rectAnimatable.evaluate(animation);
             Rect sheetRect = reverse
                     ? _sheetRectAnimatableReverse.evaluate(animation)
                     : _sheetRectAnimatable.evaluate(animation);
             float?sheetScale = reverse
                     ? _sheetScaleAnimatableReverse.evaluate(animation)
                     : _sheetScaleAnimatable.evaluate(animation);
             List <Widget> widgets = new List <Widget>();
             widgets.Add(
                 Positioned.fromRect(
                     rect: sheetRect,
                     child: new Opacity(
                         opacity: _sheetOpacity.value,
                         child: Transform.scale(
                             alignment: getSheetAlignment(_contextMenuLocation),
                             scale: sheetScale ?? 1.0f,
                             child: new _ContextMenuSheet(
                                 key: _sheetGlobalKey,
                                 actions: _actions,
                                 contextMenuLocation: _contextMenuLocation,
                                 orientation: orientation
                                 )
                             )
                         )
                     )
                 );
             widgets.Add(
                 Positioned.fromRect(
                     key: _childGlobalKey,
                     rect: rect,
                     child: _builder(context2, animation)
                     ));
             return new Stack(
                 children: widgets
                 );
         }
         return new _ContextMenuRouteStatic(
             actions: _actions,
             child: _builder(context1, animation),
             childGlobalKey: _childGlobalKey,
             contextMenuLocation: _contextMenuLocation,
             onDismiss: _onDismiss,
             orientation: orientation,
             sheetGlobalKey: _sheetGlobalKey
             );
     }
                ));
 }
Exemplo n.º 19
0
        public override Widget build(BuildContext context)
        {
            D.assert(WidgetsD.debugCheckHasDirectionality(context));
            D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));

            float additionalBottomPadding =
                Mathf.Max(MediaQuery.of(context).padding.bottom - BottomNavigationBarUtils._kBottomMargin, 0.0f);
            Color backgroundColor = null;

            switch (this.widget.type)
            {
            case BottomNavigationBarType.fix:
                break;

            case BottomNavigationBarType.shifting:
                backgroundColor = this._backgroundColor;
                break;
            }

            return(new Stack(
                       children: new List <Widget>
            {
                Positioned.fill(
                    child: new Material(     // Casts shadow.
                        elevation: 8.0f,
                        color: backgroundColor
                        )
                    ),
                new ConstrainedBox(
                    constraints: new BoxConstraints(
                        minHeight: Constants.kBottomNavigationBarHeight + additionalBottomPadding),
                    child: new Stack(
                        children: new List <Widget>
                {
                    Positioned.fill(
                        child: new CustomPaint(
                            painter: new _RadialPainter(
                                circles: this._circles.ToList()
                                )
                            )
                        ),
                    new Material(             // Splashes.
                        type: MaterialType.transparency,
                        child: new Padding(
                            padding: EdgeInsets.only(bottom: additionalBottomPadding),
                            child: MediaQuery.removePadding(
                                context: context,
                                removeBottom: true,
                                child: this._createContainer(this._createTiles())
                                )
                            )
                        )
                }
                        )
                    )
            }
                       ));
        }
Exemplo n.º 20
0
 /**
  * Constructor
  *
  * @param nextScene
  * @param newX
  * @param newY
  */
 public ChangePositionTool(Positioned data, int newX, int newY)
 {
     this.oldX = data.getPositionX();
     this.oldY = data.getPositionY();
     this.x    = newX;
     this.y    = newY;
     this.data = data;
     listeners = new List <ChangePositionToolListener>();
 }
Exemplo n.º 21
0
 private static void SendNear(Positioned me, IPacket responce)
 {
     foreach (Player player in ObjectManager.GetPlayersNear(me))
     {
         if (player.Session != null)
         {
             player.Session.Send(responce);
         }
     }
 }
Exemplo n.º 22
0
 public static void SendNearExceptMe(Positioned me, IPacket responce)
 {
     foreach (Player player in ObjectManager.GetPlayersNear(me))
     {
         if (player.Session != null && player != me)
         {
             player.Session.Send(responce);
         }
     }
 }
Exemplo n.º 23
0
 public static void Add(Positioned positioned)
 {
     if (!allObjects.ContainsKey(positioned.Guid))
     {
         allObjects.Add(positioned.Guid, positioned);
     }
     if (positioned is Player && allLoggedPlayers.ContainsKey(positioned.Guid) == false)
     {
         allLoggedPlayers.Add(positioned.Guid, (Player) positioned);
     }
 }
Exemplo n.º 24
0
 public static void Add(Positioned positioned)
 {
     if (!allObjects.ContainsKey(positioned.Guid))
     {
         allObjects.Add(positioned.Guid, positioned);
     }
     if (positioned is Player && allLoggedPlayers.ContainsKey(positioned.Guid) == false)
     {
         allLoggedPlayers.Add(positioned.Guid, (Player)positioned);
     }
 }
Exemplo n.º 25
0
        public override Widget build(BuildContext context)
        {
            List <Color> colors;

            if (this._selectedIndex == 2)
            {
                colors = new List <Color> {
                    new Color(0xFFFFB84F),
                    new Color(0xFFFF8024)
                };
            }
            else
            {
                colors = new List <Color> {
                    new Color(0xFF6EC6FF),
                    CColors.PrimaryBlue,
                    CColors.MessageReactionCount
                };
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Container(
                               decoration: new BoxDecoration(
                                   gradient: new LinearGradient(
                                       colors: colors,
                                       begin: Alignment.topLeft,
                                       end: Alignment.bottomRight
                                       )
                                   ),
                               child: new Stack(
                                   alignment: Alignment.topLeft,
                                   fit: StackFit.expand,
                                   children: new List <Widget> {
                Image.asset("image/leaderboard-pattern-curves", fit: BoxFit.fill),
                Positioned.fill(
                    new Column(
                        children: new List <Widget> {
                    this._buildNavigationBar(context: context),
                    new Flexible(child: this._buildContent())
                }
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Exemplo n.º 26
0
        private void Draw(SvgDocument document, Positioned root)
        {
            root.DrawAction(document, root);

            foreach (var child in root.Children)
            {
                Draw(document, child);
            }

            foreach (var sibling in root.Siblings)
            {
                Draw(document, sibling);
            }
        }
Exemplo n.º 27
0
 public override Widget build(BuildContext context)
 {
     D.assert(WidgetsD.debugCheckHasDirectionality(context));
     return(Positioned.directional(
                textDirection: Directionality.of(context: context),
                child: widget.child,
                start: _start?.evaluate(animation: animation),
                top: _top?.evaluate(animation: animation),
                end: _end?.evaluate(animation: animation),
                bottom: _bottom?.evaluate(animation: animation),
                width: _width?.evaluate(animation: animation),
                height: _height?.evaluate(animation: animation)
                ));
 }
Exemplo n.º 28
0
        Widget _buildLeaderBoardItem(BuildContext context, int index)
        {
            var collectionId = this.data[index : index];
            var rankData     = this.rankDict.ContainsKey(key: collectionId)
                ? this.rankDict[key : collectionId]
                               : new RankData();
            var favoriteTag = this.favoriteTagDict.ContainsKey(key: rankData.itemId)
                ? this.favoriteTagDict[key : rankData.itemId]
                              : new FavoriteTag();

            return(new GestureDetector(
                       onTap: () => this.onPressItem?.Invoke(text: rankData.id),
                       child: new Container(
                           width: 160,
                           height: 80,
                           margin: EdgeInsets.only(index == 0 ? 16 : 0, right: 16),
                           decoration: new BoxDecoration(
                               borderRadius: BorderRadius.all(4)
                               ),
                           child: new ClipRRect(
                               borderRadius: BorderRadius.all(4),
                               child: new Stack(
                                   children: new List <Widget> {
                Positioned.fill(
                    new Container(color: CColorUtils.GetCardColorFromId(id: collectionId))
                    ),
                Image.asset(
                    CImageUtils.GetSpecificPatternImageNameFromId(id: collectionId),
                    width: 160,
                    height: 80,
                    fit: BoxFit.fill
                    ),
                Positioned.fill(
                    new Padding(
                        padding: EdgeInsets.all(16),
                        child: new Text(
                            rankData.resetTitle.isNotEmpty() ? rankData.resetTitle : favoriteTag.name,
                            maxLines: 2,
                            overflow: TextOverflow.ellipsis,
                            style: CTextStyle.PLargeMediumWhite
                            )
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Exemplo n.º 29
0
        protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx)
        {
            return(Positioned.fill(
                       new LayoutBuilder(builder: (_context, constraints) => {
                var state = ctx.state;
                var count = state.actionCount;
                var showActions = ctx.showActions;
                var actionsMoveAnimation = state.actionsMoveAnimation;
                var actionExtent = ctx.getMaxExtent(constraints) * state.widget.actionExtentRatio;
                var actionDelegate = state.actionDelegate;

                var animations = new List <Animation <float> >();
                for (var index = 0; index < count; index++)
                {
                    var animation = new FloatTween(
                        -(float)actionExtent,
                        (count - index - 1) * (float)actionExtent
                        ).animate(actionsMoveAnimation);
                    animations.Add(animation);
                }

                return new AnimatedBuilder(
                    animation: actionsMoveAnimation,
                    builder: (cxt, child) => {
                    var widgets = new List <Widget>();
                    for (var index = 0; index < count; index++)
                    {
                        var displayIndex = showActions ? count - index - 1 : index;
                        var widget = ctx.createPositioned(
                            position: animations[index].value,
                            extent: (float)actionExtent,
                            child: actionDelegate.build(
                                context,
                                displayIndex,
                                actionsMoveAnimation,
                                CustomDismissibleMode.slide
                                )
                            );
                        widgets.Add(widget);
                    }

                    return new Stack(
                        children: widgets
                        );
                }
                    );
            })
                       ));
        }
Exemplo n.º 30
0
        void Arrange(Positioned root)
        {
            root.TreeHeight = root.Height;
            root.TreeWidth  = root.Width;

            var childX = root.X + ChildHorizontalOffset;
            var childY = root.Y + root.Height + ChildVericalSpacing;

            var siblingX = root.X + root.Width + SiblingHorizontalSpacing;
            var siblingY = root.Y;

            var x = childX;
            var y = childY;

            foreach (var child in root.Children)
            {
                child.X = x;
                child.Y = y;
                Arrange(child);
                y += child.TreeHeight + ChildVericalSpacing;
                if (child.X + child.TreeWidth > root.X + root.TreeWidth)
                {
                    root.TreeWidth = child.TreeWidth + child.X - root.X;
                }
            }
            if (y - root.Y - ChildVericalSpacing > root.TreeHeight)
            {
                root.TreeHeight = y - root.Y - ChildVericalSpacing;
            }

            x = siblingX;
            y = siblingY;
            foreach (var sibling in root.Siblings)
            {
                sibling.X = x;
                sibling.Y = y;
                Arrange(sibling);
                x += sibling.TreeWidth + SiblingHorizontalSpacing;
                if (sibling.Y + sibling.TreeHeight > root.Y + root.TreeHeight)
                {
                    root.TreeHeight = sibling.TreeHeight + sibling.Y - root.Y;
                }
            }
            if (x - root.X - SiblingHorizontalSpacing > root.TreeWidth)
            {
                root.TreeWidth = x - root.X - SiblingHorizontalSpacing;
            }
        }
Exemplo n.º 31
0
 Widget _buildQrScanWidget(bool isLoggedIn)
 {
     return(new Container(
                height: 44,
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: new List <Widget> {
         isLoggedIn
                     ? (Widget) new CustomButton(
             padding: EdgeInsets.symmetric(8, 16),
             onPressed: () => this.widget.actionModel.pushToNotifications(),
             child: new Container(
                 width: 28,
                 height: 28,
                 child: new Stack(
                     children: new List <Widget> {
             new Icon(
                 icon: Icons.outline_notifications,
                 color: CColors.LightBlueGrey,
                 size: 28
                 ),
             Positioned.fill(
                 new Align(
                     alignment: Alignment.topRight,
                     child: new NotificationDot(
                         this.widget.viewModel.hasUnreadNotifications ? "" : null,
                         new BorderSide(color: CColors.White, 2)
                         )
                     )
                 )
         }
                     )
                 )
             )
                     : new Container(),
         new CustomButton(
             padding: EdgeInsets.symmetric(8, 16),
             onPressed: QRScanPlugin.PushToQRScan,
             child: new Icon(
                 icon: Icons.outline_scan,
                 size: 28,
                 color: CColors.LightBlueGrey
                 )
             )
     }
                    )
                ));
 }
Exemplo n.º 32
0
        public Orbit(Positioned center, Vector3 rotationAxis, float rotationSpeed, float currentRotation, float radius)
        {
            _center = center;

            rotationAxis.Normalize();
            _rotationAxis = rotationAxis;
            _rotationSpeed = rotationSpeed;

            if(Vector3.Normalize(rotationAxis) - Vector3.Left == Vector3.Zero) _localPostion = Vector3.Cross(rotationAxis, Vector3.Up);
            else _localPostion = Vector3.Cross(rotationAxis, Vector3.Left);

            _localPostion.Normalize();
            _localPostion *= radius;

            _localPostion = Vector3.Transform(_localPostion, Matrix.CreateFromAxisAngle(rotationAxis, currentRotation));
        }
Exemplo n.º 33
0
        public static IReplayableOperation CreateLiftAreaOperation(IMapModel map, int x, int y, int width, int height)
        {
            // copy the target area to a new tile
            var tile = new MapTile(width, height);

            GridMethods.Copy(map.Tile.TileGrid, tile.TileGrid, x, y, 0, 0, width, height);
            GridMethods.Copy(map.Tile.HeightGrid, tile.HeightGrid, x * 2, y * 2, 0, 0, width * 2, height * 2);

            var positionedTile = new Positioned <IMapTile>(tile, new Point(x, y));

            var addOp         = new AddFloatingTileOperation(map, positionedTile);
            var clearBitmapOp = new FillAreaOperation <Bitmap>(map.Tile.TileGrid, x, y, width, height, Globals.DefaultTile);
            var clearHeightOp = new FillAreaOperation <int>(map.Tile.HeightGrid, x * 2, y * 2, width * 2, height * 2, 0);

            return(new CompositeOperation(addOp, clearBitmapOp, clearHeightOp));
        }
Exemplo n.º 34
0
 public static void createBasicObjectWithTitle(
     this MovieClipSnapshot snapshot,
     string id,
     string title,
     Widget child,
     float titleDistance       = 25,
     Alignment alignment       = null,
     TextStyle style           = null,
     AppearAnimation animation = AppearAnimation.none,
     int layer        = 0,
     Offset position  = null,
     Offset pivot     = null,
     Size scale       = null,
     float rotation   = 0,
     float opacity    = 1,
     float delay      = 0,
     float appearTime = MovieClipSnapshot.kDefaultAppearTime)
 {
     snapshot.createBasicObject(
         id: id,
         child: new Stack(children: new List <Widget> {
         new Padding(
             child: child,
             padding: EdgeInsets.all(titleDistance)
             ),
         Positioned.fill(
             new Align(
                 child: new Text(title, style: style ?? new TextStyle(fontWeight: FontWeight.bold)),
                 alignment: alignment ?? Alignment.topCenter
                 )
             )
     }),
         animation: animation,
         layer: layer,
         position: position,
         pivot: pivot,
         scale: scale,
         rotation: rotation,
         opacity: opacity,
         delay: delay,
         appearTime: appearTime
         );
 }
Exemplo n.º 35
0
 private Orbit NextStableOrbit(Positioned center, int i)
 {
     return new Orbit(center, Vector3.Up, rand.Next(1, 4) / 3000.0f / (i/100.0f) / 5.0f, (float)(rand.NextDouble() * Math.PI * 2), 40 + i * 5);
 }
Exemplo n.º 36
0
 public static IEnumerable<Player> GetPlayersNear(Positioned me)
 {
     return allLoggedPlayers.Values;
 }
Exemplo n.º 37
0
 public Orbit(Positioned center, Vector3 rotationAxis, float rotationSpeed, float currentRotation, float radius)
     : this(center, rotationAxis, rotationSpeed, currentRotation, radius, Vector3.One)
 {
 }
Exemplo n.º 38
0
 public static Vector2 Project3DPosition(Positioned followed)
 {
     Vector2 ratioFactor = new Vector2(1280.0f / YND.GraphicsDevice.Viewport.Width, 720.0f / YND.GraphicsDevice.Viewport.Height);
     Vector3 projection = YND.GraphicsDevice.Viewport.Project(followed.Position, Instance.ProjectionMatrix , Instance.ViewMatrix, Matrix.Identity);
     return new Vector2(projection.X, projection.Y) * ratioFactor;
 }
Exemplo n.º 39
0
 public HoldButton(string texture, SpriteFont font, String caption, Positioned followed, int size, Action onReady)
     : this(texture, font, caption, Vector2.Zero, size, onReady)
 {
     _followed = followed;
 }
Exemplo n.º 40
0
 private static void SendNear(Positioned me, IPacket responce)
 {
     foreach(Player player in ObjectManager.GetPlayersNear(me)) {
         if(player.Session != null) {
             player.Session.Send(responce);
         }
     }
 }