Inheritance: MonoBehaviour
        /// <summary>
        /// Classifies files in <paramref name="sourceDirectory"/> in <paramref name="targetDirectory"/> grouped in
        /// sub directories by <paramref name="classificationOrder"/>.
        /// </summary>
        /// <returns>Task that represents the classification job.</returns>
        /// <param name="sourceDirectory">Source directory.</param>
        /// <param name="targetDirectory">Target directory.</param>
        /// <param name="recursive">
        /// If <c>true</c> classify recursively in all sub directories of <paramref name="sourceDirectory"/>; 
        /// otherwise only on <paramref name="sourceDirectory"/>.</param>
        /// <param name="actionType">
        /// Specify action to classify media files. 
        /// 'Copy' will copy media file in hierarchized directory. 
        /// 'Move' will move the media file. 
        /// Link will create a link, this can be used to create multiple hierarchisations.
        /// </param>
        /// <param name="hierarchy">Hierarchy of classification.
        /// <example>>If <paramref name="classificationOrder"/> is [Year, Month, Country], then folders will be
        /// like '/1996/03/Urugway'.</example>
        /// </param>
        public async Task ClassifyAsync(string sourceDirectory, string targetDirectory, bool recursive, ActionType actionType, params ClassificationType[] hierarchy)
        {
            if (sourceDirectory == null)
                throw new ArgumentNullException("sourceDirectory");
            if (targetDirectory == null)
                throw new ArgumentNullException("targetDirectory");
            if (hierarchy == null || !hierarchy.Any())
                throw new ArgumentNullException("classificationOrder");
            if (!_directory.Exists(sourceDirectory))
                throw new DirectoryNotFoundException(string.Format("Source directory '{0}' doesn't exists.", sourceDirectory));

            Log.I("Launching classification.");

            if (!_directory.Exists(targetDirectory))
            {
                Log.T("Target directory doesn't exists, create it.");
                _directory.CreateDirectory(targetDirectory);
            }

            var classificationTasks = _fileSystemHelper.ProcessForEachFilesAsync(
                new[] { sourceDirectory }, 
                recursive, 
                FileFilterProvider.TagFileMatcher, 
				(f, cts) => ClassifiyFileAsync(targetDirectory, f, actionType, hierarchy));

			await Task.WhenAll(classificationTasks);
        }
Beispiel #2
0
 public Action(ActionItem item, ActionType type, TimeSpan duration)
 {
     Id = Guid.NewGuid();
     Item = item;
     Duration = duration;
     Type = type;
 }
Beispiel #3
0
 private static void GetRedirectActionTokenAndValue(ActionType action, out string token, out string value)
 {
     switch (action)
     {
         case ActionType.CheckFor301:
             token = "do301";
             value = "check";
             break;
         case ActionType.Redirect301:
             token = "do301";
             value = "true";
             break;
         case ActionType.Output404:
             token = "do404";
             value = "true";
             break;
         case ActionType.Redirect302:
             token = "do302";
             value = "true";
             break;
         default:
             token = "";
             value = "";
             break;
     }
 }
        public AddEditStaff(string name, string staffID, string email, DateTime renewPasswordDate, DateTime dateOfBirth, DateTime joinDate, string gender, string position, string contact, bool defaultPassword, bool blocked)
        {
            InitializeComponent();
            lblStaffID.Text = staffID;
            txtName.Text = name;
            txtEmail.Text = email;
            dtpPswExpirateDate.Value = renewPasswordDate;
            dtpDoB.Value = dateOfBirth;
            dtpJoinDate.Value = joinDate;
            cbGender.Text = gender;
            isDefaultPassword = defaultPassword;

            cbGender.DropDownStyle = ComboBoxStyle.DropDown;
            cbPosition.DropDownStyle = ComboBoxStyle.DropDown;
            cbPosition.Text = position;
            txtContact.Text = contact;
            chkDefaultPsw.Checked = defaultPassword;
            chkBlocked.Checked = blocked;

            txtName.Enabled = false;
            txtEmail.Enabled = false;
            dtpPswExpirateDate.Enabled = false;
            dtpDoB.Enabled = false;
            dtpJoinDate.Enabled = false;
            cbGender.Enabled = false;

            if (defaultPassword == true)
            {
                chkDefaultPsw.Enabled = false;
            }

            currentAction = ActionType.Edit;
        }
Beispiel #5
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.Victory)
     return type == ActionType.VictoryForever;
   else
     return true;
 }
Beispiel #6
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.ToCornerFront)
     return type == ActionType.ToCornerBack;
   else
     return true;
 }
