Example #1
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;
            }
        }
        public ImgInfoPopup(int X, int Y, int ID, string ImgFile, int TextID, UIScreen Screen)
        {
            //m_Archive = new FAR3Archive(GlobalSettings.Default.StartupPath + "uigraphics\\dialogs\\dialogs.dat");
            m_HintImg = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, GlobalSettings.Default.StartupPath +
                "uigraphics\\hints\\" + ImgFile);

            //dialog_backgroundtemplate.tga
            MemoryStream TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0xe500000002));
            m_DiagImg = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x18500000002));
            m_DiagCorner = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x89200000001));
            Texture2D BtnTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            ManualTextureMask(ref BtnTex, new Color(255, 0, 255));

            float Scale = GlobalSettings.Default.ScaleFactor;

            m_OKCheckBtn = new UIButton((X + (m_DiagImg.Width * Scale) + 100) * Scale,
                (Y + (m_DiagImg.Height * Scale) - 2) * Scale, .83f, .23f, BtnTex, "OKCheckBtn", Screen);

            m_Text = Screen.ScreenMgr.TextDict[TextID];
            m_X = X;
            m_Y = Y;
            m_ID = ID;

            m_Screen = Screen;

            ManualTextureMask(ref m_HintImg, new Color(255, 0, 255));
            //AddDownRightCorner(ref m_DiagImg);
        }
        /// <summary>
        /// Creates a new instance of CitySelectionDialog. Only used once in the game, when creating a new sim.
        /// </summary>
        /// <param name="Client">A NetworkClient instance, used to communicate with the loginserver.</param>
        /// <param name="X">The x-coordinate of this dialog on the screen.</param>
        /// <param name="Y">The y-coordinate of this dialog on the screen.</param>
        /// <param name="DiagBackgrnd">The background-texture for the dialog. Loaded from dialogs.dat.</param>
        /// <param name="Screen">A UIScreen instance, which is the screen that this dialog will be displayed on.</param>
        /// <param name="StrID">The string ID of this UICitySelectionDialog instance.</param>
        public UICitySelectionDialog(NetworkClient Client, int X, int Y, Texture2D DiagBackgrnd, 
            List<CityServerInformation> CityServerInfo, UIScreen Screen, string StrID)
            : base(Client, Screen, StrID, 
            DrawLevel.DontGiveAFuck)
        {
            m_DiagImg = DiagBackgrnd;
            m_X = X;
            m_Y = Y;
            m_Caption = "What City Do You Want to Live In?";

            //TODO: Should probably finetune all coordinates to work based on the dialog's coordinates...
            m_OnlineCities = new UIListBox(40, 78, 40, 3, Screen, "LstOnlineCities", DrawLevel.DontGiveAFuck);

            MemoryStream TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x8a900000001));
            Texture2D CityDescBackroundTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            m_CityDescBackground = new UIImage(221, 280, "CityDescBackgroundImg", CityDescBackroundTex, Screen);
            m_CityDescription = new UITextEdit(231, 292, 265, 141, true, 1000, "TxtCityDescription", Screen);

            TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(CityServerInfo[0].ImageID));
            Texture2D CityImgTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            m_CityImg = new UIImage(28, 283, "CityThumbnailImg", CityImgTex, Screen);

            TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x1e700000001));
            Texture2D BtnTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            m_OKBtn = new UIButton(278, 230, BtnTex, false, "BtnOK", Screen);
            m_CancelBtn = new UIButton(388, 430, BtnTex, false, "BtnCancel", Screen);

            m_Client.OnNetworkError += new NetworkErrorDelegate(m_Client_OnNetworkError);
            m_Client.OnReceivedData += new ReceivedPacketDelegate(m_Client_OnReceivedData);
        }
        /// <summary>
        /// Constructor for the UIProgressbar class.
        /// </summary>
        /// <param name="X">The X-coordinate on the screen of where to draw this progressbar.</param>
        /// <param name="Y">The Y-coordinate on the screen of where to draw this progressbar.</param>
        /// <param name="Width">The width of the progressbar in pixels. Should be greater than 45.</param>
        /// <param name="Background">The background texture for this progressbar. (ID: 0x7A5)</param>
        /// <param name="Status">The initial status appearing on the progressbar.</param>
        /// <param name="Screen">A UIScreen instance.</param>
        /// <param name="StrID">The string ID of this progressbar.</param>
        public UIProgressBar(float X, float Y, int Width, Texture2D Background, string Status, 
            UIScreen Screen, string StrID)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_BackgroundTile = Background;
            m_X = X;
            m_Y = Y;
            m_CurrentStatus = Status;

            //The Width parameter will hopefully always be greater than 39, as the
            //'dialog_textboxbackground.bmp' image is 39x39 pixels.
            if (Width > m_BackgroundTile.Width)
            {
                m_NumTiles = (int)(Width / (m_BackgroundTile.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 * 15) + m_BackgroundTile.Width;
            }
            else
            {
                //Originally I set m_NumTiles to m_BackgroundTex.Width here, but realized
                //that that would cause f*****g ENDLESS progressbars (39 tiles!!)
                m_NumTiles = Width;
                m_Width = m_BackgroundTile.Width;
            }

            if (Screen.ScreenMgr.SprFontBig.MeasureString(Status).X > m_Width)
                m_ShrinkText = true;
        }
        public NetworkedUIElement(string IP, int Port, UIScreen Screen, string StrID, DrawLevel DLevel)
        {
            m_Screen = Screen;
            m_StringID = StrID;

            m_Client = new NetworkClient(IP, Port);
        }
        public NetworkedUIElement(NetworkClient Client, UIScreen Screen, string StrID, DrawLevel DLevel)
        {
            m_Screen = Screen;
            m_StringID = StrID;

            m_Client = Client;
        }
        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;
        }
        public UICollectionViewerOutfits(float x, float y, int thumbSizeX, int thumbSizeY, int thumbMarginX, int thumbMarginY, int thumbImageSizeX, int thumbImageSizeY, int thumbImageOffsetX, int thumbImageOffsetY, int rows, int columns, ulong maleCollectionID, ulong femaleCollectionID, UIScreen screen, string strID, ScreenManager scrnMgr)
            : base(screen, strID, DrawLevel.AlwaysOnTop)
        {
            float Scale = GlobalSettings.Default.ScaleFactor;

            myButtons = new UIButton[rows, columns];
            myScreen = screen;
            myScrMgr = scrnMgr;
            myMaleCollectionID = maleCollectionID;
            myFemaleCollectionID = femaleCollectionID;
            myCurrentCollectionID = femaleCollectionID;
            myThumbSizeX = thumbSizeX;
            myThumbSizeY = thumbSizeY;
            myThumbImageSizeX = thumbImageSizeX;
            myThumbImageSizeY = thumbImageSizeY;
            myThumbMarginX = thumbMarginX;
            myThumbMarginY = thumbMarginY;
            myThumbImageOffsetX = thumbImageOffsetX;
            myThumbImageOffsetY = thumbImageOffsetY;
            myPurchasables = new List<ulong>();
            myOutfits = new List<ulong>();
            myAppearances = new List<ulong[]>();
            myThumbnails = new List<ulong[]>();
            myCurrentThumbnails = null;
            myLeftButton = addButton(0x3f500000001, 415 * Scale, 560 * Scale, 1, false, strID + "LeftArrow");
            myRightButton = addButton(0x3f600000001, 650 * Scale, 560 * Scale, 1, false, strID + "RightArrow");

            /*myLeftButton.OnButtonClick += delegate(UIButton btn) { myPageStartIdx -= myRows * myColumns; myCurrentThumbnails = null; };
            myRightButton.OnButtonClick += delegate(UIButton btn) { myPageStartIdx += myRows * myColumns; myCurrentThumbnails = null; };*/

            myTextButtons = new UITextButton[12];
            for (int i = 0, stride = 0; i < 12; i++)
            {
                myTextButtons[i] = new UITextButton((455 * Scale) + stride, (555 * Scale), (i + 1).ToString(), strID + "NumberButton" + i, myScreen);
                myScreen.Add(myTextButtons[i]);
                myTextButtons[i].OnButtonClick += delegate(UIElement element) { myPageStartIdx = int.Parse(element.StrID.Substring(element.StrID.LastIndexOf("NumberButton") + 12)) * myRows * myColumns; myCurrentThumbnails = null; };
                if (i < 9)
                    stride += 15;
                else
                    stride += 22;
            }

            mySkinColor = 0;
            myRows = rows;
            myColumns = columns;
            myPageStartIdx = 0;

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    myButtons[i, j] = addButton(0x3df00000001, (x * Scale) + (thumbMarginX * Scale) + (j * ((thumbMarginX * Scale) + (thumbSizeX * Scale))), (y * Scale) + (thumbMarginY * Scale) + (i * ((thumbMarginY * Scale) + (thumbSizeY * Scale))), 1, false, strID + '_' + i + j);
                }
            }
            loadCollection();
            myCountLabel = new UILabel(0, strID + "CountLabel", 515, 537, myScreen);
            myCountLabel.Caption = "" + myThumbnails.Count + " Outfits";
            myScreen.Add(myCountLabel);
        }
