コード例 #1
0
ファイル: ButtonCard.cs プロジェクト: majda107/blaze-cards
        public ButtonCard(string name, CardEventHandler buttonAction)
        {
            this.ButtonAction = buttonAction;
            this.OnClick     += this.ButtonAction;

            this.TextBehavior.Value = name;
            this.Highlightable      = false;
            this.Editable           = false;

            this.Classes.Add("blaze-button");

            this.OnDown += (s, e) =>
            {
                s.Classes.Add("blaze-button-down");
                s.InvokeComponentChange();
            };

            this.OnUp += (s, e) =>
            {
                s.Classes.Remove("blaze-button-down");
                s.InvokeComponentChange();
            };
        }
コード例 #2
0
ファイル: CardClicked.cs プロジェクト: massiecb/496
	CardEventHandler handler; // the script which handles all player1's card events
	void Start () {
		handler = GameObject.Find("GamePlay").GetComponent<CardEventHandler>();
	}
コード例 #3
0
 CardEventHandler handler;     // the script which handles all player1's card events
 void Start()
 {
     handler = GameObject.Find("GamePlay").GetComponent <CardEventHandler>();
 }
コード例 #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <CardContext>(optBuilder =>
            {
                var connectionString = Environment.GetEnvironmentVariable("CardDb");
                optBuilder.UseMySQL(connectionString);
            });

            services.AddScoped <ICardContext, CardContext>();
            services.AddScoped <ICardOperations, CardOperations>();
            services.AddScoped <ICardEventHandler, CardEventHandler>();

            var prconfig = new Dictionary <string, string>
            {
                { "bootstrap.servers", Environment.GetEnvironmentVariable("Producer") }
            };
            var producerConfig = new ProducerConfig(prconfig);

            services.AddSingleton <ProducerConfig>(producerConfig);
            var cardEventHandler = new CardEventHandler(producerConfig, services.BuildServiceProvider().GetRequiredService <ILogger <CardEventHandler> >());

            services.AddSingleton <CardEventHandler>(cardEventHandler);

            var config = new ConsumerConfig
            {
                BootstrapServers      = Environment.GetEnvironmentVariable("Producer"),
                GroupId               = Environment.GetEnvironmentVariable("GroupId"),
                AllowAutoCreateTopics = true,
                EnableAutoCommit      = false
            };

            services.AddCors(c =>
            {
                c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            });
            services.AddHostedService <UrlDeletionEventListener>();
            services.AddHostedService <CardEventListener>();
            services.AddControllers(setupAction =>
            {
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.BadRequest));
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.NotAcceptable));
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.InternalServerError));
                setupAction.Filters.Add(new ProducesAttribute("application/json"));
                setupAction.ReturnHttpNotAcceptable = true;
            });

            services.AddSwaggerGen(setup =>
            {
                setup.SwaggerDoc("CardOpenApiSpecification",
                                 new OpenApiInfo()
                {
                    Title       = "Cards Api",
                    Version     = "1",
                    Description = "Through this api user can create and  access the cards"
                });
                var xmlCommentFile = $"{ Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath        = Path.Combine(AppContext.BaseDirectory, xmlCommentFile);

                setup.IncludeXmlComments(xmlPath);
            });
        }
コード例 #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <CatalogContext>(optBuilder =>
            {
                var connectionString = Environment.GetEnvironmentVariable("CatalogDb");
                optBuilder.UseMySQL(connectionString);
            });
            services.AddCors(c =>
            {
                c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            });

            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());

            services.AddScoped <ICatalogContext, CatalogContext>();
            services.AddScoped <ICatalogRepository, CatalogRepository>();
            services.AddScoped <IEventConsumerHandler, CardConsumerHandler>();
            services.AddScoped <ICardEventHandler, CardEventHandler>();

            var prconfig = new Dictionary <string, string>
            {
                { "bootstrap.servers", Environment.GetEnvironmentVariable("Producer") }
            };
            var producerConfig = new ProducerConfig(prconfig);

            services.AddSingleton <ProducerConfig>(producerConfig);
            var cardEventHandler = new CardEventHandler(producerConfig);

            services.AddSingleton <CardEventHandler>(cardEventHandler);


            services.AddHostedService <CardEventListener>();
            services.AddControllers(setupAction =>
            {
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.BadRequest));
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.NotAcceptable));
                setupAction.Filters.Add(new ProducesResponseTypeAttribute((int)HttpStatusCode.InternalServerError));
                setupAction.Filters.Add(new ProducesAttribute("application/json"));
                setupAction.ReturnHttpNotAcceptable = true;
            });

            services.AddSwaggerGen(setup =>
            {
                setup.SwaggerDoc("CatalogOpenApiSpecification",
                                 new OpenApiInfo()
                {
                    Title       = "Catalog Api",
                    Version     = "1",
                    Description = "Through this api user can create and  access the catalog and the cards linked to it "
                });
                var xmlCommentFile = $"{ Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath        = Path.Combine(AppContext.BaseDirectory, xmlCommentFile);

                setup.IncludeXmlComments(xmlPath);
            });
            //services.AddAuthentication(options =>
            //{
            //    options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
            //})
            //    .AddJwtBearer(bearerOptions =>
            //    {
            //        bearerOptions.Authority = "https://login.microsoftonline.com/9fd07c39-4f15-4a12-97fe-aac5db59c524";
            //        bearerOptions.Audience = "0e953e51-bc80-4f52-b12c-dd557edc602e";
            //    });


            ////services.AddAuthentication(option => option.DefaultScheme = AzureADDefaults.AuthenticationScheme).AddAzureAD(options =>
            //// {
            ////     options.Instance = "https://login.microsoftonline.com/";
            ////     options.Domain = "vinithavnrgmail.onmicrosoft.com";
            ////     options.TenantId = "9fd07c39-4f15-4a12-97fe-aac5db59c524";
            ////     options.ClientId = "api://0e953e51-bc80-4f52-b12c-dd557edc602e";
            //// });
        }