Ejemplo n.º 1
0
        public CommentDeleter(ICreatesValidators <DeleteCommentRequest> validatorFactory,
                              IGetsTransaction transactionCreator,
                              IEntityData data,
                              Func <IValidationResult, DeleteCommentResponse> responseCreator)
        {
            if (responseCreator == null)
            {
                throw new ArgumentNullException(nameof(responseCreator));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (transactionCreator == null)
            {
                throw new ArgumentNullException(nameof(transactionCreator));
            }
            if (validatorFactory == null)
            {
                throw new ArgumentNullException(nameof(validatorFactory));
            }

            this.validatorFactory   = validatorFactory;
            this.transactionCreator = transactionCreator;
            this.data            = data;
            this.responseCreator = responseCreator;
        }
Ejemplo n.º 2
0
 public CommentEditor(ICreatesValidators <EditCommentRequest> validatorFactory,
                      Func <IValidationResult, EditCommentResponse> responseCreator,
                      IGetsTransaction transactionCreator,
                      IEntityData commentRepo,
                      IEnvironment environment)
 {
     if (environment == null)
     {
         throw new ArgumentNullException(nameof(environment));
     }
     if (commentRepo == null)
     {
         throw new ArgumentNullException(nameof(commentRepo));
     }
     if (transactionCreator == null)
     {
         throw new ArgumentNullException(nameof(transactionCreator));
     }
     if (responseCreator == null)
     {
         throw new ArgumentNullException(nameof(responseCreator));
     }
     if (validatorFactory == null)
     {
         throw new ArgumentNullException(nameof(validatorFactory));
     }
     this.validatorFactory   = validatorFactory;
     this.responseCreator    = responseCreator;
     this.transactionCreator = transactionCreator;
     this.commentRepo        = commentRepo;
     this.environment        = environment;
 }
Ejemplo n.º 3
0
        public override void SetData(IEntityData data)
        {
            _data = (HeroData)data;
            base.SetData(data);
            if (data == null)
            {
                return;
            }

            gameObject.name = _data.Name + " (Hero)";

            var mr = gameObject.GetComponentInChildren <MeshRenderer>();

            if (mr != null)
            {
                mr.material = _data.Mat;
            }

            _abilitiable = new Abilitiable(gameObject, _data);
            _armorable   = new Armorable(_data);

            _attackable   = new Attackable(gameObject);
            _attackerable = new Attackerable(gameObject, _data);

            _healthable = new Healthable(gameObject, _data);

            _magicable = new Magicable(gameObject, _data);
            _movable   = new Movable(gameObject, _data);
            _events    = new MiscEvent();

            _jobSystem = new JobSystem(gameObject);

            _teamable = new Teamable(gameObject);
        }
Ejemplo n.º 4
0
        private int GetImgIndex(IEntityData entityData)
        {
            int imgageIndex = 0;

            if (entityData is ProjectData)
            {
                imgageIndex = 0;
            }
            else if (entityData is GroupData)
            {
                imgageIndex = 1;
            }
            else if (entityData is IAssetsData)
            {
                AssetsData assetsData = entityData as AssetsData;
                if (assetsData.MainProduct.Contains("油"))
                {
                    imgageIndex = 4;
                }
                else
                {
                    imgageIndex = 5;
                }
            }

            return(imgageIndex);
        }
Ejemplo n.º 5
0
        public SprintEditor(IEntityData sprintRepo,
                            IGetsTransaction transactionFactory,
                            ICreatesValidators <EditSprintRequest> validatorFactory,
                            Func <IValidationResult, Sprint, EditSprintResponse> responseCreator,
                            IMapper mapper)
        {
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }
            if (responseCreator == null)
            {
                throw new ArgumentNullException(nameof(responseCreator));
            }
            if (validatorFactory == null)
            {
                throw new ArgumentNullException(nameof(validatorFactory));
            }
            if (transactionFactory == null)
            {
                throw new ArgumentNullException(nameof(transactionFactory));
            }
            if (sprintRepo == null)
            {
                throw new ArgumentNullException(nameof(sprintRepo));
            }

            this.mapper             = mapper;
            this.responseCreator    = responseCreator;
            this.validatorFactory   = validatorFactory;
            this.transactionFactory = transactionFactory;
            this.sprintRepo         = sprintRepo;
        }
