Example #1
0
        /// <summary>
        /// 初始化寻路
        /// </summary>
        private void InitPathfinding()
        {
            if (m_SearchPath == null)
            {
                m_SearchPath = new PathFinding(this);
            }

            if (Application.isPlaying)
            {
                if (m_FindAttackRange == null)
                {
                    m_FindAttackRange = ScriptableObject.CreateInstance <FindRange>();
                }

                if (m_FindMoveRange == null)
                {
                    m_FindMoveRange = ScriptableObject.CreateInstance <FindMoveRange>();
                }

                if (m_FindPathDirect == null)
                {
                    m_FindPathDirect = ScriptableObject.CreateInstance <FindPathDirect>();
                }
            }

            if (m_CellPositionEqualityComparer == null)
            {
                m_CellPositionEqualityComparer = new CellPositionEqualityComparer();
            }
        }
Example #2
0
        private List <Nodes.Node> GetRootNodes(FindRange findRange)
        {
            List <Nodes.Node> rootNodes = new List <Nodes.Node>();

            switch (findRange)
            {
            case FindRange.CurrentFile:
                if (BehaviorTreeViewDock.LastFocused != null)
                {
                    BehaviorTreeView behaviorTreeView = BehaviorTreeViewDock.LastFocused.BehaviorTreeView;

                    if (behaviorTreeView != null && behaviorTreeView.RootNodeView != null)
                    {
                        rootNodes.Add(behaviorTreeView.RootNodeView.Node);
                    }
                }

                break;

            case FindRange.AllOpenFiles:
                foreach (BehaviorTreeViewDock dock in BehaviorTreeViewDock.Instances)
                {
                    BehaviorTreeView behaviorTreeView = dock.BehaviorTreeView;

                    if (behaviorTreeView != null && behaviorTreeView.RootNodeView != null)
                    {
                        rootNodes.Add(behaviorTreeView.RootNodeView.Node);
                    }
                }

                break;

            case FindRange.EntireWorkspace:
                BehaviorTreeList behaviorTreeList = BehaviorManager.Instance as BehaviorTreeList;

                if (behaviorTreeList != null)
                {
                    foreach (Nodes.BehaviorNode behavior in behaviorTreeList.GetAllBehaviors())
                    {
                        if (behavior != null && behavior is Nodes.Node)
                        {
                            rootNodes.Add((Nodes.Node)behavior);
                        }
                    }
                }

                break;
            }

            return(rootNodes);
        }
Example #3
0
        private void btnSalesPerson_Click(object sender, EventArgs e)
        {
            DatabaseConnection dbCon    = new DatabaseConnection();
            DataSet            FillData = dbCon.Get("Select SRepCode as SalesPerson,SRepName as SalesPerson_Name from File_SalesPerson");

            GlobalVariables.HelpDataSetMain = FillData;

            FindRange newFind = new FindRange("Sales Person", DS_SalesPersonRight, DS_SalesPersonLeft);

            newFind.ShowInTaskbar = false;
            newFind.ShowDialog();

            if (DS_SalesPersonRight.Tables[0].Rows.Count > 0)
            {
                txtRepCode.Text = "";
            }
        }
Example #4
0
        private void btnCourse_Click(object sender, EventArgs e)
        {
            DatabaseConnection dbCon    = new DatabaseConnection();
            DataSet            FillData = dbCon.Get("Select SCourseCode as Course_Code,SCourseName as Course_Name from file_Course");

            GlobalVariables.HelpDataSetMain = FillData;

            FindRange newFind = new FindRange("Course", DS_CourseRight, DS_CourseLeft);

            newFind.ShowInTaskbar = false;
            newFind.ShowDialog();

            if (DS_CourseRight.Tables[0].Rows.Count > 0)
            {
                txtCourse.Text = "";
            }
        }