Beispiel #7
0
 /// <summary>
 /// Logs the specified username.
 /// </summary>
 /// <param name="username">The username.</param>
 /// <param name="ip">The ip.</param>
 /// <param name="action">The action.</param>
 public static void Log(string username, string ip, ActionType action)
 {
     using (SqlConnection conn = Config.DB.Open())
     {
         SqlHelper.GetDB().ExecuteNonQuery( "SaveIPLog", username, ip, (int) action);
     }
 }
 public ActionInformation(Func<Tile, ActionAnimationScript> script, TileSelector abilityRange, Func<Tile, TileSelector> abilityAreaOfEffect, ActionType actionType)
 {
     Script = script;
     AbilityRange = abilityRange;
     AbilityAreaOfEffect = abilityAreaOfEffect;
     ActionType = actionType;
 }
Beispiel #9
0
        private double[] _results;  // global place to store the workload results for verication

        #endregion

        public ParallelInvokeTest(ParallelInvokeTestParameters parameters)
        {
            _count = parameters.Count;
            _actionType = parameters.ActionType;

            _actions = new Action[_count];
            _results = new double[_count];

            // intialize actions 
            for (int i = 0; i < _count; i++)
            {
                int iCopy = i;
                if (_actionType == ActionType.Empty)
                {
                    _actions[i] = new Action(delegate { });
                }
                else if (_actionType == ActionType.EqualWorkload)
                {
                    _actions[i] = new Action(delegate
                    {
                        _results[iCopy] = ZetaSequence(SEED);
                    });
                }
                else
                {
                    _actions[i] = new Action(delegate
                    {
                        _results[iCopy] = ZetaSequence((iCopy + 1) * SEED);
                    });
                }
            }
        }
 public ActionContainer(ActionType actionType, string text, ISlot sourceSlot, ISlot targetSlot)
 {
     ActionType = actionType;
     Text = text;
     SourceSlot = sourceSlot;
     TargetSlot = targetSlot;
 }
Beispiel #11
0
		public Instruction(ActionType type, int from, int to)
		{
			// Dupe can also use the other constructors, but specifying the target via this one is prefered even though it won't affect anything in the actual combine. This is required by the CondenseSlots logic to move the final base gem when no longer needed, but is also useful for debugging.
			this.Action = type;
			this.From = from;
			this.To = to;
		}
        /// <summary>
        /// Gets a default behavior for a path segment
        /// </summary>
        /// <param name="location"></param>
        /// <param name="vehicleState"></param>
        /// <param name="exit"></param>
        /// <param name="relative"></param>
        /// <param name="stopSpeed"></param>
        /// <param name="aMax"></param>
        /// <param name="dt">timestep in seconds</param>
        /// <returns></returns>
        public static PathFollowingBehavior DefaultStayInLaneBehavior(RndfLocation location, VehicleState vehicleState, 
            RndfWaypointID action, ActionType actionType, bool relative, double stopSpeed, double aMax, double dt,
            double maxSpeed, IPath path)
        {
            // get lane path
            //IPath path = RoadToolkit.LanePath(location.Partition.FinalWaypoint.Lane, vehicleState, relative);

            // check if the action is just a goal (note that exit and stop take precedence)
            if (actionType == ActionType.Goal)
            {
                // get maximum speed
                //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed;
                //double maxSpeed = maxV;

                // generate path following behavior
                //return new PathFollowingBehavior(path, new ScalarSpeedCommand(maxSpeed));
                return null;
            }
            else
            {
                // get maximum speed
                //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed;

                // get operational required distance to hand over to operational stop
                double distance = RoadToolkit.DistanceUntilOperationalStop(RoadToolkit.DistanceToWaypoint(location, action)-TahoeParams.FL);

                // get desired velocity
                double desiredSpeed = RoadToolkit.InferFinalSpeed(0, stopSpeed, distance, maxSpeed, aMax, dt);

                // generate path following behavior
                //return new PathFollowingBehavior(path, new ScalarSpeedCommand(desiredSpeed));
                return null;
            }
        }
 public AddEditProduct(ref DataTable productList)
 {
     InitializeComponent();
     lblProductID.Text = mainController.GenerateNextAvailableProductID();
     currentProductList = productList;
     currentAction = ActionType.Add;
 }
        public void AddAction(string playerA, string playerB, ActionType actionType, ModifierType modifyer, Weapon weapon, WhereType where, ArmyType teamA, ArmyType teamB)
        {
            Player playerGet = getPlayer(playerA, teamA);
            Player playerDo = null;
            
            //damage from the world (harrier, falling) will not be considered in this version
            if (playerB == string.Empty)
            {
                playerDo = playerGet;
            } else
            {
                playerDo = getPlayer(playerB, teamB);
            }

            switch (actionType)
            {
                case ActionType.Kill:
                    playerGet.AddAction(playerDo, ActionType.Die, modifyer, weapon, where);
                    playerDo.AddAction(playerGet, ActionType.Kill, modifyer, weapon, where);
                    break;
                case ActionType.Damage:
                    playerGet.AddAction(playerDo, ActionType.Damage, modifyer, weapon, where);
                    playerDo.AddAction(playerGet, ActionType.Damage, modifyer, weapon, where);
                    break;
            }
        }
