상속: Shootable
예제 #1
0
        public async Task Monitor_DocuSign_Activate_Returns_ActivityDTO()
        {
            //Arrange
            var configureUrl = GetTerminalActivateUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestDataDTO = await HealthMonitor_FixtureData.Mail_Merge_Into_DocuSign_v1_InitialConfiguration_Fr8DataDTO(this);

            using (var crateStorage = Crate.GetUpdatableStorage(requestDataDTO.ActivityDTO))
            {
                crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM());
            }


            //Act
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestDataDTO
                    );

            //Assert
            Assert.IsNotNull(responseActionDTO);
            Assert.IsNotNull(Crate.FromDto(responseActionDTO.CrateStorage));
        }
        public async Task Run_Returns_ActivityDTO()
        {
            //Arrange
            var        runUrl  = GetTerminalRunUrl();
            Fr8DataDTO dataDto = HealthMonitor_FixtureData.GetFileListTestFr8DataDTO();

            // Add initial configuretion controls
            using (var crateStorage = Crate.GetUpdatableStorage(dataDto.ActivityDTO))
            {
                crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM());
            }
            // Add operational state crate
            AddOperationalStateCrate(dataDto, new OperationalStateCM());

            //Act
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(
                    runUrl,
                    dataDto
                    );

            //Assert
            Assert.IsNotNull(responseActionDTO);
            var crateFromDTO = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.IsNotNull(crateFromDTO);
            Assert.Greater(crateFromDTO.CratesOfType <StandardFileListCM>().Count(), 0);
        }
예제 #3
0
        private void ExportCrate(object sender, RoutedEventArgs e)
        {
            var messageResult = MessageBox.Show("Would you like to save to file?", "Save", MessageBoxButton.YesNoCancel);

            if (messageResult == MessageBoxResult.Yes)
            {
                var dialog = new Microsoft.Win32.SaveFileDialog();
                dialog.Filter = "YML file (*.yml)|*.yml";
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult == true)
                {
                    string filePath = dialog.FileName;

                    using (FileStream stream = File.OpenWrite(filePath))
                    {
                        using (StreamWriter writer = new StreamWriter(stream))
                        {
                            Crate crate = (Crate)CratePanel.DataContext;
                            writer.Write(crate.ToString());
                        }
                    }
                }
            }
            else if (messageResult == MessageBoxResult.No)
            {
                if (CratePanel.DataContext is Crate)
                {
                    Crate crate = (Crate)CratePanel.DataContext;
                    // Should probably make a new window to show this in that allows the user to copy+paste it into their config.
                    // Once more developed, I should also add a export all button.
                    MessageBox.Show(crate.ToString());
                }
            }
        }
예제 #4
0
 //Undocks, sets crate, and triggers movement update
 public void Dispatch(Crate crate, Dock port)
 {
     HeldCrate = crate;
     Undock(port);
     reverse = port == Pipe.To;
     Move();
 }
예제 #5
0
        private async Task ProcessFilePickers(IEnumerable <ControlDefinitionDTO> filepickers)
        {
            int labeless_pickers = 0;

            foreach (FilePicker filepicker in filepickers)
            {
                var    uploadFilePath = filepicker.Value;
                byte[] file           = null;
                switch (GetUriFileExtension(uploadFilePath))
                {
                case ".xlsx":
                    file = await ProcessExcelFile(uploadFilePath);

                    break;
                }

                if (file == null)
                {
                    continue;
                }

                string crate_label     = GetFileDescriptionLabel(filepicker, labeless_pickers);
                var    fileDescription = new StandardFileDescriptionCM
                {
                    Filename           = Path.GetFileName(uploadFilePath),
                    TextRepresentation = Convert.ToBase64String(file),
                    Filetype           = Path.GetExtension(uploadFilePath)
                };

                Payload.Add(Crate.FromContent(crate_label, fileDescription));
            }
        }
예제 #6
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            background  = Content.Load <Texture2D>("sky");
            foreground  = Content.Load <Texture2D>("nearback");
            world       = new World(new Vector2(0, 1f));

            debugView       = new DebugViewXNA(world);
            camera          = new Camera(this);
            camera.Position = new Vector2(22, 20);
            debugView.LoadContent(GraphicsDevice, Content);

            playerController.LoadContent();
            badger = new ScrapBadger(this, new Vector2(23, 4));

            badger.Rotate(20f * 0.0174532925f);


            crate = new Crate(this, new Vector2(26, 2));
            //XmlLoader loader = new XmlLoader();
            //loader.LoadLevel(ref entityList);


            terrain.LoadContent();
            terrain.CreateGround(world);

            //Init();
        }
