コード例 #1
0
        public UIMessageBox(float X, float Y, string Message, UIScreen Screen, string StrID)
            : base(Screen, StrID, DrawLevel.AlwaysOnTop)
        {
            m_Archive = new FAR3Archive(GlobalSettings.Default.StartupPath + "uigraphics\\dialogs\\dialogs.dat");

            m_X = X;
            m_Y = Y;

            MemoryStream TexStream = new MemoryStream(m_Archive.GetItemByID(0xE5));
            m_DiagBackgrnd = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            TexStream = new MemoryStream(m_Archive.GetItemByID(0x185));
            m_DiagCorner = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            TexStream = new MemoryStream(m_Archive.GetItemByID(0x892));
            Texture2D BtnTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            ManualTextureMask(ref BtnTex, new Color(255, 0, 255));

            float Scale = GlobalSettings.Default.ScaleFactor;

            m_OkBtn = new UIButton(((m_X + (m_DiagBackgrnd.Width * Scale) + 94) - (m_DiagCorner.Width * Scale)) * Scale,
                ((m_Y + (m_DiagBackgrnd.Height * Scale) + 37) - (m_DiagCorner.Height * Scale)) * Scale, .15f, .4f, BtnTex, "BtnOK", Screen);
            m_OkBtn.OnButtonClick += new ButtonClickDelegate(m_OkBtn_OnButtonClick);

            m_Message = Message;
        }
コード例 #2
0
        /// <summary>
        /// Constructor for the UITextbox class.
        /// </summary>
        /// <param name="BackgrdID">The ID of the background's texture.</param>
        /// <param name="X">The x-coordinate on the screen of where to draw the textbox.</param>
        /// <param name="Y">The y-coordinate on the screen of where to draw the textbox.</param>
        /// <param name="Width">The width of the textbox in pixels. Should be greater than 39.</param>
        /// <param name="DrawTransparent">Whether or not to draw this textbox transparently.</param>
        /// <param name="Screen">A UIScreen instance.</param>
        /// <param name="StrID">The the string ID of this textbox.</param>
        public UITextbox(uint BackgrdID, int X, int Y, int Width, int Transparency, 
            UIScreen Screen, string StrID)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_Archive = new FAR3Archive(GlobalSettings.Default.StartupPath + "uigraphics\\dialogs\\dialogs.dat");

            MemoryStream TexStream = new MemoryStream(m_Archive.GetItemByID(BackgrdID));
            m_BackgroundTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            m_Transparency = Transparency;

            m_X = X;
            m_Y = Y;
            m_CursorDrawX = (m_X + 3);

            //The Width parameter will hopefully always be greater than 39, as the
            //'dialog_textboxbackground.bmp' image is 39x39 pixels.
            if (Width > m_BackgroundTex.Width)
            {
                m_NumTiles = (int)(Width / (m_BackgroundTex.Width + 3));
                //The background consist of one half tile + one third of a tile as many times as m_NumTiles,
                //then another half tile. Therefore the total width equals the calculation below.
                m_Width = (m_NumTiles * 13) + m_BackgroundTex.Width;
                m_Height = m_BackgroundTex.Height;
            }
            else
            {
                //Originally I set m_NumTiles to m_BackgroundTex.Width here, but realized
                //that that would cause f*****g ENDLESS textboxes (39 tiles!!)
                m_NumTiles = Width;
                m_Width = m_BackgroundTex.Width;
                m_Height = m_BackgroundTex.Height;
            }
        }
コード例 #3
0
        public static byte[] GetResourceFromLongID(ulong ID)
        {
            byte[] Resource;

            while (!initComplete) ;
            //Resource hasn't already been loaded...
            if (!m_LoadedResources.TryGetValue(ID, out Resource))
            {
                string path = m_Resources[ID];

                FAR3Archive Archive = new FAR3Archive(path);

                Resource = Archive.GetItemByID(ID);
                return Resource;
            }
            else
                return m_LoadedResources[ID];
        }