Esempio n. 1
0
        public override void Init(L2PlayerData data, ActionsController actionsController)
        {
            base.Init(data, actionsController);
            data.MainHero.PropertyChanged +=
                (obj, args) =>
            {
                if (args.PropertyName == nameof(data.MainHero.WeaponDisplayId) && UseDefaultAttackRangeCalculation)
                {
                    MaximumAttackDistance = CalculateMaximumAttackRange();
                }
            };

            data.Skills.CollectionChanged +=
                (obj, args) =>
            {
                if (UseDefaultAttackRangeCalculation)
                {
                    MaximumAttackDistance = CalculateMaximumAttackRange();
                }
            };

            data.MainHero.Buffs.CollectionChanged +=
                (obj, args) =>
            {
                if (UseDefaultAttackRangeCalculation)
                {
                    MaximumAttackDistance = CalculateMaximumAttackRange();
                }
            };
        }
Esempio n. 2
0
        public ActionControllerTests()
        {
            var actionMappingMock = new Mock <IActionMappingLogic>();

            _actionLogicMock   = new Mock <IActionLogic>();
            _actionsController = new ActionsController(actionMappingMock.Object,
                                                       _actionLogicMock.Object);

            _fixture = new Fixture();
        }
        public async void GetActionsReturnsListOfActions()
        {
            var mockRepo = new Mock <IActionAsyncRepository>();

            mockRepo.Setup(repo => repo.GetActionsAsync()).ReturnsAsync(ActionMemoryDb.GetTestActions());
            var controller = new ActionsController(mockRepo.Object);

            var actions = await controller.GetActions();

            Assert.Equal(ActionMemoryDb.GetTestActions().Count, actions.Count);
        }
 /// <summary>
 /// Create scheduled alert rule for all instances or for a single instance
 /// </summary>
 /// <returns></returns>
 public async Task CreateScheduledAlertRule(ActionsController actionsController, int insId = -1)
 {
     if (insId != -1)
     {
         await CreateScheduledAlertRuleByInstance(insId, actionsController);
     }
     else
     {
         for (var i = 0; i < azureConfigs.Length; i++)
         {
             await CreateScheduledAlertRuleByInstance(i, actionsController);
         }
     }
 }
        public override void Init(L2PlayerData data, ActionsController actionsController)
        {
            base.Init(data, actionsController);

            data.Skills.CollectionChanged +=
                (obj, args) =>
            {
                OnPropertyChanged(nameof(NukesToAdd));
            };

            data.Inventory.CollectionChanged += (sender, args) =>
            {
                OnPropertyChanged(nameof(NukesToAdd));
            };
        }
Esempio n. 6
0
        // List<Task<string>> tasks = new List<Task<string>>();

        public AppHost(
            AlertRulesController alertRulesController,
            AuthenticationService authenticationService,
            AlertRuleTemplatesController alertRuleTemplatesController,
            IncidentsController incidentsController,
            ActionsController actionsController,
            BookmarksController bookmarksController, DataConnectorsController dataConnectorsController)
        {
            _alertRulesController         = alertRulesController;
            _authenticationService        = authenticationService;
            _alertRuleTemplatesController = alertRuleTemplatesController;
            _incidentsController          = incidentsController;
            _actionsController            = actionsController;
            _bookmarksController          = bookmarksController;
            _dataConnectorsController     = dataConnectorsController;
        }
Esempio n. 7
0
        IActionSystem InitActions(ControllersStorage controllers)
        {
            IActionSystem actionSystem = new ActionsController();

            if (!(actionSystem is IInteractionObject))
            {
                throw new GameException(
                          "InitGame.InitActions: ActionsController is not IAttackSystem");
            }

            controllers.Add(actionSystem as IInteractionObject);

            actionSystem.Add(LootName.gun, new ShootoutController <BombViewFabric>());
            actionSystem.Add(LootName.cutlass, new PrickAttackController());

            return(actionSystem);
        }
Esempio n. 8
0
    void Start()
    {
        m_healthBar = Instantiate(m_healthBarPrefab);
        m_healthBar.GetComponent <HealthBar>().SetParent(this);

        m_actionsController = m_actionsControllerObj.GetComponent <ActionsController>();

        m_inputController = m_inputControllerObj.GetComponent <InputController>();
        m_inputController.AddClickListener(this);

        m_currentCooldown = 0;

        m_agent = GetComponent <NavMeshAgent>();
        m_agent.updateRotation = false;

        SetHealthBarActive(false);
    }
        public void GetShipsList_From_Wiki()
        {
            // Arrange
            var logger       = Substitute.For <ILogger <ActionsController> >();
            var shipsCrawler = Substitute.For <IShipsCrawler>();

            shipsCrawler.GetAllShipsAsync().Returns(_fakeShips);
            var controller = new ActionsController(logger, shipsCrawler);

            // Act
            var result = controller.CrawlWiki().Result;

            // Assert
            var payload = Assert.IsAssignableFrom <OkObjectResult>(result);
            var ships   = Assert.IsAssignableFrom <IEnumerable <Ship> >(payload.Value);

            Assert.Equal(2, ships.Count());
        }