Beispiel #15
0
		public Instruction(ActionType action, int from, int to)
		{
			if (from < 0)
			{
				throw new ArgumentOutOfRangeException(nameof(from), "Invalid slot in instruction.");
			}

			if (to < 0)
			{
				throw new ArgumentOutOfRangeException(nameof(to), "Invalid slot in instruction.");
			}

			if (action == ActionType.Upgrade)
			{
				if (from != to)
				{
					throw new ArgumentException("From and to parameters are not equal in an Upgrade instruction.");
				}
			}
			else
			{
				if (from == to)
				{
					throw new ArgumentException("From and to parameters cannot be equal except in an Upgrade instruction.");
				}
			}

			this.Action = action;
			this.From = from;
			this.To = to;
		}
Beispiel #16
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.IdleToClimb && type != ActionType.JumpToClimb && (type != ActionType.IdleToFrontClimb && type != ActionType.IdleToSideClimb))
     return type == ActionType.JumpToSideClimb;
   else
     return true;
 }
        /// <summary>
        /// Creates new action exception.
        /// </summary>
        /// <param name="message">the message, as in ordinary exception</param>
        /// <param name="actionType">type of the action that caused the exception</param>
        /// <param name="innerException">exception that was catched to throw this one</param>
        public ActionException(string message, ActionType actionType, MemeType? memeType
				= MemeType.AreYouFuckingKiddingMe, Exception innerException = null)
            : base(SHOW_EXCEPTION_DETAILS ? GetExtendedMessage(message, innerException) :
				GetTypicalMessage(message, innerException), innerException)
        {
            SetInitialValues(message, actionType, memeType);
        }
        private static void AppendDescriptionUsingContext(DbContext context, StringBuilder builder, EntityType type, ActionType aType, object entity)
        {
            string additionalInfo = string.Empty;
            string identity = string.Empty;
            var enrty = context.Entry(entity);

            var prop =
                enrty.Entity.GetType()
                    .GetProperties()
                    .FirstOrDefault(c => c.GetCustomAttributes(typeof(KeyAttribute), true).FirstOrDefault() != null);
            var name = enrty.Entity.GetType().GetProperties().FirstOrDefault(c => c.Name.Contains("Name"));

            identity = CreateIdentityString(entity, prop, identity, name);

            if (aType == ActionType.Updating)
            {
                additionalInfo = string.Format("Были изменены следующие поля: {0}",
                    string.Join(",", enrty.CurrentValues.PropertyNames));
            }

            if (aType != ActionType.Import || aType != ActionType.Export)
            {
                builder.Append(string.Format("Сущность \"{0}\" {1} была {2}.{3}", type.GetEntityTypeName(), identity,
                    aType.GetActionTypeName(), additionalInfo));
            }
        }
Beispiel #19
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.ExitDoor && type != ActionType.ExitDoorCarry)
     return type == ActionType.ExitDoorCarryHeavy;
   else
     return true;
 }
Beispiel #20
0
 public PlayerAction(Player player, Point targetPoint, ActionType actionType)
 {
     AffectedPlayer = player;
     this.TargetPoint = targetPoint;
     WayToTarget = new Queue<Point>();
     Type = actionType;
 }
Beispiel #21
0
        public override ActionFeedback[] PerformAction(ActionType actionType, Actor actor, object[] args)
        {
            if (actionType == ActionType.CONSUME)
            {
                if (Effects.HasFlag(ConsumableEffect.FEED))
                {
                    //Eat
                    int newFeedingLevel = (int) actor.FeedingLevel + this.EffectPower;

                    actor.FeedingLevel = (FeedingLevel) ( (newFeedingLevel > 5) ? 5 : newFeedingLevel);
                }
                //How many have we got?
                if (this.TotalAmount > 1)
                {
                    this.TotalAmount--; //reduce by one
                }
                else
                {
                    //remove from inventory
                    actor.Inventory.Inventory.Remove(this.Category, this);
                }

                return new ActionFeedback[] { new LogFeedback(null, Color.Blue, "You consume the " + this.Name) };
            }
            else
            {
                return base.PerformAction(actionType, actor, args);
            }
        }
