Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="action"></param>
        /// <param name="user"></param>
        public UserInfo(EntityAction action, User user)
        {
            InitializeComponent();

            entityAction   = action;
            this.dataLogic = new FileDb();
            GridHelper.InitializeGrid <Address>(dgvAddresses);

            User = user;

            if (action == EntityAction.Edit)
            {
                PopulateInfo();
            }
            else
            {
                User            = new User();
                User.PrimaryKey = Guid.NewGuid();
            }

            if (User.Addresses == null)
            {
                User.Addresses = new List <Address>();
            }
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Action = (EntityAction) reader.ReadByte();

            return this;
        }
        public Task ValidateAccessToEntityAsync(
            ITenantEntity entity, EntityAction desiredAction)
        {
            if (null == entity)
            {
                return(Task.CompletedTask);
            }

            // this call may throw exception if the user doesn't have
            // the validated TenantId claim
            var _userTenantId = _tenantIdProvider.GetTenantId();

            if (TenantSpec.BelongsToSite(_userTenantId))
            {
                // simple tenant access (no permissions)
                // 'site user' can access entities within any tenant
                // for the purposes of administration
                return(Task.CompletedTask);
            }
            if (_userTenantId != entity.TenantId)
            {
                var message =
                    $"User belonging to tenant {_userTenantId} has been denied access " +
                    $"to entity '{entity.GetType().Name}' belonging to tenant {entity.TenantId}";
                throw new UnauthorizedAccessException(message);
            }
            return(Task.CompletedTask);
        }
Exemplo n.º 4
0
        public SchoolYearScoreEditor(string schoolYear, string gradeyear, string refStudentID)
        {
            InitializeComponent();
            _StudentID = refStudentID;
            beforeXml.AddElement("SubjectGradeYear");
            afterXml.AddElement("SubjectGradeYear");
            beforeXml.AddElement("SubjectCollection");
            beforeXml.AddElement("EntryCollection");
            afterXml.AddElement("SubjectCollection");
            afterXml.AddElement("EntryCollection");
            entityAction = EntityAction.Update;
            comboBoxEx3.Items.AddRange(new object[] { "1", "2", "3", "4" });

            //2019/7/10 - 原本顯示身分證號,但是應該顯示學號 by俊威,佳樺
            labelX10.Text = Student.Instance.Items[_StudentID].StudentNumber + "  " + Student.Instance.Items[_StudentID].Name;

            this.comboBoxEx1.Text = schoolYear;
            this.comboBoxEx3.Text = gradeyear;
            comboBoxEx1.Enabled   = false;
            ReLoad(null, null);
            ValidateAll();

            btnSave.Visible         = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            dataGridViewX1.ReadOnly = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            comboBoxEx1.Enabled     = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            comboBoxEx3.Enabled     = CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX1.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX2.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX3.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX4.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX5.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX6.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
            textBoxX7.ReadOnly      = !CurrentUser.Acl[SemesterScorePalmerworm.FeatureCode].Editable;
        }
Exemplo n.º 5
0
        public void InvokeEntityActionCorrectly(EntityAction actionToInvoke)
        {
            // Arrange
            EntityAction testAction     = actionToInvoke;
            BIWEntity    testEntity     = new BIWEntity();
            BIWEntity    returnedEntity = null;

            switch (actionToInvoke)
            {
            case EntityAction.SELECT:

                inspectorController.OnEntityClick += (entity) => { returnedEntity = entity; };
                break;

            case EntityAction.LOCK:

                inspectorController.OnEntityLock += (entity) => { returnedEntity = entity; };
                break;

            case EntityAction.DELETE:

                inspectorController.OnEntityDelete += (entity) => { returnedEntity = entity; };
                break;

            case EntityAction.SHOW:
                inspectorController.OnEntityChangeVisibility += (entity) => { returnedEntity = entity; };
                break;
            }

            // Act
            inspectorController.EntityActionInvoked(testAction, testEntity, null);

            // Assert
            Assert.AreEqual(testEntity, returnedEntity, "The entity does not match!");
        }