Example #5
0
        private void btnStudent_Click(object sender, EventArgs e)
        {
            DatabaseConnection dbCon    = new DatabaseConnection();
            DataSet            FillData = dbCon.Get("Select SStudentId as Student_ID,SName as Student_Name from File_Student");

            GlobalVariables.HelpDataSetMain = FillData;

            FindRange newFind = new FindRange("Student", DS_StudentRight, DS_StudentLeft);

            newFind.ShowInTaskbar = false;
            newFind.ShowDialog();

            if (DS_StudentRight.Tables[0].Rows.Count > 0)
            {
                txtStudent.Text = "";
            }
        }
Example #6
0
        private void FindObject(string findWhat, FindRange findRange, bool matchCase,
                                bool matchWholeWord, bool onlyByNodeType, bool onlyByNodeId, FindType findType)
        {
            if (string.IsNullOrEmpty(findWhat))
            {
                return;
            }

            saveFindSettings();

            try {
                List <Nodes.Node> rootNodes   = GetRootNodes(findRange);
                List <ObjectPair> findObjects = new List <ObjectPair>();

                if (!onlyByNodeType)
                {
                    // by Id
                    int id = int.MinValue;

                    if (int.TryParse(findWhat, out id))
                    {
                        foreach (Nodes.Node root in rootNodes)
                        {
                            DefaultObject obj = Plugin.GetObjectById(root, id);

                            if (obj != null)
                            {
                                findObjects.Add(new ObjectPair(root, obj));
                            }
                        }
                    }
                }

                if (!onlyByNodeId)
                {
                    // by Type
                    foreach (Nodes.Node root in rootNodes)
                    {
                        root.GetObjectsByType(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (!onlyByNodeId && !onlyByNodeType)
                {
                    foreach (Nodes.Node root in rootNodes)
                    {
                        root.GetObjectsByPropertyMethod(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (findObjects.Count > 0)
                {
                    if (Plugin.CompareTwoObjectLists(_findObjects, findObjects))
                    {
                        if (findType == FindType.Next)
                        {
                            _objectIndex++;

                            if (_objectIndex >= findObjects.Count)
                            {
                                _objectIndex = 0;
                            }
                        }
                        else if (findType == FindType.Previous)
                        {
                            _objectIndex--;

                            if (_objectIndex < 0)
                            {
                                _objectIndex = findObjects.Count - 1;
                            }
                        }
                    }
                    else
                    {
                        _objectIndex = 0;
                        _findObjects = findObjects;
                    }

                    if (findType == FindType.All)
                    {
                        FindFileDock.Inspect(findWhat, rootNodes.Count, findObjects);
                    }
                    else
                    {
                        ShowObject(findObjects[_objectIndex]);
                    }

                    return;
                }
            } catch (Exception) {
            }

            MessageBox.Show(Resources.FindWarningInfo, Resources.FindWarning, MessageBoxButtons.OK);
        }
Example #7
0
        public static SqlString Geocode(SqlString AddressLine,
                                        SqlString PrimaryCity,
                                        SqlString Subdivision,
                                        SqlString PostalCode,
                                        SqlString CountryRegion,
                                        SqlString UserName,
                                        SqlString Password)
        {
            FindServiceSoap findService = new FindServiceSoap();

            findService.Credentials
                = new NetworkCredential(UserName.ToString(), Password.ToString());

            FindAddressSpecification addressToGeocode
                = new FindAddressSpecification();

            Address address = new Address();

            address.AddressLine   = AddressLine.ToString();
            address.PrimaryCity   = PrimaryCity.ToString();
            address.Subdivision   = Subdivision.ToString();
            address.PostalCode    = PostalCode.ToString();
            address.CountryRegion = CountryRegion.ToString();

            addressToGeocode.InputAddress = address;
            // NOTE: need to use the appropriate MapPoint location (NA for North America)
            addressToGeocode.DataSourceName = "MapPoint.AP";

            FindOptions findOptions = new FindOptions();

            // we only want latitude and longitude
            findOptions.ResultMask = FindResultMask.LatLongFlag;

            FindRange findRange = new FindRange();

            findRange.StartIndex = 0;
            findRange.Count      = 1;

            findOptions.Range = findRange;

            addressToGeocode.Options = findOptions;

            FindResults findResults;

            findResults = findService.FindAddress(addressToGeocode);

            SqlString locatedAddress = new SqlString();

            if (findResults.Results.Length > 0)
            {
                locatedAddress
                    = "POINT("
                      + findResults.Results[0].FoundLocation.LatLong.Longitude
                      + " "
                      + findResults.Results[0].FoundLocation.LatLong.Latitude
                      + ")";
            }
            else
            {
                locatedAddress = "POINT EMPTY";
            }

            return(locatedAddress);
        }
Example #8
0
        private List<Nodes.Node> GetRootNodes(FindRange findRange) {
            List<Nodes.Node> rootNodes = new List<Nodes.Node>();

            switch (findRange) {
                case FindRange.CurrentFile:
                    if (BehaviorTreeViewDock.LastFocused != null) {
                        BehaviorTreeView behaviorTreeView = BehaviorTreeViewDock.LastFocused.BehaviorTreeView;

                        if (behaviorTreeView != null && behaviorTreeView.RootNodeView != null) {
                            rootNodes.Add(behaviorTreeView.RootNodeView.Node);
                        }
                    }

                    break;

                case FindRange.AllOpenFiles:
                    foreach(BehaviorTreeViewDock dock in BehaviorTreeViewDock.Instances) {
                        BehaviorTreeView behaviorTreeView = dock.BehaviorTreeView;

                        if (behaviorTreeView != null && behaviorTreeView.RootNodeView != null) {
                            rootNodes.Add(behaviorTreeView.RootNodeView.Node);
                        }
                    }
                    break;

                case FindRange.EntireWorkspace:
                    BehaviorTreeList behaviorTreeList = BehaviorManager.Instance as BehaviorTreeList;

                    if (behaviorTreeList != null) {
                        foreach(Nodes.BehaviorNode behavior in behaviorTreeList.GetAllBehaviors()) {
                            if (behavior != null && behavior is Nodes.Node) {
                                rootNodes.Add((Nodes.Node)behavior);
                            }
                        }
                    }

                    break;
            }

            return rootNodes;
        }
Example #9
0
        private void FindObject(string findWhat, FindRange findRange, bool matchCase,
                                bool matchWholeWord, bool onlyByNodeType, bool onlyByNodeId, FindType findType) {
            if (string.IsNullOrEmpty(findWhat)) {
                return;
            }

            saveFindSettings();

            try {
                List<Nodes.Node> rootNodes = GetRootNodes(findRange);
                List<ObjectPair> findObjects = new List<ObjectPair>();

                if (!onlyByNodeType) {
                    // by Id
                    int id = int.MinValue;

                    if (int.TryParse(findWhat, out id)) {
                        foreach(Nodes.Node root in rootNodes) {
                            DefaultObject obj = Plugin.GetObjectById(root, id);

                            if (obj != null) {
                                findObjects.Add(new ObjectPair(root, obj));
                            }
                        }
                    }
                }

                if (!onlyByNodeId) {
                    // by Type
                    foreach(Nodes.Node root in rootNodes) {
                        root.GetObjectsByType(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (!onlyByNodeId && !onlyByNodeType) {
                    foreach(Nodes.Node root in rootNodes) {
                        root.GetObjectsByPropertyMethod(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (findObjects.Count > 0) {
                    if (Plugin.CompareTwoObjectLists(_findObjects, findObjects)) {
                        if (findType == FindType.Next) {
                            _objectIndex++;

                            if (_objectIndex >= findObjects.Count) {
                                _objectIndex = 0;
                            }

                        } else if (findType == FindType.Previous) {
                            _objectIndex--;

                            if (_objectIndex < 0) {
                                _objectIndex = findObjects.Count - 1;
                            }
                        }

                    } else {
                        _objectIndex = 0;
                        _findObjects = findObjects;
                    }

                    if (findType == FindType.All) {
                        FindFileDock.Inspect(findWhat, rootNodes.Count, findObjects);

                    } else {
                        ShowObject(findObjects[_objectIndex]);
                    }

                    return;
                }

            } catch (Exception) {
            }

            MessageBox.Show(Resources.FindWarningInfo, Resources.FindWarning, MessageBoxButtons.OK);
        }
Example #10
0
 /// <summary>
 /// Find tweets.
 /// </summary>
 /// <param name="predicate">find predicate</param>
 /// <param name="range">finding range</param>
 /// <param name="count">count of findings</param>
 /// <returns>results observable sequence.</returns>
 public static IObservable<TwitterStatus> Find(Func<TwitterStatus, bool> predicate,
     FindRange<long> range = null, int? count = null)
 {
     return _isInShutdown
                ? Observable.Empty<TwitterStatus>()
                : _store.Find(predicate, range, count)
                        .Catch((ObjectDisposedException ex) => Observable.Empty<TwitterStatus>());
 }
        public static SqlString geocode(
            SqlString AddressLine,
            SqlString PrimaryCity,
            SqlString Subdivision,
            SqlString PostalCode,
            SqlString CountryRegion)
        {
            // Initialize the MapPoint Find service
            FindServiceSoap findService = new FindServiceSoap();

            // Provide the logon credentials
            string UserName = "******";
            string Password = "******";

            findService.Credentials = new NetworkCredential(UserName, Password);

            // FindAddressSpecification contains the details passed to the Find service
            FindAddressSpecification findAddressSpec = new FindAddressSpecification();
            // Build a new address object from the parameters provided to the function
            Address address = new Address();

            address.AddressLine   = AddressLine.ToString();
            address.PrimaryCity   = PrimaryCity.ToString();
            address.Subdivision   = Subdivision.ToString();
            address.PostalCode    = PostalCode.ToString();
            address.CountryRegion = CountryRegion.ToString();
            // Add the address to search for to the specification
            findAddressSpec.InputAddress = address;
            // Specify the data source in which to search for the address
            findAddressSpec.DataSourceName = "MapPoint.NA";

            // Create the options to limit the result set
            FindOptions findOptions = new FindOptions();

            // Filter the results to only show LatLong information
            findOptions.ResultMask = FindResultMask.LatLongFlag;
            // Only return the first matching result
            FindRange findRange = new FindRange();

            findRange.StartIndex = 0; findRange.Count = 1;
            findOptions.Range    = findRange;
            // Apply the options to the specification
            findAddressSpec.Options = findOptions;

            // Call the MapPoint Web Service and retrieve the results
            FindResults findResults; findResults = findService.FindAddress(findAddressSpec);

            // Create the WKT representation of the geocoded result
            SqlString WKT = new SqlString();

            if (findResults.Results.Length > 0)
            {
                WKT = "POINT(" +
                      findResults.Results[0].FoundLocation.LatLong.Longitude + " " +
                      findResults.Results[0].FoundLocation.LatLong.Latitude + ")";
            }
            else
            {
                WKT = "POINT EMPTY";
            }

            // Return the result to SQL Server
            return(WKT);
        }
Example #12
0
 /// <summary>
 /// Find tweets.
 /// </summary>
 /// <param name="predicate">find predicate</param>
 /// <param name="range">finding range</param>
 /// <param name="count">count of findings</param>
 /// <returns>results observable sequence.</returns>
 public static IObservable<TwitterStatus> Find(Func<TwitterStatus, bool> predicate,
     FindRange<long> range = null, int? count = null)
 {
     if (_isInShutdown) return Observable.Empty<TwitterStatus>();
     var result = _store.Find(predicate, range, count);
     if (count == null)
         return result;
     return result
         .Distinct(_ => _.Id)
         .OrderByDescending(_ => _.Id)
         .Take(count.Value);
 }
Example #13
0
 /// <summary>
 /// Find tweets.
 /// </summary>
 /// <param name="predicate">find predicate</param>
 /// <param name="range">finding range</param>
 /// <returns>results observable sequence.</returns>
 public static IObservable<TwitterStatus> Find(Func<TwitterStatus, bool> predicate, FindRange<long> range = null, int? count = null)
 {
     if (_isInShutdown) return Observable.Empty<TwitterStatus>();
     return store.Find(predicate, range, count);
 }