示例#1
0
        public override void Init()
        {
            if (DefaultChecked == null)
            {
                DefaultChecked = ModContent.Load <Texture2D>("ylmapi/gui/checkbox_checked");
                if (DefaultChecked != null)
                {
                    DefaultChecked.filterMode = FilterMode.Trilinear;
                }
            }
            if (DefaultUnchecked == null)
            {
                DefaultUnchecked = ModContent.Load <Texture2D>("ylmapi/gui/checkbox_unchecked");
                if (DefaultUnchecked != null)
                {
                    DefaultUnchecked.filterMode = FilterMode.Trilinear;
                }
            }

            SButton button = (SButton)Elem;

            button.OnClick += elem => SetValue?.Invoke(button, Value = !Value);
            if (Scale != null)
            {
                button.IconScale = Scale.Value;
            }
        }