示例#1
0
        private void ExtractTasks(IList <PerfTask> extrct, TaskSequence seq)
        {
            if (seq == null)
            {
                return;
            }
            extrct.Add(seq);
            IList <PerfTask> t = sequence.Tasks;

            if (t == null)
            {
                return;
            }
            foreach (PerfTask p in t)
            {
                if (p is TaskSequence)
                {
                    ExtractTasks(extrct, (TaskSequence)p);
                }
                else
                {
                    extrct.Add(p);
                }
            }
        }
示例#2
0
        public static void StopVehiclePed(Ped target)
        {
            if (target == null)
            {
                throw new ArgumentNullException();
            }
            if (!Game.Exists(target))
            {
                throw new NonExistingObjectException();
            }
            if (!target.isInVehicle())
            {
                throw new InvalidOperationException("The target is on foot.");
            }
            if (!Game.Exists(target.CurrentVehicle))
            {
                throw new NonExistingObjectException("The vehicle of the ped not exist.");
            }

            TaskSequence pullOver = new TaskSequence();

            pullOver.AddTask.DriveTo(target.Position.Around(10.5f), 10, true);
            pullOver.AddTask.LeaveVehicle(target.CurrentVehicle, false);
            pullOver.AddTask.HandsUp(1000);
            pullOver.AddTask.RunTo(Game.LocalPlayer.Character.Position, true);
            pullOver.AddTask.StandStill(-1);
            pullOver.Perform(target);
        }
