Beispiel #1
0
        public Player FutureUser; // pool for setting players for game

        /// <summary>
        /// If Button dont lead to another frame- Dest can be null
        ///Modes: 1-leading to another frame
        ///       2-mode for calling additional functions after click
        ///       3- mode for calling function with additional string
        ///       To be honest mode 2 and 3 do nothing special (nothing...realy), mode 1 is neccessary
        /// </summary>
        public Button(Vector2f position, Vector2f size, Color Background, Color OnHover, Font UsedFont, string ToDisplay, uint CharacterSize, Frame Dest, int Mode_)
        {
            DestinationSet = Dest;
            OnHoverColor   = OnHover;
            NormalColor    = Background;

            Shape = new RectangleShape(size)
            {
                Position         = position,
                FillColor        = Background,
                OutlineThickness = 3,
                OutlineColor     = Color.Black
            };

            Content = new Text(ToDisplay, UsedFont, CharacterSize)
            {
                Color    = Color.Black,
                Position = new Vector2f(Shape.Position.X + 5, Shape.Position.Y + 5)
            };

            Mode = Mode_;
            switch (Mode)
            {
            case 1:     // this mode changes frame
            {
                Main = ModeOne;

                break;
            }

            case 2:     // this is for casting other functions
            {
                //Main = Adding;
                break;
            }

            case 3:     // this is for functions with extra string needed
            {
                // Main = ModeThree;
                break;
            }

            default:
            {
                throw new Exception();        // jakiś nieobsługiwany mode
            }
            }
        }
Beispiel #2
0
 public override void buttonPress()
 {
     FunctionToDo.Invoke();
     isToggle = true;
     if (!toggeledOn)
     {
         if (TurnOffEvent != null)
         {
             TurnOnEvent.Raise();
         }
     }
     else
     {
         if (TurnOnEvent != null)
         {
             TurnOffEvent.Raise();
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// this one set one functions to do on click and remove old ones
 /// </summary>
 /// <param name="function"></param>
 public void SetOneFunction(FunctionToDo function)
 {
     Adding = function;
 }
Beispiel #4
0
 public void AddingAdditionalFunction(FunctionToDo function)
 {
     Adding += function;
 }