示例#1
0
        public void MoleculeLoaded(int id, string name, string description, int atomCount, int residueCount)
        {
            if (molecules.Contains(id))
            {
                console.ShowMessage("Loaded file: " + name);

                MoleculeSettings settings = molecules.Get(id);
                settings.Name         = name;
                settings.Description  = description;
                settings.AtomCount    = atomCount;
                settings.ResidueCount = residueCount;
                settings.Loaded       = true;

                GameObject listItem = GameObject.Instantiate(moleculeListItemPrefab);
                listItem.transform.position   = Vector3.zero;
                listItem.transform.rotation   = Quaternion.identity;
                listItem.transform.localScale = Vector3.one;
                listItem.SetActive(true);
                listItem.transform.SetParent(moleculeListContent.transform, false);

                MoleculeSettingsPanelListItem item = listItem.GetComponent <MoleculeSettingsPanelListItem>();

                item.Initialise(id, settings.FileName, onMoleculeListItemClick, onMoleculeListItemDoubleClick);

                moleculeListItems.Add(id, item);
                numberMoleculeListItems();

                SetMoleculeSelected(id);
                onMoleculeListItemDoubleClick(id);

                updateSelectedMoleculeInterfaceSettings();
            }
        }
示例#2
0
        // This is purely cosmetic. These numbers have no reference value.
        // All molecules are referenced by moleculeID
        private void numberMoleculeListItems()
        {
            List <int> keys = moleculeListItems.Keys.ToList();

            keys.Sort();

            int displayID = 0;

            foreach (int key in keys)
            {
                MoleculeSettingsPanelListItem item = moleculeListItems[key];
                item.DisplayID = ++displayID;
            }
        }