示例#3
0
        private FileBasedProject CreateProject(ProjectRequest request)
        {
            ProjectInfo projectInfo = new ProjectInfo
            {
                Name = request.Name,
                LocalProjectFolder = GetProjectFolderPath(request.Name),
            };
            FileBasedProject project = new FileBasedProject(projectInfo,
                                                            new ProjectTemplateReference(request.ProjectTemplate.Uri));

            // new ProjectTemplateReference(ProjectTemplate.Uri));

            OnMessageReported(project, String.Format("Creating project {0}", request.Name));

            //path to subdirectory
            var subdirectoryPath =
                request.Files[0].Substring(0, request.Files[0].IndexOf(request.Name, StringComparison.Ordinal)) +
                request.Name;

            ProjectFile[] projectFiles = project.AddFolderWithFiles(subdirectoryPath, true);
            project.RunAutomaticTask(projectFiles.GetIds(), AutomaticTaskTemplateIds.Scan);

            //when a template is created from a Single file project, task sequencies is null.
            try
            {
                TaskSequence taskSequence = project.RunDefaultTaskSequence(projectFiles.GetIds(),
                                                                           (sender, e)
                                                                           =>
                {
                    OnProgressChanged(_currentProgress + (double)e.PercentComplete / Requests.Count);
                }
                                                                           , (sender, e)
                                                                           =>
                {
                    OnMessageReported(project, e.Message);
                });

                project.Save();

                if (taskSequence.Status == TaskStatus.Completed)
                {
                    SuccessfulRequests.Add(Tuple.Create(request, project));
                    OnMessageReported(project, String.Format("Project {0} created successfully.", request.Name));
                    return(project);
                }
                else
                {
                    OnMessageReported(project, String.Format("Project {0} creation failed.", request.Name));
                    return(null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    @"Please go to File -> Setup -> Project templates -> Select a template -> Edit -> Default Task Sequence -> Ok after that run again Content connector");
                TelemetryService.Instance.AddException(ex);
            }

            return(project);
        }
示例#4
0
        void OnGUI()
        {
            GUILayout.Label("Tasklist", EditorStyles.boldLabel);
            this._task_sequence = FindObjectOfType <TaskSequence>();
            if (this._task_sequence != null)
            {
                this._scroll_position = EditorGUILayout.BeginScrollView(this._scroll_position);
                EditorGUILayout.BeginVertical("Box");

                var seq = this._task_sequence.GetSequence();
                if (seq != null)
                {
                    foreach (var g in seq)
                    {
                        if (g != null)
                        {
                            if (this._task_sequence.CurrentGoalCell != null &&
                                this._task_sequence.CurrentGoalCell.name == g.name)
                            {
                                GUILayout.Label(g.name, EditorStyles.whiteLabel);
                            }
                            else
                            {
                                GUILayout.Label(g.name);
                            }
                        }
                    }
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndScrollView();
            }
        }
示例#5
0
        public void Tick()
        {
            if (driver.IsPlayer)
            {
                return;
            }
            if (car.Speed > 40 && Math.Abs(car.SteeringAngle) > 20)
            {
                UI.Notify(car.FriendlyName + " is freaking out.");
                Vector3      pos          = car.Position;
                TaskSequence TempSequence = new TaskSequence();
                Function.Call(Hash.TASK_VEHICLE_TEMP_ACTION, 0, car, 1, 2000);
                Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, car, pos.X, pos.Y, pos.Z, 200f, 4194304, 250f);

                TempSequence.Close();
                driver.Task.PerformSequence(TempSequence);
                TempSequence.Dispose();
            }
            if (car.IsOnAllWheels && Function.Call <bool>(Hash.HAS_ENTITY_COLLIDED_WITH_ANYTHING, car))
            {
                NitroSafety = 0;
            }

            if (LetOffTheGas && HoldBrakeTime > Game.GameTime && car.Speed > 4f)
            {
                car.EngineTorqueMultiplier = 0f;
            }
            HandleNitro();
        }
示例#6
0
        public void Attack(Ped player)
        {
            int x = random.Next(1, 100 + 1);

            TaskSequence sequence = new TaskSequence();

            /* 60% to attack the victim - 40 % to attack the player */
            if (x <= 60)
            {
                sequence.AddTask.FightAgainst(Victim);

                x = random.Next(1, 100 + 1);
                if (x <= 50)
                {
                    sequence.AddTask.FightAgainst(player);
                }
                else
                {
                    sequence.AddTask.FleeFrom(player);
                }
            }
            else
            {
                sequence.AddTask.FightAgainst(player);
                sequence.AddTask.FleeFrom(player);
            }
            sequence.Close();
            Attacker.Task.PerformSequence(sequence);
        }
示例#7
0
 public void PerformSequence(TaskSequence sequence)
 {
     if (sequence != null)
     {
         sequence.Perform(Ped);
     }
 }
示例#8
0
        public void Clear()
        {
            if (LivelyWorld.CanWeUse(HunterPed))
            {
                HunterPed.RelationshipGroup = Game.GenerateHash("CIVMALE");

                if (HunterPed.CurrentBlip.Exists())
                {
                    HunterPed.CurrentBlip.Color = BlipColor.White;
                }
                Function.Call(Hash.RESET_PED_MOVEMENT_CLIPSET, HunterPed, 0.0f);
                Function.Call(Hash.RESET_PED_STRAFE_CLIPSET, HunterPed);
                HunterPed.IsPersistent = false;

                if (LivelyWorld.CanWeUse(HunterCar))
                {
                    LivelyWorld.TemporalPersistence.Add(HunterCar);
                    TaskSequence seq = new TaskSequence();
                    Function.Call(Hash.TASK_PAUSE, 0, LivelyWorld.RandomInt(2, 4) * 1000);

                    Function.Call(Hash.TASK_ENTER_VEHICLE, 0, HunterCar, 20000, -1, 1f, 1, 0);
                    Function.Call(Hash.TASK_PAUSE, 0, LivelyWorld.RandomInt(2, 4) * 1000);
                    Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, 0, HunterCar, 30f, 1 + 2 + 4 + 8 + 16 + 32);
                    seq.Close();
                    HunterPed.Task.PerformSequence(seq);
                    seq.Dispose();
                    HunterCar.IsPersistent = false;
                }
            }
            if (LivelyWorld.CanWeUse(HunterDog))
            {
                HunterDog.IsPersistent = false;
            }
        }
示例#9
0
 void OnEnabled()
 {
     if (!this._task_sequence)
     {
         this._task_sequence = FindObjectOfType <TaskSequence>();
     }
 }