Beispiel #22
0
		public FeatureAction (XPathNavigator nav)
		{
			string val = Helpers.GetRequiredNonEmptyAttribute (nav, "type");
			type = Helpers.ConvertEnum <ActionType> (val, "type");

			val = Helpers.GetRequiredNonEmptyAttribute (nav, "when");
			when = Helpers.ConvertEnum <ActionWhen> (val, "when");

			XPathNodeIterator iter;
			StringBuilder sb = new StringBuilder ();
			
			switch (type) {
				case ActionType.Message:
				case ActionType.ShellScript:
					iter = nav.Select ("./text()");
					while (iter.MoveNext ())
						sb.Append (iter.Current.Value);
					if (type == ActionType.Message)
						message = sb.ToString ();
					else
						script = sb.ToString ();
					break;
					
				case ActionType.Exec:
					command = Helpers.GetRequiredNonEmptyAttribute (nav, "command");
					commandArguments = Helpers.GetOptionalAttribute (nav, "commndArguments");
					break;
			}
		}
Beispiel #23
0
	public void SetAction(ActionType pendingAction)
	{
		Debug.Log("SET THIS ACTION: "+pendingAction);

		if (!m_hasAction)
		{
			if(pendingAction._energyCost < _uiController._currentEnergy)
			{
				LockActions();
				_uiController.ReduceEnergy(pendingAction._energyCost);

				//No action has yet been set
				m_hasAction = true;
				
				if(pendingAction._instantApply)
				{
					//We have an instant action
					ActivateAction(pendingAction);
				}
				else
				{
					//We have a queued action
					SetQueuedAction(pendingAction);
				}
			}
		}
	}
Beispiel #24
0
 [JsonConstructor] public PartyParam(string parameters,TargetParam targetparam,int targetType,ActionType type){
     Parameters=
         parameters.Split(new[]{','},StringSplitOptions.RemoveEmptyEntries).ToList().Select(Parse).ToArray();
     TargetParam=targetparam;
     TargetType=targetType;
     Type=type;
 }
Beispiel #25
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.TurnAwayFromBell && type != ActionType.HitBell)
     return type == ActionType.TurnToBell;
   else
     return true;
 }
        private static string GetDescription(KeyValuePair<Type, EntityType> current, ActionType type, object entity)
        {
            var builder = new StringBuilder();
            var firstFormat = string.Format("Сущность \"{0}\"",current.Value.GetEntityTypeName());
            const string idFormat = " с идентификатором \"{0}\"";
            const string nameFormat = " с названием \"{0}\"";
            var actionFormat = string.Format(" была {0}", type.GetActionTypeName());

            if (entity != null)
            {
                var idProp = entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("ID"));
                var nameProp = entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("NAME"));

                builder.Append(firstFormat);

                if (idProp != null)
                {
                    builder.Append(string.Format(idFormat, idProp.GetValue(entity)));
                }

                if (nameProp != null)
                {
                    builder.Append(string.Format(nameFormat, nameProp.GetValue(entity)));
                }

                builder.Append(actionFormat);
            }

            if (type == ActionType.Export || type == ActionType.Import)
            {
                builder.Append(type.GetActionTypeName());
            }

            return builder.ToString();
        }
 public AddEditStock(DataTable product, DataTable stock)
 {
     InitializeComponent();
     productTable = product;
     stockTable = stock;
     currentAction = ActionType.Add;
 }
Beispiel #28
0
 /*		Action (string actionName, Sprite actionSprite, ActionType actionType) {
     Name = actionName;
     Sprite = actionSprite;
     Type = actionType;
     Enabled = true;
 }*/
 public void setAction(string actionName, Sprite actionSprite, ActionType actionType)
 {
     Name = actionName;
     Sprite = actionSprite;
     Type = actionType;
     Enabled = true;
 }
        public static void AddTransaction(DbContext context, ActionType type, object entity)
        {
            var currentData = entity.GetEnityType();
            var description = GetDescription(currentData, type, entity);

            int entityId = -1;
            var entityIdProp = entity == null ? null : entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("ID"));
            if (entityIdProp != null)
            {
                entityId = entityIdProp.GetValue(entity).MaybeAs<int>().GetOrDefault(-1);
                if (entityId == -1)
                {
                    var guid = entityIdProp.GetValue(entity).MaybeAs<Guid>().GetOrDefault(default(Guid));
                    entityId = guid == default(Guid) ? -1 : guid.GetHashCode();
                }
            }
            var tLog = new TransactionLog
            {
                ActionDateTime = DateTime.Now,
                ActionType = type,
                EntityType = currentData.Value,
                Description = description,
                EntityId = entityId
            };

            context.Set<TransactionLog>().Add(tLog);
        }
