//Reset all of the slider values for the newly selected parameter type private void setParameterType(paramTypeContainer p) { paramType = p; pFRew = p.RewardFund.reverseLog(); pFPen = p.PenaltyFund.reverseLog(); pRRew = p.RewardRep.reverseLog(); pRPen = p.PenaltyRep.reverseLog(); pSRew = p.RewardScience.reverseLog(); }
private string stringConcat(paramTypeContainer p) { string[] s = new string[5]; s[0] = p.RewardFund.ToString("N3"); s[1] = p.PenaltyFund.ToString("N3"); s[2] = p.RewardRep.ToString("N3"); s[3] = p.PenaltyRep.ToString("N3"); s[4] = p.RewardScience.ToString("N3"); return(string.Join(",", s)); }
private void paramChanged(float[] originals, paramTypeContainer p) { DMC_MBE.LogFormatted_DebugOnly("Parameter Value Event Fired; Type: {0}", p.Name); var cList = ContractSystem.Instance.Contracts; for (int i = 0; i < cList.Count; i++) { if (cList[i].ContractState == Contract.State.Active || cList[i].ContractState == Contract.State.Offered) { updateParameterValues(p, cList[i], originals); } } for (int j = 0; j < masterList.Count; j++) { masterList.ElementAt(j).Value.updateContractInfo(); } }
private void updateParameterValues(paramTypeContainer pC, Contract c, float[] originals) { List <ContractParameter> modifyList = new List <ContractParameter>(); var cParams = c.AllParameters; for (int i = 0; i < cParams.Count(); i++) { if (cParams.ElementAt(i).GetType() == pC.ParamType) { DMC_MBE.LogFormatted_DebugOnly("Found Parameter Of Type: {0}; Updating Values", pC.Name); modifyList.Add(cParams.ElementAt(i)); } } if (modifyList.Count > 0) { DMC_MBE.LogFormatted_DebugOnly("Found {0} Parameters Of Type: {1}", modifyList.Count, pC.Name); updateParameterValues(pC, modifyList, originals); } }
private void updateParameterValues(paramTypeContainer pC, List <ContractParameter> pL, float[] O) { foreach (ContractParameter p in pL) { if (pTypeList.ContainsValue(pC)) { if (p.GetType() == pC.ParamType) { DMC_MBE.LogFormatted_DebugOnly("Updating Param Values; Type: {0}", pC.Name); DMC_MBE.LogFormatted_DebugOnly("Original Param Values: {0}; New Values: {1}", printArray(O), printArray(pC.ParamValues)); p.FundsCompletion = (p.FundsCompletion / O[0]) * pC.RewardFund; p.FundsFailure = (p.FundsFailure / O[1]) * pC.PenaltyFund; p.ReputationCompletion = (p.ReputationCompletion / O[2]) * pC.RewardRep; p.ReputationFailure = (p.ReputationFailure / O[3]) * pC.PenaltyRep; p.ScienceCompletion = (p.ScienceCompletion / O[4]) * pC.RewardScience; } } } }