public getMoleculesFromMedium ( int id ) : ArrayList | ||
id | int | |
Résultat | ArrayList |
// Update is called once per frame void Update() { int previousListedCount = _displayedListMoleculesCount; int previousTotalCount = _displayedMolecules.Count; resetMoleculeList(); ArrayList molecules = _reactionEngine.getMoleculesFromMedium(mediumId); foreach (System.Object molecule in molecules) { Molecule castMolecule = (Molecule)molecule; string realName = castMolecule.getRealName(); string codeName = castMolecule.getName(); float concentration = castMolecule.getConcentration(); if (displayAll || (0 != concentration)) { DisplayedMolecule found = LinkedListExtensions.Find( _displayedMolecules , m => m.getCodeName() == codeName , false , " GraphMoleculeList::Update()" ); if (null != found) { found.update(concentration); } else //molecule is not displayed yet { DisplayedMolecule created = new DisplayedMolecule(codeName, realName, concentration, DisplayedMolecule.DisplayType.MOLECULELIST); //search if molecule should be displayed in a Device/molecule component List <EquipedDisplayedDeviceWithMolecules> containers = _equipedDevices.FindAll(eddwm => eddwm.device.getFirstGeneProteinName() == codeName); if (containers.Count != 0) { created.setDisplayType(DisplayedMolecule.DisplayType.DEVICEMOLECULELIST); foreach (EquipedDisplayedDeviceWithMolecules container in containers) { container.addDisplayedMolecule(created); } } else { _displayedListMoleculesCount++; } //anyway add it to molecule list _displayedMolecules.AddLast(created); } } } removeUnusedMolecules(); if (_displayedMolecules.Count != previousTotalCount || previousListedCount != _displayedListMoleculesCount) { //rearrange devices positionDeviceAndMoleculeComponents(); } string namesToDisplay = ""; string valuesToDisplay = ""; foreach (DisplayedMolecule molecule in _displayedMolecules) { if (molecule.getDisplayType() == DisplayedMolecule.DisplayType.MOLECULELIST) { namesToDisplay += molecule.getRealName() + ":\n"; valuesToDisplay += molecule.getVal() + "\n"; } } if (!string.IsNullOrEmpty(namesToDisplay)) { namesToDisplay.Remove(namesToDisplay.Length - 1, 1); valuesToDisplay.Remove(valuesToDisplay.Length - 1, 1); } namesLabel.text = namesToDisplay; valuesLabel.text = valuesToDisplay; /* * if(null != topLabels) * { * topLabelsShift = Vector3.up * topLabels.relativeSize.y * topLabels.transform.localScale.y; * namesLabel.transform.localPosition = topLabels.transform.localPosition + topLabelsShift; * } */ setUnfoldingListBackgroundScale(); }