Beispiel #30
0
 public GameState(Dictionary<int, Entity> entities, ActionType type)
 {
     AllEntities = entities;
     Type = type;
     Player1 = new Player(entities, 1);
     Player2 = new Player(entities, 2);
 }
Beispiel #31
0
 public InputAction(ActionType type, object data)
 {
     this.Type = type;
     this.Data = data;
 }
Beispiel #32
0
 public ImportantRemovedArgs(ActionType action, ChatMessage item = null)
 {
     Action = action;
     Item   = item;
 }
 public QuickMediaSorterProjectTriggerAction(ActionType actionType, string folder)
 {
     ActionType = actionType.ToString();
     Folder     = folder;
 }
 public QuickMediaSorterProjectTriggerAction(ActionType actionType)
 {
     ActionType = actionType.ToString();
 }
Beispiel #35
0
        public void ActivityLog(LogLevel level, string message, string action, string primaryKeyVals, string changedColumn, string userId, string machineName, string eventOrigin, string description, ActionType actionType, int result, Exception ex = null)
        {
            ActivityLogEvent logEvent = new ActivityLogEvent();

            logger.Log(logEvent.GetLogEvent(level, "PMSWeb", message, "", action, primaryKeyVals, changedColumn, "", DateTime.Now, userId, DateTime.Now, machineName, result, eventOrigin, description, actionType, ex));
        }
Beispiel #36
0
 /// <summary>
 /// 違う行動に切り替えます。
 /// </summary>
 /// <param name="type">StellaMove.ActionTypeで次の動作を指定します。</param>
 public void ChangeAction(ActionType type)
 {
     EndAction();
     NowAction = type;
     stellaActionScriptableObjects[(int)type].Init();
 }
Beispiel #37
0
        protected override void TestConditions()
        {
            switch (this.PlayerManager.Action)
            {
            case ActionType.IdlePlay:
            case ActionType.IdleSleep:
            case ActionType.IdleLookAround:
            case ActionType.IdleYawn:
            case ActionType.Idle:
            case ActionType.LookingLeft:
            case ActionType.LookingRight:
            case ActionType.LookingUp:
            case ActionType.LookingDown:
            case ActionType.Teetering:
                if (this.PlayerManager.CanControl)
                {
                    if ((double)this.InputManager.FreeLook.Y < -0.4)
                    {
                        this.nextAction = ActionType.LookingDown;
                    }
                    else if ((double)this.InputManager.FreeLook.Y > 0.4)
                    {
                        this.nextAction = ActionType.LookingUp;
                    }
                    else if ((double)this.InputManager.FreeLook.X < -0.4)
                    {
                        this.nextAction = ActionType.LookingLeft;
                    }
                    else if ((double)this.InputManager.FreeLook.X > 0.4)
                    {
                        this.nextAction = ActionType.LookingRight;
                    }
                    else if (FezMath.AlmostEqual(this.InputManager.FreeLook, Vector2.Zero))
                    {
                        this.nextAction = ActionType.Idle;
                    }
                }
                else
                {
                    this.nextAction = ActionTypeExtensions.IsLookingAround(this.PlayerManager.Action) ? this.PlayerManager.Action : ActionType.Idle;
                }
                if (this.PlayerManager.LookingDirection == HorizontalDirection.Left && (this.nextAction == ActionType.LookingLeft || this.nextAction == ActionType.LookingRight))
                {
                    this.nextAction = this.nextAction == ActionType.LookingRight ? ActionType.LookingLeft : ActionType.LookingRight;
                }
                if (ActionTypeExtensions.IsIdle(this.PlayerManager.Action) && this.nextAction != ActionType.None && this.nextAction != ActionType.Idle)
                {
                    this.PlaySound();
                    this.PlayerManager.Action = this.nextAction;
                    this.nextAction           = ActionType.None;
                }
                if (this.nextAction != this.PlayerManager.Action)
                {
                    break;
                }
                this.nextAction = ActionType.None;
                break;

            default:
                this.nextAction = ActionType.None;
                break;
            }
        }
