private int CompletedCount(String exp = null, CelestialBody body = null) { int ret = 0; if (ContractSystem.Instance == null) { return(0); } if (ContractSystem.Instance.ContractsFinished == null) { return(0); } foreach (Contract con in ContractSystem.Instance.ContractsFinished) { StnSciContract sscon = con as StnSciContract; if (sscon != null && sscon.ContractState == Contract.State.Completed && sscon.experimentType != null && sscon.targetBody != null && (exp == null || sscon.experimentType != null) && (body == null || sscon.targetBody != null) && ((exp == null || exp == sscon.experimentType.name) && (body == null || body.name == sscon.targetBody.name))) { ret += 1; } } return(ret); }
private int ActiveCount(String exp = null, CelestialBody body = null) { int ret = 0; if (ContractSystem.Instance == null) { Debug.Log("ContractSystem Instance is null"); return(0); } if (ContractSystem.Instance.Contracts == null) { Debug.Log("ContractSystem ContratsFinished is null"); return(0); } foreach (Contract con in ContractSystem.Instance.Contracts) { StnSciContract sscon = con as StnSciContract; if (sscon != null && (sscon.ContractState == Contract.State.Active || sscon.ContractState == Contract.State.Offered) && (exp == null || sscon.experimentType != null) && (body == null || sscon.targetBody != null) && ((exp == null || exp == sscon.experimentType.name) && (body == null || body.theName == sscon.targetBody.theName))) { ret += 1; } } return(ret); }