protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Vessel State";
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        output       = "";
                        hideChildren = true;
                    }
                    else
                    {
                        output += ": ";
                    }

                    output += ParameterDelegate <Vessel> .GetDelegateText(this);
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        hideChildren = true;
                    }

                    output = ParameterDelegate <Vessel> .GetDelegateText(this);
                }
                else
                {
                    output = Localizer.GetStringByTag("#cc.param.HasResource");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Vessel State";
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        output       = ParameterDelegate <Vessel> .GetDelegateText(this);;
                        hideChildren = true;
                    }
                    else
                    {
                        output = Localizer.Format("#cc.param.ReachState.detail", ParameterDelegate <Vessel> .GetDelegateText(this));
                    }
                }
                else
                {
                    Localizer.GetStringByTag("#cc.param.ReachState");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
Beispiel #4
0
        protected override string GetParameterTitle()
        {
            string output = "";

            if (string.IsNullOrEmpty(title))
            {
                if (passengers.Count == 0)
                {
                    output = "Load " + (count == 0 ? "all" : count.ToString()) + " passenger" + (count != 1 ? "s" : "") + " while on the launchpad/runway";
                }
                else if (passengers.Count == 1)
                {
                    output = "Passenger " + ParameterDelegate <Vessel> .GetDelegateText(this);

                    hideChildren = true;
                }
                else if (state == ParameterState.Complete)
                {
                    output = "Passengers: " + passengers.Count;
                }
                else
                {
                    output = "Passengers";
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Parts";
                if (state == ParameterState.Complete)
                {
                    output += ": ";
                    if (maxCount == int.MaxValue && minCount != 1)
                    {
                        output += "At least " + minCount + " ";
                    }
                    else if (maxCount != int.MaxValue && minCount == 1)
                    {
                        output += "At most " + maxCount + " ";
                    }
                    output += ParameterDelegate <Part> .GetDelegateText(this);
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
Beispiel #6
0
        protected override string GetParameterTitle()
        {
            string title = base.GetParameterTitle();

            if (state != ParameterState.Incomplete)
            {
                title += ": " + ParameterDelegate <T> .GetDelegateText(this);
            }

            return(title);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (vesselIdentifier != null)
                {
                    if (countMax == 1)
                    {
                        output = "Kill no Kerbals";
                    }
                    else
                    {
                        output = "Kill no more than " + countMax + " Kerbals";
                    }
                    output += " on vessel " + ContractVesselTracker.GetDisplayName(vesselIdentifier.identifier);
                }
                else if (!kerbals.Any())
                {
                    if (countMax == 1)
                    {
                        output = "Kill no Kerbals";
                    }
                    else
                    {
                        output = "Kill no more than " + countMax + " Kerbals";
                    }
                }
                else
                {
                    output = "Do not kill";
                    if (state != ParameterState.Incomplete || ParameterCount == 1)
                    {
                        if (ParameterCount == 1)
                        {
                            hideChildren = true;
                        }

                        output += ": " + ParameterDelegate <ProtoCrewMember> .GetDelegateText(this);
                    }
                }
            }
            else
            {
                output = title;
            }

            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Orbit";
                if (state == ParameterState.Complete)
                {
                    output += ": " + ParameterDelegate <Vessel> .GetDelegateText(this);
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (state == ParameterState.Complete)
                {
                    output = Localizer.Format("#cc.param.Orbit.detail", ParameterDelegate <Vessel> .GetDelegateText(this));
                }
                else
                {
                    output = Localizer.GetStringByTag("#cc.param.Orbit");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (kerbals.Count == 0 && (state == ParameterState.Complete || ParameterCount == 1))
                {
                    if (ParameterCount == 1)
                    {
                        hideChildren = true;
                    }

                    string traitString = String.IsNullOrEmpty(trait) ? "Kerbal" : TraitTitle(trait);
                    output = "Crew: ";
                    if (maxCrew == 0)
                    {
                        output += "Unmanned";
                    }
                    else if (maxCrew == int.MaxValue)
                    {
                        output += "At least " + minCrew + " " + traitString + (minCrew != 1 ? "s" : "");
                    }
                    else if (minCrew == 0)
                    {
                        output += "At most " + maxCrew + " " + traitString + (maxCrew != 1 ? "s" : "");
                    }
                    else if (minCrew == maxCrew)
                    {
                        output += minCrew + " " + traitString + (minCrew != 1 ? "s" : "");
                    }
                    else
                    {
                        output += "Between " + minCrew + " and " + maxCrew + " " + traitString + "s";
                    }

                    if (minExperience != 0 || maxExperience != 5)
                    {
                        if (minExperience == 0)
                        {
                            output += " with experience level of at most " + maxExperience;
                        }
                        else if (maxExperience == 5)
                        {
                            output += " with experience level of at least " + minExperience;
                        }
                        else
                        {
                            output += " with experience level between " + minExperience + " and " + maxExperience;
                        }
                    }
                }
                else
                {
                    output = "Crew";
                    if (state == ParameterState.Complete || ParameterCount == 1)
                    {
                        if (ParameterCount == 1)
                        {
                            hideChildren = true;
                        }

                        output += ": " + ParameterDelegate <ProtoCrewMember> .GetDelegateText(this);
                    }
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
 protected override string GetParameterTitle()
 {
     if (state != ParameterState.Incomplete)
     {
         return(StringBuilderCache.Format("{0}: {1}", base.GetParameterTitle(), ParameterDelegate <T> .GetDelegateText(this)));
     }
     else
     {
         return(base.GetParameterTitle());
     }
 }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (state == ParameterState.Complete)
                {
                    if (maxCount == int.MaxValue && minCount != 1)
                    {
                        output = Localizer.Format("#cc.param.PartValidation.atLeast", minCount, ParameterDelegate <Part> .GetDelegateText(this));
                    }
                    else if (maxCount != int.MaxValue && minCount == 1)
                    {
                        output = Localizer.Format("#cc.param.PartValidation.atMost", maxCount, ParameterDelegate <Part> .GetDelegateText(this));
                    }
                    else
                    {
                        output = Localizer.Format("#cc.param.PartValidation.nocount", ParameterDelegate <Part> .GetDelegateText(this));
                    }
                }
                else
                {
                    output = Localizer.GetStringByTag("#cc.param.PartValidation");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (vesselIdentifier != null)
                {
                    output = Localizer.Format("#cc.param.KerbalDeaths.vessel", countMax - 1, ContractVesselTracker.GetDisplayName(vesselIdentifier.identifier));
                }
                else if (!kerbals.Any())
                {
                    output = Localizer.Format("#cc.param.KerbalDeaths.generic", countMax - 1);
                }
                else
                {
                    output = Localizer.Format("#cc.param.KerbalDeaths.specific");
                    if (state != ParameterState.Incomplete || ParameterCount == 1)
                    {
                        if (ParameterCount == 1)
                        {
                            output       = StringBuilderCache.Format("{0}: {1}", output, ParameterDelegate <ProtoCrewMember> .GetDelegateText(this));
                            hideChildren = true;
                        }
                    }
                }
            }
            else
            {
                output = title;
            }

            return(output);
        }
        protected void CreateVesselListParameter()
        {
            if (vesselList.Any())
            {
                if (vesselList.Count() == 1)
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : "Vessel: " + ContractVesselTracker.GetDisplayName(vesselList.First()), v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            vesselListParam.SetTitle((FlightGlobals.ActiveVessel == v && trackedVessel != null ? "" : "Tracked ") + "Vessel: " + ContractVesselTracker.GetDisplayName(vesselList.First()));
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    AddParameter(vesselListParam);
                }
                else
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : "Vessel: Any of the following:", v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            vesselListParam.SetTitle("Vessel: Any of the following:" + (check ? " " + ParameterDelegate <Vessel> .GetDelegateText(vesselListParam) : ""));
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    foreach (string vessel in vesselList)
                    {
                        ContractParameter childParam = new ParameterDelegate <Vessel>(ContractVesselTracker.GetDisplayName(vessel), v => false);
                        vesselListParam.AddParameter(childParam);
                    }

                    AddParameter(vesselListParam);
                }
            }
        }
        protected override string GetParameterTitle()
        {
            string output = "";

            if (string.IsNullOrEmpty(title))
            {
                if (passengers.Count == 0)
                {
                    output = Localizer.Format("#cc.param.HasPassenger.initial", count);
                }
                else if (passengers.Count == 1)
                {
                    output       = Localizer.Format("#cc.param.HasPassenger.summary", ParameterDelegate <Vessel> .GetDelegateText(this));
                    hideChildren = true;
                }
                else if (state == ParameterState.Complete)
                {
                    output = Localizer.Format("#cc.param.HasPassenger.summary", passengers.Count);
                }
                else
                {
                    output = Localizer.GetStringByTag("#cc.param.HasPassenger");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected void CreateVesselListParameter()
        {
            if (vesselList.Any())
            {
                if (vesselList.Count() == 1)
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : Localizer.Format("#cc.param.VesselParameterGroup.default", ContractVesselTracker.GetDisplayName(vesselList.First())), v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            vesselListParam.SetTitle(Localizer.Format((FlightGlobals.ActiveVessel == v && trackedVessel != null ? "#cc.param.VesselParameterGroup.default" : "#cc.param.VesselParameterGroup.trackedVessel"),
                                                                      ContractVesselTracker.GetDisplayName(vesselList.First())));
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    AddParameter(vesselListParam);
                }
                else
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : Localizer.GetStringByTag("#cc.param.VesselParameterGroup.anyVesselListEmpty"), v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            if (check)
                            {
                                vesselListParam.SetTitle(Localizer.Format("#cc.param.VesselParameterGroup.anyVesselList", ParameterDelegate <Vessel> .GetDelegateText(vesselListParam)));
                            }
                            else
                            {
                                Localizer.GetStringByTag("#cc.param.VesselParameterGroup.anyVesselListEmpty");
                            }
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    foreach (string vessel in vesselList)
                    {
                        ContractParameter childParam = new ParameterDelegate <Vessel>(ContractVesselTracker.GetDisplayName(vessel), v => false);
                        vesselListParam.AddParameter(childParam);
                    }

                    AddParameter(vesselListParam);
                }
            }
        }
Beispiel #17
0
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (kerbals.Count == 0 && (state == ParameterState.Complete || ParameterCount == 1))
                {
                    if (ParameterCount == 1)
                    {
                        hideChildren = true;
                    }

                    // Build the count string
                    string countStr;
                    if (maxCrew == 0)
                    {
                        countStr = Localizer.GetStringByTag("#cc.param.HasCrew.unmanned");
                    }
                    else if (maxCrew == int.MaxValue)
                    {
                        countStr = Localizer.Format("#cc.param.count.atLeast", minCrew);
                    }
                    else if (minCrew == 0)
                    {
                        countStr = Localizer.Format("#cc.param.count.atMost", maxCrew);
                    }
                    else if (minCrew == maxCrew)
                    {
                        countStr = Localizer.Format("#cc.param.count.exact", minCrew);
                    }
                    else
                    {
                        countStr = Localizer.Format("#cc.param.count.between", minCrew, maxCrew);
                    }

                    // Build the trait string
                    string traitStr = null;
                    if (!String.IsNullOrEmpty(trait))
                    {
                        traitStr = Localizer.Format("#cc.param.HasAstronaut.trait", LocalizationUtil.TraitTitle(trait));
                    }

                    // Build the experience string
                    string experienceStr = null;
                    if (minExperience != 0 && maxExperience != 5)
                    {
                        if (minExperience == 0)
                        {
                            experienceStr = Localizer.Format("#cc.param.HasAstronaut.experience.atMost", maxExperience);
                        }
                        else if (maxExperience == 5)
                        {
                            experienceStr = Localizer.Format("#cc.param.HasAstronaut.experience.atLeast", minExperience);
                        }
                        else if (minExperience == maxExperience)
                        {
                            experienceStr = Localizer.Format("#cc.param.HasAstronaut.experience.exact", minExperience);
                        }
                        else
                        {
                            experienceStr = Localizer.Format("#cc.param.HasAstronaut.experience.between", minExperience, maxExperience);
                        }
                    }

                    // Build the output string
                    if (String.IsNullOrEmpty(traitStr))
                    {
                        if (String.IsNullOrEmpty(experienceStr))
                        {
                            output = Localizer.Format("#cc.param.HasCrew.1", countStr);
                        }
                        else
                        {
                            output = Localizer.Format("#cc.param.HasCrew.2", countStr, experienceStr);
                        }
                    }
                    else if (String.IsNullOrEmpty(experienceStr))
                    {
                        output = Localizer.Format("#cc.param.HasCrew.2", countStr, traitStr);
                    }
                    else
                    {
                        output = Localizer.Format("#cc.param.HasCrew.3", countStr, traitStr, experienceStr);
                    }
                }
                else
                {
                    if (state == ParameterState.Complete || ParameterCount == 1)
                    {
                        if (ParameterCount == 1)
                        {
                            hideChildren = true;
                        }

                        output = Localizer.Format("#cc.param.HasCrew.1", ParameterDelegate <ProtoCrewMember> .GetDelegateText(this));
                    }
                    else
                    {
                        output = Localizer.GetStringByTag("#cc.param.HasCrew");
                    }
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }