private void AddAttachObject(Collider collider) { GameObject parent = m_ColliderInfo.GetCollider(); if (parent == null) { return; } AttachConfig attach_config = m_ColliderInfo.GetAttachConfig(); AttachTargetInfo attach_info = new AttachTargetInfo(); attach_info.ParentObj = parent; attach_info.TargetObj = collider.gameObject; attach_info.AttachNode = TriggerUtil.GetChildNodeByName(collider.gameObject, attach_config.AttachNodeName); UnityEngine.Vector3 hit_pos = parent.GetComponent <Collider>().ClosestPointOnBounds(attach_info.AttachNode.position); attach_info.ParentPos = attach_info.ParentObj.transform.InverseTransformPoint(hit_pos); attach_info.Rotate = attach_config.AttachRotation; attach_info.MoveControler = attach_info.TargetObj.GetComponent <CharacterController>(); m_AttachedObjects.Add(attach_info); UpdateAttachTargetPos(attach_info); LogicSystem.NotifyGfxMoveControlStart(attach_info.TargetObj, m_OwnSkill.SkillId, true); //Debug.Log("---AttachImpact: send " + attach_config.AttachImpact + " to " + attach_info.TargetObj.name); m_DamageManager.SendImpactToObject(m_DamageManager.GetOwner(), collider.gameObject, attach_config.AttachImpact, attach_config.AttachImpactTime, m_OwnSkill.SkillId, 0); }
public AttachConfig GetByOrgId(string orgId) { //return _attachConfigRepository.Single(a=>a.OrgId==orgId); AttachConfig config = null; OtherConfig ac = _otherConfigRepository.Single(a => a.OrgId == orgId && a.ConfigName == "attach"); if (ac != null) { if (!string.IsNullOrEmpty(ac.ConfigValue)) { config = JsonConvert.DeserializeObject <AttachConfig>(ac.ConfigValue); } else { config = new AttachConfig(); } } else { config = new AttachConfig(); OtherConfig newac = new OtherConfig(); newac.ConfigName = "attach"; newac.ConfigValue = JsonConvert.SerializeObject(config); newac.LastUpdateTime = DateTime.Now; _otherConfigRepository.Add(newac); } return(config); }
public override void Analyze(object sender, SkillInstance instance) { AttachConfig attach_config = m_ColliderInfo.GetAttachConfig(); instance.EnableImpactsToOther.Add(attach_config.AttachImpact); instance.EnableImpactsToOther.Add(attach_config.FallImpact); instance.EnableImpactsToOther.Add(attach_config.FinalImpact); instance.Resources.Add(m_ColliderInfo.Prefab); }
private void SendFinalImpact() { AttachConfig attach_config = m_ColliderInfo.GetAttachConfig(); for (int i = m_AttachedObjects.Count - 1; i >= 0; --i) { AttachTargetInfo ati = m_AttachedObjects[i]; if (ati.ParentObj != null) { //Debug.Log("---FinalImpact: send " + attach_config.FinalImpact + " to " + ati.TargetObj.name); m_DamageManager.SendImpactToObject(m_DamageManager.GetOwner(), ati.TargetObj, attach_config.FinalImpact, attach_config.FinalImpactTime, m_OwnSkill.SkillId, 0); } } }
private void UpdateAttachObjects() { AttachConfig attach_config = m_ColliderInfo.GetAttachConfig(); for (int i = m_AttachedObjects.Count - 1; i >= 0; --i) { AttachTargetInfo ati = m_AttachedObjects[i]; if (ati.ParentObj != null) { if (!UpdateAttachTargetPos(ati)) { m_AttachedObjects.RemoveAt(i); //Debug.Log("---FallImpact: send to " + ati.TargetObj.name); m_DamageManager.SendImpactToObject(m_DamageManager.GetOwner(), ati.TargetObj, attach_config.FallImpact, attach_config.FallImpactTime, m_OwnSkill.SkillId, 0); } } } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMicrosoftIdentityWebApiAuthentication(Configuration, subscribeToJwtBearerMiddlewareDiagnosticsEvents: true) .EnableTokenAcquisitionToCallDownstreamApi() .AddInMemoryTokenCaches(); services.Configure <JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme, options => { // The valid audiences are both the Client ID (options.Audience) and api://{ClientID} options.TokenValidationParameters.ValidAudiences = new string[] { options.Audience, $"api://{options.Audience}", $"https://{options.Audience}" }; }); services.AddScoped <UserInfo>(); // grabbing current userInfo services.AddHttpContextAccessor(); // outside api calls [OBO] services.AddHttpClient(); services.AddMvc(opt => { opt.Filters.Add(typeof(ValidatorActionFilter)); }).AddFluentValidation(fvc => fvc.RegisterValidatorsFromAssemblyContaining <Startup>()); services.AddControllers(); services.AddAuthorization(config => { config.AddPolicy("OnlineFormOnly", policy => policy.RequireRole("Lookup.Get") .RequireRole("Form.Create")); }); services.AddSwaggerGen(c => { c.CustomOperationIds(apiDesc => { return(apiDesc.TryGetMethodInfo(out MethodInfo methodInfo) ? methodInfo.Name : null); }); c.SwaggerDoc("v1", new OpenApiInfo { Title = "SIMS incident/signals management API", Version = "v1" }); c.EnableAnnotations(); }); services.Configure <IISServerOptions>(options => { options.MaxRequestBodySize = int.MaxValue; }); services.Configure <FormOptions>(x => { x.ValueLengthLimit = int.MaxValue; x.MultipartBodyLengthLimit = int.MaxValue; // if don't set default value is: 128 MB x.MultipartHeadersLengthLimit = int.MaxValue; }); services.AddScoped <X509Certificate2>((o) => new X509Certificate2(Convert.FromBase64String(Configuration["SharePointAccess"]))); services.AddAutoMapper((cfg) => { cfg.AddProfile <SimsDbMappingProfile>(); cfg.AddProfile <WebMappingProfile>(); cfg.AddCollectionMappers(); }); var simsConn = Configuration.GetConnectionString("SIMSDbConn"); services.AddDbContext <SimsDbContext>((provider, opts) => opts .UseSqlServer(simsConn, (d) => { d.EnableRetryOnFailure(15); d.CommandTimeout(100); }) .UseInternalServiceProvider(provider)); services.AddEntityFrameworkSqlServer(); services.RegisterTemporalTablesForDatabase <SimsDbContext>(); services.AddScoped <ISIMSApplication, SimsManangement>((srv) => { var db = srv.GetRequiredService <SimsDbContext>(); var map = srv.GetRequiredService <IMapper>(); var userInfo = srv.GetRequiredService <UserInfo>(); var attachments = srv.GetRequiredService <ISIMSAttachmentHost>(); return(new SimsManangement(db, map, attachments, userInfo.GetUserId(), srv.GetRequiredService <ILoggerFactory>())); }); services.AddScoped <ISIMSAttachmentHost, SimsAttachments>((o) => { var user = o.GetRequiredService <UserInfo>(); var conf = o.GetRequiredService <IConfiguration>(); var section = conf.GetSection("AzureAd"); var sharePoint = conf.GetSection("SharePoint"); var cert = o.GetRequiredService <X509Certificate2>(); var incidentAttach = new AttachConfig { ContentTypeId = sharePoint["SimsDocCType"], SiteUrl = $"https://{sharePoint["HostSiteCol"]}/{sharePoint["DocSiteUrl"]}" }; var signalsAttach = new AttachConfig { ContentTypeId = sharePoint["SimsDocCType"], SiteUrl = $"https://{sharePoint["HostSiteCol"]}/{sharePoint["DocSiteUrl"]}" }; return(new SimsAttachments(section["ClientId"], user.GetTenantId(), cert, sharePoint["HostSiteCol"], incidentAttach, signalsAttach)); }); }