Esempio n. 10
0
 private void Awake()
 {
     _manager = FindObjectOfType <ActionsManager>();
     Instance = this;
 }
Esempio n. 11
0
    void DrawActionController(ActionsController actionControler)
    {
        GUILayout.BeginVertical("Actions", "window");

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        showWindow = GUILayout.Toggle(showWindow, showWindow ? "Close Actions" : "Open Actions", "button", GUILayout.ExpandWidth(true));
        if (showWindow)
        {
            EditorGUILayout.HelpBox("The Input has being mapped using the 360 Gamepad layout, to modify a keyboard button open the Input Manager and change the Alt Positive Button. For Mobile Input, check the Mobile DemoScene and the MobileControls prefab.", MessageType.Info);
            EditorGUILayout.Space();

            var         type              = actionControler.GetType();
            FieldInfo[] types             = type.GetFields();
            var         _actionController = serializedObject.FindProperty("actionsController");

            foreach (FieldInfo info in types)
            {
                var         childType  = info.FieldType;
                FieldInfo[] childTypes = childType.GetFields();
                GUILayout.BeginVertical("box");
                var prop      = _actionController.FindPropertyRelative(info.Name);
                var useAction = prop.FindPropertyRelative("use");
                var options   = prop.FindPropertyRelative("options");
                var input     = prop.FindPropertyRelative("input");

                GUILayout.BeginHorizontal();
                useAction.boolValue = GUILayout.Toggle(useAction.boolValue, "");
                GUILayout.Label(info.Name, GUILayout.Width(80));
                if (useAction.boolValue)
                {
                    //GUILayout.FlexibleSpace();
                    GUILayout.Label("Input");
                    //EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(input, new GUIContent(""));
                }
                GUILayout.EndHorizontal();

                if (childTypes.Length > 3)
                {
                    if (useAction.boolValue)
                    {
                        options.boolValue = EditorGUILayout.Foldout(options.boolValue, "...");
                    }
                    else
                    {
                        options.boolValue = false;
                    }

                    if (options.boolValue == true)
                    {
                        foreach (FieldInfo childInfo in childTypes)
                        {
                            if (!childInfo.Name.Equals("use") && !childInfo.Name.Equals("options") && !childInfo.Name.Equals("input"))
                            {
                                var childProp = prop.FindPropertyRelative(childInfo.Name);
                                EditorGUILayout.PropertyField(childProp, true);
                            }
                        }
                    }
                }
                //EditorGUILayout.Space();
                GUILayout.EndVertical();
            }

            EditorGUILayout.HelpBox("The LT and RT buttons are Axis, make sure to change the condition from Input.GetButton to Input.GetAxis on the method of you action", MessageType.Info);
        }
        GUILayout.EndVertical();

        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
        }
    }
