Пример #1
0
        private string GetNavigationHint(LinkDirection direction)
        {
            bool   canNavigate = (FocusedNode != null && FocusedNode.HasLinkedNode(direction));
            string text        = string.Empty;

            if (canNavigate)
            {
                var control = FocusedNode.GetLinkedNode(direction).Control;

                if (control is TreeControl)
                {
                    text = (control as TreeControl).modelName;
                }
                if (control is ProjectControl)
                {
                    text = "Project";
                }
                if (control is ReportControl)
                {
                    text = "Report";
                }
            }

            return(text);
        }
Пример #2
0
        private static Matrix3D GetLinearTransformation(LinkDirection direction, double value, double pos = 0.0)
        {
            var matrix = Matrix3D.Identity;
            var v      = value - pos;

            switch (direction)
            {
            case LinkDirection.X:
                matrix.OffsetX = v;
                break;

            case LinkDirection.Y:
                matrix.OffsetY = v;
                break;

            case LinkDirection.Z:
                matrix.OffsetZ = v;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(matrix);
        }
Пример #3
0
        private bool IsValidMove(Node selected, Node target, LinkDirection linkDirection)
        {
            //get link
            Link link = Board.Links.Where(x => x.From == selected && x.Direction == linkDirection).FirstOrDefault();

            //no node in this direction
            if (link == null)
            {
                return(false);
            }

            //target node is next and in the right direction
            if (link.To == target)
            {
                return(true);
            }

            //other piece in the way
            if (!link.To.IsVacant)
            {
                return(false);
            }

            //otherwise try the next node
            return(IsValidMove(link.To, target, linkDirection));
        }
Пример #4
0
        public override async System.Threading.Tasks.Task <bool> SetInitializer(CRenderContext rc, EngineNS.GamePlay.Actor.GActor host, GComponentInitializer v)
        {
            if (!await base.SetInitializer(rc, host, v))
            {
                return(false);
            }

            if (mLineMeshComponent == null)
            {
                await InitGraphLines();
            }

            if (mLineMeshComponent != null)
            {
                mLineMeshComponent.Host = host;

                Host.PlacementChange -= PlacementChange;
                Host.PlacementChange += PlacementChange;
                var mat = host.Placement.WorldMatrix;
                mLineMeshComponent.OnUpdateDrawMatrix(ref mat);
            }

            Initializer = v as NavLinkProxyComponentInitializer;

            Radius    = Initializer.Radius;
            Direction = Initializer.Direction;

            return(true);
        }
Пример #5
0
        public void LinkControl(LinkDirection direction, UserControl linkedUserControl)
        {
            if (!dict.ContainsKey(linkedUserControl))
            {
                AddLinkedControl(linkedUserControl);
            }

            FocusedNode.Link(direction, dict[linkedUserControl]);

            switch (direction)
            {
            case LinkDirection.ldRight:
                OnPropertyChanged("CanNavigateRight");
                OnPropertyChanged("RightDirectionModelName");
                break;

            case LinkDirection.ldLeft:
                OnPropertyChanged("CanNavigateLeft");
                OnPropertyChanged("LeftDirectionModelName");
                break;

            case LinkDirection.ldTop:
                OnPropertyChanged("CanNavigateTop");
                OnPropertyChanged("TopDirectionModelName");
                break;

            case LinkDirection.ldBottom:
                OnPropertyChanged("CanNavigateBottom");
                OnPropertyChanged("BottomDirectionModelName");
                break;

            default:
                break;
            }
        }
Пример #6
0
        private static Matrix3D GetRataryTransformation(LinkDirection direction, double value, double pos = 0.0)
        {
            double x = 0.0, y = 0.0, z = 0.0;
            var    matrix = Matrix3D.Identity;
            var    v      = value - pos;

            switch (direction)
            {
            case LinkDirection.X:
                x = 1.0;
                break;

            case LinkDirection.Y:
                y = 1.0;
                break;

            case LinkDirection.Z:
                z = 1.0;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }


            matrix.Rotate(new Quaternion(new Vector3D(x, y, z), v));

            return(matrix);
        }
Пример #7
0
        //private NavLinkProxyComponentInitializer Initializer;
        public override async System.Threading.Tasks.Task <bool> SetInitializer(CRenderContext rc, GamePlay.IEntity host, GamePlay.Component.IComponentContainer hostContainer, GComponentInitializer v)
        {
            if (!await base.SetInitializer(rc, host, hostContainer, v))
            {
                return(false);
            }

            if (mLineMeshComponent == null)
            {
                await InitGraphLines();
            }

            if (mLineMeshComponent != null)
            {
                mLineMeshComponent.Entity = host;

                Host.PlacementChange -= PlacementChange;
                Host.PlacementChange += PlacementChange;
                var mat = this.Host.Placement.WorldMatrix;
                mLineMeshComponent.OnUpdateDrawMatrix(ref mat);
            }

            var initializer = v as NavLinkProxyComponentInitializer;

            Radius    = initializer.Radius;
            Direction = initializer.Direction;

            Initializer = initializer;

            return(true);
        }
Пример #8
0
 public void Load(BinaryReader reader)
 {
     this.Id                = reader.ReadInt32();
     this.LinkType          = (RoomLinkType)Enum.Parse(typeof(RoomLinkType), reader.ReadString());
     this.LinkDirection     = (LinkDirection)Enum.Parse(typeof(LinkDirection), reader.ReadString());
     this.DestinationRoomId = reader.ReadInt32();
     this.DestinationLinkId = reader.ReadInt32();
 }
Пример #9
0
 public LinkData(CheckBox enabled, int linkID, int BSID, int MSID, LinkDirection linkDirection, Button button)
 {
     this._enabled       = enabled;
     LinkID              = linkID;
     this._BSID          = BSID;
     this._MSID          = MSID;
     this._button        = button;
     this._linkDirection = linkDirection;
 }
Пример #10
0
 private static IEnumerable <Link> GetLinksEnumerable(IList <Link> chain, LinkDirection direction)
 {
     for (int i = 0; i < chain.Count; i++)
     {
         if (chain[i].Direction == direction)
         {
             yield return(chain[i]);
         }
     }
 }
Пример #11
0
 public static LinkDirection Invert(LinkDirection direction)
 {
     switch (direction)
     {
         case LinkDirection.ldRight: return LinkDirection.ldLeft;
         case LinkDirection.ldLeft: return LinkDirection.ldRight;
         case LinkDirection.ldTop: return LinkDirection.ldBottom;
         case LinkDirection.ldBottom:
         default: return LinkDirection.ldTop;
     }
 }
Пример #12
0
    void ShowJumpableCell(CellUnit cell, LinkDirection direction)
    {
        var jumpableCell = GetJumpableCell(cell, direction);

        if (jumpableCell != null)
        {
            jumpableCell.Args = direction;              // 將來源cell & 方向存進 cell 中
            ShowHintAt(jumpableCell, HintType.Confirm); // 傳入來源格
            ShowJumpableCell(jumpableCell, direction);  // 遞迴下去
        }
    }
Пример #13
0
        public void LinkNode(Func <Node, bool> f, Node n, LinkDirection ld)
        {
            var t = Nodes.Where(f).FirstOrDefault();

            if (t != null)
            {
                Links.Add(new Link()
                {
                    From = n, To = t, Direction = ld
                });
            }
        }
Пример #14
0
        public void Link(LinkDirection direction, VisualNavigatorNode node)
        {
            arr[(int)direction] = node;

            // link back
            if (node != null)
            {
                var invertDirection = LinkDirectionHelper.Invert(direction);
                var invertDirectionNode = node.GetLinkedNode(invertDirection);
                if (invertDirectionNode != this) node.Link(invertDirection, this);
            }
        }
Пример #15
0
    void KillBetween(CellUnit startCell, CellUnit endCell, LinkDirection direction)
    {
        var nextCell = startCell.Neighbors[direction];

        KillChess(nextCell.Index);
        var nextNextCell = nextCell.Neighbors[direction];

        if (nextNextCell != endCell)
        {
            KillBetween(nextNextCell, endCell, direction);
        }
    }
Пример #16
0
        public void Navigate(LinkDirection direction)
        {
            var targetNode = FocusedNode.GetLinkedNode(direction);

            // relink TreeControl (call link back)
            if (FocusedNode.Control is TreeControl && !(targetNode.Control is TreeControl))
            {
                FocusedNode.Link(LinkDirection.ldLeft, FocusedNode.GetLinkedNode(LinkDirection.ldLeft));
                FocusedNode.Link(LinkDirection.ldRight, FocusedNode.GetLinkedNode(LinkDirection.ldRight));
            }

            FocusedNode = targetNode;
        }
Пример #17
0
        public static LinkDirection Invert(LinkDirection direction)
        {
            switch (direction)
            {
            case LinkDirection.ldRight: return(LinkDirection.ldLeft);

            case LinkDirection.ldLeft: return(LinkDirection.ldRight);

            case LinkDirection.ldTop: return(LinkDirection.ldBottom);

            case LinkDirection.ldBottom:
            default: return(LinkDirection.ldTop);
            }
        }
Пример #18
0
        public void Link(LinkDirection direction, VisualNavigatorNode node)
        {
            arr[(int)direction] = node;

            // link back
            if (node != null)
            {
                var invertDirection     = LinkDirectionHelper.Invert(direction);
                var invertDirectionNode = node.GetLinkedNode(invertDirection);
                if (invertDirectionNode != this)
                {
                    node.Link(invertDirection, this);
                }
            }
        }
Пример #19
0
        public virtual double GetWeightedError(int index, LinkDirection direction)
        {
            var val = 0.0;

            switch (direction)
            {
            case LinkDirection.Input:
                val = Values[WeightIndex] * InNode.GetNodeError(index);
                break;

            case LinkDirection.Output:
                val = Values[WeightIndex] * OutNode.GetNodeError(index);
                break;
            }
            return(val);
        }
Пример #20
0
        private static Vector3D GetDirectionVector(LinkDirection d)
        {
            var direction = new Vector3D();

            switch (d)
            {
            case LinkDirection.X: direction.X = 1.0; break;

            case LinkDirection.Y: direction.Y = 1.0; break;

            case LinkDirection.Z: direction.Z = 1.0; break;

            default: break;
            }

            return(direction);
        }
        private static Vector3D GetRotationDirection(LinkDirection direction)
        {
            Vector3D vector;

            switch (direction)
            {
            case LinkDirection.X: vector = new Vector3D(1.0, 0.0, 0.0); break;

            case LinkDirection.Y: vector = new Vector3D(0.0, 1.0, 0.0); break;

            case LinkDirection.Z: vector = new Vector3D(0.0, 0.0, 1.0); break;

            default: throw new ArgumentException("Invalid rotation direction!");
            }

            return(vector);
        }
Пример #22
0
    CellUnit GetJumpableCell(CellUnit cell, LinkDirection direction)
    {
        // 第一步要有格子且有棋子
        var cellStep1 = cell.Neighbors[direction];

        if (cellStep1 != null && mChessPool.Get(cellStep1.Index) != null)
        {
            // 第二步要有格子但不能有棋子
            var cellStep2 = cellStep1.Neighbors[direction];
            if (cellStep2 != null && mChessPool.Get(cellStep2.Index) == null)
            {
                return(cellStep2);
            }
        }

        // 除此之外都NG
        return(null);
    }
Пример #23
0
        public string ToVerboseString()
        {
            LinkDirection direction = Parent.Parent.Parent.Mhdr.LinkDirection;
            StringBuilder sb        = new StringBuilder();

            sb.AppendFormat("       FCtrl :").AppendLine();
            sb.AppendFormat("        .ADR = {0}", ADR).AppendLine();
            sb.AppendFormat("        .ACK = {0}", ACK).AppendLine();
            if (direction == LinkDirection.Down)
            {
                sb.AppendFormat("        .RFU = {0}", RFU).AppendLine();
                sb.AppendFormat("   .FPending = {0}", FPending).AppendLine();
            }
            if (direction == LinkDirection.Up)
            {
                sb.AppendFormat("  .ADRACKReq = {0}", ADRACKReq).AppendLine();
                sb.AppendFormat("     .ClassB = {0}", ClassB).AppendLine();
            }
            return(sb.ToString());
        }
Пример #24
0
        public bool IsValidMove(Node selected, Node target)
        {
            bool isAbove = target.Row > selected.Row;

            LinkDirection targetDirection = LinkDirection.None;

            if (target.Col > selected.Col)
            {
                targetDirection = isAbove ? LinkDirection.UpRight : LinkDirection.DownRight;
            }
            else if (target.Col < selected.Col)
            {
                targetDirection = isAbove ? LinkDirection.UpLeft : LinkDirection.DownLeft;
            }
            else
            {
                targetDirection = isAbove ? LinkDirection.Up : LinkDirection.Down;
            }

            return(IsValidMove(selected, target, targetDirection));
        }
        private static Func <double> GetGetTraslationFuncion(LinkDirection direction, TranslateTransform3D tt)
        {
            Func <double> function = null;

            switch (direction)
            {
            case LinkDirection.X:
                function = () => tt.OffsetX;
                break;

            case LinkDirection.Y:
                function = () => tt.OffsetY;
                break;

            case LinkDirection.Z:
                function = () => tt.OffsetZ;
                break;

            default:
                throw new ArgumentException("Invalid traslation direction!");
            }

            return(function);
        }
        private static Action <double> GetSetTraslationAction(LinkDirection direction, TranslateTransform3D tt)
        {
            Action <double> action = null;

            switch (direction)
            {
            case LinkDirection.X:
                action = (d) => tt.OffsetX = d;
                break;

            case LinkDirection.Y:
                action = (d) => tt.OffsetY = d;
                break;

            case LinkDirection.Z:
                action = (d) => tt.OffsetZ = d;
                break;

            default:
                throw new ArgumentException("Invalid traslation direction!");
            }

            return(action);
        }
Пример #27
0
 public VisualNavigatorNode GetLinkedNode(LinkDirection direction)
 {
     return arr[(int) direction];
 }
Пример #28
0
 public virtual Artist GetArtist(LinkDirection direction)
 {
     return(direction == LinkDirection.ManyToOne ? Parent : Member);
 }
        private static Action <double> GetLinearPositionLinkAction(Transform3DGroup transformGroup, LinkDirection direction, double offset)
        {
            Action <double> action = null;
            var             tt     = new TranslateTransform3D();

            transformGroup.Children.Add(tt);

            switch (direction)
            {
            case LinkDirection.X:
                action = (d) => tt.OffsetX = d - offset;
                break;

            case LinkDirection.Y:
                action = (d) => tt.OffsetY = d - offset;
                break;

            case LinkDirection.Z:
                action = (d) => tt.OffsetZ = d - offset;
                break;

            default:
                throw new ArgumentException("Invalid traslation direction!");
            }


            return(action);
        }
Пример #30
0
        public void LinkControl(LinkDirection direction, UserControl linkedUserControl)
        {
            if (!dict.ContainsKey(linkedUserControl)) AddLinkedControl(linkedUserControl);

            FocusedNode.Link(direction, dict[linkedUserControl]);

            switch (direction)
            {
                case LinkDirection.ldRight:
                    OnPropertyChanged("CanNavigateRight");
                    OnPropertyChanged("RightDirectionModelName");
                    break;
                case LinkDirection.ldLeft:
                    OnPropertyChanged("CanNavigateLeft");
                    OnPropertyChanged("LeftDirectionModelName");
                    break;
                case LinkDirection.ldTop:
                    OnPropertyChanged("CanNavigateTop");
                    OnPropertyChanged("TopDirectionModelName");
                    break;
                case LinkDirection.ldBottom:
                    OnPropertyChanged("CanNavigateBottom");
                    OnPropertyChanged("BottomDirectionModelName");
                    break;
                default:
                    break;
            }
        }
Пример #31
0
        public void Navigate(LinkDirection direction)
        {
            var targetNode = FocusedNode.GetLinkedNode(direction);

            // relink TreeControl (call link back)
            if (FocusedNode.Control is TreeControl && !(targetNode.Control is TreeControl) )
            {
                FocusedNode.Link(LinkDirection.ldLeft, FocusedNode.GetLinkedNode(LinkDirection.ldLeft));
                FocusedNode.Link(LinkDirection.ldRight, FocusedNode.GetLinkedNode(LinkDirection.ldRight));
            }

            FocusedNode = targetNode;
        }
Пример #32
0
 public LinkId(int linkID, LinkDirection linkDirection)
 {
     Id        = linkID;
     Direction = linkDirection;
 }
Пример #33
0
 private static IMachineElementViewModel GetFirstAncestorWithLinearPositionLink(IMachineElementViewModel vm, LinkDirection direction)
 {
     if (vm != null)
     {
         if ((vm.LinkToParent != null) &&
             (vm.LinkToParent is LinearPositionViewModel lpvm) &&
             (lpvm.Direction == direction))
         {
             return(vm);
         }
         else
         {
             return(GetFirstAncestorWithLinearPositionLink(vm.Parent, direction));
         }
     }
     else
     {
         return(null);
     }
 }
Пример #34
0
        private string GetNavigationHint(LinkDirection direction)
        {
            bool canNavigate = (FocusedNode != null && FocusedNode.HasLinkedNode(direction));
            string text = string.Empty;

            if (canNavigate)
            {
                var control = FocusedNode.GetLinkedNode(direction).Control;

                if (control is TreeControl) text = (control as TreeControl).modelName;
                if (control is ProjectControl) text = "Project";
                if (control is ReportControl) text = "Report";
            }

            return text;
        }
Пример #35
0
        public virtual IEnumerable <Artist> ArtistLinksOfType(ArtistLinkType linkType, LinkDirection direction, bool allowInheritance = false)
        {
            if (!ArtistHelper.CanHaveRelatedArtists(ArtistType, linkType, direction))
            {
                return(Enumerable.Empty <Artist>());
            }

            var result = (direction == LinkDirection.ManyToOne ? Groups : Members)
                         .Where(g => g.LinkType == linkType)
                         .Select(g => g.GetArtist(direction));

            // ReSharper disable PossibleMultipleEnumeration
            return(allowInheritance && BaseVoicebank != null && !result.Any()
                                ? BaseVoicebank.ArtistLinksOfType(linkType, direction, true)
                                : result);
            // ReSharper restore PossibleMultipleEnumeration
        }
Пример #36
0
 public bool HasLinkedNode(LinkDirection direction)
 {
     return arr[(int)direction] != null;
 }
Пример #37
0
 public IActionResult AssignPrefixWithNewCustomer(string selectedPrefix, string abb, string name, string prefix, int page, LinkType link, LinkDirection direction)
 {
     if (ModelState.IsValid)
     {
         var prefixes = selectedPrefix.Split(',');
         repository.AssignPrefix(prefixes, abb, name, User.Identity.Name, link, direction);
         return(RedirectToAction(nameof(Pool), new { prefix, page }));
     }
     return(BadRequest());
 }