示例#1
0
        /// <summary>
        /// Create the options for the provided keyword
        /// </summary>
        /// <param name="tag">The search criteria to create description</param>
        private FinderOptions CreateOption(string tag)
        {
            FinderOptions options = null;
            switch (tag)
            {
                case "VillageNewInactive":
                    options = new FinderOptions(SearchForEnum.Villages);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.ActiveRectangle;
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.NewInactives;
                    break;

                case "VillageLostPoints":
                    options = new FinderOptions(SearchForEnum.Villages);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.ActiveRectangle;
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.LostPoints;
                    break;

                case "PlayerNobled":
                    options = new FinderOptions(SearchForEnum.Villages);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.ActiveRectangle;
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.Nobled;
                    break;

                case "PlayerNoActivity":
                    options = new FinderOptions(SearchForEnum.Players);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.ActiveRectangle;
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.Inactives;
                    break;

                case "PlayerTribeChange":
                    options = new FinderOptions(SearchForEnum.Players);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.ActiveRectangle;
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.TribeChange;
                    break;

                case "TribeNobled":
                    options = new FinderOptions(SearchForEnum.Villages);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.EntireMap;
                    if (World.Default.You.HasTribe)
                    {
                        options.Tribe = World.Default.You.Tribe;
                    }
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.Nobled;
                    break;

                case "TribeNoActivity":
                    options = new FinderOptions(SearchForEnum.Players);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.EntireMap;
                    if (World.Default.You.HasTribe)
                    {
                        options.Tribe = World.Default.You.Tribe;
                    }
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.Inactives;
                    break;

                case "TribeLostPoints":
                    options = new FinderOptions(SearchForEnum.Players);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.EntireMap;
                    if (World.Default.You.HasTribe)
                    {
                        options.Tribe = World.Default.You.Tribe;
                    }
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.LostPoints;
                    break;

                case "TribePlayers":
                    options = new FinderOptions(SearchForEnum.Players);
                    options.EvaluatedArea = FinderOptions.FinderLocationEnum.EntireMap;
                    if (World.Default.You.HasTribe)
                    {
                        options.Tribe = World.Default.You.Tribe;
                    }
                    options.SearchStrategy = FinderOptions.FinderOptionsEnum.All;
                    break;

                default:
                    Debug.Assert(false, "No other options");
                    break;
            }

            AdditionalFilters.SetFilters(options);
            if (ActivateAdditionalFilters.Checked)
            {
                return AdditionalFilters.GetFinderOptions();
            }
            else
            {
                return options;
            }
        }
示例#2
0
        /// <summary>
        /// Create the object that holds the different search criteria
        /// </summary>
        public FinderOptions GetFinderOptions()
        {
            Debug.Assert(Area.SelectedIndex != -1, "Default value should be set by ctor");
            Debug.Assert(Filter.SelectedIndex != -1);

            var options = new FinderOptions((SearchForEnum) What.SelectedIndex);

            options.EvaluatedArea = (FinderOptions.FinderLocationEnum)Area.SelectedIndex;
            options.PointsBetweenEnd = (int)PointsBetweenEnd.Value;
            options.PointsBetweenStart = (int)PointsBetweenStart.Value;
            options.ResultLimit = (int)ResultLimit.Value;
            options.SearchStrategy = (FinderOptions.FinderOptionsEnum)Filter.SelectedIndex;

            options.Text = Search.Text.Trim().ToUpper(CultureInfo.InvariantCulture);
            options.Tribe = Tribe.Tribe;

            return options;
        }
示例#3
0
        /// <summary>
        /// Displays a list of villages, players or tribes
        /// </summary>
        /// <param name="options">The search conditions</param>
        public void Display(FinderOptions options)
        {
            Table.BeginUpdate();
            Table.TableModel.Rows.Clear();
            switch (options.SearchFor)
            {
                case SearchForEnum.Tribes:
                    Table.ColumnModel = TribeColumnModel;
                    foreach (Tribe vil in options.TribeMatches())
                    {
                        Table.TableModel.Rows.Add(new TribeTableRow(_map, vil));
                    }
                    break;
                case SearchForEnum.Villages:
                    Table.ColumnModel = VillageColumnModel;
                    foreach (Village vil in options.VillageMatches())
                    {
                        Table.TableModel.Rows.Add(new VillageTableRow(_map, vil));
                    }
                    break;
                default:
                    Table.ColumnModel = PlayerColumnModel;
                    foreach (Player vil in options.PlayerMatches())
                    {
                        Table.TableModel.Rows.Add(new PlayerTableRow(_map, vil));
                    }
                    break;
            }

            // auto sorting
            if (Table.SortingColumn != -1)
            {
                Table.Sort(Table.SortingColumn, Table.ColumnModel.Columns[Table.SortingColumn].SortOrder);
            }
            Table.EndUpdate();
        }
示例#4
0
 /// <summary>
 /// Make the control reflect the parameter
 /// </summary>
 public void SetFilters(FinderOptions options)
 {
     Area.SelectedIndex = (int)options.EvaluatedArea;
     Filter.SelectedIndex = (int)options.SearchStrategy;
     What.SelectedIndex = (int)options.SearchFor;
     if (options.Tribe != null)
     {
         Tribe.SetTribe(options.Tribe);
     }
     else
     {
         Tribe.SetTribe(null);
     }
 }