예제 #7
0
    private void ToPushing()
    {
        RaycastHit2D hit2D = Physics2D.Raycast(transform.position, transform.right, SensorPush, Pushable);


        float moveRaw = Input.GetAxisRaw("Horizontal");

        if (hit2D && (Pushable & 1 << hit2D.collider.gameObject.layer) == 1 << hit2D.collider.gameObject.layer)
        {
            if (moveRaw == transform.right.x && IsOnGround)
            {
                Crate CrateBox = hit2D.collider.GetComponent <Crate>();

                _moveSpeed = MoveSpeed - CrateBox.getPushSpeed;
            }
            else if (MoveDir.x == 0 || !IsOnGround)
            {
                _moveSpeed = MoveSpeed;
            }
        }
        else if (!IsPulling)
        {
            //Crate CrateBox = hit2D.collider.GetComponent<Crate>();
            //CrateBox.GetThisRB.constraints &= ~RigidbodyConstraints2D.FreezePositionX;
            _moveSpeed = MoveSpeed;
        }
    }
예제 #8
0
    private void ToPulling()
    {
        float MoveRaw = Input.GetAxisRaw("Horizontal");

        if (Input.GetKey(KeyCode.E) && MoveRaw == -transform.right.x)
        {
            IsPulling = true;

            RaycastHit2D hit2D = Physics2D.Raycast(transform.position, transform.right, SensorPush, Pushable);

            if (hit2D && (Pushable & 1 << hit2D.collider.gameObject.layer) == 1 << hit2D.collider.gameObject.layer)
            {
                fixedJoint.enabled       = true;
                fixedJoint.connectedBody = hit2D.rigidbody;

                Crate crateBox = hit2D.collider.GetComponent <Crate>();
                playerPullSpeed = MoveSpeed - crateBox.getPushSpeed;
            }
            _moveSpeed = playerPullSpeed;
        }
        else if (!IsOnGround)
        {
            fixedJoint.enabled = false;
            IsPulling          = false;
        }

        if (Input.GetKeyUp(KeyCode.E))
        {
            fixedJoint.enabled = false;
            IsPulling          = false;
        }
    }
        private void SetFilterUsingRunTimeActivityFields(ActivityPayload filterUsingRunTimeAction, string status)
        {
            var crateStorage    = filterUsingRunTimeAction.CrateStorage;
            var configControlCM = crateStorage
                                  .CrateContentsOfType <StandardConfigurationControlsCM>()
                                  .First();
            var filterPane = (FilterPane)configControlCM.Controls.First(c => c.Name == "Selected_Filter");

            var conditions = new List <FilterConditionDTO>
            {
                new FilterConditionDTO {
                    Field = "Status", Operator = "neq", Value = status
                }
            };

            filterPane.Value = JsonConvert.SerializeObject(new FilterDataDTO
            {
                ExecutionType = FilterExecutionType.WithFilter,
                Conditions    = conditions
            });

            var queryableCriteria = new FieldDescriptionsCM(
                new FieldDTO()
            {
                Name      = "Status",
                Label     = "Status",
                FieldType = FieldType.String
            });
            var queryFieldsCrate = Crate.FromContent("Queryable Criteria", queryableCriteria);

            crateStorage.RemoveByLabel("Queryable Criteria");
            crateStorage.Add(queryFieldsCrate);
        }
예제 #10
0
        public async Task Run_WhenNoChatterSourceIsSelected_ReturnsError()
        {
            var activity         = New <Post_To_Chatter_v2>();
            var executionContext = new ContainerExecutionContext
            {
                PayloadStorage = new CrateStorage(Crate.FromContent(string.Empty, new OperationalStateCM()))
            };
            var activityContext = new ActivityContext
            {
                HubCommunicator = ObjectFactory.GetInstance <IHubCommunicator>(),
                ActivityPayload = new ActivityPayload
                {
                    CrateStorage = new CrateStorage()
                },
                AuthorizationToken = new AuthorizationToken {
                    Token = Token.Token
                }
            };
            await activity.Configure(activityContext);

            activityContext.ActivityPayload.CrateStorage.UpdateControls <Post_To_Chatter_v2.ActivityUi>(x =>
            {
                x.FeedTextSource.TextValue   = "message";
                x.FeedTextSource.ValueSource = "specific";
            });

            activity = New <Post_To_Chatter_v2>();

            await activity.Run(activityContext, executionContext);

            var operationalState = executionContext.PayloadStorage.FirstCrateContentOrDefault <OperationalStateCM>();

            Assert.AreEqual(ActivityResponse.Error.ToString(), operationalState.CurrentActivityResponse.Type, "Run must fail if chatter is not specified is empty");
        }
