Пример #1
0
 public void OnDestinationReached(destination dest)
 {
     if (dest.pos.Equals(m_Destination))
     {
         m_Destination = Vec3.ZERO;
     }
 }
Пример #2
0
        private static dicDataDeployments CreateDicDataDeployments()
        {
            dicDataDeployments ddds = new dicDataDeployments();

            ddds.version = Data.version;
            ddds.ListdicDataDeployment = new List <dicDataDeployment>();

            dicDataDeployment ddd = new dicDataDeployment();

            ddd.descriptionFile          = Constants.descriptionFile;
            ddd.archiveFile              = Data.PathToZip;
            ddd.activationTimeStamp      = DateTime.UtcNow.ToLocalTime().ToString();
            ddd.localDownloadTimeStamp   = DateTime.UtcNow.ToLocalTime().ToString();
            ddd.centralDownloadTimeStamp = DateTime.UtcNow.ToLocalTime().ToString();
            ddd.destinations             = new List <destination>();

            destination dest = new destination();

            dest.source       = "destinations";
            dest.name         = Data.PathToZip;
            dest.stores       = new List <store>();
            dest.systemGroups = new List <string>();

            store objStore = new store();

            objStore.name = Data.storeDetails;

            dest.stores.Add(objStore);
            ddd.destinations.Add(dest);
            ddds.ListdicDataDeployment.Add(ddd);

            return(ddds);
        }
Пример #3
0
        public void OnDestinationReached(destination dest)
        {
            if (dest.type != DestType.Explore)
            {
                return;
            }

            ExploreCell dest_cell = dest.user_data as ExploreCell;

            if (dest_cell != null)
            {
                OnCellExplored(dest_cell);
            }

            SelectNewDestinationCell();
        }
Пример #4
0
        private void ParseResponse(string r)
        {
            string[] lines = r.Split('{');

            int o = 0, d = 0;

            origin or  = new origin();
            string val = "";

            for (int i = 0; i < lines.Length; i++)
            {
                int pos = lines[i].IndexOf("value");

                if (pos >= 0 && lines[i - 1].IndexOf("distance") >= 0)
                {
                    string sub = lines[i].Substring(pos + 9);
                    val = sub.Substring(0, sub.IndexOf("\n"));

                    destination e = new destination();
                    e.dest = my_destinations[d + 1];
                    e.dist = Convert.ToInt32(val);
                    or.destinations.Add(e);

                    d++;

                    if (d > my_destinations.Count - 2)
                    {
                        or.orig = my_destinations[o];

                        o++;
                        d = o;

                        origins.Add(or);
                        or = new origin();
                    }
                }
            }

            for (int i = 0; i < origins.Count; i++)
            {
                while (origins[i].destinations.Count < my_destinations.Count)
                {
                    origins[i].destinations.Insert(0, new destination());
                }
            }
        }
Пример #5
0
        public void OnDestinationReached(destination dest)
        {
            if (dest.type != DestType.Explore)
            {
                return;
            }

            ExploreCell dest_cell = dest.user_data as ExploreCell;

            //Trace.WriteLine($"marking explore cell id {dest_cell?.GlobalId ?? -1} as explored");

            if (dest_cell != null)
            {
                Trace.WriteLine($"Explore cell GID {m_DestCell.GlobalId} considered explored because it was reached.");
                OnCellExplored(dest_cell);
            }

            SelectNewDestinationCell(dest_cell);
        }
Пример #6
0
        /// <summary>
        /// 静态属性重写测试
        /// </summary>
        static void StaticProperty()
        {
            Console.WriteLine("StaticProperty Start");
            destination destination = new destination {
                Value = 1
            };

            using (methodWriter <Func <int> > methodWriter = new methodWriter <Func <int> >((Func <int>)Delegate.CreateDelegate(typeof(Func <int>), typeof(destination).GetProperty("StaticProperty", BindingFlags.Static | BindingFlags.Public).GetGetMethod(false))))
            {
                Console.WriteLine("原始调用输出1 -> " + destination.StaticProperty.toString());
                Console.WriteLine("静态方法原始调用输出1 -> " + methodWriter.Method().toString());

                methodWriter.Set(new source().Get2);
                Console.WriteLine("重写到实例方法source.Get2后调用输出2 -> " + destination.StaticProperty.toString());

                methodWriter.Set(source.Get3);
                Console.WriteLine("重写到静态方法source.Get3后调用输出3 -> " + destination.StaticProperty.toString());
            }
            Console.WriteLine("释放重写后原始调用输出1 -> " + destination.StaticProperty.toString());
            Console.WriteLine("StaticProperty End");
        }
Пример #7
0
        /// <summary>
        /// 实例方法重写测试
        /// </summary>
        static void Instance()
        {
            Console.WriteLine("Instance Start");
            destination destination = new destination {
                Value = 1
            };

            using (methodWriter <Func <int> > methodWriter = new methodWriter <Func <int> >(destination.Get))
            {
                Console.WriteLine("原始调用输出1 -> " + destination.Get().toString());
                Console.WriteLine("没有绑定实例的实例方法调用输出“随机数” -> " + methodWriter.Method().toString());

                methodWriter.Set(new source().Get2);
                Console.WriteLine("重写到实例方法source.Get2后调用输出2 -> " + destination.Get().toString());

                methodWriter.Set(source.Get3);
                Console.WriteLine("重写到静态方法source.Get3后调用输出3 -> " + destination.Get().toString());
            }
            Console.WriteLine("释放重写后原始调用输出1 -> " + destination.Get().toString());
            Console.WriteLine("Instance End");
        }
Пример #8
0
        private byte[] Process(destination viewModel, ResponseInfo response, string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                data = "null";
            }

            byte[] type = BitConverter.GetBytes((int)packetType.Text);
            byte[] togo = BitConverter.GetBytes((int)viewModel);
            byte[] res  = BitConverter.GetBytes((int)response);
            byte[] send;

            byte[] text = Encoding.UTF8.GetBytes(data);

            send = new byte[type.Length + togo.Length + res.Length + text.Length];

            type.CopyTo(send, 0);
            togo.CopyTo(send, 4);
            res.CopyTo(send, 8);
            text.CopyTo(send, 12);

            return(send);
        }
 byteBuffer[..remaining].CopyTo(destination[index..]);
Пример #10
0
 public void OnDestinationReachFailed(destination dest)
 {
     OnDestinationReached(dest);
 }
Пример #11
0
 => new NuGetPackage(url, packageName).DownloadLatestPackagAsync(destination, cancelationToken);
Пример #12
0
 => new NuGetPackage(ServerUrl, packageName).DownloadLatestPreReleasePackageAsync(destination, cancelationToken);
Пример #13
0
 RemoveAssignments(destination, assignmentsToBeRemoved);
Пример #14
0
 public Backup(Database source, Database destination) => _ptr = sqlite3_backup_init(destination, source);
 RemoveRelatedItSystemUsages(destination, relatedItSystemUsagesToBeRemoved, usageRepository, pickDestinationCollection);
Пример #16
0
 public Thumbnail(WindowHandle source, WindowHandle destination) => DwmRegisterThumbnail(destination, source, out thumbnail);
Пример #17
0
 => DownSample(ctx, source, destination, fullScreenScaleBias, fullScreenScaleBias, sourceMip, destMip);
Пример #18
0
 /// <summary>
 /// 覆盖测试源方法
 /// </summary>
 /// <param name="destination"></param>
 /// <returns></returns>
 public static int GetAdd2(destination destination)
 {
     return(destination.Value + 2);
 }
Пример #19
0
 /// <summary>
 /// 覆盖测试源方法
 /// </summary>
 /// <param name="destination"></param>
 /// <returns></returns>
 public int GetAdd1(destination destination)
 {
     return(Value + 1);
 }
