/// <inheritdoc />
        public override void Register(IServiceRegister register)
        {
            LoginDetailsSceneData details = GameObject.FindObjectOfType <LoginDetailsSceneData>();

            //TODO: Should we throw? Or log? It might be more informative for the container
            //to say it doesn't have it and log the component requring it.
            if (details == null)
            {
                return;
            }

            register.RegisterInstance <LoginDetailsSceneData, IUserAuthenticationDetailsContainer>(details);
        }
        /// <inheritdoc />
        public override void Register(IServiceRegister register)
        {
            //https://stackoverflow.com/questions/4926676/mono-https-webrequest-fails-with-the-authentication-or-decryption-has-failed
            ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

            IAuthenticationService authService = TypeSafeHttpBuilder <IAuthenticationService> .Create()
                                                 .RegisterDefaultSerializers()
                                                 .RegisterJsonNetSerializer()
                                                 .RegisterDotNetHttpClient(GetDeclaredServiceUrl("AuthenticationService")) //TODO: Central the naming of these services
                                                 .Build();

            //TODO: Adjust registeration
            register.RegisterInstance <IAuthenticationService, IAuthenticationService>(authService);
        }
        //TODO: Enable this once we use actual seperate gameservers
        //PlayerPrefs.HasKey(PlayerPreferences.GameServerIp.ToString()) && PlayerPrefs.HasKey(PlayerPreferences.GameServerPort.ToString());

        /// <inheritdoc />
        public override void Register(IServiceRegister register)
        {
            if (hasStoredGameServer)
            {
                //We need to know where the server is first. We can't ask the discovery service.
                register.RegisterInstance <IGameServerMediatorService, IGameServerMediatorService>(TypeSafeHttpBuilder <IGameServerMediatorService> .Create()
                                                                                                   .RegisterDefaultSerializers()
                                                                                                   .RegisterJsonNetSerializer()
                                                                                                   .RegisterDotNetHttpClient(GenerateGameServerMediatorUrl())
                                                                                                   .Build());
            }
            else
            {
                throw new InvalidOperationException($"Failed to load gameserver from {nameof(PlayerPrefs)}");
            }
        }
示例#4
0
 public virtual void InitializeServices(IServiceRegister register)
 {
     register
     .RegisterInstance(Messenger.Default)
     .RegisterType <IEFRepository <ExamCar>, EFRepositoryBase <ExamCar> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ExamStudent>, EFRepositoryBase <ExamStudent> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <User>, EFRepositoryBase <User> >(LifetimeScope.Singleton)
     .RegisterType <ILoginService, LoginService>(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ExamRecord>, EFRepositoryBase <ExamRecord> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ExamBreakeRuleRecord>, EFRepositoryBase <ExamBreakeRuleRecord> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ExamItem>, EFRepositoryBase <ExamItem> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ProjectThrough>, EFRepositoryBase <ProjectThrough> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <ExamCapture>, EFRepositoryBase <ExamCapture> >(LifetimeScope.Singleton)
     .RegisterType <IEFRepository <DeductionRule>, EFRepositoryBase <DeductionRule> >(LifetimeScope.Singleton)
     .RegisterType <HSJXEntities, HSJXEntities>(LifetimeScope.Singleton)
     .RegisterType <IExamService, ExamService>(LifetimeScope.Singleton);
 }