Beispiel #38
0
    public virtual ActionType SelectAction(List <Fighter> Enemies, List <Fighter> Allies)
    {
        GameObject g = GameObject.FindGameObjectWithTag("ProtoManager");

        if (g != null)
        {
            ProtoScript protoScript = g.GetComponent <ProtoScript>();
            if (protoScript.combat.iteration == 1)
            {
                return(ActionType.TALK);
            }
            else
            {
                return(ActionType.ATTACK);
            }
        }

        if (groupHumanFighter.bWantsToAttack)
        {
            return(ActionType.ATTACK);
        }
        if (groupHumanFighter.bInConversation)
        {
            return(ActionType.TALK);
        }

        if (!groupHumanFighter.bCanBeFeared || !groupHumanFighter.bCanListen)
        {
            groupHumanFighter.bWantsToAttack = true;
            return(ActionType.ATTACK);
        }

        if (bIsFirstLogicTurn)
        {
            bIsFirstLogicTurn = false;
            CombatManager combatManager = GameObject.FindGameObjectWithTag("CombatManager").GetComponent <CombatManager>();

            if (combatManager.isBossCombat)
            {
                groupHumanFighter.bWantsToAttack  = true;
                groupHumanFighter.bInConversation = false;
                return(ActionType.ATTACK);
            }
            float rand = Random.Range(0.0f, 1.0f);

            ActionType.ActionEnum enumAction = GameObject.FindGameObjectWithTag("CombatTerrain").GetComponent <CombatTerrainInfo>().modComportement.action;
            ActionType            acType     = ActionType.GetActionTypeWithID((int)enumAction);

            if ((acType == ActionType.ATTACK && rand > rollProbaManager.humanComp.discussion - 0.1))
            {
                groupHumanFighter.bWantsToAttack  = true;
                groupHumanFighter.bInConversation = false;
                return(ActionType.ATTACK);
            }

            if (rand < rollProbaManager.humanComp.escape || (acType == ActionType.ESCAPE && rand < rollProbaManager.humanComp.escape + 0.1))
            {
                groupHumanFighter.bIsFeared = true;
                return(ActionType.ESCAPE);
            }
            if (rand < rollProbaManager.humanComp.discussion || (acType == ActionType.TALK && rand < rollProbaManager.humanComp.discussion + 0.1))
            {
                groupHumanFighter.bInConversation = true;
                groupHumanFighter.bWantsToAttack  = false;
                return(ActionType.TALK);
            }

            else
            {
                groupHumanFighter.bWantsToAttack  = true;
                groupHumanFighter.bInConversation = false;
                return(ActionType.ATTACK);
            }
        }


        float random = Random.Range(0.0f, 1.0f);

        if (random < 0.6)
        {
            groupHumanFighter.bWantsToAttack  = true;
            groupHumanFighter.bInConversation = false;
            return(ActionType.ATTACK);
        }

        else
        {
            groupHumanFighter.bInConversation = true;
            groupHumanFighter.bWantsToAttack  = false;
            return(ActionType.TALK);
        }
    }
Beispiel #39
0
 public void ContactJoin(Uri uri)
 {
     _defaultAction = ActionType.Join;
     Message.Obtain(_mhandler, (int)MessageType.AddToLogView, "joined:" + NameByUri(uri) + "\r\n").SendToTarget();       //
 }
 public ActionInfo(ActionInfo action)
 {
     actor      = action.actor;
     target     = action.target;
     actionType = action.actionType;
 }
Beispiel #41
0
 public List <ActionBase> GetFilteredActions(ActionType actionType)
 {
     return(this.actions.Filter((ActionBase action) => action.actionType == actionType));
 }
Beispiel #42
0
 public void ContactIgnore()
 {
     _defaultAction = ActionType.Ignore;
 }
Beispiel #43
0
 public BankAccountCommand(BankAccount bankAccount, ActionType action, int amount)
 {
     this.bankAccount = bankAccount;
     this.action      = action;
     this.amount      = amount;
 }
Beispiel #44
0
 public void ContactDelete(Uri uri)
 {
     _defaultAction = ActionType.Delete;
     Message.Obtain(_mhandler, (int)MessageType.AddToLogView, "deleted:" + NameByUri(uri) + "\r\n").SendToTarget();       //
     _context.ContentResolver.Delete(uri, null, null);
 }
Beispiel #45
0
 /** Clears action */
 public void Clear()
 {
     _type      = ActionType.Empty;
     _parameter = 0;
 }
