Exemple #1
0
        public void Initialise(List <int> residueIDs, string residueName, List <string> atomNames, ResidueUpdateType residueUpdateType, ResidueRenderSettings renderSettings, SaveCustomResidueSettingsDelegate saveSettings, CloseCustomResidueSettingsDelegate onClose)
        {
            this.residueIDs           = residueIDs;
            this.residueName          = residueName;
            this.atomNames            = atomNames;
            this.renderSettings       = renderSettings;
            this.residueUpdateType    = residueUpdateType;
            this.saveSettingsCallback = saveSettings;
            this.onCloseCallback      = onClose;

            this.savedRenderSettings = renderSettings.Clone();

            loadSettings();
            customSettingsPanel.SetActive(true);

            autoSaveSettingUpdates = true;
        }
        private void saveCustomResidueIDSettings(List <int> residueIDs, ResidueRenderSettings customResidueSettings, ResidueUpdateType updateType)
        {
            saveCustomResidueSettings(residueIDs, customResidueSettings, updateType);

            residueIDsPanel.SetActive(false); // removes partial button updates on screen
            renderResidueIDButtons();
            residueIDsPanel.SetActive(true);
        }
        private void saveCustomResidueSettings(List <int> residueIDs, ResidueRenderSettings customResidueSettings, ResidueUpdateType updateType)
        {
            if (!customResidueSettings.IsDefault())
            {
                //Debug.Log("Saving residue settings - not default ");

                foreach (int residueID in residueIDs)
                {
                    if (moleculeRenderSettings.CustomResidueRenderSettings.ContainsKey(residueID))
                    {
                        moleculeRenderSettings.CustomResidueRenderSettings[residueID] = customResidueSettings;
                    }
                    else
                    {
                        moleculeRenderSettings.CustomResidueRenderSettings.Add(residueID, customResidueSettings);
                    }
                }
            }
            else
            {
                //Debug.Log("Removing residue settings - are default");

                foreach (int residueID in residueIDs)
                {
                    if (moleculeRenderSettings.CustomResidueRenderSettings.ContainsKey(residueID))
                    {
                        moleculeRenderSettings.CustomResidueRenderSettings.Remove(residueID);
                    }
                }
            }

            updateCustomResidueNameStatus(residueIDs);

            //if (updateType == ResidueUpdateType.All) {
            //    renderResidueNameButtons();
            //}

            settingsUpdatedCallback();
        }