Пример #20
0
        // Everything inside this method is rendered with transformation resulting from ModifyRenderMatrix.
        protected virtual void OnRenderData(PaintEventArgs e)
        {
            try
            {
                int cells_count      = 0;
                int grid_cells_count = 0;

                if (m_RenderGrids || m_RenderCells)
                {
                    using (m_Navmesh.AcquireReadDataLock())
                    {
                        var grid_cells = m_Navmesh.dbg_GetGridCells();

                        if (m_RenderGrids)
                        {
                            foreach (Nav.GridCell grid_cell in grid_cells)
                            {
                                RenderHelper.Render(grid_cell, m_RenderCenter, e, m_RenderConnections, m_RenderIds);
                            }

                            grid_cells_count = grid_cells.Count;
                        }

                        if (m_RenderCells)
                        {
                            foreach (Nav.GridCell grid_cell in grid_cells)
                            {
                                foreach (Nav.Cell cell in grid_cell.GetCells())
                                {
                                    RenderHelper.Render(cell, m_RenderCenter, e, m_RenderConnections, m_RenderIds, m_RenderRegionsMode == RegionsRenderMode.MoveCostMult, m_RenderRegionsMode == RegionsRenderMode.Threat);
                                }

                                cells_count += grid_cell.GetCellsCount();
                            }
                        }
                    }
                }

                if (m_RenderExploreCells || m_RenderExploreArea)
                {
                    using (m_Explorer.AquireReadDataLock())
                    {
                        var explore_cells = m_Explorer.dbg_GetExploreCells();

                        foreach (Nav.ExploreCell explore_cell in explore_cells)
                        {
                            RenderHelper.Render(explore_cell, m_Explorer.ExploreDestPrecision, m_RenderCenter, e, m_RenderConnections, m_RenderIds);

                            if (m_RenderExploreArea)
                            {
                                RenderHelper.DrawString(e.Graphics, explore_cell.Small ? Brushes.DarkRed : Brushes.Black, m_RenderCenter, explore_cell.Position, explore_cell.CellsArea().ToString(), 12);
                            }
                        }
                    }
                }

                if (m_RenderPatches)
                {
                    using (m_Navmesh.AcquireReadDataLock())
                    {
                        int id = 0;
                        foreach (var patch in m_Navmesh.m_CellsPatches)
                        {
                            var   rng = new Random(id++);
                            Color c   = Color.FromArgb(rng.Next(255), rng.Next(255), rng.Next(255));

                            foreach (var cell in patch.Cells)
                            {
                                RenderHelper.Render(cell, m_RenderCenter, e, draw_connections: false, draw_id: false, render_move_cost_mult: false, render_threat: false, render_outline: false, render_disabled: true, force_color: c);
                            }
                        }
                    }
                }

                if (m_RenderRegionsMode == RegionsRenderMode.Outline)
                {
                    var regions = m_Navmesh.Regions;

                    foreach (var region in regions)
                    {
                        RenderHelper.DrawRectangle(e.Graphics, Pens.Black, m_RenderCenter, region.Area.Min, region.Area.Max);
                    }

                    //Vec3 safe_point = m_Navigator.GetNearestGridCellOutsideAvoidAreas();

                    //if (!safe_point.IsEmpty)
                    //    RenderHelper.DrawPoint(e.Graphics, Pens.Green, render_center, safe_point);
                }

                if (m_RenderAxis)
                {
                    e.Graphics.DrawString("X", new Font("Arial", 6 / m_RenderScale), Brushes.Black, 25 / m_RenderScale, 0);
                    e.Graphics.DrawLine(RenderHelper.AXIS_PEN, -25 / m_RenderScale, 0, 25 / m_RenderScale, 0);
                    e.Graphics.DrawString("Y", new Font("Arial", 6 / m_RenderScale), Brushes.Black, 0, 25 / m_RenderScale);
                    e.Graphics.DrawLine(RenderHelper.AXIS_PEN, 0, -25 / m_RenderScale, 0, 25 / m_RenderScale);
                }

                if (!m_RenderOriginalPath && m_RenderPath)
                {
                    destination last_path_dest = default(destination);
                    if (m_Navigator.TryGetPath(ref m_LastPath, ref last_path_dest))
                    {
                        m_LastPath.Insert(0, m_Navigator.CurrentPos);
                    }
                    RenderHelper.DrawLines(e.Graphics, RenderHelper.PATH_PEN, m_RenderCenter, m_LastPath, 1, true);

                    if (!m_Navigator.PathRecalcTriggerPosition.IsZero())
                    {
                        RenderHelper.DrawCircle(e.Graphics, Pens.DarkRed, m_RenderCenter, m_Navigator.PathRecalcTriggerPosition, m_Navigator.PathRecalcTriggerPrecision);
                    }
                }

                if (m_RenderBacktrackPath)
                {
                    if (m_Navigator.TryGetBackTrackPath(ref m_LastBacktrackPath))
                    {
                        m_LastBacktrackPath.Insert(0, m_Navigator.CurrentPos);
                    }
                    RenderHelper.DrawLines(e.Graphics, Pens.Blue, m_RenderCenter, m_LastBacktrackPath, 1);
                }

                if (m_RenderPositionsHistory)
                {
                    m_Navigator.TryGetDebugPositionsHistory(ref m_LastPositionsHistory);
                    RenderHelper.DrawLines(e.Graphics, Pens.Green, m_RenderCenter, m_LastPositionsHistory, 1, true);
                }

                Vec3 curr      = m_Navigator.CurrentPos;
                Vec3 dest      = m_Navigator.Destination.pos;
                var  ring_dest = m_Navigator.RingDestination;

                if (!curr.IsZero())
                {
                    RenderHelper.DrawPoint(e.Graphics, Pens.Blue, m_RenderCenter, curr);
                }

                if (!dest.IsZero())
                {
                    RenderHelper.DrawPoint(e.Graphics, Pens.LightBlue, m_RenderCenter, dest);
                }

                if (!ring_dest.pos.IsZero())
                {
                    RenderHelper.DrawPoint(e.Graphics, Pens.LightBlue, m_RenderCenter, ring_dest.pos);
                    RenderHelper.DrawCircle(e.Graphics, Pens.LightBlue, m_RenderCenter, ring_dest.pos, ring_dest.precision);
                    RenderHelper.DrawCircle(e.Graphics, Pens.LightBlue, m_RenderCenter, ring_dest.pos, ring_dest.precision_max);
                }

                if (!curr.IsZero() && !dest.IsZero())
                {
                    if (m_RenderOriginalPath)
                    {
                        List <Vec3> path = new List <Vec3>();
                        m_Navigator.FindPath(curr, dest, MovementFlag.Walk, ref path, out var path_recalc_trigger_position, out var path_recalc_trigger_precision, -1, false, false, 0, false, 0, smoothen_distance: 0);
                        path.Insert(0, curr);
                        RenderHelper.DrawLines(e.Graphics, Pens.Black, m_RenderCenter, path, 1);
                    }

                    if (m_RenderRoughPath)
                    {
                        List <Vec3> rought_path = new List <Vec3>();

                        if (m_Navigator.m_RoughtPathEstimator != null)
                        {
                            m_Navigator.m_RoughtPathEstimator.FindRoughPath(curr, dest, ref rought_path);
                        }

                        rought_path.Insert(0, curr);
                        RenderHelper.DrawLines(e.Graphics, RenderHelper.EXPLORE_PATH_PEN, m_RenderCenter, rought_path, 1, true);
                    }

                    if (m_RenderRayCast)
                    {
                        var result = m_Navmesh.RayCast2D(curr, dest, MovementFlag.Walk);
                        RenderHelper.DrawLine(e.Graphics, result ? Pens.Green : Pens.Red, m_RenderCenter, curr, result.End);
                    }

                    if (m_RenderConnected)
                    {
                        bool connected = m_Navmesh.AreConnected(curr, dest, MovementFlag.Walk, 100, 400, out var curr_on_nav, out var dest_on_nav);
                        RenderHelper.DrawLine(e.Graphics, connected ? Pens.Green : Pens.Red, m_RenderCenter, curr, dest);
                        RenderHelper.DrawLine(e.Graphics, Pens.Lavender, m_RenderCenter, curr, curr_on_nav);
                        RenderHelper.DrawLine(e.Graphics, Pens.Lavender, m_RenderCenter, dest, dest_on_nav);
                        RenderHelper.DrawString(e.Graphics, connected ? Brushes.Green : Brushes.Red, m_RenderCenter, dest, connected ? "connected" : "not connected", 4);
                    }
                }

                if (!curr.IsZero() && dest.IsZero())
                {
                    if (m_RenderAvoidancePath)
                    {
                        List <Vec3> path = new List <Vec3>();
                        m_Navigator.FindAvoidancePath(curr, 0, MovementFlag.Walk, ref path, Vec3.ZERO, false, 0, float.MaxValue);
                        path.Insert(0, curr);
                        RenderHelper.DrawLines(e.Graphics, Pens.Black, m_RenderCenter, path, 1);
                    }
                }

                var waypoints = m_Navigator.Waypoints;
                if (waypoints.Count > 0)
                {
                    RenderHelper.DrawLines(e.Graphics, Pens.Red, m_RenderCenter, waypoints, 1);
                }

                if (m_Bot != null)
                {
                    //if (!m_Bot.Paused && m_CenterOnBot)
                    //    m_RenderCenter = new PointF(m_Bot.Position.X, m_Bot.Position.Y);
                    m_Bot.Render(e.Graphics, m_RenderCenter);
                }
            }
            catch (Exception)
            {
            }
        }
Пример #21
0
 Directory.CreateDirectory(Path.Combine(destination, directory));