Exemplo n.º 6
0
        public Task ValidateAccessToEntityAsync(
            ITenantEntity entity, EntityAction desiredAction)
        {
            if (null == entity)
            {
                return(Task.CompletedTask);
            }

            var userTenantId = _tenantIdProvider.GetTenantId();

            if (TenantSpec.BelongsToSite(userTenantId))
            {
                // simplistic access rules for prototype phase:
                // 'site user' can access any tenant
                // for the purposes of administration
                return(Task.CompletedTask);
            }

            // non-'site user'
            if (userTenantId != entity.TenantId)
            {
                string message = BuildAccessDeniedMessage(entity, desiredAction);
                throw new UnauthorizedAccessException(message);
            }

            // 'tenant user' can perform any modification read its own tenant information
            if (desiredAction != EntityAction.Read)
            {
                string message = BuildAccessDeniedMessage(entity, desiredAction);
                throw new UnauthorizedAccessException(message);
            }
            return(Task.CompletedTask);
        }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        if (m_state != EntityState.Alive)
        {
            return;
        }

        if (m_currentAction != null)
        {
            m_currentAction.Update();

            if (m_currentAction.IsComplete())
            {
                m_currentAction.End();
                m_currentAction = null;

                if (m_actionQueue.Count > 0)
                {
                    m_currentAction = m_actionQueue.Dequeue();
                    m_currentAction.Start();
                }
            }
        }
        else
        {
            if (m_actionQueue.Count > 0)
            {
                m_currentAction = m_actionQueue.Dequeue();
                m_currentAction.Start();
            }
        }
    }
 /// <summary>
 /// Create an instance of this class.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="entityAction"></param>
 /// <param name="actionEventArgs"></param>
 protected EntityChangeEventArgs(IEntity entity, EntityAction entityAction, EventArgs actionEventArgs = null)
     : base()
 {
     Entity          = entity;
     Action          = entityAction;
     ActionEventArgs = actionEventArgs ?? EventArgs.Empty;
 }
Exemplo n.º 9
0
 void UpdateRoll(Vector3 V)
 {
     if (this.CheckButtonDown(this._rollButton) && V.sqrMagnitude > 0.001f)
     {
         EntityAction.ActionData freeData = this.GetFreeData();
         freeData.dir = V.normalized;
         if (this._player.DoAction("roll", freeData))
         {
             this.rollAction = this._player.GetAction("roll");
         }
     }
     else if (this.rollAction != null)
     {
         if (this.rollAction.IsReleasable() && !this.CheckButtonPressed(this._rollButton))
         {
             this.rollAction.ReleaseAction();
         }
         if (this.rollAction.IsActive)
         {
             if (V.sqrMagnitude > 0.001f)
             {
                 EntityAction.ActionData freeData2 = this.GetFreeData();
                 freeData2.dir = V.normalized;
                 this.rollAction.UpdateData(freeData2);
             }
         }
         else
         {
             this.rollAction = null;
         }
     }
 }
Exemplo n.º 10
0
        public ProcessResult WaitInvoke <T>(EntityAction <T> action)
            where T : Entity
        {
            InvokeResult invokeResult = Invoke(action);

            while (true)
            {
                ProcessResult processResult = GetProcessStatus(invokeResult);

                System.Threading.Thread.Sleep(100);

                switch (processResult.Status)
                {
                case ProcessStatus.NotExists:
                case ProcessStatus.Aborted:
                    throw new SystemException("Process status: " +
                                              processResult.Status + "; Error: " +
                                              processResult.Message);

                case ProcessStatus.Completed:
                case ProcessStatus.OK:
                    return(processResult);

                case ProcessStatus.InProcess:
                    if (processResult.Seconds > 30)
                    {
                        throw new TimeoutException();
                    }
                    continue;

                default:
                    throw new InvalidOperationException();
                }
            }
        }
Exemplo n.º 11
0
 public void DOAction(EntityAction action)
 {
     if (handlers.TryGetValue(action.GetType(), out IActionHandler handler))
     {
         handler.OnAction(action);
     }
 }
Exemplo n.º 12
0
 private string BuildAccessDeniedMessage(ITenantEntity entity, EntityAction desiredAction)
 {
     // deny the attempt to access a tenant
     // that the user doesn't belong to
     return($"User belonging to tenant {_tenantIdProvider.GetTenantId()} has been denied '{desiredAction}' access " +
            $"to entity '{entity.GetType().Name}' belonging to tenant {entity.TenantId}");
 }