Esempio n. 12
0
    private ActionsController actions;                                                          // Reference to the Enable Actions

    protected override void Awake()
    {
        actions = GetComponent <ActionsController> ();
        base.Awake();
    }
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        phrase_warm.Add("The start lights are on, it's time to show what I do best.");
        phrase_warm.Add("It looks like I'm going to have to work with so many good drivers starting close to me, but I need to gain some positions when the lights turn off.");
        phrase_warm.Add("I'm a little nervous. The car has not behaved very well on the opposite straight. Anyway, I'm sure I can keep my position until the mixed part of the circuit.");
        phrase_warm.Add("As soon as the lights go out I plan to attack some cars in front of me. There is no chance to lose.");

        phrase_start.Add("The start was problematic and some cars run wide on the first corner. You left unharmed and managed to maintain your position, but the distance to the second place remains the same. Meanwhile, the two cars from behind remain very close. What do you want to do?");

        phrase_normal.Add("One more lap completed. I need to keep the car at my fingertips.");
        phrase_normal.Add("Go! Go! Go!");
        phrase_normal.Add("One more lap, one more lap!");
        phrase_normal.Add("The car looked strange on the last lap. Are you sure there's nothing wrong?");
        phrase_normal.Add("That was a sexy lap");
        phrase_normal.Add("I’m driving like a grandma.");
        phrase_normal.Add("Woah! There’s a giant lizard on the track…. Yeah, I’m not joking! Out of Turn 3.");
        phrase_normal.Add("Oh, the annoying octopus is back! It’s been a while. It’s quite a small one. It’s a baby octopus.");
        phrase_normal.Add("One more lap completed. I need to keep the car at my fingertips.");
        phrase_normal.Add("One more lap completed. I need to keep the car at my fingertips.");
        phrase_normal.Add("One more lap completed. I need to keep the car at my fingertips.");

        phrase_finalBest.Add("Wow Wow Wow Wow! We are the champions, my friend!");
        phrase_finalBest.Add("We are the number one, baby! There's going to be a party at home today!");
        phrase_finalBest.Add("Uhuuuuuullllllll! I won! I won! I won! I WON!");
        phrase_finalBest.Add("Thank you so much guys. That’s a childhood dream come true. Thank you so much. We did it, we did it!");
        phrase_finalBest.Add("I will never forget this moment, this team, this job. Thank you, all of you guys…");
        phrase_finalGood.Add("It could have been better, but at least I have some champagne on the podium");
        phrase_finalGood.Add("Yeaaah! Great job, team! Next year I want victory, be warned!");
        phrase_finalGood.Add("The victory did not come, but thanks for the podium, guys!");
        phrase_finalOK.Add("Okay ... could have been worse.");
        phrase_finalOK.Add("Crossing the finish line was good enough");
        phrase_finalBad.Add("What a race to be forgotten ...");
        phrase_finalBad.Add("Terrible result. Next time give me a better car for me.");
        phrase_finalBad.Add("I did a **** job today");
        phrase_finalWorst.Add("Oh, f ** k! What I'll tell to my girlfriend?");
        phrase_finalWorst.Add("... [someone seems to be crying]");

        phrase_motor.Add("What? What was that noise? [A black smoke comes out of the car engine. It's the end of the race]");
        phrase_motor.Add("Uh? Come on .... [Car engine shut down]");
        phrase_motor.Add("F***ing car! F***ing car! F***in... [The radio was turned off by the GMA]");
        phrase_motor.Add("Does this smoke harms the environment?");
        phrase_motor.Add("I did what I could, I need to take more care of my car next time ... [The engine stopped]");

        phrase_gearbox.Add("[Gearbox Failure]");

        phrase_suspension.Add("[Suspension Failure]");

        phrase_breaks.Add("[Breaks Failure]");

        phrase_tyres.Add("[Tyres Failure]");

        phrase_fuel.Add("No one told me I needed to refuel? What kind of team is this?");
        phrase_fuel.Add("Right now that my car was floating! [Ran out of fuel]");
        phrase_fuel.Add("I thought refueling was banned, was not?");
        phrase_fuel.Add("Uh? Come on, just a few meters! [The car chokes near the last corner]");
        phrase_fuel.Add("Look, I swore we could run without fuel.");
    }