예제 #11
0
        private async Task PrepareGetData(PlanDTO plan)
        {
            var getDataActivity = plan.SubPlans.First().Activities.Last();

            //set lead and do the follow up config
            using (var crateStorage = Crate.GetUpdatableStorage(getDataActivity))
            {
                crateStorage.UpdateControls <Get_Data_v1.ActivityUi>(x =>
                {
                    x.SalesforceObjectSelector.selectedKey = SalesforceObjectType.Lead.ToString();
                });
            }
            getDataActivity = await ConfigureActivity(getDataActivity);

            Debug.WriteLine("Get Data Follow up config is successfull with Lead selected");
            //set the lead required fields.
            using (var crateStorage = Crate.GetUpdatableStorage(getDataActivity))
            {
                crateStorage.UpdateControls <Get_Data_v1.ActivityUi>(x =>
                {
                    x.SalesforceObjectFilter.Value = JsonConvert.SerializeObject(new List <FilterConditionDTO> {
                        new FilterConditionDTO {
                            Field = "LastName", Operator = "eq", Value = "Unit"
                        }
                    });
                });
            }

            getDataActivity = await ConfigureActivity(getDataActivity);

            Debug.WriteLine("Get Data Follow up config is successfull with selection query fields set.");
            plan.SubPlans.First().Activities[1] = getDataActivity;
        }
        public override async Task Run()
        {
            var authToken = JsonConvert.DeserializeObject <DocuSignAuthTokenDTO>(AuthorizationToken.Token);

            Debug.WriteLine($"Running PrepareDocuSignEventForStorage: {ActivityId} - view viewhere!!!{0} - label {ActivityPayload.Label}");
            Debug.WriteLine($"for container {ExecutionContext.ContainerId} and authToken {AuthorizationToken}");

            var curEventReport = Payload.CrateContentsOfType <EventReportCM>().First();

            if (curEventReport.EventNames.Contains("Envelope"))
            {
                var crate = curEventReport.EventPayload.CrateContentsOfType <DocuSignEnvelopeCM_v2>().First();
                Payload.Add(Crate.FromContent("DocuSign Envelope", crate));

                foreach (var recipient in crate.Recipients)
                {
                    var recManifest = new DocuSignRecipientCM()
                    {
                        DocuSignAccountId = authToken.AccountId,
                        EnvelopeId        = crate.EnvelopeId,
                        RecipientEmail    = recipient.Email,
                        RecipientId       = recipient.RecipientId,
                        RecipientUserName = recipient.Name,
                        RecipientStatus   = recipient.Status
                    };
                    Payload.Add(Crate.FromContent("DocuSign Recipient " + recManifest.RecipientEmail, recManifest));
                }
            }

            Payload.RemoveByManifestId((int)MT.StandardEventReport);
            Debug.WriteLine($"Returning success for payload {ExecutionContext.ContainerId} - {Payload}");
            Success();
        }
 public static List <Crate> TestCrateDTO3()
 {
     return(new List <Crate>
     {
         Crate.FromContent("Crate1", new CrateDescriptionCM
         {
             CrateDescriptions =
             {
                 new CrateDescriptionDTO
                 {
                     Label = "Crate2",
                     Availability = AvailabilityType.Always,
                     Fields =
                     {
                         new FieldDTO("Text 5"),
                         new FieldDTO("Doctor"),
                         new FieldDTO("Condition"),
                     }
                 }
             }
         }),
         Crate.FromContent("CrateId2", new StandardConfigurationControlsCM()),
         Crate.FromContent("CrateId3", new DocuSignRecipientCM()),
         Crate.FromContent("CrateId4", new EventSubscriptionCM()),
         Crate.FromContent("CrateId5", new StandardFileListCM())
     });
 }
        /// <summary>
        /// Get or sets value of configuration field with the given key stored in current activity storage
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        protected string this[string key]
        {
            get
            {
                CheckCurrentActivityStorageAvailability();
                var crate = Storage.FirstCrateOrDefault <FieldDescriptionsCM>(x => x.Label == ConfigurationValuesCrateLabel);
                return(crate?.Content.Fields.FirstOrDefault(x => x.Key == key)?.Value);
            }
            set
            {
                CheckCurrentActivityStorageAvailability();
                var crate = Storage.FirstCrateOrDefault <FieldDescriptionsCM>(x => x.Label == ConfigurationValuesCrateLabel);
                if (crate == null)
                {
                    crate = Crate <FieldDescriptionsCM> .FromContent(ConfigurationValuesCrateLabel, new FieldDescriptionsCM(), AvailabilityType.Configuration);

                    Storage.Add(crate);
                }
                var field = crate.Content.Fields.FirstOrDefault(x => x.Key == key);
                if (field == null)
                {
                    field = new FieldDTO(key, AvailabilityType.Configuration);
                    crate.Content.Fields.Add(field);
                }
                field.Value = value;
                Storage.ReplaceByLabel(crate);
            }
        }
예제 #15
0
        public async Task Prepare_DocuSign_Events_For_Storage_Envelope_Run()
        {
            var runUrl = GetTerminalRunUrl();

            var dataDTO = await HealthMonitor_FixtureData.Prepare_DocuSign_Events_For_Storage_v1_InitialConfiguration_Fr8DataDTO(this);

            var date        = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern);
            var envelopeId  = Guid.NewGuid().ToString();
            var accountId   = "*****@*****.**";
            var eventId     = Guid.NewGuid().ToString();
            var recipientId = Guid.NewGuid().ToString();

            var envelopePayload = HealthMonitor_FixtureData.GetEnvelopePayload();


            AddPayloadCrate(
                dataDTO,
                new EventReportCM()
            {
                EventPayload = envelopePayload,
                EventNames   = "Receive Envelope"
            }
                );

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var crateStorage = Crate.GetStorage(responsePayloadDTO);

            Assert.AreEqual(1, crateStorage.CrateContentsOfType <DocuSignEnvelopeCM_v2>(x => x.Label == "DocuSign Envelope").Count());
        }