示例#10
0
        /// <summary>
        /// Processes the ability to rearm player when driving an Enforcer.
        /// </summary>
        private void ProcessEnforcerAbility()
        {
            if (LPlayer.LocalPlayer.IsOnDuty && GetEnforcerArmoryState() &&
                (LPlayer.LocalPlayer.Skin.Model == new Model("M_Y_SWAT") | LPlayer.LocalPlayer.Skin.Model == new Model("M_Y_NHELIPILOT")))
            {
                // Fixed the state where you cannot get back into the Enforcer - used the customized method of the original NooseMod
                if (!LPlayer.LocalPlayer.Ped.IsInVehicle() && GetEnforcerArmoryState())
                {
                    Functions.PrintHelp("Press ~KEY_OPEN_TRUNK~ to rearm your weapon or ~INPUT_ENTER~ to get in the Enforcer.");
                    if (Functions.IsKeyDown(SettingsFile.Open("LCPDFR\\LCPDFR.ini").GetValueKey("OpenTrunk", "Keybindings", Keys.E)))
                    {
                        TaskSequence mytask = new TaskSequence();
                        mytask.AddTask.StandStill(-1);
                        mytask.AddTask.PlayAnimation(new AnimationSet("playidles_std"), "gun_cock_weapon", 8f, AnimationFlags.Unknown05);
                        mytask.Perform(LPlayer.LocalPlayer.Ped);
                        Functions.PrintText("Rearming...", 5000);
                        Game.WaitInCurrentScript(3000);

                        Rearm();

                        Game.WaitInCurrentScript(1500);
                        LPlayer.LocalPlayer.Ped.Task.ClearAllImmediately();
                        Game.WaitInCurrentScript(500);
                        Functions.PrintText("Complete", 5000);
                        Function.Call("TRIGGER_MISSION_COMPLETE_AUDIO", new Parameter[] { 27 });
                        Game.WaitInCurrentScript(10000);
                    }
                }
            }
            // If return is active, this method will loop around, making others not be processed
            //else return;
        }
示例#11
0
        public override void OnStart(Ped player)
        {
            base.OnStart(player);

            Vector3[] checkpoints = new Vector3[amountOfRaceCheckpoints];
            for (int i = 0; i < amountOfRaceCheckpoints; i++)
            {
                checkpoints[i] = EndLocations[random.Next(0, EndLocations.Length)];
            }

            // Initiate suspect ped tasks
            for (int i = 0; i < amountOfRacers; i++)
            {
                raceSequence = new TaskSequence();

                // Potential Driving Styles = 1074543228, 786956
                // Set up task sequence
                for (int j = 0; j < amountOfRaceCheckpoints; j++)
                {
                    raceSequence.AddTask.DriveTo(SuspectVehicles[i], checkpoints[j], 100f, 1000f, 1074543228);
                }

                // Initiate the task sequence for current ped
                SuspectVehicles[i].Speed = 20f;
                Suspects[i].Task.PerformSequence(raceSequence);
                SetDriverAbility(Suspects[i].Handle, 1.0f);
                SetDriverAggressiveness(Suspects[i].Handle, 1.0f);
                SetDriverRacingModifier(Suspects[i].Handle, 1.0f);
            }
        }
示例#12
0
        private void doTestIndexProperties(bool setIndexProps,
                                           bool indexPropsVal, int numExpectedResults)
        {
            Dictionary <string, string> props = new Dictionary <string, string>();

            // Indexing configuration.
            props["analyzer"]       = typeof(WhitespaceAnalyzer).AssemblyQualifiedName;
            props["content.source"] = typeof(OneDocSource).AssemblyQualifiedName;
            props["directory"]      = "RAMDirectory";
            if (setIndexProps)
            {
                props["doc.index.props"] = indexPropsVal.ToString();
            }

            // Create PerfRunData
            Config      config  = new Config(props);
            PerfRunData runData = new PerfRunData(config);

            TaskSequence tasks = new TaskSequence(runData, TestName, null, false);

            tasks.AddTask(new CreateIndexTask(runData));
            tasks.AddTask(new AddDocTask(runData));
            tasks.AddTask(new CloseIndexTask(runData));
            tasks.DoLogic();

            IndexReader   reader   = DirectoryReader.Open(runData.Directory);
            IndexSearcher searcher = NewSearcher(reader);
            TopDocs       td       = searcher.Search(new TermQuery(new Term("key", "value")), 10);

            assertEquals(numExpectedResults, td.TotalHits);
            reader.Dispose();
        }
