public static BitMaskPanel Add( RoadEditorPanel roadEditorPanel, UIComponent container, string label, Type enumType, SetHandlerD setHandler, GetHandlerD getHandler, string hint) { Log.Debug($"BitMaskPanel.Add(container:{container}, label:{label}, enumType:{enumType})"); var subPanel = UIView.GetAView().AddUIComponent(typeof(BitMaskPanel)) as BitMaskPanel; subPanel.EnumType = enumType; subPanel.SetHandler = setHandler; subPanel.GetHandler = getHandler; subPanel.Initialize(); subPanel.Label.text = label + ":"; subPanel.Hint = hint; //if (dark) // subPanel.opacity = 0.1f; //else // subPanel.opacity = 0.3f; container.AttachUIComponent(subPanel.gameObject); roadEditorPanel.FitToContainer(subPanel); return(subPanel); }
public FlagDataT(SetHandlerD setValue, GetHandlerD getValue, Type enumType) { SetValue = setValue; GetValue = getValue; EnumType = enumType; UnderlyingType = getValue().GetTypeCode(); Assertion.Assert( UnderlyingType == TypeCode.Int64 || UnderlyingType == TypeCode.Int32, $"bad enum type:{enumType}, Underlying Type:{UnderlyingType}"); Assertion.Assert(enumType.IsEnum, "isEnum"); Assertion.Equal( Type.GetTypeCode(Enum.GetUnderlyingType(enumType)), UnderlyingType, "underlaying types mismatch"); }