// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            BTContext context = serviceProvider.GetService <BTContext>();

            MockData.AddMockData(context);

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
        }
        private async Task UpdateCountryCodeList(string userId, string toBeAdded, string toBeRemoved)
        {
            using (var context = new BTContext())
            {
                var user = await _UserManager.FindByIdAsync(userId);

                var visitedCountries = new List <string>();
                if (!string.IsNullOrWhiteSpace(user.VisitedCountryCodesList))
                {
                    visitedCountries = user.VisitedCountryCodesList.Split(',').ToList();
                }
                if (!string.IsNullOrWhiteSpace(toBeAdded) && !visitedCountries.Contains(toBeAdded))
                {
                    visitedCountries.Add(toBeAdded);
                }
                ;
                if (!string.IsNullOrWhiteSpace(toBeRemoved) && visitedCountries.Contains(toBeRemoved))
                {
                    visitedCountries.Remove(toBeRemoved);
                }
                ;
                user.VisitedCountryCodesList = string.Join(",", visitedCountries);

                await _UserManager.UpdateAsync(user);
            }
        }
Exemple #3
0
 public static void InitializeBugTracking(string connectionString, string adminPassword)
 {
     if (null == connectionString)
     {
         throw new ArgumentNullException(nameof(connectionString), "Connection string cannot be empty");
     }
     if ("" == connectionString)
     {
         throw new ArgumentException("Connection string cannot be empty", nameof(connectionString));
     }
     if (null == adminPassword)
     {
         throw new ArgumentNullException(nameof(adminPassword), "Admin password cannot be null");
     }
     if (adminPassword.Length < Auxiliary.PasswordLength)
     {
         throw new ArgumentOutOfRangeException(nameof(adminPassword),
                                               $"Passwords must have at least {Auxiliary.PasswordLength} characters");
     }
     using (var c = new BTContext(connectionString)){
         c.Database.Delete();
         c.Database.Create();
         var admin = c.Admins.Create();
         admin.Address         = new Address();
         admin.Address.Country = "Nowhere";
         admin.Address.Street  = "Boh";
         admin.BirthDate       = new DateTime(1900, 1, 1);
         admin.FiscalCode      = "ABCDEF12G34H567I";
         admin.Login           = "******";
         admin.Password        = PwManagement.PwManagement.HashPassword(adminPassword, Auxiliary.HashedPwSize,
                                                                        Auxiliary.SaltSize, Auxiliary.IterationNumber);
         c.Admins.Add(admin);
         c.SaveChanges();
     }
 }
    /// <summary>
    /// Removes a currently running node
    /// </summary>
    /// <param name="nodeContext"></param>
    /// <param name="node"></param>
    public static void RemoveRunningNode(BTContext nodeContext, BTNode node)
    {
        BTContextData data = contextMap[nodeContext.contextOwner.behaviourTreeType].Find(x => x.owningContext == nodeContext);

        if (data != null)
        {
            data.RemoveRunningNode(node);
        }
    }
    /// <summary>
    /// Registers the <see cref="BTContextData"/> for the behavior tree
    /// </summary>
    /// <param name="behaviourType"></param>
    /// <param name="aiContext"></param>
    public static void RegisterAgentContext(BehaviourTreeType behaviourType, BTContext aiContext)
    {
        if (!contextMap.ContainsKey(behaviourType))
        {
            contextMap[behaviourType] = new List <BTContextData>();
        }

        contextMap[behaviourType].Add(new BTContextData(aiContext));
    }
 /// <summary>
 /// Removes a registered <see cref="BTContext"/> from <see cref="contextMap"/>
 /// </summary>
 /// <param name="behaviourType"></param>
 /// <param name="aiContext"></param>
 public static void UnregisterAgentContext(BehaviourTreeType behaviourType, BTContext aiContext)
 {
     if (contextMap.ContainsKey(behaviourType))
     {
         BTContextData data = contextMap[behaviourType].Find(x => x.owningContext == aiContext);
         if (data != null)
         {
             contextMap[behaviourType].Remove(data);
         }
     }
 }
Exemple #7
0
    public override object GetValue(NodePort port)
    {
        BTNode parentNode = port.Connection.node as BTNode;

        if (parentNode != null)
        {
            context = parentNode.context;
        }



#if UNITY_EDITOR
        context.behaviourHistory.Add(nodeDescription == "" ? GetType().ToString() : nodeDescription);
#endif
        return(Execute());
    }
Exemple #8
0
 public PessoaController(BTContext context)
 {
     _context = context;
 }
Exemple #9
0
 /// <summary>
 /// Sets the <see cref="BTContext"/> for the behavior tree
 /// </summary>
 /// <param name="context"></param>
 public BTContextData(BTContext context)
 {
     owningContext = context;
 }
Exemple #10
0
 public FichaController(BTContext context)
 {
     _context = context;
 }
 public LoginController(BTContext context)
 {
     db = context;
 }
Exemple #12
0
 public SerieController(BTContext context)
 {
     _context = context;
 }
Exemple #13
0
    [HideInInspector] public Vector3 startPosition     = Vector3.zero; // The start position of the agent


    /// <summary>
    /// Sets the values of <see cref="navAgent"/> and <see cref="aiContext"/>
    /// </summary>
    private void Awake()
    {
        navAgent = GetComponent <NavMeshAgent>();

        aiContext = new BTContext(navAgent, this, transform, target);
    }
Exemple #14
0
 public BaseTests()
 {
     db = new BTContext();
     MockData.AddMockData(db);
 }
 public ExercicioController(BTContext context)
 {
     _context = context;
 }
 public ClienteController(BTContext context)
 {
     _context = context;
 }