예제 #16
0
    private void ProcessStack(Stack <Crate> stack, List <Crate> checkList, List <Crate> updateList, Group newGroup)
    {
        // INGRESS
        // get crate from stack - get nbrs - add nbrs to stack and list
        while (stack.Count > 0)
        {
            Crate   nextCrate = stack.Peek();           // get crate from stack - PEEK ONLY
            Crate[] nbrs      = nextCrate.Neighbours(); // get nbrs
            foreach (Crate nbr in nbrs)                 // get deeper if there are unchecked nbrs
            {
                if (nbr != null && !checkList.Contains(nbr))
                {
                    stack.Push(nbr);
                    checkList.Add(nbr);
                    ProcessStack(stack, checkList, updateList, newGroup);
                }
            }

            // EGRESS
            // pull a crate from the stack - reassign group
            if (stack.Count > 0)
            {
                Crate crateToUpdate = stack.Pop();
                if (!updateList.Contains(crateToUpdate))                       // was the crate already updated?
                {
                    GetGroupByCrate(crateToUpdate).RemoveCrate(crateToUpdate); // remove crate from old group
                    master.orderMaster.RemoveGroupMatches(GetGroupByCrate(crateToUpdate));
                    newGroup.AddCrate(crateToUpdate);                          // add crate to new group
                    crateToUpdate.SetGroup(newGroup.Index);                    // update group index in crate
                    updateList.Add(crateToUpdate);                             // mark crate as updated
                }
            }
        }
    }
예제 #17
0
        private async Task PrepareSaveToLead(PlanDTO plan)
        {
            var saveActivity = plan.SubPlans.First().Activities.First();

            //set lead and do the follow up config
            using (var updatableStorage = Crate.GetUpdatableStorage(saveActivity))
            {
                var ddlb = (DropDownList)updatableStorage.CratesOfType <StandardConfigurationControlsCM>().Single().Content.Controls[0];
                ddlb.selectedKey = "Lead";
            }
            saveActivity = await ConfigureActivity(saveActivity);

            Debug.WriteLine("Save to Salesforce Follow up config is successfull with Lead selected.");

            //set the lead required fields.
            using (var updatableStorage = Crate.GetUpdatableStorage(saveActivity))
            {
                var requiredControls = updatableStorage.CratesOfType <StandardConfigurationControlsCM>().Single().Content.Controls;

                var lastNameControl = (TextSource)requiredControls.Single(c => c.Name.Equals("LastName"));
                lastNameControl.ValueSource = "specific";
                lastNameControl.TextValue   = "Unit";

                var companyControl = (TextSource)requiredControls.Single(c => c.Name.Equals("Company"));
                companyControl.ValueSource = "specific";
                companyControl.TextValue   = "Test";
            }
            saveActivity = await ConfigureActivity(saveActivity);

            Debug.WriteLine("Save to Salesforce Follow up config is successfull with required fields set.");

            plan.SubPlans.First().Activities[0] = saveActivity;
        }
예제 #18
0
    private void Shoot()
    {
        --_currentAmmo;
        _UI.UpdateAmmo(_currentAmmo);

        if (_shootingSoundSource.isPlaying == false)
        {
            _shootingSoundSource.Play();
        }

        _muzzleFash.Emit(1);
        _laserStreaks.Emit(1);
        Ray        ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)); // I can also use ScreenPointToRay and pass the mouse position on screen as a parameter
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, Mathf.Infinity))
        {
            Debug.Log("Raycast hit the Gameobject with a collider box named: " + hitInfo.transform.name);
            _hitMarkerContainer = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
            Destroy(_hitMarkerContainer, 5.0f);

            Crate crate = hitInfo.transform.GetComponent <Crate>();

            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
        else
        {
            Debug.Log("I hit nothing");
        }
    }
예제 #19
0
    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (hit.gameObject.tag == "Crate")
        {
            Crate crate = hit.gameObject.GetComponent <Crate> ();

            float xDirection = hit.moveDirection.x;
            float zDirection = hit.moveDirection.z;

            if (xDirection == 1.0f || xDirection == -1.0f)
            {
                zDirection = 0.0f;
            }
            else if (zDirection == 1.0f || zDirection == -1.0f)
            {
                xDirection = 0.0f;
            }
            else
            {
                xDirection = 0.0f;
                zDirection = 0.0f;
            }

            Vector3 direction = new Vector3(xDirection, 0.0f, zDirection);
            crate.Push(direction);
        }
    }
예제 #20
0
        public async Task Get_Google_Sheet_Data_v1_FollowupConfiguration_Row_And_Column_Table()
        {
            var configureUrl = GetTerminalConfigureUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            ////Act
            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "Row_And_Column");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            //As the ActionDTO is preconfigured configure url actually calls the follow up configuration
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());

            // Due to performance issue, remove functionalilty to load table contents
            //  Assert.AreEqual("(2,1)", crateStorage.CratesOfType<StandardTableDataCM>().Single().Content.Table[0].Row[0].Cell.Value);
            //Assert.AreEqual("(2,2)", crateStorage.CratesOfType<StandardTableDataCM>().Single().Content.Table[0].Row[1].Cell.Value);
        }
