/// <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);
        }
        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);
        }
Beispiel #3
0
 /// <summary>
 /// Creates a UILabel instance and adds it to this UIScreen's list of UILabels.
 /// This function is called from Lua.
 /// </summary>
 /// <param name="CaptionID">The ID of the caption for the label.</param>
 /// <param name="StrID">The string ID of the label.</param>
 /// <param name="X">The X position of the label.</param>
 /// <param name="Y">The Y position of the label.</param>
 public UILabel CreateLabel(int CaptionID, string StrID, float X, float Y)
 {
     UILabel Lbl = new UILabel(CaptionID, StrID, X, Y, this);
     m_UIElements.Add(Lbl);
     return Lbl;
 }
        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);
        }
        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);
        }