示例#13
0
    public static ITask DoInSequenceWith(this ITask original, MonoBehaviour holder, params ITask[] tasks)
    {
        var result = new TaskSequence(holder);

        AddTo(result, original, tasks);

        return(result);
    }
示例#14
0
        private async Task ATMTick()
        {
            if (this.InAnim || Game.Player.Character.IsInVehicle())
            {
                return;
            }

            var atm = this.atms
                      .Select(a => new { atm = a, distance = new Vector3(a.Position.X, a.Position.Y, a.Position.Z).DistanceToSquared(Game.Player.Character.Position) })
                      .Where(a => a.distance < 5.0F)           // Nearby
                      .Select(a => new { a.atm, prop = new Prop(API.GetClosestObjectOfType(a.atm.Position.X, a.atm.Position.Y, a.atm.Position.Z, 1, (uint)a.atm.Hash, false, false, false)), a.distance })
                      .Where(p => p.prop.Model.IsValid)
                      .Where(a => Vector3.Dot(a.prop.ForwardVector, Vector3.Normalize(a.prop.Position - Game.Player.Character.Position)).IsBetween(0f, 1.0f))           // In front of
                      .OrderBy(a => a.distance)
                      .Select(a => new Tuple <BankATM, Prop>(a.atm, a.prop))
                      .FirstOrDefault();

            if (atm == null)
            {
                return;
            }

            new Text("Press Z to use ATM", new PointF(50, Screen.Height - 50), 0.4f, Color.FromArgb(255, 255, 255), Font.ChaletLondon, Alignment.Left, false, true).Draw();

            if (!this.interactKey.IsJustPressed())
            {
                return;
            }

            var atmModel = atm.Item2;

            var ts = new TaskSequence();

            ts.AddTask.LookAt(atmModel);
            var moveToPos = atmModel.Position.ToVector3().InFrontOf(atmModel.Heading + 180f, 0.5f);

            ts.AddTask.SlideTo(moveToPos.ToCitVector3(), atmModel.Heading);
            ts.AddTask.ClearLookAt();
            ts.Close();
            await Game.Player.Character.RunTaskSequence(ts);

            API.SetScenarioTypeEnabled("PROP_HUMAN_ATM", true);
            API.ResetScenarioTypesEnabled();
            API.TaskStartScenarioInPlace(Game.PlayerPed.Handle, "PROP_HUMAN_ATM", 0, true);
            this.InAnim = true;

            // Camera
            var atmCameraPos = atmModel.Position.ToVector3().ToPosition().TranslateDir(atmModel.Heading - 50f, 1.5f);

            this.Camera = World.CreateCamera(
                new Vector3(atmCameraPos.X, atmCameraPos.Y, atmCameraPos.Z) + (Vector3.UnitZ * 1.8f),
                GameplayCamera.Rotation,
                50
                );
            this.Camera.PointAt(new Vector3(atmModel.Position.X, atmModel.Position.Y, atmModel.Position.Z) + Vector3.UnitZ * 1f);
            World.RenderingCamera.InterpTo(this.Camera, 1000, true, true);
            API.RenderScriptCams(true, true, 1000, true, false);
        }
