internal static CBaseParam CreateParam(EBaseParamType inParamType, string[] inNewValue) { CBaseParam p = null; switch (inParamType) { case EBaseParamType.Color: p = new CColorParam(); break; case EBaseParamType.Vector4: p = new CVector4Param(); break; case EBaseParamType.PVector2: p = new CPVectorParam(); break; case EBaseParamType.Float: p = new CFloatParam(); break; case EBaseParamType.Bool: p = new CBoolParam(); break; case EBaseParamType.String: p = new CStringParam(); break; } if (inNewValue != null) { p.SetValue(inNewValue); } return(p); }
CBaseParam GetBaseParam(SWindowParamDescr inParamDescr) { CBaseParam val; if (!_params.TryGetValue(inParamDescr.Id, out val)) { val = CBaseParam.CreateParam(inParamDescr.ParamType, null); //_params.Add(inParamDescr.Id, val); //_gui_realization.OnWindowChange(this, inParamDescr.Id, val); } return(val); }
void OnWindowChange(SWindowParamDescr inParamDescr, CBaseParam inNewVal) { _gui_realization.OnWindowChange(this, inParamDescr.Id, inNewVal); if (inParamDescr.IsChildInfluence) { for (int i = 0; i < _childs.Count; ++i) { CBaseParam child_val = _childs[i].GetParamValue(inParamDescr.Id); _gui_realization.OnWindowChange(_childs[i], inParamDescr.Id, child_val); } } }
internal void CheckChanging(SWinKeyInfo inKeyInfo, ILogPrinter inLogger) { CWindowTypeDescr type_descr = _window_type_descrs.GetDescr(WindowType); List <NamedId> unusing_params = new List <NamedId>(_params.Keys); foreach (SWindowParamDescr param_descr in type_descr) { if (param_descr == SWindowParamDescr.Name) { CheckParam(param_descr, new string[] { inKeyInfo.Name }); unusing_params.Remove(param_descr.Id); } else { bool must_be = type_descr.IsMustBe(param_descr.Id); string[] a = Utils.TryGetParamsByNameFromSubKey(param_descr.Id.Name, inKeyInfo.WinKey, inLogger, must_be, CBaseParam.GetParamCount(param_descr.ParamType)); if (a != null) { CheckParam(param_descr, a); unusing_params.Remove(param_descr.Id); } } } unusing_params.ForEach(id => { _params.Remove(id); SWindowParamDescr?pd = type_descr.GetWindowParamDescr(id); if (pd.HasValue) { CBaseParam def_val = CBaseParam.CreateParam(pd.Value.ParamType, null); OnWindowChange(pd.Value, def_val); } }); IKey childs_key = inKeyInfo.WinKey.FindChildByName("Childs", StringComparison.InvariantCultureIgnoreCase); if (childs_key != null) { Build(childs_key, inLogger); } }
void CheckParam(SWindowParamDescr inParamDescr, string[] inNewValue) { CBaseParam val; if (_params.TryGetValue(inParamDescr.Id, out val)) { if (val.SetValue(inNewValue)) { OnWindowChange(inParamDescr, val); } } else { val = CBaseParam.CreateParam(inParamDescr.ParamType, inNewValue); _params.Add(inParamDescr.Id, val); OnWindowChange(inParamDescr, val); } }