示例#1
0
 public ItemFactory(CitadelObtainer citadelObtainer, BlueprintService blueprintService, Func<int, string> getItemNameFunc, Func<string, int> getItemIdFunc, MaterialsService materialsService)
 {
     _citadelObtainer = citadelObtainer;
     _blueprintService = blueprintService;
     _getItemNameFunc = getItemNameFunc;
     _getItemIdFunc = getItemIdFunc;
     _materialsService = materialsService;
 }
示例#2
0
    public JoinGameCommandSystem(Contexts contexts) : base(contexts.command)
    {
        m_blueprintService = Services.Get <BlueprintService>();
        m_entityIdService  = Services.Get <EntityIdService>();

        m_contexts = contexts;
        m_commands = contexts.command.GetGroup(CommandMatcher.JoinGameCommand);
    }
示例#3
0
        public BlueprintWorkspaceViewModel(string blueprintURI, BlueprintService service)
        {
            counter++;

            _blueprint = service;
            Init(blueprintURI);

            DisplayName = _blueprint.BlueprintName;
            Mass        = _blueprint.Mass > 100000 ? $"{(_blueprint.Mass / 1000):#,##0.00} tons" : $"{_blueprint.Mass:#,##0.00} kg";
        }
示例#4
0
        void InitServices()
        {
            Services.Add <ILogService>(new LogService());

            var viewService = new ViewService(Contexts.sharedInstance);

            Services.Add(viewService);
            Services.Add <ITimeService>(new TimeService());
            Services.Add(new EntityIdService());

            // blueprint service
            var blueprintService = new BlueprintService(new JsonBlueprints());
            var text             = Resources.Load <TextAsset>("blueprints");

            blueprintService.AddBlueprints(text.bytes);
            Resources.UnloadAsset(text);
            Services.Add(blueprintService);
        }
        public void Initialize(string serialId, UicProject project, List <EmbeddedDriverModule> edms)
        {
            WebApiRequestExecutor       webApiRequestExecutor  = new WebApiRequestExecutor();
            M2mgoUserTokenWebApiWrapper userTokenWebApiWrapper = new M2mgoUserTokenWebApiWrapper(_serializer, webApiRequestExecutor, _loggerFactory.GetLoggerFor(typeof(M2mgoUserTokenWebApiWrapper)));
            var m2MgoGatewayProjectWebApiWrapper     = new M2mgoGatewayProjectWebApiWrapper(_serializer, _loggerFactory, webApiRequestExecutor, userTokenWebApiWrapper);
            M2MgoProjectTranslator projectTranslator = new M2MgoProjectTranslator();
            var gatewayService = new GatewayService(m2MgoGatewayProjectWebApiWrapper, _loggerFactory.GetLoggerFor(typeof(GatewayService)), _serializer, projectTranslator);

            M2mgoGetwayProjectDto gatewayProject = gatewayService.RegisterProject(_configuration, serialId, project);

            M2mgoDeviceWebApiWrapper        apiWrapper          = new M2mgoDeviceWebApiWrapper(_serializer, webApiRequestExecutor, _loggerFactory.GetLoggerFor(typeof(M2mgoDeviceWebApiWrapper)), userTokenWebApiWrapper);
            M2mgoGatewayBlueprintTranslator blueprintTranslator = new M2mgoGatewayBlueprintTranslator(projectTranslator);

            _m2MgoProjectBlueprintTranslator = new M2MgoProjectBlueprintTranslator(project, edms);
            var blueprintService = new BlueprintService(apiWrapper, _loggerFactory.GetLoggerFor(typeof(BlueprintService)), blueprintTranslator, _m2MgoProjectBlueprintTranslator, projectTranslator, m2MgoGatewayProjectWebApiWrapper);

            _applianceBlueprints = blueprintService.SynchronizeWithCloud(_configuration, serialId, project, gatewayProject);

            _projectDataTopic      = new DataTopic(_applianceBlueprints.ProjectBlueprint.Identifier.ID, serialId);
            _projectAttributeTopic = new AttributeTopic(_applianceBlueprints.ProjectBlueprint.Identifier.ID, serialId);
            _gatewayDataTopic      = new DataTopic(_applianceBlueprints.GatewayBlueprint.Identifier.ID, serialId);
        }
示例#6
0
 public ShootCommandSystem(Contexts contexts) : base(contexts.command)
 {
     m_blueprintService = Services.Get <BlueprintService>();
     m_contexts         = contexts;
     m_commands         = contexts.command.GetGroup(CommandMatcher.ShootCommand);
 }
示例#7
0
 public Item WithOneDqBuildStrategy(Func <int, int, Task <Item> > buildFunc, BlueprintService blueprintService, MaterialsService materialsService)
 {
     _obtainingStrategies.Add(BuildLocalOneItemStrategy.Build(this, buildFunc, blueprintService, materialsService));
     return(this);
 }
        public static Strategy Build(Item item, Func <int, int, Task <Item> > buildFunc, BlueprintService blueprintService, MaterialsService materialsService)
        {
            if (!blueprintService.ItemHasBlueprint(item.Id))
            {
                return(new NullObtainingStrategy(item));
            }

            return(new BuildLocalOneItemStrategy(item, buildFunc, blueprintService, materialsService));
        }
 private BuildLocalOneItemStrategy(Item item, Func <int, int, Task <Item> > buildFunc, BlueprintService blueprintService, MaterialsService materialsService) : base(item)
 {
     _buildFunc        = buildFunc;
     _materialsService = materialsService;
     _components       = blueprintService.GetComponentsWithMultipleRuns(item.Id, item.Amount, 0.9);
 }