Example #9
0
 public UIImage(int X, int Y, string StrID, Texture2D Texture, UIScreen Screen)
     : base(Screen, StrID, DrawLevel.DontGiveAFuck)
 {
     m_X = X;
     m_Y = Y;
     m_Texture = Texture;
     m_StrID = StrID;
 }
Example #10
0
        public UIListBox(int X, int Y, int Width, int Spacing, UIScreen Screen, string StrID, DrawLevel DLevel)
            : base(Screen, StrID, DLevel)
        {
            m_X = X;
            m_Y = Y;
            m_Width = Width;

            m_ListItems = new List<string>();
        }
Example #11
0
        public UILabel(string Caption, string StrID, int X, int Y, UIScreen Screen)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_X = X;
            m_Y = Y;

            m_Text = Caption;

            m_StrID = StrID;
        }
 public UITextButton(float X, float Y, string Text, string StrID, UIScreen Screen)
     : base(Screen, StrID, DrawLevel.DontGiveAFuck)
 {
     m_X = X;
     m_Y = Y;
     myString = Text;
     m_StrID = StrID;
     //All buttons have 4 frames...
     m_Width = 15;
     m_CurrentFrame = 0;
 }
Example #13
0
        public UILabel(int CaptionID, string StrID, int X, int Y, UIScreen Screen)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_X = X;
            m_Y = Y;

            if (Screen.ScreenMgr.TextDict.ContainsKey(CaptionID))
                m_Text = Screen.ScreenMgr.TextDict[CaptionID];

            m_StrID = StrID;
        }
        /// <summary>
        /// Creates a new instance of LoginDialog. Only used once in the game, during login.
        /// </summary>
        /// <param name="X">X position.</param>
        /// <param name="Y">Y position.</param>
        /// <param name="DiagBackgrnd">The background-texture for the dialog. Loaded from dialogs.dat.</param>
        public UILoginDialog(string IP, int Port, float X, float Y, Texture2D DiagBackgrnd, UIScreen Screen, 
            string StrID)
            : base(IP, Port, Screen, StrID, DrawLevel.AlwaysOnTop)
        {
            m_DiagImg = DiagBackgrnd;
            m_LoginProgressDiag = DiagBackgrnd;
            m_X = X;
            m_Y = Y;

            //This might have to be passed in to the constructor for language purposes.
            m_Caption = "Login to The Sims Online";

            m_LblAccName = new UILabel(1, "LblAccName", (m_X + 20), (m_Y + 65), Screen);
            m_LblPass = new UILabel(2, "LblPass", (m_X + 20), (m_Y + 125), Screen);
            m_TxtAccName = new UITextbox(0x7A4, (m_X + 20), m_Y + (m_DiagImg.Height / 2),
                1000, 205, Screen, "TxtAccName");
            m_TxtPass = new UITextbox(0x7A4, (m_X + 20), m_Y + ((m_DiagImg.Height / 2) + 60),
                1000, 205, Screen, "TxtPass");

            MemoryStream TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x1e700000001));
            Texture2D BtnTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);
            Color c = new Color(255, 0, 255, 0);
            ManualTextureMask(ref BtnTex, new Color(255, 0, 255, 255));

            TexStream = new MemoryStream(ContentManager.GetResourceFromLongID(0x7a500000001));
            Texture2D ProgressBTex = Texture2D.FromFile(Screen.ScreenMgr.GraphicsDevice, TexStream);

            m_LblOverallProgress = new UILabel(5, "LblOverallProgress", (m_X + m_DiagImg.Width) + 50,
                (m_Y + m_DiagImg.Height) + 150, Screen);
            m_LblCurrentTask = new UILabel(6, "LblCurrentTask", (m_X + m_DiagImg.Width) + 50,
                (m_Y + m_DiagImg.Height) + 208, Screen);

            float Scale = GlobalSettings.Default.ScaleFactor;

            //Progressbars for showing the loginprocess to the user.
            m_OverallProgressbar = new UIProgressBar((m_X + (m_DiagImg.Width * Scale) + 50) * Scale,
                (m_Y + (m_DiagImg.Height * Scale) + 180) * Scale, 800, ProgressBTex, "0%", Screen, "OverallProgressBar");
            m_CurrentTaskbar = new UIProgressBar((m_X + (m_DiagImg.Width * Scale) + 50) * Scale,
                (m_Y + (m_DiagImg.Height * Scale) + 238) * Scale, 800, ProgressBTex,
                "Authorizing. Prompting for name and password...", Screen, "CurrentTaskBar");

            //TextID 3: "Login"
            //TextID 4: "Exit"
            m_BtnLogin = new UIButton((m_X + 125) * Scale, (m_Y + (m_DiagImg.Height * Scale) + 35) * Scale, .13f, .2f,
                BtnTex, 3, "BtnLogin", Screen);
            m_BtnExit = new UIButton((m_X + (m_DiagImg.Width * Scale) + 60) * Scale, (m_Y + (m_DiagImg.Height * Scale) + 35) * Scale,
                .13f, .2f, BtnTex, 4, "BtnExit", Screen);

            //All classes inheriting from NetworkedUIElement MUST subscribe to these events!
            m_Client.OnNetworkError += new TSOClient.Network.NetworkErrorDelegate(m_Client_OnNetworkError);
            m_Client.OnReceivedData += new TSOClient.Network.ReceivedPacketDelegate(m_Client_OnReceivedData);
            m_BtnLogin.OnButtonClick += new ButtonClickDelegate(m_BtnLogin_ButtonClickEvent);
        }