Exemplo n.º 13
0
    ActionResult?CheckFrameAction(EntityState aEntityState)
    {
        if (aEntityState.mobData?.canFall != true)
        {
            return(null);
        }
        EntityAction currentEntityAction = this.stateMachine.GetState() as EntityAction;

        Debug.Assert(currentEntityAction != null);
        if (!currentEntityAction.canBeInterrupted)
        {
            return(null);
        }
        FallAction   fallAction       = new FallAction(this.id);
        ActionResult fallActionResult = fallAction.GetActionResult(GM.boardManager.currentState);

        if (fallActionResult.boardState != null)
        {
            return(fallActionResult);
        }
        ExitAction   exitAction       = new ExitAction(this.id);
        ActionResult exitActionResult = exitAction.GetActionResult(GM.boardManager.currentState);

        if (exitActionResult.boardState != null)
        {
            return(exitActionResult);
        }
        return(null);
    }
Exemplo n.º 14
0
 public void OnAction(EntityAction action)
 {
     if (action is T act)
     {
         DoAction(act);
     }
 }
Exemplo n.º 15
0
        public static EntityAction ReadFrom(System.IO.BinaryReader reader)
        {
            Model.MoveAction?moveAction = null;
            if (reader.ReadBoolean())
            {
                moveAction = Model.MoveAction.ReadFrom(reader);
            }

            Model.BuildAction?buildAction = null;
            if (reader.ReadBoolean())
            {
                buildAction = Model.BuildAction.ReadFrom(reader);
            }

            Model.AttackAction?attackAction = null;
            if (reader.ReadBoolean())
            {
                attackAction = Model.AttackAction.ReadFrom(reader);
            }

            Model.RepairAction?repairAction = null;
            if (reader.ReadBoolean())
            {
                repairAction = Model.RepairAction.ReadFrom(reader);
            }

            var result = new EntityAction(moveAction, buildAction, attackAction, repairAction);

            return(result);
        }
Exemplo n.º 16
0
        public void InvokeEntityActionCorrectly()
        {
            // Arrange
            DCLBuilderInWorldEntity testEntity = new GameObject("_DCLBuilderInWorldEntity").AddComponent <DCLBuilderInWorldEntity>();

            testEntity.entityUniqueId = "testId";
            EntityListAdapter testEntityListAdapter = new GameObject("_EntityListAdapter").AddComponent <EntityListAdapter>();

            testEntity.entityUniqueId = "testId";
            EntityAction            testEntityAction          = EntityAction.SHOW;
            DCLBuilderInWorldEntity returnedEntity            = null;
            EntityListAdapter       returnedEntityListAdapter = null;
            EntityAction            retournedEntityAction     = EntityAction.DELETE;

            inspectorView.OnEntityActionInvoked += (action, entityToApply, adapter) =>
            {
                retournedEntityAction     = action;
                returnedEntity            = entityToApply;
                returnedEntityListAdapter = adapter;
            };

            // Act
            inspectorView.EntityActionInvoked(testEntityAction, testEntity, testEntityListAdapter);

            // Assert
            Assert.AreEqual(testEntity.entityUniqueId, returnedEntity.entityUniqueId, "The entity does not match!!");
            Assert.AreEqual(testEntityListAdapter, returnedEntityListAdapter, "The entity list adapter does not match!!");
            Assert.AreEqual(testEntityAction, retournedEntityAction, "The entity action does not match!!");
        }
Exemplo n.º 17
0
    protected override void OnRecv(Connection connection)
    {
        var entity = BattleManager.Instance.GetEntity(message.id);

        if (entity != null)
        {
            Vector3 pos = new Vector3(message.position.x, 0, message.position.y);


            if (entity.machine != null && entity.machine.current != null &&
                entity.machine.current.type == (int)ActionType.Run)
            {
                var run = entity.machine.current as EntityAction;
                if (run != null)
                {
                    run.AddPathPoint(pos, Vector3.zero, true);
                }
            }


            EntityAction action = ObjectPool.GetInstance <EntityAction>();
            action.skillid  = message.skill;
            action.duration = message.duration;
            action.target   = message.target;
            action.speed    = message.speed;


            entity.PlayAction(ActionType.Attack, action);
        }
    }