예제 #21
0
        public async Task Run_WhenMessageIsEmpty_ReturnsError()
        {
            var activity         = New <Post_To_Chatter_v2>();
            var executionContext = new ContainerExecutionContext
            {
                PayloadStorage = new CrateStorage(Crate.FromContent(string.Empty, new OperationalStateCM()))
            };
            var activityContext = new ActivityContext
            {
                HubCommunicator = ObjectFactory.GetInstance <IHubCommunicator>(),
                ActivityPayload = new ActivityPayload
                {
                    CrateStorage = new CrateStorage()
                },
                AuthorizationToken = new AuthorizationToken {
                    Token = Token.Token
                }
            };
            await activity.Configure(activityContext);


            ActivityConfigurator.GetControl <ControlDefinitionDTO>(activityContext.ActivityPayload, "FeedTextSource").Value = null;

            activity = New <Post_To_Chatter_v2>();

            await activity.Run(activityContext, executionContext);

            var operationalState = executionContext.PayloadStorage.FirstCrateContentOrDefault <OperationalStateCM>();

            Assert.AreEqual(ActivityResponse.Error.ToString(), operationalState.CurrentActivityResponse.Type, "Run must fail if message is empty");
        }
예제 #22
0
        public async Task Get_Google_Sheet_Data_v1_FollowupConfiguration_Row_Only_Table()
        {
            var configureUrl = GetTerminalConfigureUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            ////Act
            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "Row_Only");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            //As the ActionDTO is preconfigured configure url actually calls the follow up configuration
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());
        }
예제 #23
0
    public void Move(Vector2 direction)
    {
        // Debug.LogFormat("Confirm: moving {0} in dir {1}", this.xy, direction);
        if (hasMoved || direction == Vector2.zero || IsNanVector(direction))
        {
            return;
        }
        hasMoved = true;
        // Debug.LogFormat("xy = {0}, direction = {1}", xy, direction);
        Vector2 target  = xy + direction;
        bool    offGrid = !Crates.InBounds(target);

        if (offGrid)
        {
            FallOffGrid(target, direction);
            return;
        }

        Crate targetCrate = Crates.At(target);

        if (targetCrate && targetCrate != this)
        {
            targetCrate.group.Move(direction);
        }

        Crates.Remove(xy);
        xy = target;
        Crates.Add(this);
        StartCoroutine(AnimateMove(target, direction));
    }
예제 #24
0
	void MakeBuildCrate(){
		buildCrate = (Crate)GameObject.Instantiate (cratePrefab, Vector3.one * -1, Quaternion.identity);
		buildCrate.VoxelInit ();
		buildCrate.temporary = true;
		buildCrate.isActive = false;
		buildCrate.SetVisible (false);
	}
예제 #25
0
        public void Check_Initial_Configuration_Crate_Structure()
        {
            //Assert.AreEqual(1, 2);
            var configureUrl = GetTerminalConfigureUrl();

            var requestActionDTO = CreateRequestActivityFixture();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            var responseActionDTO = HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO).Result;

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count);

            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count(x => x.Label == "Configuration_Controls"));
            Assert.AreEqual(1, crateStorage.CratesOfType <KeyValueListCM>().Count(x => x.Label == "Select Fr8 Object"));

            var configCrate = crateStorage
                              .CrateContentsOfType <StandardConfigurationControlsCM>(x => x.Label == "Configuration_Controls")
                              .SingleOrDefault();

            ValidateConfigurationCrateStructure(configCrate);

            var designTimeCrate = crateStorage
                                  .CrateContentsOfType <KeyValueListCM>(x => x.Label == "Select Fr8 Object")
                                  .SingleOrDefault();

            ValidateFr8ObjectCrateStructure(designTimeCrate);
        }
예제 #26
0
        public void TestSetup()
        {
            Maze  maze = new Maze();
            Field tmpfield;
            Truck tmptruck;

            maze._Truck                 = new Truck();
            maze._FirstTile             = new Wall();
            maze._FirstTile._East       = new Destination(null);
            maze._FirstTile._East._West = maze._FirstTile;
            tmpfield = new Field(null);
            _Crate   = new Crate();
            maze.crates.Add(_Crate);
            tmpfield._Movable                 = _Crate;
            tmpfield._Movable._Field          = tmpfield;
            maze._FirstTile._East._East       = tmpfield;
            maze._FirstTile._East._East._West = maze._FirstTile._East;
            tmpfield                                      = new Field(null);
            tmptruck                                      = new Truck();
            tmpfield._Movable                             = tmptruck;
            maze._Truck                                   = tmptruck;
            tmpfield._Movable._Field                      = tmpfield;
            maze._FirstTile._East._East._East             = tmpfield;
            maze._FirstTile._East._East._East._West       = maze._FirstTile._East._East;
            maze._FirstTile._East._East._East._East       = new Wall();
            maze._FirstTile._East._East._East._East._West = maze._FirstTile._East._East._East;
            _Game = new Game(maze);
        }