Example #15
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); });
 }
Example #16
0
        /// <summary>
        /// Constructs a new UITextEdit instance.
        /// </summary>
        /// <param name="X">The X position of where this UITextEdit is supposed to be visible on screen.</param>
        /// <param name="Y">The Y position of where this UITextEdit is supposed to be visible on screen.</param>
        /// <param name="Width">The Width of this UITextEdit control.</param>
        /// <param name="Height">The Height of this UITextEdit control.</param>
        /// <param name="ReadOnly">Can the user edit the text in this control?</param>
        /// <param name="Capacity">The capacity of this UITextEdit instance, in number of characters.</param>
        /// <param name="StrID">The String ID of this UITextEdit instance.</param>
        /// <param name="Screen">A UIScreen instance.</param>
        public UITextEdit(int X, int Y, int Width, int Height, bool ReadOnly, int Capacity, string StrID, UIScreen Screen)
            : base(Screen, StrID, DrawLevel.DontGiveAFuck)
        {
            m_X = X;
            m_Y = Y;
            m_Width = Width;
            m_Height = Height;
            m_ReadOnly = ReadOnly;
            m_Capacity = Capacity;

            m_Lines.Add(new TextLine(new StringBuilder(), Y));
            m_LinePositionCounter = Y;
        }
        public UINetworkButton(float X, float Y, Texture2D Texture, NetworkClient Client, UIScreen Screen, string StrID)
            : base(Client, Screen, StrID, DrawLevel.AlwaysOnTop)
        {
            m_X = X;
            m_Y = Y;

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

            m_Caption = "";
            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);
        }
        public CatalogChooser(UIScreen scr, string StrID, uint background_0, uint background_1, int x, int y, string catalogType)
            : base(scr, StrID, DrawLevel.DontGiveAFuck)
        {
            m_Screen.CreateImage(background_0, background_1, 336+177, 5+96+390, 1, StrID+"SubtoolsBackground");
            myCatalogType = catalogType;

            m_Screen.CreateButton(0x00000423, 1, 348 + 177, 30 + 96, 1, false, StrID + "PreviousPageButton");
            m_Screen.CreateButton(0x00000424, 1, 597 + 177, 30 + 96, 1, false, StrID + "NextPageButton");
            myScreen.CreateImage(background_0, background_1, 336+177, 5+96+390, 1, StrID+"SubtoolsBackground");

            myPrevPgBtn = myScreen.CreateButton(0x00000423, 1, 348 + 177, 30 + 96, 1, false, StrID + "PreviousPageButton");
            myNextPgBtn = myScreen.CreateButton(0x00000424, 1, 597 + 177, 30 + 96, 1, false, StrID + "NextPageButton");

            myPrevPgBtn.Disabled = true;
            myPrevPgBtn.OnButtonClick += new ButtonClickDelegate(delegate(UIButton b) { if (currentItemIndex != 0) { currentItemIndex -= 10; } RefreshFloorCatalog(); if (currentItemIndex == 0) { myPrevPgBtn.Disabled = true; } if (currentItemIndex <= ContentManager.Floors.Count) { myNextPgBtn.Disabled = false; } });
            myNextPgBtn.OnButtonClick += new ButtonClickDelegate(delegate(UIButton b) { if (currentItemIndex <= ContentManager.Floors.Count) { currentItemIndex += 10; } RefreshFloorCatalog(); if (currentItemIndex + 10 >= ContentManager.Floors.Count) { myNextPgBtn.Disabled = true; } if (currentItemIndex != 0) { myPrevPgBtn.Disabled = false; } });

            InitCatalog();
        }
        public UICollectionViewer(int x, int y, int thumbSizeX, int thumbSizeY, int thumbMarginX, int thumbMarginY, int thumbImageSizeX, int thumbImageSizeY, int thumbImageOffsetX, int thumbImageOffsetY, int rows, int columns, ulong maleCollectionID, ulong femaleCollectionID, UIScreen screen, string strID, ScreenManager scrnMgr)
            : base(screen, strID, DrawLevel.AlwaysOnTop)
        {
            m_StringID = strID;

            myButtons = new UIButton[rows, columns];
            myScreen = screen;
            myScrMgr = scrnMgr;
            myMaleCollectionID = maleCollectionID;
            myFemaleCollectionID = femaleCollectionID;
            myCurrentCollectionID = femaleCollectionID;
            myThumbSizeX = thumbSizeX;
            myThumbSizeY = thumbSizeY;
            myThumbImageSizeX = thumbImageSizeX;
            myThumbImageSizeY = thumbImageSizeY;
            myThumbMarginX = thumbMarginX;
            myThumbMarginY = thumbMarginY;
            myThumbImageOffsetX = thumbImageOffsetX;
            myThumbImageOffsetY = thumbImageOffsetY;
            myPurchasables = new List<ulong>();
            myOutfits = new List<ulong>();
            myAppearances = new List<ulong[]>();
            myBindings = new List<ulong[]>();
            myThumbnails = new List<ulong[]>();
            myCurrentThumbnails = null;
            myLeftButton = addButton(0x3f500000001, 410, 275, 1, false, strID + "LeftArrow");
            myRightButton = addButton(0x3f600000001, 645, 275, 1, false, strID + "RightArrow");

            /*myLeftButton.OnButtonClick += delegate(UIButton btn) { myPageStartIdx -= myRows * myColumns; myCurrentThumbnails = null; };
            myRightButton.OnButtonClick += delegate(UIButton btn) { myPageStartIdx += myRows * myColumns; myCurrentThumbnails = null; };*/

            myTextButtons = new UITextButton[12];

            for (int i = 0, stride = 0; i < 12; i++)
            {
                myTextButtons[i] = new UITextButton(450 + stride, 270, (i + 1).ToString(), strID + "NumberButton" + i, myScreen);
                myScreen.Add(myTextButtons[i]);
                myTextButtons[i].OnButtonClick += delegate(UIElement element) { myPageStartIdx = int.Parse(element.StrID.Substring(element.StrID.LastIndexOf("NumberButton") + 12)) * myRows * myColumns; myCurrentThumbnails = null; };

                if (i < 9)
                    stride += 15;
                else
                    stride += 22;
            }

            mySkinColor = 0;
            myRows = rows;
            myColumns = columns;
            myPageStartIdx = 0;

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    myButtons[i, j] = addButton(0x000003E600000001, x + thumbMarginX + (j * (thumbMarginX + thumbSizeX)), y + thumbMarginY + (i * (thumbMarginY + thumbSizeY)), 1, false, strID + '_' + i + j);
                }
            }

            loadCollection();
            myCountLabel = new UILabel(0, "CountLabel", 505, 250, myScreen);
            myCountLabel.Caption = "" + myThumbnails.Count + " Heads";
            myScreen.Add(myCountLabel);
        }
        public UICollectionViewer(float x, float y, int thumbSizeX, int thumbSizeY, int thumbMarginX, int thumbMarginY, int thumbImageSizeX, int thumbImageSizeY, int thumbImageOffsetX, int thumbImageOffsetY, int rows, int columns, ulong maleCollectionID, ulong femaleCollectionID, UIScreen screen, string strID, ScreenManager scrnMgr)
            : base(screen, strID, DrawLevel.AlwaysOnTop)
        {
            m_StringID = strID;

            float Scale = GlobalSettings.Default.ScaleFactor;

            myButtons = new UIButton[rows, columns];
            myScreen = screen;
            myScrMgr = scrnMgr;
            myMaleCollectionID = maleCollectionID;
            myFemaleCollectionID = femaleCollectionID;
            myCurrentCollectionID = femaleCollectionID;
            myThumbSizeX = thumbSizeX;
            myThumbSizeY = thumbSizeY;
            myThumbImageSizeX = thumbImageSizeX;
            myThumbImageSizeY = thumbImageSizeY;
            myThumbMarginX = thumbMarginX;
            myThumbMarginY = thumbMarginY;
            myThumbImageOffsetX = thumbImageOffsetX;
            myThumbImageOffsetY = thumbImageOffsetY;
            myPurchasables = new List<ulong>();
            myOutfits = new List<ulong>();
            myAppearances = new List<ulong[]>();
            myBindings = new List<ulong[]>();
            myThumbnails = new List<ulong[]>();
            myCurrentThumbnails = null;

            myLeftButton = addButton((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowleft, x + 20, y + 200, 1, false, strID + "LeftArrow");
            myRightButton = addButton((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowright, x + 260, y + 200, 1, false, strID + "RightArrow");

            myTextButtons = new UIClickableLabel[12];

            for (int i = 0, stride = 0; i < 12; i++)
            {
                myTextButtons[i] = new UIClickableLabel((x + 61) + stride, y + 200, (i + 1).ToString(), strID + "NumberButton" + i, myScreen);

                myScreen.Add(myTextButtons[i]);
                myTextButtons[i].OnButtonClick += delegate(UIElement element) { myPageStartIdx = int.Parse(element.StrID.Substring(element.StrID.LastIndexOf("NumberButton") + 12)) * myRows * myColumns; myCurrentThumbnails = null; };

                if (i < 9)
                    stride += 15;
                else
                    stride += 22;
            }

            mySkinColor = 0;
            myRows = rows;
            myColumns = columns;
            myPageStartIdx = 0;

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    myButtons[i, j] = addButton((ulong)FileIDs.UIFileIDs.person_edit_headskinbtn, (x * Scale) + (thumbMarginX * Scale) + (j * ((thumbMarginX * Scale) + (thumbSizeX * Scale))), (y * Scale) + (thumbMarginY * Scale) + (i * ((thumbMarginY * Scale) + (thumbSizeY * Scale))), 1, false, strID + '_' + i + j);
                }
            }

            loadCollection();
            myCountLabel = new UILabel(0, "CountLabel", x + 120, y + 175, myScreen);
            myCountLabel.Caption = "" + myThumbnails.Count + " Heads";
            myScreen.Add(myCountLabel);
        }
 /// <summary>
 /// Adds a UIScreen instance to this ScreenManager's list of screens.
 /// This function is called from Lua.
 /// </summary>
 /// <param name="Screen">The UIScreen instance to be added.</param>
 public void AddScreen(UIScreen Screen, string LuaPath)
 {
     if (LuaPath != "")
     {
         m_Screens.Add(Screen);
         LuaInterfaceManager.RunFileInThread(LuaPath);
     }
     else
         m_Screens.Add(Screen);
 }
        /// <summary>
        /// Occurs when the client was not authenticated by the loginserver.
        /// Called by UILoginDialog.cs.
        /// </summary>
        /// <param name="Client">The client that received the packet.</param>
        /// <param name="Packet">The packet that was received.</param>
        /// <param name="Screen">A UIScreen instance on which to display a messagebox to inform the player of the
        ///                      failure state.</param>
        public static void OnLoginFailResponse(ref NetworkClient Client, PacketStream Packet, UIScreen Screen)
        {
            byte Opcode = (byte)Packet.ReadByte();

            switch (Packet.ReadByte())
            {
                case 0x01:
                    Screen.CreateMsgBox(250, 200, "Invalid accountname!");
                    break;
                case 0x02:
                    Screen.CreateMsgBox(250, 200, "Invalid password!");
                    break;
            }

            Client.Disconnect();
        }
 public void RemoveScreen(UIScreen Screen)
 {
     m_Screens.Remove(Screen);
 }
Example #24
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); });
 }
Example #25
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];
        }
 public UIElement(UIScreen Screen, string StrID, DrawLevel Level)
 {
     m_Screen = Screen;
     m_StringID = StrID;
     m_DrawLevel = Level;
 }