Exemplo n.º 18
0
        private void CommandUnitsMelee()
        {
            foreach (var meleeUnit in Around.MyUnitsMelees)
            {
                var moveAction   = new MoveAction();
                var attackAction = new AttackAction();
                var action       = new EntityAction();

                if (Around.Behavior == BehaviorType.Aggressive)
                {
                    var nearestEnemy = Around.GetNearestEntity(meleeUnit.Position, PlayerType.Enemy);
                    moveAction   = new MoveAction(nearestEnemy.Position, true, false);
                    attackAction = new AttackAction(nearestEnemy.Id, null);
                }
                else
                {
                    // var topBuilding = Around.MyBuildings
                    //                         .OrderByDescending(b => b.Position.X + b.Position.Y)
                    //                         .FirstOrDefault();
                    // moveAction = new MoveAction(GetRndPositionAround(topBuilding, false), true, false);
                    moveAction = new MoveAction(meleeUnit.Position, true, false);
                }

                action = new EntityAction(moveAction, null, attackAction, null);

                actions.Add(meleeUnit.Id, action);
            }
        }
Exemplo n.º 19
0
        void INetworkProvider.EntityAction(int entityId, EntityAction action)
        {
            PlayerAction translated;

            switch (action)
            {
            case EntityAction.StartSneaking:
                translated = PlayerAction.StartSneak;
                break;

            case EntityAction.StopSneaking:
                translated = PlayerAction.StopSneak;
                break;

            case EntityAction.StartSprinting:
                translated = PlayerAction.StartSprint;
                break;

            case EntityAction.StopSprinting:
                translated = PlayerAction.StopSprint;
                break;

            default:
                return;
            }

            SendPlayerAction(translated, null, null);
        }
Exemplo n.º 20
0
        public override bool TakeAction(EntityAction entityAction)
        {
            if (!entityAction.IsExecutable)
            {
                return(false);
            }

            // weapon attack
            if (entityAction is WeaponAttack weaponAttack)
            {
                Attack(weaponAttack);
                return(true);
            }

            // cast spell
            if (entityAction is SpellCast spellCast)
            {
                return(Cast(spellCast));
            }

            // move
            if (entityAction is MoveAction moveAction)
            {
                return(Move(moveAction.Destination, true));
            }

            return(false);
        }
Exemplo n.º 21
0
        public EntityAction Delete(int id)
        {
            //Chheck Is Parent
            EntityAction result = rep.Delete(id);

            return(result);
        }
Exemplo n.º 22
0
    public void PlayAnimation(EntityAction action, EntityParamPluginAnimationClip clip)
    {
        if (action == null || clip == null)
        {
            return;
        }
        var animationClip = GetAnimationClip(clip.animationClip);

        if (animationClip == null)
        {
            return;
        }



        if (mCurrentAnimationClip == null ||
            animationClip != mCurrentAnimationClip ||
            animationClip.isLooping == false)
        {
            animator.Play("empty", 0);
            animator.Update(0);
            if (clip.beginAt > 0)
            {
                animator.Play(clip.animationClip, 0, clip.beginAt / animationClip.length);
            }
            else
            {
                animator.CrossFade(clip.animationClip, 0.5f, 0);
            }

            mCurrentAnimationClip = animationClip;

            mParamAnimationClip = clip;
        }
    }
Exemplo n.º 23
0
        private static string GetRelativeUrl(string baseUrl, EntityAction entityAction, EntityUrl entityUrl, bool isPrimaryEntity)
        {
            string relativeUrl = baseUrl;

            if (entityUrl.IsFullPath)
            {
                relativeUrl = entityUrl.URL;
            }
            else if (!isPrimaryEntity || (isPrimaryEntity && string.IsNullOrEmpty(entityAction.EntityKey)))
            {
                // Not Primary: Add Sub URL
                // Primary w/ out ID: Add Sub URL
                relativeUrl += entityUrl.URL;
            }

            if (!string.IsNullOrEmpty(entityAction.EntityKey))
            {
                if (entityAction.EntityKey.Contains("?"))
                {
                    //Note : This is added to build link with search parameters
                    relativeUrl += entityAction.EntityKey;
                }
                else
                {
                    relativeUrl += "/" + entityAction.EntityKey;
                }
            }

            return(relativeUrl);
        }
Exemplo n.º 24
0
        public void Articles_Data_Post_Insert_Test()
        {
            AuthorRefrence author = new AuthorRefrence(lastName: "test",
                                                       name: "test",
                                                       userName: "******"
                                                       );

            author.Id = 1;

            Category cat = new Category(name: "test", slug: "test", isParent: true, lineAge: "");

            cat.Id = 1;

            var model = new Post(title: "Test", sendDate: DateTime.Now,
                                 publishedDate: null, visitCount: 0, content: "test", description: "test", postImage: "test",
                                 slug: "test",
                                 authorId: 1, tagId: 1, categoryId: 1, author: author, category: cat)
            {
                Id = rep.GetNextId()
            };

            uni.BeginTransAction();

            EntityAction result = rep.Create(model);

            Assert.AreEqual(result, EntityAction.Added);
            uni.RollBack();
        }