예제 #27
0
 private void OnGrabberDocked(Dock port, Grabber grabber)
 {
     if(port == output && outputOverflow != null)
     {
         grabber.Dispatch(outputOverflow, port);
         outputOverflow = null;
     }
     else if(inputA.DockedGrabbers.Count > 0
        && inputB.DockedGrabbers.Count > 0
        && output.DockedGrabbers.Count > 0)
     {
         Crate inCrateA = inputA.DockedGrabbers[0].HeldCrate;
         Crate inCrateB = inputB.DockedGrabbers[0].HeldCrate;
         int featuresMoved = Mathf.Min (Crate.MaxFeatures - inCrateA.Features.Count, inCrateB.Features.Count);
         for(int i = 0; i < featuresMoved; i++)
         {
             inCrateA.Features.Add(inCrateB.Features[i]);
         }
         if(featuresMoved < inCrateB.Features.Count)
         {
             inCrateB.Features.RemoveRange (0, featuresMoved);
             outputOverflow = inCrateB;
         }
         inputA.DockedGrabbers[0].Dispatch(null, inputA);
         inputB.DockedGrabbers[0].Dispatch(null, inputB);
         output.DockedGrabbers[0].Dispatch(inCrateA, output);
     }
 }
        public override Task Run()
        {
            var resultFields  = new List <KeyValueDTO>();
            var delayActivity = ActivityPayload.ChildrenActivities.FirstOrDefault(x => x.ActivityTemplate.Name == "Set_Delay" && x.ActivityTemplate.Version == "1");

            if (delayActivity != null)
            {
                var delayControl = delayActivity.CrateStorage.FirstCrate <StandardConfigurationControlsCM>().Content.Controls.OfType <Duration>().First();
                resultFields.Add(new KeyValueDTO {
                    Key = DelayTimeProperty, Value = GetDelayDescription(delayControl)
                });
            }
            var filterActivity = ActivityPayload.ChildrenActivities.FirstOrDefault(x => x.ActivityTemplate.Name == "Test_Incoming_Data" && x.ActivityTemplate.Version == "1");

            if (filterActivity != null)
            {
                var filterPane  = filterActivity.CrateStorage.FirstCrate <StandardConfigurationControlsCM>().Content.Controls.OfType <FilterPane>().First();
                var conditions  = JsonConvert.DeserializeObject <FilterDataDTO>(filterPane.Value);
                var statusField = conditions.Conditions.FirstOrDefault(c => c.Field == "Status");
                if (statusField != null)
                {
                    resultFields.Add(new KeyValueDTO {
                        Key = ActionBeingTrackedProperty, Value = statusField.Value
                    });
                }
            }
            Payload.Add(Crate <StandardPayloadDataCM> .FromContent(RuntimeCrateLabel, new StandardPayloadDataCM(resultFields)));
            return(Task.FromResult(0));
        }
        public override async Task FollowUp()
        {
            var selectedObject    = ActivityUI.AvailableObjects.Value;
            var hasSelectedObject = !string.IsNullOrEmpty(selectedObject);

            var properties = new List <FieldDTO>();

            if (hasSelectedObject)
            {
                Guid selectedObjectId;
                if (Guid.TryParse(ActivityUI.AvailableObjects.Value, out selectedObjectId))
                {
                    using (var uow = _container.GetInstance <IUnitOfWork>())
                    {
                        properties = MTTypesHelper.GetFieldsByTypeId(uow, selectedObjectId, AvailabilityType.RunTime).ToList();
                        Storage.ReplaceByLabel(
                            Crate.FromContent("Queryable Criteria", new FieldDescriptionsCM(properties)));
                    }
                }
            }

            ActivityUI.QueryBuilder.IsHidden      = !hasSelectedObject;
            ActivityUI.SelectObjectLabel.IsHidden = hasSelectedObject;
            if (!string.IsNullOrEmpty(selectedObject))
            {
                using (var uow = _container.GetInstance <IUnitOfWork>())
                {
                    CrateSignaller.MarkAvailableAtRuntime <StandardTableDataCM>(RunTimeCrateLabel).AddFields(properties);
                }
            }

            await Task.Yield();
        }
예제 #30
0
        private async Task <ActivityDTO> GetActivityDTO_WithRecipientValue()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var requestActionDTO = await HealthMonitor_FixtureData.Monitor_DocuSign_v1_InitialConfiguration_Fr8DataDTO(this);

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestActionDTO
                    );

            responseActionDTO.AuthToken = requestActionDTO.ActivityDTO.AuthToken;

            using (var crateStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                var controls = crateStorage
                               .CrateContentsOfType <StandardConfigurationControlsCM>()
                               .Single();
                //Part of FR-2474: mark first checkbox as selected so activity will pass validation
                var checkBox = controls.Controls.OfType <CheckBox>().First();
                checkBox.Selected = true;

                var radioGroup = (RadioButtonGroup)controls.Controls[4];
                radioGroup.Radios[0].Selected = true;
                radioGroup.Radios[1].Selected = false;

                var recipientTextBox = (TextBox)radioGroup.Radios[0].Controls[0];
                recipientTextBox.Value = "*****@*****.**";
            }

            return(responseActionDTO);
        }