Ejemplo n.º 6
0
        public void InitFrom(DecParams decParams, List <AssetsData> lstAssetsData, IEntityData entityData)
        {
            if (this.decParams != decParams)
            {
                this.decParams = decParams;
            }
            if (this.lstAssetsData != lstAssetsData)
            {
                this.lstAssetsData = lstAssetsData;
            }
            if (this.entityData != entityData)
            {
                this.entityData = entityData;
            }
            this.Text = entityData.Text + "预测产量";

            if (entityData != lstAssetsData[0])
            {
                this.tsbSave.Visible = false;
                this.treeHeadDataGridView1.ReadOnly = true;
            }
            else
            {
                this.tsbSave.Visible = true;
                this.treeHeadDataGridView1.ReadOnly = false;
            }
            unitType = UnitType.CnUnit;
            InitUnit(UnitType.CnUnit);
        }
Ejemplo n.º 7
0
    public void FindTarget(InputData input)
    {
        IEntityData nearestTarget = default(IEntityData);
        float       minDistance   = float.MaxValue;

        foreach (var e in LevelController.Instance.EntitiesCollection.OtherEntities)
        {
            if (e.Base.ThisGameObject == ThisGameObject)
            {
                continue;
            }

            var distance = (e.Base.ThisTransform.position - ThisTransform.position).sqrMagnitude;

            if (distance < minDistance)
            {
                minDistance   = distance;
                nearestTarget = e;
            }
        }

        if (_target != nearestTarget)
        {
            _target = nearestTarget;

            Broadcaster.Instance.Invoke(BroadcasterEvents.TargetFounded, _target);
        }
    }