Exemplo n.º 25
0
        public static void RenderFilter(RenderContext ctx)
        {
            var filter = ctx.Query.Get("Filter");

            if (filter == null)
            {
                return;
            }

            var widgets =
                from property in filter.GetType().GetProperties().Select(x => x.Name)
                let widget = filter.Get(property) as Widget
                             where widget != null
                             select widget;

            if (!widgets.Any())
            {
                return;
            }

            if (ctx.Entity.Actions == null)
            {
                ctx.Entity.Actions = new EntityActionCollection();
            }

            var filterAction = ctx.Entity.Actions.FirstOrDefault(x => x.Name.EqualsIgnoreCase("Filter"));

            if (filterAction == null)
            {
                var filterArgs = Enumerable.Empty <KeyValuePair <string, object> >();
                var href       = QueryPathBuilder.BuildPath(ctx, ctx.Query, ctx.PathTemplate, null, filterArgs);

                // removendo informacao de paginacao
                href = new Route(href).UnsetArgs("limit", "offset");

                filterAction        = new EntityAction();
                filterAction.Name   = "Filters";
                filterAction.Href   = href;
                filterAction.Method = "GET";
                filterAction.Title  = "Filtros";
                ctx.Entity.Actions.Add(filterAction);
            }

            if (filterAction.Fields == null)
            {
                filterAction.Fields = new FieldCollection();
            }

            foreach (var widget in widgets)
            {
                var field = widget.ToMediaField();

                if (field.Title == null)
                {
                    field.Title = field?.Name.ChangeCase(TextCase.ProperCase);
                }

                filterAction.Fields.Add(field);
            }
        }
Exemplo n.º 26
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Action   = (EntityAction)reader.ReadByte();

            return(this);
        }
        /// <summary>
        /// Get list of data massagers for the entity.
        /// </summary>
        /// <returns></returns>
        protected override BoolMessage  PerformValidation(IActionContext ctx, EntityAction entityAction)
        {
            var massager = new StatusUpdateMassager();

            massager.Massage(ctx.Item, entityAction);
            return(base.PerformValidation(ctx, entityAction));
        }
Exemplo n.º 28
0
        private Task DispatchPacket(EntityAction packet)
        {
            Logger.LogWarning("EntityAction is not implemented.");

            // TODO Set Entity Action
            return(Task.CompletedTask);
        }
Exemplo n.º 29
0
        public EntityAction Create(Post entity)
        {
            entity.Id = rep.GetNextId();
            EntityAction result = rep.Create(entity);

            return(result);
        }
Exemplo n.º 30
0
 public void ExecuteOnEntity <T, W>(int id,
                                    ExclusiveGroup.ExclusiveGroupStruct groupid,
                                    ref W value,
                                    EntityAction <T, W> action) where T : IEntityStruct
 {
     ExecuteOnEntity(id, (int)groupid, ref value, action);
 }
Exemplo n.º 31
0
        /// <summary>
        /// Performs the validation on the model.
        /// </summary>
        /// <param name="ctx">The action context.</param>
        /// <param name="entityAction">The type of entity action</param>
        /// <returns></returns>
        protected virtual BoolMessage PerformValidation(IActionContext ctx, EntityAction entityAction)
        {
            if (_settings == null)
            {
                return(BoolMessage.True);
            }

            if (!_settings.EnableValidation)
            {
                return(BoolMessage.True);
            }

            IEntity entity  = ctx.Item as IEntity;
            bool    isValid = entity.Validate(ctx.Errors);

            if (!isValid)
            {
                if (ctx.CombineMessageErrors)
                {
                    string errorMessage = ctx.Errors.Message();
                    return(new BoolMessage(false, errorMessage));
                }
                return(BoolMessage.False);
            }
            return(BoolMessage.True);
        }
Exemplo n.º 32
0
 private object GetEntity(EntityAction action, IDictionary<string, object> parameters)
 {
     var repositoryType = typeof (IDynamicRepository<>).MakeGenericType(action.Type);
     var getCommand = repositoryType.GetMethod("Get");
     var repository = _Locator.GetInstance(repositoryType);
     // Todo this seems to bypass our security checks for this method... possibly we should have a thing to check this one too.  Not sure how, maybe checking access should be a reusable service instead of a pipeline component.
     // I would really like to have a stage to do this repository to entity fetching, maybe a DomainRepositoryActionInvoker stage?
     return getCommand.Invoke(repository,
                              parameters.Where(p => p.Key.ToLowerInvariant() == "id").Select(p => p.Value).ToArray());
 }