예제 #31
0
    void Start()
    {
        this.enabled = false;
        int playerCount = 1;

        GameObject[,] level = new GameObject[zSize, xSize];
        for (int z = 0; z < zSize; z++)
        {
            for (int x = 0; x < xSize; x++)
            {
                if (LevelGen[z, x] == (int)ObjectType.Wall_solid)
                {
                    level[z, x] = PlaceObject(Wall_solid, x, z, ObjectType.Wall_solid) as GameObject;
                }

                if (LevelGen[z, x] == (int)ObjectType.Crate)
                {
                    level[z, x] = PlaceObject(Crate, x, z, ObjectType.Crate) as GameObject;
                    Crate crate = level[z, x].GetComponent <Crate>();
                    crate.SetX(x);
                    crate.SetZ(z);
                }
                if (LevelGen[z, x] == (int)ObjectType.Player)
                {
                    level[z, x] = PlaceObject(Player[playerCount - 1], x, z, ObjectType.Player) as GameObject;
                    Character player = level[z, x].GetComponent <Character>();
                    player.SetPlayer(playerCount);
                    player.SetX(x);
                    player.SetZ(z);
                    playerCount++;
                    LevelGen[z, x] = 0;
                }
            }
        }
    }
예제 #32
0
        public async Task Monitor_DocuSign_FollowUp_Configuration_RecipientValue()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var activityDTO = await GetActivityDTO_WithRecipientValue();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            var crateStorage = Crate.GetStorage(responseActionDTO);

            var availableFields = crateStorage
                                  .CrateContentsOfType <CrateDescriptionCM>(x => x.Label == "Runtime Available Crates")
                                  .Single();

            Assert.AreEqual(1, availableFields.CrateDescriptions.Count, "Unexpected number of available crates");

            Assert.AreEqual(7, availableFields.CrateDescriptions[0].Fields.Count, "Unexpected number of available fields");
        }
예제 #33
0
        public override async Task Run()
        {
            var findObjectHelper = new FindObjectHelper();
            var columnTypes      = await findObjectHelper.ExtractColumnTypes(HubCommunicator, ActivityContext);

            if (columnTypes == null)
            {
                RaiseError("No column types crate found.");
                return;
            }

            var queryPayloadValue = ExtractSqlQuery();

            if (queryPayloadValue == null)
            {
                RaiseError("No Sql Query payload crate found.");
                return;
            }

            var connectionString = await ExtractConnectionString();

            var query = BuildQuery(connectionString, queryPayloadValue, columnTypes);

            var dbProvider     = DbProvider.GetDbProvider(DefaultDbProvider);
            var data           = dbProvider.ExecuteQuery(query);
            var payloadCM      = BuildStandardPayloadData(data, columnTypes);
            var payloadCMCrate = Crate.FromContent("Sql Query Result", payloadCM);

            Payload.Add(payloadCMCrate);
            Success();
        }
예제 #34
0
    public void Initialize(Slot s, CrateSlot cs, float delay)
    {
        this.crate = s.crate;
        this.typeCollected = this.crate.type;
        //this.crate.transform.parent = transform;
        this.delay = delay;
        this.crateSlot = cs;

        effectState = 0;
    }
    void ListenObtainCrate(Character _character, Crate _crate)
    {
        if (_character != character)
        {
            Debug.LogWarning("Character does not match. Ignore");
            return;
        }

        if (Network.peerType == NetworkPeerType.Disconnected)
            GameCharacter_ObtainCrate(Network.player.guid, _crate.id);
        else
            networkView.RPC("GameCharacter_ObtainCrate", RPCMode.All,
                Network.player.guid, _crate.id);
    }
    public void Obtain(Crate _crate)
    {
        if (! enabled)
        {
            Debug.Log("trying to obtain disabled CrateDetector!");
            return;
        }

        if ( m_DoObtain != null)
        {
            m_DoObtain(_crate);
        }
        else
        {
            Debug.Log("doObtain is not set!");
        }
    }
예제 #37
0
 private void OnGrabberDocked(Dock port, Grabber grabber)
 {
     if(input.DockedGrabbers.Count > 0
        && outputSingle.DockedGrabbers.Count > 0
        && (input.DockedGrabbers[0].HeldCrate.Features.Count == 1 || outputRemainder.DockedGrabbers.Count > 0))
     {
         Crate inCrate = input.DockedGrabbers[0].HeldCrate;
         if(inCrate.Features.Count == 1)
         {
             outputSingle.DockedGrabbers[0].Dispatch(inCrate, outputSingle);
             input.DockedGrabbers[0].Dispatch(null, input);
         }
         else
         {
             Crate single = new Crate();
             int last = inCrate.Features.Count - 1;
             single.Features = new List<CrateFeature>(){inCrate.Features[last]};
             inCrate.Features.RemoveAt (last);
             input.DockedGrabbers[0].Dispatch(null, input);
             outputSingle.DockedGrabbers[0].Dispatch(single, outputSingle);
             outputRemainder.DockedGrabbers[0].Dispatch(inCrate, outputRemainder);
         }
     }
 }
예제 #38
0
	public void AddCrate(Crate crate){
		crates.Add (crate);
	}
