Пример #1
0
 /// <summary>
 /// Creates an instance of UIButton that has a texture.
 /// </summary>
 /// <param name="X">The x-coordinate where the button will be displayed.</param>
 /// <param name="Y">The y-coordinate where the button will be displayed.</param>
 /// <param name="Texture">The texture for this button.</param>
 /// <param name="Enabled">Is this button enabled?</param>
 /// <param name="StrID">The button's string ID.</param>
 /// <param name="Screen">The UIScreen instance that will draw and update this button.</param>
 public UIButton(float X, float Y, Texture2D Texture, bool Disabled, string StrID, UIScreen Screen)
     : base(Screen, StrID, DrawLevel.DontGiveAFuck)
 {
     m_X = X;
     m_Y = Y;
     m_Texture = Texture;
     m_Disabled = Disabled;
     m_StrID = StrID;
     //All buttons have 4 frames...
     m_Width = Texture.Width / 4;
     m_CurrentFrame = 0;
     OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); });
 }
Пример #2
0
        public UINetworkButton(float X, float Y, Texture2D Texture, string Text, NetworkClient Client, 
            UIScreen Screen, string StrID)
            : base(Client, Screen, StrID, DrawLevel.AlwaysOnTop)
        {
            m_X = X;
            m_Y = Y;
            m_Caption = Text;

            m_Texture = Texture;
            m_Width = Texture.Width / 4;

            m_CurrentFrame = 0;

            OnButtonClick += new NetworkButtonClickDelegate(delegate(UINetworkButton btn) { Screen.RegisterClick(this); });

            //All classes inheriting from NetworkedUIElement MUST subscribe to these events!
            m_Client.OnReceivedData += new ReceivedPacketDelegate(m_Client_OnReceivedData);
            m_Client.OnNetworkError += new NetworkErrorDelegate(m_Client_OnNetworkError);
        }
Пример #3
0
        /// <summary>
        /// Creates an instance of UIButton that has a texture and a caption.
        /// </summary>
        /// <param name="X">The x-coordinate where the button will be displayed.</param>
        /// <param name="Y">The y-coordinate where the button will be displayed.</param>
        /// <param name="Texture">The texture for this button.</param>
        /// <param name="Caption">The button's caption.</param>
        /// <param name="CaptionID">The ID for the string to use as the button's caption.</param>
        /// <param name="Screen">The UIScreen instance that will draw and update this button.</param>
        public UIButton(float X, float Y, Texture2D Texture, int CaptionID, string StrID, UIScreen Screen)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_X = X;
            m_Y = Y;
            m_Texture = Texture;
            m_StrID = StrID;
            //All buttons have 4 frames...
            m_Width = Texture.Width / 4;
            m_CurrentFrame = 0;
            OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); });

            if (Screen.ScreenMgr.TextDict.ContainsKey(CaptionID))
                m_Caption = Screen.ScreenMgr.TextDict[CaptionID];
        }
Пример #4
0
 /// <summary>
 /// Creates an instance of UIButton that has a scaled texture.
 /// </summary>
 /// <param name="X">The x-coordinate where the button will be displayed.</param>
 /// <param name="Y">The y-coordinate where the button will be displayed.</param>
 /// <param name="ScaleX">The scaling-factor used to scale this button's texture on the X-axis.</param>
 /// <param name="ScaleY">The scaling-factor used to scale this button's texture on the Y-axis.</param>
 /// <param name="Texture">The texture for this button.</param>
 /// <param name="StrID">The button's string ID.</param>
 /// <param name="Screen">The UIScreen instance that will draw and update this button.</param>
 public UIButton(int X, int Y, int ScaleX, int ScaleY, Texture2D Texture, string StrID, UIScreen Screen)
     : base(Screen, StrID, DrawLevel.DontGiveAFuck)
 {
     m_X = X;
     m_Y = Y;
     m_ScaleX = ScaleX;
     m_ScaleY = ScaleY;
     m_Texture = Texture;
     m_StrID = StrID;
     //All buttons have 4 frames...
     m_Width = Texture.Width / 4;
     m_CurrentFrame = 0;
     OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); });
 }