Ejemplo n.º 8
0
        public SimpleSampleProject(IEntityData repo,
                                   IGetsTransaction transactionCreator,
                                   IGetsUserByUsername userQuery,
                                   IUserCreator userCreator)
        {
            if (userCreator == null)
            {
                throw new ArgumentNullException(nameof(userCreator));
            }
            if (transactionCreator == null)
            {
                throw new ArgumentNullException(nameof(transactionCreator));
            }
            if (repo == null)
            {
                throw new ArgumentNullException(nameof(repo));
            }
            if (userQuery == null)
            {
                throw new ArgumentNullException(nameof(userQuery));
            }

            this.transactionCreator = transactionCreator;
            this.repo        = repo;
            this.userQuery   = userQuery;
            this.userCreator = userCreator;
        }
        public void GetLabels_returns_labels_in_relevance_order([Frozen, InMemory] IEntityData entityData,
                                                                LabelsMatchingSearchByRelevanceSearcher sut,
                                                                Label label1,
                                                                Label label2,
                                                                Label label3,
                                                                Label label4)
        {
            // Arrange
            label1.Name = "Element";
            label2.Name = "Elemental";
            label3.Name = "Fire Elemental";
            label4.Name = "Zebra";
            entityData.Add(label4);
            entityData.Add(label3);
            entityData.Add(label1);
            entityData.Add(label2);

            // Act
            var result = sut.GetLabels("Element");

            // Assert
            var labelNames = result.Select(x => x.Name).ToArray();

            Assert.That(labelNames, Is.EqualTo(new [] { "Element", "Elemental", "Fire Elemental" }));
        }
        public PersistingTicketFactoryDecorator(ICreatesTicket wrappedInstance,
                                                IGetsTransaction transactionFactory,
                                                IEntityData data,
                                                ILog logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (transactionFactory == null)
            {
                throw new ArgumentNullException(nameof(transactionFactory));
            }
            if (wrappedInstance == null)
            {
                throw new ArgumentNullException(nameof(wrappedInstance));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            this.wrappedInstance    = wrappedInstance;
            this.transactionFactory = transactionFactory;
            this.data   = data;
            this.logger = logger;
        }
Ejemplo n.º 11
0
        public EditTicketRequestHandler(IEntityData ticketRepo,
                                        IGetsTransaction transactionFactory,
                                        ICreatesValidators <EditTicketRequest> validatorFactory,
                                        ICreatesEditTicketResponse responseCreator,
                                        IEditsTicket editor,
                                        ILog logger)
        {
            if (editor == null)
            {
                throw new ArgumentNullException(nameof(editor));
            }
            if (responseCreator == null)
            {
                throw new ArgumentNullException(nameof(responseCreator));
            }
            if (validatorFactory == null)
            {
                throw new ArgumentNullException(nameof(validatorFactory));
            }
            if (transactionFactory == null)
            {
                throw new ArgumentNullException(nameof(transactionFactory));
            }
            if (ticketRepo == null)
            {
                throw new ArgumentNullException(nameof(ticketRepo));
            }

            this.ticketRepo         = ticketRepo;
            this.transactionFactory = transactionFactory;
            this.validatorFactory   = validatorFactory;
            this.responseCreator    = responseCreator;
            this.editor             = editor;
            this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
        }
Ejemplo n.º 12
0
        public void GetSprints_returns_only_open_sprints_when_request_is_default([Frozen, InMemory] IEntityData query,
                                                                                 [Frozen, HardCodedSpec] ISpecForSprintInProject sprintSpec,
                                                                                 [Frozen] ISpecForOpenSprint openSprintSpec,
                                                                                 [Frozen, HardCodedSpec] ISpecForClosedSprint closedSprintSpec,
                                                                                 SprintLister sut,
                                                                                 [HasIdentity] Sprint sprintOne,
                                                                                 [HasIdentity] Sprint sprintTwo,
                                                                                 [HasIdentity] Sprint sprintThree)
        {
            // Arrange
            sprintOne.Closed   = false;
            sprintTwo.Closed   = true;
            sprintThree.Closed = false;
            query.Add(sprintOne);
            query.Add(sprintTwo);
            query.Add(sprintThree);

            var expected = new[] { sprintOne, sprintThree };

            Mock.Get(openSprintSpec).Setup(x => x.GetExpression()).Returns(x => !x.Closed);

            // Act
            var result = sut.GetSprints(new ListSprintsRequest());

            // Assert
            Assert.That(result, Is.EquivalentTo(expected));
        }
Ejemplo n.º 13
0
        public void GetSprints_orders_sprints_by_start_dates_when_present([Frozen, InMemory] IEntityData query,
                                                                          [Frozen, HardCodedSpec] ISpecForSprintInProject sprintSpec,
                                                                          [Frozen, HardCodedSpec] ISpecForOpenSprint openSprintSpec,
                                                                          [Frozen, HardCodedSpec] ISpecForClosedSprint closedSprintSpec,
                                                                          SprintLister sut,
                                                                          [HasIdentity] Sprint sprintOne,
                                                                          [HasIdentity] Sprint sprintTwo,
                                                                          [HasIdentity] Sprint sprintThree)
        {
            // Arrange
            sprintOne.StartDate   = new DateTime(2011, 1, 1);
            sprintTwo.StartDate   = new DateTime(2010, 1, 1);
            sprintThree.StartDate = new DateTime(2012, 1, 1);
            query.Add(sprintOne);
            query.Add(sprintTwo);
            query.Add(sprintThree);

            var expected = new[] { sprintTwo, sprintOne, sprintThree };

            var request = new ListSprintsRequest {
                ShowOpenSprints   = true,
                ShowClosedSprints = true,
            };

            // Act
            var result = sut.GetSprints(request);

            // Assert
            Assert.That(result, Is.EqualTo(expected));
        }
Ejemplo n.º 14
0
 public TicketDetailService(IEntityData repo)
 {
     if (repo == null)
     {
         throw new ArgumentNullException(nameof(repo));
     }
     this.repo = repo;
 }
Ejemplo n.º 15
0
 public CommentReader(IEntityData commentRepo)
 {
     if (commentRepo == null)
     {
         throw new ArgumentNullException(nameof(commentRepo));
     }
     this.commentRepo = commentRepo;
 }
Ejemplo n.º 16
0
 public virtual void SetData(IEntityData data)
 {
     gameObject.SetActive(data != null); //If we set null, something is wrong, raise a warning
     if (data == null)
     {
         Debug.LogWarning("Data is null, disabling gameObject.");
     }
 }
Ejemplo n.º 17
0
 public ProjectEditor(IMapper mapper,
                      IEntityData data,
                      Func <EditProjectResponse> responseFactory)
 {
     this.mapper          = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.data            = data ?? throw new ArgumentNullException(nameof(data));
     this.responseFactory = responseFactory ?? throw new ArgumentNullException(nameof(responseFactory));
 }
Ejemplo n.º 18
0
 public AvailableRelationshipProvider(IEntityData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     this.data = data;
 }
Ejemplo n.º 19
0
 public EntityMustExistRule(IEntityData repository)
 {
     if (repository == null)
     {
         throw new ArgumentNullException(nameof(repository));
     }
     this.repository = repository;
 }
Ejemplo n.º 20
0
 public UserQueryByUsername(IEntityData repo)
 {
     if (repo == null)
     {
         throw new ArgumentNullException(nameof(repo));
     }
     this.repo = repo;
 }
Ejemplo n.º 21
0
 public ExistingLabelReader(IEntityData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     this.data = data;
 }
Ejemplo n.º 22
0
 public CurrentlyChosenProjectDecorator(IGetsCurrentProject wrapped,
                                        IAppSessionStore session,
                                        IEntityData data)
 {
     this.wrapped = wrapped ?? throw new ArgumentNullException(nameof(wrapped));
     this.session = session ?? throw new ArgumentNullException(nameof(session));
     this.data    = data ?? throw new ArgumentNullException(nameof(data));
 }
Ejemplo n.º 23
0
 private void FullySetupLoggedInUser(User user,
                                     ICurrentUserInfo userInfo,
                                     IEntityData query,
                                     IIdentityReader identityReader)
 {
     SetupCurrentUserIdentity(user, userInfo, identityReader);
     query.Add(user);
 }
Ejemplo n.º 24
0
 public TicketTypeProvider(IEntityData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     this.data = data;
 }
Ejemplo n.º 25
0
        public UserCredentialsRepository(IEntityData query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            this.query = query;
        }
Ejemplo n.º 26
0
    private void OnEntityKilled(object[] obj)
    {
        IEntityData entity = (IEntityData)obj[0];

        if (entity == _target)
        {
            _target = null;
        }
    }
Ejemplo n.º 27
0
        //获取标题名称
        private string GetText(IEntityData entity, SortInfoQueue SortList)
        {
            IAssetsData assetsData = entity as IAssetsData;

            if (assetsData == null)
            {
                return(entity.Text);
            }
            return(assetsData.GetText(SortList));
        }
Ejemplo n.º 28
0
        public ExistingLabelProvider(IEntityData entityData,
                                     IParsesLabelNames labelNameParser) : base(labelNameParser)
        {
            if (entityData == null)
            {
                throw new ArgumentNullException(nameof(entityData));
            }

            this.entityData = entityData;
        }
Ejemplo n.º 29
0
        private Color GetForeColor(IEntityData entityData)
        {
            AssetsData x = entityData as AssetsData;

            if (x != null)
            {
                return(dtData.Select("dydm='" + x.ID + "'").Length > 0 ? Color.Black : Color.Blue);
            }
            return(Color.Black);
        }
Ejemplo n.º 30
0
        private void AddControl(IEntityData item)
        {
            FontMousePanel fmp1 = new FontMousePanel();

            fmp1.Tag      = item;
            fmp1.Dock     = DockStyle.Left;
            fmp1.KeyWorld = item.Text;
            fmp1.Click   -= fmp1_Click;
            fmp1.Click   += fmp1_Click;
            this.Controls.Add(fmp1);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityViewModel"/> class.
 /// </summary>
 /// <param name="contextViewModel">The owning <see cref="ContextViewModel"/>.</param>
 /// <param name="entityData">The shared <see cref="IEntityData"/> state.</param>
 public EntityViewModel(ContextViewModel contextViewModel, IEntityData entityData)
 {
     this._contextViewModel = contextViewModel;
     this._entityData = entityData;
 }