예제 #39
0
 public ProduceRule(Crate produces)
 {
     Production = produces;
 }
예제 #40
0
 public Crate(Crate cloneOf)
 {
     Features.AddRange (cloneOf.Features);
 }
예제 #41
0
	void Obtain(Crate _crate) 
	{
		if (networkView.enabled && ! networkView.isMine) 
			return;
		
		if (_crate.empty) return;
		
		var _weapon = GameObject.Instantiate(Resources.Load(_crate.weapon)) as GameObject;
		weapon = _weapon.GetComponent<Weapon>();
	}
 public void OnEnable()
 {
     m_This = target as Crate;
 }
    void Obtain(Crate _crate)
    {
        if ( IsNetworkEnabled() && ! IsMine())
            return;

        if (_crate.empty)
            return;

        SetWeapon(_crate.weapon);
        if (postObtainCrate != null) postObtainCrate(this, _crate);
    }
예제 #44
0
	public void Build(){
		buildCrate.Teleport(position + forwardDirection);
		buildCrate = null;
		anim.SetTrigger ("build");
	}
예제 #45
0
        private void Init()
        {
            cursor = new CursorMovement(this);
            crates = new List<Crate>();
            stack = new List<VectorInt>();

            grid.Children.Clear();
            crates.Clear();

            grid.ColumnDefinitions.Clear();
            grid.RowDefinitions.Clear();

            SizeInt size = Logic.Current.Size;
            for (int r = 0; r < size.Height; r++)
            {
                grid.RowDefinitions.Add(new RowDefinition
                {
                    MinHeight = 16,
                });
            }

            for (int c = 0; c < size.Width; c++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition
                {
                    MinWidth = 16,
                });
            }

            for (int r = 0; r < size.Height; r++)
                for (int c = 0; c < size.Width; c++)
                {
                    var cells = CellFactory(c, r);
                    if (cells != null)
                    {
                        foreach (var cell in cells)
                        {
                            Grid.SetColumn(cell, c);
                            Grid.SetRow(cell, r);
                            grid.Children.Add(cell);
                        }

                    }
                }

            // So that the player has the largest z-Order...
            for (int r = 0; r < size.Height; r++)
                for (int c = 0; c < size.Width; c++)
                {
                    CellStates tile = Logic.Current[c, r];

                    if (tile == CellStates.FloorCrate || tile == CellStates.FloorCrate || tile == CellStates.FloorGoalCrate)
                    {
                        var crate = new Crate
                        {
                            Element = new Image
                            {
                                Stretch = Stretch.Fill,
                                Source = Resources["Crate"] as BitmapImage
                            }
                        };
                        Grid.SetColumn(crate.Element, c);
                        Grid.SetRow(crate.Element, r);
                        grid.Children.Add(crate.Element);
                        crates.Add(crate);
                    }
                }

            for (int r = 0; r < size.Height; r++)
                for (int c = 0; c < size.Width; c++)
                {
                    CellStates tile = Logic.Current[c, r];

                    if (tile == CellStates.FloorPlayer || tile == CellStates.FloorGoalPlayer)
                    {
                        player = new Image
                        {
                            Stretch = Stretch.Fill,
                            Source = Resources["Player"] as BitmapImage
                        };
                        Grid.SetColumn(player, c);
                        Grid.SetRow(player, r);
                        grid.Children.Add(player);
                    }
                }
        }
예제 #46
0
	public void RemoveCrate(Crate crate){
		if(crates.Contains(crate))
		crates.Remove (crate);
	}
예제 #47
0
 private void DoMatchReplace(Crate crate)
 {
     for(int i = 0; i < crate.Features.Count; i++)
     {
         if(crate.Features[i].Matches(MatchFeature))
         {
             CrateFeature newFeature = new CrateFeature(crate.Features[i]);
             if(ReplaceFeature.Color != CrateFeature.ColorWildcard)
             {
                 newFeature.Color = ReplaceFeature.Color;
             }
             if(ReplaceFeature.Shape != CrateFeature.ShapeWildcard)
             {
                 newFeature.Shape = ReplaceFeature.Shape;
             }
             crate.Features[i] = newFeature;
         }
     }
 }
예제 #48
0
 public DestroyExactlyRule(Crate filter)
 {
     this.filter = filter;
 }
 public override void HandleInput(GameTime gameTime, InputState input)
 {
     foreach(GestureSample gesture in input.Gestures) {
         if(gesture.GestureType == GestureType.Tap) {
             Vector2 scaledPos = Helpers.ScaleInput(gesture.Position);
             foreach(Crate crate in crates) {
                 if(Math.Abs(crate.Coord.X - scaledPos.X) < Constants.SPRITE_DIM * 1.4 &&
                 Math.Abs(crate.Coord.Y - scaledPos.Y) < Constants.SPRITE_DIM * 1.4 && !hold) {
                     if(crate.GoUp(gameTime)) {
                         if(lastPick != null) {
                             crate.Match(lastPick);
                         } else {
                             lastPick = crate;
                         }
                     }
                     break;
                 }
             }
         }
     }
     base.HandleInput(gameTime, input);
 }