示例#15
0
    void EngageCPR(Ped target, Ped victim)
    {
        Vector3 offset = new Vector3(
            (float)Math.Cos((double)target.Heading * 0.0174532925f + 70f),
            (float)Math.Sin((double)target.Heading * 0.0174532925f + 70f),
            0);

        target.Task.ClearAll();
        victim.Task.ClearAllImmediately();
        victim.Position  = target.Position + target.ForwardVector * 1.2f + offset * 0.06f;
        victim.Position -= new Vector3(0, 0, victim.HeightAboveGround + 0.2f);
        victim.Heading   = target.Heading + 70;

        Random rndGen = new Random();

        if (rndGen.Next(0, 11) >= 9)
        {
            _reanimationFailed = true;
        }
        else
        {
            _reanimationFailed = false;
        }

        //MEDIC
        TaskSequence seq = new TaskSequence();

        seq.AddTask.PlayAnimation("mini@cpr@char_a@cpr_def", "cpr_intro", 8f, 15000, true, 8f);
        seq.AddTask.PlayAnimation("mini@cpr@char_a@cpr_str", "cpr_pumpchest", 8f, 20000, true, 8f);
        if (_reanimationFailed)
        {
            seq.AddTask.PlayAnimation("mini@cpr@char_a@cpr_str", "cpr_fail", 8f, 20000, true, 8f);
        }
        else
        {
            seq.AddTask.PlayAnimation("mini@cpr@char_a@cpr_str", "cpr_success", 8f, 28000, true, 8f);
        }
        seq.Close();
        target.Task.PerformSequence(seq);

        //VICTIM
        TaskSequence seq2 = new TaskSequence();

        seq2.AddTask.PlayAnimation("mini@cpr@char_b@cpr_def", "cpr_intro", 8f, 15000, true, 8f);
        seq2.AddTask.PlayAnimation("mini@cpr@char_b@cpr_str", "cpr_pumpchest", 8f, 20000, true, 8f);
        if (_reanimationFailed)
        {
            seq2.AddTask.PlayAnimation("mini@cpr@char_b@cpr_str", "cpr_fail", 8f, 20000, true, 8f);
        }
        else
        {
            seq2.AddTask.PlayAnimation("mini@cpr@char_b@cpr_str", "cpr_success", 8f, 28000, true, 8f);
        }
        seq2.Close();
        victim.Task.PerformSequence(seq2);
    }
示例#16
0
        public void Attack(Ped player)
        {
            TaskSequence sequence = new TaskSequence();

            sequence.AddTask.FightAgainst(player);
            sequence.AddTask.FleeFrom(player);

            sequence.Close();
            DrunkSuspect.Task.PerformSequence(sequence);
        }
示例#17
0
        public TaskSequenceExample()
        {
            // Add tasks to the TaskSequence
            FleeTask = new TaskSequence();
            FleeTask.AddTask.SwapWeapon(Weapon.Handgun_Glock);
            FleeTask.AddTask.FightAgainst(Player, 5000);
            FleeTask.AddTask.FleeFromChar(Player, false, 5000);
            FleeTask.AddTask.Die();

            this.KeyDown += new GTA.KeyEventHandler(this.TaskSequenceExample_KeyDown);
        }
示例#18
0
 void OnEnable()
 {
     this._icon = (Texture2D)AssetDatabase.LoadAssetAtPath(
         NeodroidInfo._ImportLocation + "Gizmos/Icons/script.png",
         typeof(Texture2D));
     this.titleContent = new GUIContent("Neo:Task", this._icon, "Window for task descriptions");
     if (!this._task_sequence)
     {
         this._task_sequence = FindObjectOfType <TaskSequence>();
     }
 }
示例#19
0
 public static async Task RunTaskSequence(this Ped ped, TaskSequence sequence)
 {
     ped.Task.PerformSequence(sequence);
     while (Game.Player.Character.TaskSequenceProgress < 0)
     {
         await BaseScript.Delay(100);                                                                // Wait for the sequence to start
     }
     while (Game.Player.Character.TaskSequenceProgress > 0)
     {
         await BaseScript.Delay(100);                                                                // Wait for the sequence to end
     }
 }