Esempio n. 14
0
        public AppHost(
            IConfigurationRoot rawConfig,
            AzureSentinelApiConfiguration[] configurations,
            AlertRulesController alertRulesController,
            AuthenticationService authenticationService,
            AlertRuleTemplatesController alertRuleTemplatesController,
            IncidentsController incidentsController,
            ActionsController actionsController,
            BookmarksController bookmarksController,
            DataConnectorsController dataConnectorsController,
            IncidentRelationController incidentRelationController,
            SavedSearchController savedSearchController)
        {
            this.configurations               = configurations;
            this.alertRulesController         = alertRulesController;
            this.authenticationService        = authenticationService;
            this.alertRuleTemplatesController = alertRuleTemplatesController;
            this.incidentsController          = incidentsController;
            this.actionsController            = actionsController;
            this.bookmarksController          = bookmarksController;
            this.dataConnectorsController     = dataConnectorsController;
            this.incidentRelationController   = incidentRelationController;
            this.savedSearchController        = savedSearchController;

            cliMode = rawConfig.GetValue <bool>("Climode");

            string exeName = "AzureSentinel_ManagementAPI.exe";

            cmdArgs = new TupleList <string, int>
            {
                { $": {exeName} 1 <actionRuleId> [instanceId]", 3 },
                { $": {exeName} 2 <actionRuleId> <actionId> [instanceId]", 4 },
                { $": {exeName} 3 <actionRuleId> <actionId> [instanceId]", 4 },
                { $": {exeName} 4 <actionRuleId> [instanceId]", 3 },
                { $": {exeName} 5 <alertRuleTemplateId> [instanceId]", 3 },
                { $": {exeName} 6 [instanceId]", 2 },
                { $": {exeName} 7 [instanceId]", 2 },
                { $": {exeName} 8 [instanceId]", 2 },
                { $": {exeName} 9 [instanceId]", 2 },
                { $": {exeName} 10 <actionRuleId> [instanceId]", 3 },
                { $": {exeName} 11 [instanceId]", 2 },
                { $": {exeName} 12 <fusionRuleId> [instanceId]", 3 },
                { $": {exeName} 13 <securityRuleId> [instanceId]", 3 },
                { $": {exeName} 14 <scheduledRuleId> [instanceId]", 3 },
                { $": {exeName} 15 [instanceId]", 2 },
                { $": {exeName} 16 <bookmarkId> [instanceId]", 3 },
                { $": {exeName} 17 <bookmarkId> [instanceId]", 3 },
                { $": {exeName} 18 [instanceId]", 2 },
                { $": {exeName} 19 [instanceId]", 2 },
                { $": {exeName} 20 <bookmarkId> [instanceId]", 3 },
                { $": {exeName} 21 [instanceId]", 2 },
                { $": {exeName} 22 [instanceId]", 2 },
                { $": {exeName} 23 <incidentId> [instanceId]", 3 },
                { $": {exeName} 24 <incidentId> [instanceId]", 3 },
                { $": {exeName} 25 [instanceId]", 2 },
                { $": {exeName} 26 <incidentId> [instanceId]", 3 },
                { $": {exeName} 27 [instanceId]", 2 },
                { $": {exeName} 28 <incidentId> [instanceId]", 3 },
                { $": {exeName} 29 <incidentId> [instanceId]", 3 },
                { $": {exeName} 30 <incidentId> <commentId> [instanceId]", 4 },
                { $": {exeName} 31 <incidentId> <bookmarkId> [instanceId]", 4 },
                { $": {exeName} 32 <incidentId> <relationId> [instanceId]", 4 },
                { $": {exeName} 33 <incidentId> [instanceId]", 3 },
                { $": {exeName} 34 <incidentId> <relationId> [instanceId]", 4 },
                { $": {exeName} 35 <incidentId> [instanceId]", 3 },
            };
        }
Esempio n. 15
0
 public virtual void Init(L2PlayerData data, ActionsController actionsController)
 {
     _data = data;
     _actionsController = actionsController;
     Initialiased       = true;
 }
        /// <summary>
        /// Create scheduled alert rule for a single instance
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public async Task CreateScheduledAlertRuleByInstance(int i, ActionsController actionsController)
        {
            var alertRules = Utils.LoadPayload <ScheduledAlertRulePayload[]>("ScheduledAlertRulePayload.json", cliMode);

            foreach (var payload in alertRules)
            {
                try
                {
                    var alertRuleId = Guid.NewGuid().ToString();
                    var url         =
                        $"{azureConfigs[i].BaseUrl}/alertRules/{alertRuleId}?api-version={azureConfigs[i].ApiVersion}";

                    string playbook      = payload.Playbook;
                    string subscription  = azureConfigs[i].SubscriptionId;
                    string resourceGroup = azureConfigs[i].ResourceGroupName;
                    playbook         = string.Format(playbook, subscription, resourceGroup);
                    payload.Playbook = null;

                    var serialized = JsonConvert.SerializeObject(payload, new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore,
                        ContractResolver  = new DefaultContractResolver
                        {
                            NamingStrategy = new CamelCaseNamingStrategy()
                        }
                    });

                    var request = new HttpRequestMessage(HttpMethod.Put, url)
                    {
                        Content = new StringContent(serialized, Encoding.UTF8, "application/json")
                    };
                    await authenticationService.AuthenticateRequest(request, i);

                    var http     = new HttpClient();
                    var response = await http.SendAsync(request);

                    if (response.IsSuccessStatusCode)
                    {
                        var res = await response.Content.ReadAsStringAsync();

                        Console.WriteLine(JToken.Parse(res).ToString(Formatting.Indented));

                        if (!string.IsNullOrEmpty(playbook))
                        {
                            await actionsController.CreateAction(alertRuleId, i, playbook);
                        }
                        continue;
                    }

                    var error = await response.Content.ReadAsStringAsync();

                    var formatted = JsonConvert.DeserializeObject(error);
                    throw new WebException("Error calling the API: \n" +
                                           JsonConvert.SerializeObject(formatted, Formatting.Indented));
                }
                catch (Exception ex)
                {
                    throw new Exception($"Something went wrong on {azureConfigs[i].InstanceName}: \n"
                                        + ex.Message);
                }
            }
        }