Exemplo n.º 33
0
 public override int TryReadPacket(byte[] buffer, int length)
 {
     int offset = 1;
     byte action = 0;
     if (!DataUtility.TryReadInt32(buffer, ref offset, out EntityId))
         return -1;
     if (!DataUtility.TryReadByte(buffer, ref offset, out action))
         return -1;
     Action = (EntityAction)action;
     return offset;
 }
Exemplo n.º 34
0
 public override int TryReadPacket(byte[] Buffer, int Length)
 {
     int offset = 1;
     byte action = 0;
     if (!TryReadInt(Buffer, ref offset, out EntityId))
         return -1;
     if (!TryReadByte(Buffer, ref offset, out action))
         return -1;
     this.Action = (EntityAction)action;
     return offset;
 }
Exemplo n.º 35
0
 //This is just initialisation. i can write raw things.
 public override EntityState Me_Start()
 {
     return new EntityState
     {
         type = EntityType.Doodle,
         canMove = true,
         position = transform.position,
         useGravity = useGravity,
         isAlive = isAlive,
         initial = _state = new EntityAction
         {
             speed = Vector2.zero,
             control = Control.Stop
         }
     };
 }
Exemplo n.º 36
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadInt8();
     JumpBoost = stream.ReadInt32();
     return mode;
 }
Exemplo n.º 37
0
 public EntityActionPacket(int entityId, EntityAction action, int jumpBoost)
 {
     EntityId = entityId;
     Action = action;
     JumpBoost = jumpBoost;
 }
        public void EntityAction()
        {
            EntityAction action = new EntityAction("MyAction1");
            Assert.AreEqual("MyAction1", action.Name);
            Assert.IsNotNull(action.Parameters);
            Assert.AreEqual(0, action.Parameters.Count());

            action = new EntityAction("MyAction2", "Param1", new string[] { "Param2_1", "Param2_2" });
            Assert.AreEqual("MyAction2", action.Name);
            Assert.AreEqual(2, action.Parameters.Count());
            Assert.AreEqual("Param1", action.Parameters.ElementAt(0) as string);
            string[] param2 = action.Parameters.ElementAt(1) as string[];
            Assert.AreEqual(2, param2.Length);
        }
 public EntityActionFilter(Process process, Entity entity, EntityAction entityAction) {
     _process = process;
     _entity = entity;
     _entityAction = entityAction;
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="entityAspect"></param>
 /// <param name="action"></param>
 public EntityChangingEventArgs(IEntity entity, EntityAction action)
   : base(entity) {
   Action = action;
   Cancel = false;
 }
		public override int CompareTo(EntityAction other)
		{
			return 0;
		}
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="entityAspect"></param>
 /// <param name="action"></param>
 public EntityChangedEventArgs(IEntity entity, EntityAction action)
   : base(entity) {
   Action = action;
 }
Exemplo n.º 43
0
 public EntityActionPacket(int entityId, EntityAction action)
 {
     EntityId = entityId;
     Action = action;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Spikes can't be attacked and will damage any entity that interacts with it, provided said entity can be damaged
 /// </summary>
 public override void Interact(EntityAction action)
 {
     attack.Execute(action.Agent);
 }
 /// <summary>
 /// Create an instance of this class.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="entityAction"></param>
 /// <param name="actionEventArgs"></param>
 protected EntityChangeEventArgs(IEntity entity, EntityAction entityAction, EventArgs actionEventArgs = null) 
   : base() {
   Entity = entity;
   Action = entityAction;
   ActionEventArgs = actionEventArgs ?? EventArgs.Empty;
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="action"></param>
 /// <param name="actionEventArgs"></param>
 public EntityChangingEventArgs(IEntity entity, EntityAction action, EventArgs actionEventArgs)
   : base(entity, action, actionEventArgs) {
   Cancel = false;
 }
Exemplo n.º 47
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadUInt8();
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="action"></param>
 /// <param name="actionEventArgs"></param>
 public EntityChangedEventArgs(IEntity entity, EntityAction action, EventArgs actionEventArgs)
   : base(entity, action, actionEventArgs ) {
   
 }