示例#1
0
    public LogDataSlice(Agent agent)
    {
        SimulationTimeInSeconds = Time.time;
        Position               = agent.transform.position;
        CurrentInterests       = agent.CurrentInterests.Duplicate();
        CurrentSocialInterests = agent.CurrentSocialInterests.Duplicate();
        LockedInterest         = agent.LockedInterest;

        _agent = agent;
    }
示例#2
0
        public ActionResult AddOrUpdateCategory(InterestCategory category, string listId)
        {
            Task <InterestCategory> result = null;

            if (category != null && listId != null)
            {
                result = mailChimpManager.InterestCategories.AddOrUpdateAsync(category, listId);
            }

            return(View(result.Result));
        }
        /// <summary>
        /// Update a specific interest category.
        /// <param name="title">The text description of this category. This field appears on signup forms and is often phrased as a question</param>
        /// <param name="display_order">The order that the categories are displayed in the list. Lower numbers display first</param>
        /// <param name="type">Determines how this category’s interests are displayed on signup forms</param>
        /// <param name="list_id">Unique id for the list</param>
        /// <param name="interest_category_id">The unique id for the interest category.</param>
        /// </summary>
        internal async Task <dynamic> UpdateInterestCategoryAsync(string title, int display_order, InterestCategoryType type, string list_id, string interest_category_id)
        {
            string endpoint = Authenticate.EndPoint(TargetTypes.lists, SubTargetType.interest_categories, SubTargetType.not_applicable,
                                                    list_id, interest_category_id);
            InterestCategory interestCategory = new InterestCategory
            {
                display_order = display_order,
                type          = type,
                title         = title
            };

            return(await BaseOperation.PatchAsync <InterestCategory>(endpoint, interestCategory));
        }
示例#4
0
 public float GetCurrentInterest(InterestCategory interestCategory)
 {
     if (CurrentInterests.ContainsKey(interestCategory))
     {
         return(CurrentInterests[interestCategory]);
     }
     if (CurrentSocialInterests.ContainsKey(interestCategory))
     {
         return(CurrentSocialInterests[interestCategory]);
     }
     else
     {
         return(0f);
     }
 }
示例#5
0
        /// <summary>
        /// The add or update async.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="listId"></param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref>
        ///         <name>uriString</name>
        ///     </paramref>
        ///     is null. </exception>
        /// <exception cref="UriFormatException">In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, <see cref="T:System.FormatException" />, instead.<paramref name="uriString" /> is empty.-or- The scheme specified in <paramref name="uriString" /> is not correctly formed. See <see cref="M:System.Uri.CheckSchemeName(System.String)" />.-or- <paramref name="uriString" /> contains too many slashes.-or- The password specified in <paramref name="uriString" /> is not valid.-or- The host name specified in <paramref name="uriString" /> is not valid.-or- The file name specified in <paramref name="uriString" /> is not valid. -or- The user name specified in <paramref name="uriString" /> is not valid.-or- The host or authority name specified in <paramref name="uriString" /> cannot be terminated by backslashes.-or- The port number specified in <paramref name="uriString" /> is not valid or cannot be parsed.-or- The length of <paramref name="uriString" /> exceeds 65519 characters.-or- The length of the scheme specified in <paramref name="uriString" /> exceeds 1023 characters.-or- There is an invalid character sequence in <paramref name="uriString" />.-or- The MS-DOS path specified in <paramref name="uriString" /> must start with c:\\.</exception>
        /// <exception cref="MailChimpException">
        /// Custom Mail Chimp Exception
        /// </exception>
        public async Task <InterestCategory> AddOrUpdateAsync(InterestCategory category, string listId)
        {
            using (var client = CreateMailClient($"lists/{listId}/interest-categories/"))
            {
                System.Net.Http.HttpResponseMessage response;
                if (string.IsNullOrWhiteSpace(category.Id))
                {
                    response = await client.PostAsJsonAsync(string.Empty, category).ConfigureAwait(false);
                }
                else
                {
                    response = await client.PatchAsJsonAsync(category.Id, category).ConfigureAwait(false);
                }

                await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false);

                return(await response.Content.ReadAsAsync <InterestCategory>().ConfigureAwait(false));
            }
        }
示例#6
0
    public AttractionZone GetMostVisiblePointOfInterest(InterestCategory interestCategory)
    {
        AttractionZone mostVisiblePointOfInterest = null;
        var            maxFoundVisibility         = 0f;

        if (!_simulation.AttractionZones.ContainsKey(interestCategory))
        {
            return(null);
        }

        foreach (var poi in _simulation.AttractionZones[interestCategory])
        {
            var poiVisibility = poi.GetVisibilityAt(this.transform.position);
            if (poiVisibility > maxFoundVisibility)
            {
                mostVisiblePointOfInterest = poi;
                maxFoundVisibility         = poiVisibility;
            }
        }
        return(mostVisiblePointOfInterest);
    }
    private static Color GetColorForCategory(InterestCategory category, float alpha)
    {
        var color = category.Color;

        return(new Color(color.r, color.g, color.b, color.a * alpha));
    }
示例#8
0
 public async Task <InterestCategory> UpdateAsync(InterestCategory category, string listId, string interestCategoryId)
 {
     throw new NotImplementedException();
 }