コード例 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value.GetType() != typeof(BindPoint))
            {
                throw new InvalidCastException("Input is not valid BindPoint.");
            }

            if (parameter == null)
            {
                parameter = 1;
            }
            else if (parameter.GetType() != typeof(int))
            {
                throw new InvalidCastException("Parameter is not a valid int.");
            }

            int size = (int)parameter;

            BindPoint point = (BindPoint)value;
            int       x     = (int)point.X / size;
            int       y     = (int)point.Y / size;

            IntPoint intPoint = new IntPoint(x, y);

            return(intPoint);
        }
コード例 #2
0
 public CardBase()
 {
     Pos2GridConv  = new CardPosition2CardGridConverter();
     RotationState = CardRotation.Deg0;
     GridPosition  = new IntPoint(-1, -1);
     Position      = new BindPoint();
 }
コード例 #3
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value.GetType() != typeof(IntPoint))
            {
                throw new InvalidCastException("Input is not a valid IntPoint.");
            }

            if (parameter == null)
            {
                parameter = 1;
            }
            else if (parameter.GetType() != typeof(int))
            {
                throw new InvalidCastException("Parameter is not a valid int.");
            }

            int      size     = (int)parameter;
            IntPoint intPoint = (IntPoint)value;

            double x = intPoint.X * size;
            double y = intPoint.Y * size;

            BindPoint point = new BindPoint(x, y);

            return(point);
        }
コード例 #4
0
 public void Add(BindPoint point)
 {
     if (NotAlreadyInGraph(point))
     {
         nodes.Add(new BindingNode(point));
     }
 }
コード例 #5
0
 public void Add(BindPoint point)
 {
     if (NotAlreadyInGraph(point))
     {
         nodes.Add(new BindingNode(point));
     }
 }
コード例 #6
0
        public void OnCommand(GameClient client, string[] args)
        {
            ushort bindRadius = 750;

            if (args.Length >= 2)
            {
                try
                {
                    bindRadius = ushort.Parse(args[1]);
                }
                catch (Exception e)
                {
                    DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Error", e.Message));
                    return;
                }
            }

            BindPoint bp = new BindPoint();

            bp.X      = client.Player.X;
            bp.Y      = client.Player.Y;
            bp.Z      = client.Player.Z;
            bp.Region = client.Player.CurrentRegionID;
            bp.Radius = bindRadius;
            GameServer.Database.AddObject(bp);
            client.Player.CurrentRegion.AddArea(new Area.BindArea("bind point", bp));
            DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.AddBind.BindPointAdded", bp.X, bp.Y, bp.Z, bp.Radius, bp.Region));
        }
コード例 #7
0
        private BindingNode FindNodeForPoint(BindPoint point)
        {
            /*
             * Find the BindingNode associated with a particular BindPoint
             */

            return(nodes.First(x => x.Vertex.Equals(point)));
        }
コード例 #8
0
ファイル: NormalServerRules.cs プロジェクト: JVirant/DOLSharp
 /// <summary>
 /// Is player allowed to bind
 /// </summary>
 /// <param name="player"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 public override bool IsAllowedToBind(GamePlayer player, BindPoint point)
 {
     if (point.Realm == 0)
     {
         return(true);
     }
     return(player.Realm == (eRealm)point.Realm);
 }
コード例 #9
0
        public void TwoWayBind(BindPoint first, BindPoint second)
        {
            /*
             * Link the two nodes in both directions
             */

            Bind(first, second);
            Bind(second, first);
        }
コード例 #10
0
        public void TwoWayBind(BindPoint first, BindPoint second)
        {
            /*
             * Link the two nodes in both directions
             */

            Bind(first, second);
            Bind(second, first);
        }
コード例 #11
0
        public void Bind(BindPoint first, BindPoint second)
        {
            /*
             * Link the two nodes in one direction
             */

            BindingNode firstNode  = FindNodeForPoint(first);
            BindingNode secondNode = FindNodeForPoint(second);

            firstNode.AddEdgeTo(secondNode);
        }
コード例 #12
0
        public void Bind(BindPoint first, BindPoint second)
        {
            /*
             * Link the two nodes in one direction
             */

            BindingNode firstNode = FindNodeForPoint(first);
            BindingNode secondNode = FindNodeForPoint(second);

            firstNode.AddEdgeTo(secondNode);
        }
コード例 #13
0
            public override void LoadFromDatabase(DBArea area)
            {
                base.LoadFromDatabase(area);

                m_dbBindPoint        = new BindPoint();
                m_dbBindPoint.Radius = (ushort)area.Radius;
                m_dbBindPoint.X      = area.X;
                m_dbBindPoint.Y      = area.Y;
                m_dbBindPoint.Z      = area.Z;
                m_dbBindPoint.Region = area.Region;
            }