示例#20
0
        /// <summary>
        ///     Updates the progress bar based on the position in the task sequence.
        /// </summary>
        private void ProgressBarRefresh()
        {
            // Get position in task sequence if there is one
            int currentInstruction;
            int lastInstruction;

            try
            {
#if DEBUG
                currentInstruction = 50;
                lastInstruction    = 100;
#else
// Get the current position in the task sequence - will get blanks and exceptions if not in a TS
                currentInstruction = int.Parse(TaskSequence.GetVariable("_SMSTSNextInstructionPointer")) + 1;
                lastInstruction    = int.Parse(TaskSequence.GetVariable("_SMSTSInstructionTableSize")) + 1;
#endif

                if (currentInstruction > lastInstruction)
                {
                    currentInstruction = lastInstruction;
                }
            }
            catch (Exception)
            {
                // Error reading task sequence variables, remove progress bar
                progressBar.Visible = false;

                // Have we been running in a task sequence before? If so, assume that the task sequence has ended
                // and close down - this prevents situations where the caller forgets to close us at the end of a TS
                if (_startedInTaskSequence)
                {
                    _eventShutdownRequested.Set();
                }

                return;
            }

            // If we reached here, we are in a task sequence, update flag
            _startedInTaskSequence = true;

            // If bar is not enabled then nothing else to do
            if (!_progressBarEnabled)
            {
                progressBar.Visible = false;
                return;
            }

            // Set percentage and make visible
            progressBar.Value   = 100 * currentInstruction / lastInstruction;
            progressBar.Visible = true;
        }
        /// <summary>
        /// Demonstrates calling a task sequence
        /// </summary>
        /// <param name="createdProject">project</param>
        /// <param name="settings">user project settings</param>
        private void RunTasksSequence(FileBasedProject createdProject, LocalProjectSettings settings)
        {
            Language targetLanguage = new Language(settings.TargetLanguage);
            List <TaskStatusEventArgs> taskStatusEventArgsList = new List <TaskStatusEventArgs>();
            List <MessageEventArgs>    messageEventArgsList    = new List <MessageEventArgs>();

            ProjectFile[] projectFiles = createdProject.GetSourceLanguageFiles();

            createdProject.AddBilingualReferenceFiles(GetBilingualFileMappings(new Language[] { targetLanguage }, projectFiles, settings.PreviousVersionPath));

            TaskSequence taskSequence = createdProject.RunAutomaticTasks(projectFiles.GetIds(), TaskSequences.Prepare);

            createdProject.Save();
        }
示例#22
0
        private void FindNewVehicle()
        {
            Logger.Write(false, "Carjacker: Finding new vehicle to jack.", "");
            trycount++;

            Util.NaturallyRemove(spawnedVehicle);
            spawnedVehicle = null;
            Logger.Write(false, "Carjacker: Unset previous vehicle.", "");

            Vehicle[] nearbyVehicles = World.GetNearbyVehicles(spawnedPed.Position, radius / 2);

            if (nearbyVehicles.Length < 1)
            {
                Logger.Write(false, "Carjacker: Couldn't find vehicles nearby. Abort finding.", "");

                return;
            }

            for (int cnt = 0; cnt < 5; cnt++)
            {
                Vehicle v = nearbyVehicles[Util.GetRandomIntBelow(nearbyVehicles.Length)];

                if (Util.WeCanEnter(v) && !spawnedPed.IsInVehicle(v) && v.Handle != lastVehicle && (Main.CriminalsCanFightWithPlayer || !Game.Player.Character.IsInVehicle(v)))
                {
                    Logger.Write(false, "Carjacker: Found proper vehicle.", "");
                    spawnedVehicle = v;

                    break;
                }
            }

            if (!Util.ThereIs(spawnedVehicle) || !Util.WeCanGiveTaskTo(spawnedPed))
            {
                Logger.Write(false, "Carjacker: Couldn't find proper vehicle. Abort finding.", "");

                return;
            }

            spawnedVehicle.IsPersistent = true;
            TaskSequence ts = new TaskSequence();

            ts.AddTask.EnterVehicle(spawnedVehicle, VehicleSeat.Driver, -1, 2.0f, 1);
            ts.AddTask.CruiseWithVehicle(spawnedVehicle, 100.0f, 262692); // 4 + 32 + 512 + 262144
            ts.Close();

            spawnedPed.Task.PerformSequence(ts);
            ts.Dispose();
            Logger.Write(false, "Carjacker: Jack new vehicle.", "");
        }
