private Experiment getExperimentByPartName(string partName) { var ExperimentParts = KEESExperimentRegister.getExperiments(); for (int idx = 0, count = ExperimentParts.Count; idx < count; idx++) { var exp = ExperimentParts[idx]; if (exp.getPartName() == partName) { return(exp); } } return(new Experiment("", "", "", "")); //Nullobject; }
/** Returns a collection of all KEES experiments which have been unlocked in the Science Centre. */ public static ReadOnlyCollection <Experiment> getUnlockedExperiments() { List <Experiment> unlockedParts = new List <Experiment>(); var ExperimentParts = KEESExperimentRegister.getExperiments(); for (int idx = 0, count = ExperimentParts.Count; idx < count; idx++) { var exp = ExperimentParts[idx]; if (NE_Helper.IsPartTechAvailable(exp.getPartName())) { unlockedParts.Add(exp); } } /* MKW: Note we cannot cache this as the user may unlock new parts in-between calls to this function. */ return(new ReadOnlyCollection <Experiment>(unlockedParts)); }