コード例 #14
0
ファイル: Npc.cs プロジェクト: tbs005/Temu
        public Npc Clone()
        {
            Npc clone = new Npc
            {
                NpcId         = NpcId,
                SpawnTemplate = SpawnTemplate,
                NpcTemplate   = NpcTemplate,
                Position      = Position.Clone(),
                BindPoint     = BindPoint.Clone(),
            };

            return(clone);
        }
コード例 #15
0
            public override void LoadFromDatabase(DBArea area)
            {
                base.LoadFromDatabase(area);

                BindPoint = new BindPoint
                {
                    Radius = (ushort)area.Radius,
                    X      = area.X,
                    Y      = area.Y,
                    Z      = area.Z,
                    Region = area.Region
                };
            }
コード例 #16
0
        public static void Run()
        {
            // ExStart:AddAnimationPropertyToDocument
            // Initialize scene object
            Scene scene = new Scene();

            // Call Common class create mesh using polygon builder method to set mesh instance
            Mesh mesh = Common.CreateMeshUsingPolygonBuilder();

            // Each cube node has their own translation
            Node cube1 = scene.RootNode.CreateChildNode("cube1", mesh);

            // Find translation property on node's transform object
            Property translation = cube1.Transform.FindProperty("Translation");

            // Create a bind point based on translation property
            BindPoint bindPoint = new BindPoint(scene, translation);

            // Create the animation curve on X component of the scale
            bindPoint.BindKeyframeSequence("X", new KeyframeSequence()
            {
                // Move node's translation to (10, 0, 10) at 0 sec using bezier interpolation
                { 0, 10.0f, Interpolation.Bezier },
                // Move node's translation to (20, 0, -10) at 3 sec
                { 3, 20.0f, Interpolation.Bezier },
                // Move node's translation to (30, 0, 0) at 5 sec
                { 5, 30.0f, Interpolation.Linear },
            });

            // Create the animation curve on Z component of the scale
            bindPoint.BindKeyframeSequence("Z", new KeyframeSequence()
            {
                // Move node's translation to (10, 0, 10) at 0 sec using bezier interpolation
                { 0, 10.0f, Interpolation.Bezier },
                // Move node's translation to (20, 0, -10) at 3 sec
                { 3, -10.0f, Interpolation.Bezier },
                // Move node's translation to (30, 0, 0) at 5 sec
                { 5, 0.0f, Interpolation.Linear },
            });

            // The path to the documents directory.
            string output = RunExamples.GetOutputFilePath("PropertyToDocument.fbx");

            // Save 3D scene in the supported file formats
            scene.Save(output, FileFormat.FBX7500ASCII);
            // ExEnd:AddAnimationPropertyToDocument

            Console.WriteLine("\nAnimation property added successfully to document.\nFile saved at " + output);
        }
コード例 #17
0
        public void MultiBind(BindPoint[] sources, BindPoint[] destinations)
        {
            /*
             * Link all sources to all destinations (possibly an over-estimate but ensures safety
             * in checking for conflicts)
             */

            foreach (BindPoint source in sources)
            {
                foreach (BindPoint dest in destinations)
                {
                    Bind(source, dest);
                }
            }
        }
コード例 #18
0
        public void RemoveBindings(BindPoint[] sources, BindPoint[] destinations)
        {
            /*
             * Remove all bindings between the sources and the destinations
             */

            foreach (BindPoint source in sources)
            {
                BindingNode node = FindNodeForPoint(source);
                node.AdjacentNodes.RemoveAll((BindingNode n) => destinations.Contains(n.Vertex));
            }
        }
コード例 #19
0
 public BindingNode(BindPoint point)
 {
     Vertex = point;
     AdjacentNodes = new List<BindingNode>();
 }
コード例 #20
0
 public bool NotAlreadyInGraph(BindPoint point)
 {
     return nodes.Where(x => x.Vertex.Equals(point)).FirstOrDefault() == null;
 }
コード例 #21
0
 public bool NotAlreadyInGraph(BindPoint point)
 {
     return(nodes.Where(x => x.Vertex.Equals(point)).FirstOrDefault() == null);
 }
コード例 #22
0
        public void TwoWayMultiBind(BindPoint[] firsts, BindPoint[] seconds)
        {
            /*
             * Link all sources to all destinations in both directions
             */

            MultiBind(firsts, seconds);
            MultiBind(seconds, firsts);
        }
コード例 #23
0
 public BindingNode(BindPoint point)
 {
     Vertex        = point;
     AdjacentNodes = new List <BindingNode>();
 }
コード例 #24
0
 public BindArea(string desc, BindPoint dbBindPoint)
     : base(desc, dbBindPoint.X, dbBindPoint.Y, dbBindPoint.Z, dbBindPoint.Radius)
 {
     BindPoint      = dbBindPoint;
     DisplayMessage = false;
 }
コード例 #25
0
        private BindingNode FindNodeForPoint(BindPoint point)
        {
            /*
             * Find the BindingNode associated with a particular BindPoint
             */

            return nodes.First(x => x.Vertex.Equals(point));
        }