コード例 #1
0
        protected void UpdateDelegates()
        {
            foreach (ContractParameter genericParam in this.GetAllDescendents())
            {
                ParameterDelegate <Vessel> param = genericParam as ParameterDelegate <Vessel>;
                if (param == null)
                {
                    continue;
                }

                string oldTitle = param.Title;
                if (matchingSubjects.Count == experiment.Count)
                {
                    if (param.ID.Contains("Destination:") || param.ID.Contains("Biome:") || param.ID.Contains("Situation:") ||
                        param.ID.Contains("Location:"))
                    {
                        param.ClearTitle();
                    }
                    else if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));

                        param.SetTitle(matchingSubjects[exp].title);
                        param.SetState(ParameterState.Complete);
                    }
                }
                else
                {
                    if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));
                        if (matchingSubjects.ContainsKey(exp))
                        {
                            param.SetTitle(matchingSubjects[exp].title);
                            param.SetState(ParameterState.Complete);
                        }
                        else
                        {
                            param.ClearTitle();
                        }
                    }
                    else
                    {
                        param.ResetTitle();
                    }
                }

                if (param.Title != oldTitle)
                {
                    ContractsWindow.SetParameterTitle(param, param.Title);
                    ContractConfigurator.OnParameterChange.Fire(Root, param);
                }
            }

            ContractsWindow.SetParameterTitle(this, GetTitle());
        }