示例#23
0
        protected bool TaskIsSet()
        {
            if (ts == null)
            {
                ts = new TaskSequence();
                ts.AddTask.LeaveVehicle(spawnedVehicle, false);
                ts.AddTask.FightAgainstHatedTargets(400.0f);
                ts.Close();

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#24
0
        /// <summary>
        ///     Called after a cell has been edited.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvTaskSequenceVariables_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = dgvTaskSequenceVariables.Rows[e.RowIndex];

            var varName  = (string)row.Cells[0].Value;
            var varValue = (string)row.Cells[1].Value;

            if (e.ColumnIndex == 0)
            {
                if (!string.IsNullOrEmpty(varName))
                {
                    // Can't set variables that start with _
                    if (varName.StartsWith("_"))
                    {
                        MessageBox.Show(Resources.UnableToCreateVariabledWithUnderscore, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        row.Cells[0].Value = null;
                        row.Cells[1].Value = null;
                        return;
                    }

                    if (_taskSequenceDictionary.ContainsKey(varName))
                    {
                        MessageBox.Show(Resources.VariableNameAlreadyExists, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        row.Cells[0].Value = null;
                        row.Cells[1].Value = null;
                        return;
                    }
                }
            }

            // Only update if the name is valid
            if (!string.IsNullOrEmpty(varName))
            {
                if (!string.IsNullOrEmpty(varValue))
                {
                    _taskSequenceDictionary[varName] = varValue;
                    TaskSequence.SetVariable(varName, varValue);
                }
                else
                {
                    _taskSequenceDictionary[varName] = "";
                    TaskSequence.SetVariable(varName, "");
                }

                //VariablesDictionaryViewUpdate();
            }
        }
示例#25
0
    private void onKeyUp(object sender, KeyEventArgs e)
    {
        Ped player = Game.Player.Character;

        if (e.KeyCode == Keys.O)
        {
            //Vehicle vehicle = World.CreateVehicle(VehicleHash.Adder, Game.Player.Character.Position + Game.Player.Character.ForwardVector * 5);
            //vehicle.PlaceOnGround();

            Vehicle vehicle1 = GTA.World.CreateVehicle(VehicleHash.Taxi, player.Position + player.ForwardVector * 6);
            vehicle1.PlaceOnGround();

            //string model_name = "a_m_y_business_02";
            //Vector3 playerPos = player.Position + (player.ForwardVector * 8f);
            //float Z = World.GetGroundHeight(playerPos);
            //Vector3 groundedPos = new Vector3(playerPos.X, playerPos.Y, Z);
            //Vector3 civPos = World.GetNextPositionOnStreet((player.Position + (player.ForwardVector * 3f)).Around(1f));
            //Ped civilian1 = GTA.World.CreatePed(model_name, groundedPos);
            //civilian1.VehicleDrivingFlags = VehicleDrivingFlags.FollowTraffic;

            //civilian1.Task.ClearAllImmediately();
            //civilian1.Task.EnterVehicle(vehicle1, VehicleSeat.Any, -1, 10f);
            //civilian1.AlwaysKeepTask = true;

            Vector3 target1 = new Vector3(126.975f, 3714.419f, 46.827f);

            // derive target from map marker
            if (Game.IsWaypointActive)
            {
                target1 = World.WaypointPosition;
                target1 = World.GetNextPositionOnStreet(target1.Around(100f));
            }

            TaskSequence taskSeq = new TaskSequence();
            taskSeq.AddTask.WarpIntoVehicle(vehicle1, VehicleSeat.Driver);
            taskSeq.AddTask.DriveTo(vehicle1, target1, 100f, 10f, DrivingStyle.Normal);
            //taskSeq.AddTask.DriveTo(vehicle1, target2, 100f, 10f, DrivingStyle.Normal);

            //civilian1.Task.PerformSequence(taskSeq);
            player.Task.PerformSequence(taskSeq);
        }

        if (e.KeyCode == Keys.L)
        {
        }
    }
示例#26
0
        public GangTeam() : base(EventManager.EventType.GangTeam)
        {
            this.members      = new List <Ped>();
            this.closeWeapons = new List <WeaponHash> {
                WeaponHash.Bat, WeaponHash.Hatchet, WeaponHash.Hammer, WeaponHash.Knife, WeaponHash.KnuckleDuster, WeaponHash.Machete, WeaponHash.Wrench, WeaponHash.BattleAxe, WeaponHash.Unarmed
            };
            this.standoffWeapons = new List <WeaponHash> {
                WeaponHash.MachinePistol, WeaponHash.SawnOffShotgun, WeaponHash.Pistol, WeaponHash.APPistol, WeaponHash.PumpShotgun, WeaponHash.Revolver
            };
            Util.CleanUp(this.relationship);

            ts = new TaskSequence();
            ts.AddTask.FightAgainstHatedTargets(200.0f);
            ts.AddTask.WanderAround();
            ts.Close();
            Logger.Write(true, "GangTeam event selected.", "");
        }
示例#27
0
    private TaskSequence CreateTask()
    {
        var sequence = new TaskSequence(_holder);

        foreach (var taskList in _tasks.Values)
        {
            var paralell = new ParallelTask(_holder);
            foreach (var task in taskList)
            {
                paralell.Add(task);
            }

            sequence.Add(paralell);
        }

        return(sequence);
    }
示例#28
0
        public static void Main(string[] args)
        {
            var         p       = InitProps();
            Config      conf    = new Config(p);
            PerfRunData runData = new PerfRunData(conf);

            // 1. top sequence
            TaskSequence top = new TaskSequence(runData, null, null, false); // top level, not parallel

            // 2. task to create the index
            CreateIndexTask create = new CreateIndexTask(runData);

            top.AddTask(create);

            // 3. task seq to add 500 docs (order matters - top to bottom - add seq to top, only then add to seq)
            TaskSequence seq1 = new TaskSequence(runData, "AddDocs", top, false);

            seq1.SetRepetitions(500);
            seq1.SetNoChildReport();
            top.AddTask(seq1);

            // 4. task to add the doc
            AddDocTask addDoc = new AddDocTask(runData);

            //addDoc.setParams("1200"); // doc size limit if supported
            seq1.AddTask(addDoc); // order matters 9see comment above)

            // 5. task to close the index
            CloseIndexTask close = new CloseIndexTask(runData);

            top.AddTask(close);

            // task to report
            RepSumByNameTask rep = new RepSumByNameTask(runData);

            top.AddTask(rep);

            // print algorithm
            Console.WriteLine(top.ToString());

            // execute
            top.DoLogic();
        }
示例#29
0
        public void RunPrepareWithPerfectMatch()
        {
            ProjectInfo info = GetProjectInfo();

            //Create the project
            FileBasedProject newProject = new FileBasedProject(info);

            //Add project files
            ProjectFile[] files = newProject.AddFiles(AddProjectFiles(@"c:\ProjectFiles\Documents\"));

            //Perfect Match Setup - Use the helper function to look for files in a previous project that match files in this project
            newProject.AddBilingualReferenceFiles(GetBilingualFileMappings(info.TargetLanguages, files, @"c:\ProjectFiles\PreviousProjectFiles"));

            //Add Translation memory
            AddMasterTMs(newProject, @"c:\ProjectFiles\TMs\");

            //Run the prepare task sequence (Scan, ConvertToTranslatableFormat, WordCount, CopyToTargetLanguages, PerfectMatch, AnalyzeFiles, PreTranslateFiles, PopulateProjectTranslationMemories)
            TaskSequence taskSequence = newProject.RunAutomaticTasks(files.GetIds(), TaskSequences.Prepare);
        }
示例#30
0
        public Emergency(string name, Entity target, string emergencyType) : base()
        {
            this.members       = new List <Ped>();
            this.name          = name;
            this.target        = target;
            this.emergencyType = emergencyType;
            this.blipName      = "";
            this.offDuty       = false;
            this.ts            = null;

            if (this.emergencyType == "ARMY")
            {
                this.relationship = Util.NewRelationshipOf(DispatchManager.DispatchType.ArmyGround);
            }
            else
            {
                this.relationship = Util.NewRelationshipOf(DispatchManager.DispatchType.CopGround);
            }
        }