Beispiel #46
0
        public CustomNotification(int PID, string applicationName, string applicationPath, ActionType actionType, DateTime time)
        {
            Time = time.ToLongTimeString();
            string title = actionType == ActionType.BlockAllow ? "First connection: " :
                           actionType == ActionType.UnblockAllow ? "Blocked connection: " :
                           actionType == ActionType.SuspendWhitelist ? "High CPU load: " :
                           actionType == ActionType.TerminateWhitelist ? "Suspended: " :
                           "";

            Title   = title + applicationName;
            Message = applicationPath;

            Button1 = actionType == ActionType.BlockAllow ? "BLOCK" :
                      actionType == ActionType.UnblockAllow ? "UNBLOCK" :
                      actionType == ActionType.SuspendWhitelist ? "SUSPEND" :
                      actionType == ActionType.TerminateWhitelist ? "TERMINATE" :
                      null;

            Button2 = actionType == ActionType.BlockAllow ? "ALLOW" :
                      actionType == ActionType.UnblockAllow ? "ALLOW" :
                      actionType == ActionType.SuspendWhitelist ? "WHITELIST" :
                      actionType == ActionType.TerminateWhitelist ? "WHITELIST" :
                      null;

            BackgroundColor = actionType == ActionType.BlockAllow ?
                              new SolidColorBrush(Color.FromArgb(255, 0, 182, 0)) :
                              actionType == ActionType.UnblockAllow ?
                              new SolidColorBrush(Color.FromArgb(255, 182, 0, 0)) :
                              actionType == ActionType.SuspendWhitelist ?
                              new SolidColorBrush(Color.FromArgb(255, 0, 112, 128)) :
                              actionType == ActionType.TerminateWhitelist ?
                              new SolidColorBrush(Color.FromArgb(255, 204, 80, 0)) :
                              new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));

            Action _button1Action = actionType == ActionType.BlockAllow ?
                                    new Action(() => Firewall.SetRule(applicationName, applicationPath, false)) :
                                    actionType == ActionType.UnblockAllow ?
                                    new Action(() => Firewall.RemoveRule(applicationName + "__" + applicationPath)) :
                                    actionType == ActionType.SuspendWhitelist ?
                                    new Action(() => Controller.SuspendProcess(PID)) :
                                    actionType == ActionType.TerminateWhitelist ?
                                    new Action(() => Controller.TerminateProcess(PID)) :
                                    new Action(() => { });

            Action _button2Action = actionType == ActionType.BlockAllow ?
                                    new Action(() => Firewall.SetRule(applicationName, applicationPath, true)) :
                                    actionType == ActionType.UnblockAllow ?
                                    new Action(() => Firewall.SetRule(applicationName, applicationPath, true)) :
                                    actionType == ActionType.SuspendWhitelist ?
                                    new Action(() =>
            {
                Controller.AddToWhitelist(PID, applicationName, applicationPath);
                ((MainWindow)Application.Current.MainWindow).SuspendedProcesses.UpdateViewSource();
            }) :
                                    actionType == ActionType.TerminateWhitelist ?
                                    new Action(() =>
            {
                Controller.ResumeProcess(PID);
                Controller.AddToWhitelist(PID, applicationName, applicationPath);
                ((MainWindow)Application.Current.MainWindow).SuspendedProcesses.UpdateViewSource();
            }) :
                                    new Action(() => { });

            var _closeAction = new Action <CustomNotification>(n => n.Close());

            Action setNotificationActivated = new Action(() =>
            {
                Controller.NotificationList.Find(x => x.Type == (int)actionType && x.ApplicationPath == applicationPath && x.Time == time).NotActivated = false;
                ((MainWindow)Application.Current.MainWindow).Notifications.UpdateViewSource();

                using (var db = new ArgonDB())
                    db.NotificationsList
                    .Where(x => x.Type == (int)actionType &&
                           x.ApplicationPath == applicationPath &&
                           x.Time == time.Ticks)
                    .Set(x => x.NotActivated, 0)
                    .Update();
            });

            Button1Command = new RelayCommand(x => { _button1Action(); setNotificationActivated(); _closeAction(this); });
            Button2Command = new RelayCommand(x => { _button2Action(); setNotificationActivated(); _closeAction(this); });
            CloseCommand   = new RelayCommand(x => _closeAction(this));
        }
Beispiel #47
0
 /**
  * Creates a new character action of the given type
  *
  * @param action The action to perform
  * @param targetID The parameter for the target.  I.e. for a spell action this is the ID of the spell.
  *
  */
 public MDRAction(ActionType actionType, int actionParameter = 0)
 {
     _type      = actionType;
     _parameter = actionParameter;
 }
 public TargetEntityActionEventArgs(IEntity performer, ActionType actionType, IEntity target) :
     base(performer, actionType)
 {
     Target = target;
 }
 protected String GetText(ActionType action)
 {
     return(Buttons.TryGetValue(action)?.Text);
 }
Beispiel #50
0
 /** Copyies another action this this action */
 public void CopyFrom(MDRAction source)
 {
     this._type      = source.Type;
     this._parameter = source.Parameter;
 }
