Exemple #1
0
        protected override void AdditionalInitialize()
        {
            InteractionGraphics = new GUIInteractionColors(Color.FromArgb(0, Color.Black), Color.FromArgb(0, Color.Black), Color.FromArgb(0, Color.Black));

            Text      = null;
            TextColor = Color.Black;
            FontName  = null;
        }
Exemple #2
0
        public override void Initialize(params object[] parameters)
        {
            base.Initialize();

            string text = "";

            if (parameters.Length >= 1 && parameters[0] is string txt)
            {
                text = txt;
            }

            FontFamily font = new FontFamily("Consolas");

            if (parameters.Length >= 2 && parameters[1] is FontFamily fnt)
            {
                font = fnt;
            }

            GUIInteractionColors colors = new GUIInteractionColors(
                Color.BLACK,
                Color.BLACK,
                Color.LIGHT_GRAY
                );

            if (parameters.Length >= 3 && parameters[2] is GUIInteractionColors c)
            {
                colors = c;
            }

            GUIInteractionGraphics graphics = new GUIInteractionGraphics(
                GraphicsHandler.CreateDefaultTexture(1, 1, Color.WHITE),
                GraphicsHandler.CreateDefaultTexture(1, 1, Color.LIGHT_GRAY),
                GraphicsHandler.CreateDefaultTexture(1, 1, Color.DARK_GRAY)
                );

            if (parameters.Length >= 4 && parameters[3] is GUIInteractionGraphics g)
            {
                graphics = g;
            }

            this.graphics = graphics;
            this.colors   = colors;

            this.sprite     = GameObject.AddComponent <Sprite>(Color.WHITE, graphics.Get(InteractionState));
            this.textSprite = GameObject.AddComponent <TextSprite>(text, 16, font, colors.Get(InteractionState), new Rectangle(0, 0, Width, Height));

            UpdateMesh();
            UpdateTextureAndColor();

            OnMouseEntered  += (component, x, y) => UpdateTextureAndColor();
            OnMouseExited   += (component, x, y) => UpdateTextureAndColor();
            OnMouseClicked  += (component, x, y) => UpdateTextureAndColor();
            OnMouseReleased += (component, x, y) => UpdateTextureAndColor();

            OnSizeChanged += UpdateMesh;
        }
Exemple #3
0
        protected override void AdditionalInitialize()
        {
            this.knobGraphics = new GUIInteractionColors(Color.SlateGray, Color.SlateGray, Color.SlateGray);

            OnMouseClicked  += OnOnMouseDown;
            OnMouseDown     += OnOnMouseDown;
            OnMouseReleased += OnOnMouseDown;

            InteractionGraphics = new GUIInteractionColors(Color.DarkGray, Color.DarkGray, Color.DarkGray);
        }