/// <summary> /// Returns sequential identifier of a block during building. /// </summary> /// <param name="block">Block object.</param> /// <returns></returns> public static string GetID(GenericBlock block) { if (buildingBlocks == null || !buildingBlocks.ContainsKey(block.Guid)) { InitializeBuildingBlockIDs(); } return(buildingBlocks[block.Guid]); }
/// <summary> /// Finds hovered block in buildingBlocks dictionary and shows identifier display. /// </summary> private void ShowBlockIdentifiers() { if (Game.AddPiece == null || Game.AddPiece.HoveredBlock == null) { hoveredBlock = null; return; } hoveredBlock = Game.AddPiece.HoveredBlock; IdentifierDisplay.Instance.ShowBlock(hoveredBlock); }
/// <summary> /// Populates dictionary with references to building blocks. /// Used for dumping block IDs while building. /// Called at first DumpBlockID after machine change. /// </summary> public static void InitializeBuildingBlockIDs() { var typeCount = new Dictionary <string, int>(); buildingBlocks = new Dictionary <Guid, string>(); for (int i = 0; i < ReferenceMaster.BuildingBlocks.Count; i++) { GenericBlock block = ReferenceMaster.BuildingBlocks[i].GetComponent <GenericBlock>(); string name = ReferenceMaster.BuildingBlocks[i].GetComponent <MyBlockInfo>().blockName.ToUpper(); typeCount[name] = typeCount.ContainsKey(name) ? typeCount[name] + 1 : 1; buildingBlocks[block.Guid] = name + " " + typeCount[name]; } }
public static Block Instantiate(string name) { Experiment.Measurement.newBlock(name); Block b; switch (name) { case "carousel": b = new CogBlock <CarouselTrial>(); break; case "propeller": b = new CogBlock <PropellerTrial>(); break; case "speed": b = new SpeedBlock(); break; case "training": b = new CogBlock <CogTrial>(); break; case "direction": b = new CogBlock <DirectionTrial>(); break; case "trainingStability": b = new GenericBlock <StabilityTrial>(); break; case "stabilityGreen": b = new GenericBlock <GreenStabilityTrial>("RESP,CRESP,AnzahlVersuche,Antwortkoordinaten,RT1,RT2,RT3,RT-Gesamt"); break; case "stabilityRed": b = new RedStabilityBlock(2); break; case "matrix": b = new MatrixBlock(7, 3); break; case "vocabulary": b = new VocabularyBlock(13); break; case "carouselTransfer": b = new CogBlock <CarouselTrial>(); // orientiert an Standard carousel break; case "prt": b = new RedStabilityBlock(0); // orientiert an RedStab break; case "sts": b = new RedStabilityBlock(1); // orientiert an RedStab break; default: throw new System.ArgumentException("Tried to instantiate a block with an unknown type: '" + name + "'"); } b.Config = name; return(b); }
internal void ShowBlock(GenericBlock block) { this.block = block; Visible = true; }