Beispiel #51
0
 public override void SignalPlayerAction(int p, ActionType actionType)
 {
 }
 protected virtual void ActionInvoke(ActionType action)
 {
     _action?.Invoke(new TypeHandledEventArgs <ActionType>(action));
 }
Beispiel #53
0
 public override void SignalBlocking(int p1, ActionType actionType, int p2, Card cardBlocking)
 {
 }
 public BrainAttribute(ActionType actionType)
 {
     this.ActionType = actionType;
 }
 private void TableCellAction(ActionType type, string tag)
 {
     AddTag(tag);
 }
Beispiel #56
0
 public override void SignalPlayersTargettedAction(int p1, ActionType actionType, int p2)
 {
 }
Beispiel #57
0
 public ActionReportContainer(ActionType actionType, ActionReportResult arResult, string description) :
     this(actionType, arResult, description, "", "")
 {
 }
Beispiel #58
0
 private void playerAction(NetworkStream nws, User user, string direction, ActionType actionType)
 {
     try
     {
         if (actionType == ActionType.MOVEMENT)
         {
             if (Match.MovementCommands.ContainsKey(direction))
             {
                 string closePlayers = Match.MovePlayer(user, Match.MovementCommands[direction]);
                 Logger.LogData(user.NickName + " movió su jugador");
                 byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.MOVEMENT, "200|" + closePlayers);
                 nws.Write(responseStream, 0, responseStream.Length);
             }
             else
             {
                 sendError(nws, "Comando invalido");
             }
         }
         else if (actionType == ActionType.ATTACK)
         {
             if (Match.MovementCommands.ContainsKey(direction))
             {
                 string attackResponse = Match.PlayerAttack(user, Match.MovementCommands[direction]);
                 Logger.LogData(user.NickName + " atacó un jugador");
                 byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.ATTACK, "200|" + attackResponse);
                 nws.Write(responseStream, 0, responseStream.Length);
             }
             else
             {
                 sendError(nws, "Comando invalido");
             }
         }
     }
     catch (OccupiedSlotException)
     {
         sendError(nws, "Ya existe un usuario en esa posición");
     }
     catch (InvalidSurvivorAttackException)
     {
         sendError(nws, "Solo puede atacar monstruos");
     }
     catch (InvalidMoveException)
     {
         sendError(nws, "El movimiento que quiere realizar es inválido");
     }
     catch (MoveOutOfBoundsException)
     {
         sendError(nws, "El movimiento que quiere realizar esta fuera de los limites.");
     }
     catch (EndOfMatchException)
     {
         string winnersString = "";
         foreach (User winner in Match.Winners)
         {
             winnersString += winner.NickName + ", ";
         }
         byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.END_OF_MATCH, ProtocolConstants.OK_RESPONSE_CODE);
         nws.Write(responseStream, 0, responseStream.Length);
     }
     catch (SurvivorsWinException)
     {
         string winnersString = "";
         foreach (User winner in Match.Winners)
         {
             winnersString += winner.NickName + ", ";
         }
         byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.END_OF_MATCH, "300|" + winnersString);
         nws.Write(responseStream, 0, responseStream.Length);
     }
     catch (MonsterWinsException)
     {
         string winnersString = "";
         foreach (User winner in Match.Winners)
         {
             winnersString += winner.NickName + ", ";
         }
         byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.END_OF_MATCH, "400|" + winnersString);
         nws.Write(responseStream, 0, responseStream.Length);
     }
     catch (UserTurnLimitException)
     {
         sendError(nws, "Debe esperar a que todos los jugadores realizan terminen su turno.");
     }
     catch (EmptyAttackTargetException)
     {
         sendError(nws, "No se encuentra nadie en el lugar que desea atacar");
     }
     catch (UserNotInMatchException)
     {
         byte[] responseStream = Protocol.GenerateStream(ProtocolConstants.SendType.RESPONSE, ProtocolConstants.END_OF_MATCH, "500");
         nws.Write(responseStream, 0, responseStream.Length);
     }
     catch (Exception)
     {
         sendError(nws, "Ocurrió un error inesperado.");
     }
 }
 public UpdateEmployeeJobPositionAssignment(EmployeeJobPositionAssignmentDTO employeeJobPositionAssignment,
                                            PeriodDTO period, EmployeeDTO employee, ActionType action)
 {
     EmployeeJobPositionAssignment = employeeJobPositionAssignment;
     Period   = period;
     Employee = employee;
     Action   = action;
 }
 private void CollectionCellAction(ActionType type, string tag)
 {
     RemoveTag(tag);
 }