public UILoginDialog(LoginScreen loginScreen)
            : base(UIDialogStyle.Standard, true)
        {
            this.m_LoginScreen = loginScreen;
            this.Caption = GameFacade.Strings.GetString("UIText", "209", "1");

            SetSize(350, 225);

            m_TxtAccName = UITextEdit.CreateTextBox();
            m_TxtAccName.X = 20;
            m_TxtAccName.Y = 72;
            m_TxtAccName.MaxChars = 16;
            m_TxtAccName.SetSize(310, 27);
            m_TxtAccName.CurrentText = "username";
            this.Add(m_TxtAccName);

            m_TxtPass = UITextEdit.CreateTextBox();
            m_TxtPass.X = 20;
            m_TxtPass.Y = 128;
            m_TxtPass.MaxChars = 16;
            m_TxtPass.CurrentText = "password";
            m_TxtPass.SetSize(310, 27);
            this.Add(m_TxtPass);

            /** Login button **/
            var loginBtn = new UIButton {
                X = 116,
                Y = 170,
                Width = 100,
                ID = "LoginButton",
                Caption = GameFacade.Strings.GetString("UIText", "209", "2")
            };
            this.Add(loginBtn);
            loginBtn.OnButtonClick += new ButtonClickDelegate(loginBtn_OnButtonClick);

            var exitBtn = new UIButton
            {
                X = 226,
                Y = 170,
                Width = 100,
                ID = "ExitButton",
                Caption = GameFacade.Strings.GetString("UIText", "209", "3")
            };
            this.Add(exitBtn);
            exitBtn.OnButtonClick += new ButtonClickDelegate(exitBtn_OnButtonClick);

            this.Add(new UILabel
            {
                Caption = GameFacade.Strings.GetString("UIText", "209", "4"),
                X = 24,
                Y = 50
            });

            this.Add(new UILabel
            {
                Caption = GameFacade.Strings.GetString("UIText", "209", "5"),
                X = 24,
                Y = 106
            });
        }
        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 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);
        }
        public UIGridViewerRender(UIGridViewer owner)
        {
            this.owner = owner;

            button = new UIButton(owner.ThumbButtonImage);
            button.Size = owner.ThumbSize;
            button.OnButtonClick += new ButtonClickDelegate(button_OnButtonClick);
            this.Add(button);

            image = new UIImage();
            //image.ScaleX = owner.ThumbImageSize.X / (owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2));
            image.SetSize(owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2),
                          owner.ThumbSize.Y - (owner.ThumbImageOffsets.Y * 2));
            image.Position = owner.ThumbImageOffsets;
            this.Add(image);
        }
Exemplo n.º 5
0
        public LotDebugScreen()
        {
            var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant01_00.xml"));

            World = new World(GameFacade.Game.GraphicsDevice);
            GameFacade.Scenes.Add(World);

            vm = new TSO.Simantics.VM(new VMContext(World));
            vm.Init();

            var activator = new VMWorldActivator(vm, World);
            var blueprint = activator.LoadFromXML(lotInfo);

            World.InitBlueprint(blueprint);
            vm.Context.Blueprint = blueprint;

            var sim = activator.CreateAvatar();
            //sim.Position = new Vector3(31.5f, 55.5f, 0.0f);
            sim.Position = new Vector3(26.5f, 41.5f, 0.0f);

            VMDebug = new UIButton()
            {
                Caption = "Simantics",
                Y = 45,
                Width = 100,
                X = GlobalSettings.Default.GraphicsWidth - 110
            };
            VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
            this.Add(VMDebug);

            LotController = new UILotControl(vm, World);
            this.AddAt(0, LotController);

            ucp = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(true);
            ucp.SetMode(UIUCP.UCPMode.LotMode);
            ucp.SelectedAvatar = sim;
            ucp.SetPanel(1);

            //ucp.ZoomLevel = 1;
            //ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged);
            //ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged);
            this.Add(ucp);
        }
Exemplo n.º 6
0
        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(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 PersonSelectionEdit()
        {
            /**
             * Data
             */
            MaleHeads = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));
            MaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male));

            FemaleHeads = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female_heads));
            FemaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female));

            /**
             * UI
             */

            UIScript ui = null;
            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselectionedit.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselectionedit" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

            DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription");
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionTextEdit.AttachSlider(DescriptionSlider);
            NameTextEdit.OnChange += new ChangeDelegate(NameTextEdit_OnChange);

            AcceptButton.Disabled = true;
            AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick);

            /** Appearance **/
            SkinLightButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinDarkButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SelectedAppearanceButton = SkinLightButton;
            SkinLightButton.Selected = true;

            HeadSkinBrowser = ui.Create<UICollectionViewer>("HeadSkinBrowser");
            HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange);
            HeadSkinBrowser.Init();
            this.Add(HeadSkinBrowser);

            BodySkinBrowser = ui.Create<UICollectionViewer>("BodySkinBrowser");
            BodySkinBrowser.Init();
            this.Add(BodySkinBrowser);

            FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);
            MaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);

            /** Backgrounds **/
            var bg = new UIImage(BackgroundImage);
            this.AddAt(0, bg);

            var offset = new Vector2(0, 0);
            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

                this.AddAt(1, new UIImage(BackgroundImageDialog) {
                    X = 112,
                    Y = 84
                });
            }

            /**
             * Music
             */
            PlayBackgroundMusic(
                GameFacade.GameFilePath("music\\modes\\create\\tsocas1_v2.mp3")
            );

            SimBox = new UISim();
            SimBox.SimScale = 0.8f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 140, offset.Y + 130);

            this.Add(SimBox);

            Sim = new Sim(new Guid().ToString());

            /**
             * Init state
             */
            RefreshCollections();

            HeadSkinBrowser.SelectedIndex = 0;
            BodySkinBrowser.SelectedIndex = 0;
            FemaleButton.Selected = true;
        }
Exemplo n.º 9
0
        public UISliderButtonHandler(UISlider slider, UIButton increase, UIButton decrease, int change)
        {
            this.slider = slider;
            this.increase = increase;
            this.decrease = decrease;
            this.Change = change;

            increase.OnButtonClick += new ButtonClickDelegate(increase_OnButtonClick);
            decrease.OnButtonClick += new ButtonClickDelegate(decrease_OnButtonClick);

            slider.OnChange += new ChangeDelegate(slider_OnChange);
            slider.OnRangeChange += new ChangeDelegate(slider_OnRangeChange);

            Update();
        }
Exemplo n.º 10
0
 public void RegisterClick(UIButton btn)
 {
     m_ButtonsClicked.Add(btn);
 }
Exemplo n.º 11
0
        public void RenderMenu()
        {
            for (int i = 0; i < m_PieButtons.Count; i++) //remove previous buttons
            {
                this.Remove(m_PieButtons[i]);
            }
            m_PieButtons.Clear();

            var elems = m_CurrentItem.Children;
            int dirConfig;
            if (elems.Count > 4) dirConfig = 8;
            else if (elems.Count > 2) dirConfig = 4;
            else dirConfig = 2;

            for (int i = 0; i < dirConfig; i++)
            {
                if (i >= elems.Count) break;
                var elem = elems.ElementAt(i);
                var but = new UIButton()
                {
                    Caption = elem.Value.Name+((elem.Value.Category)?"...":""),
                    CaptionStyle = ButtonStyle,
                    ImageStates = 1,
                    Texture = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };

                double dir = (((double)i)/dirConfig)*Math.PI*2;
                but.AutoMargins = 4;

                if (i == 0) { //top
                    but.X = (float)(Math.Sin(dir)*60-but.Width/2);
                    but.Y = (float)((Math.Cos(dir)*-60)-but.Size.Y);
                } else if (i == dirConfig/2) { //bottom
                    but.X = (float)(Math.Sin(dir)*60-but.Width/2);
                    but.Y = (float)((Math.Cos(dir)*-60));
                }
                else if (i < dirConfig / 2) //on right side
                {
                    but.X = (float)(Math.Sin(dir) * 60);
                    but.Y = (float)((Math.Cos(dir) * -60) - but.Size.Y / 2);
                }
                else //on left side
                {
                    but.X = (float)(Math.Sin(dir) * 60-but.Width);
                    but.Y = (float)((Math.Cos(dir) * -60) - but.Size.Y / 2);
                }

                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(PieButtonClick);
                but.OnButtonHover += new ButtonClickDelegate(PieButtonHover);
            }

            bool top = true;
            for (int i = 8; i < elems.Count; i++)
            {
                var elem = elems.ElementAt(i);
                var but = new UIButton()
                {
                    Caption = elem.Value.Name+((elem.Value.Category)?"...":""),
                    CaptionStyle = ButtonStyle,
                    ImageStates = 1,
                    Texture = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };
                but.AutoMargins = 4;

                but.X = (float)(- but.Width / 2);
                if (top)
                { //top
                    but.Y = (float)(-60 - but.Size.Y*((i-8)/2 + 2));
                }
                else
                {
                    but.Y = (float)(60 + but.Size.Y * ((i - 8) / 2 + 1));
                }

                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(PieButtonClick);

                top = !top;
            }

            if (m_CurrentItem.Parent != null)
            {
                var but = new UIButton()
                {
                    Caption = m_CurrentItem.Name,
                    CaptionStyle = ButtonStyle.Clone(),
                    ImageStates = 1,
                    Texture = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };

                but.CaptionStyle.Color = but.CaptionStyle.SelectedColor;
                but.AutoMargins = 4;
                but.X = (float)(- but.Width / 2);
                but.Y = (float)(- but.Size.Y / 2);
                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(BackButtonPress);
            }
        }
Exemplo n.º 12
0
 private void InitCatalog()
 {
     int current = 0;
     for (int i = 0; i < 2; i++)
     {
         for (int j = 0; j < 5; j++)
         {
             if (ContentManager.Floors.Count > currentItemIndex + current)
             {
                 UIButton btn = new UIButton(462 + 86 - 7 + (44 * j), 500 - 7 + (44 * i), ContentManager.Floors[currentItemIndex + current++].CatalogImage, false, StrID + myCatalogType + '_' + i + '_' + j, myScreen);
                 btn.OnButtonClick += new ButtonClickDelegate(delegate (UIButton button) {
                             if (myScreen is IsometricView)
                             {
                                 string[] nameParts = button.StrID.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                                 int row = int.Parse(nameParts[1]);
                                 int col = int.Parse(nameParts[2]);
                                 ((IsometricView)myScreen).CurrentTool = new FloorTool((IsometricView)myScreen, currentItemIndex + row * 5 + col);
                             }
                         });
                 myScreen.Add(btn);
             }
         }
     }
 }
Exemplo n.º 13
0
        private UIButton AddButton(string label, UIAlertButtons type)
        {
            var btn = new UIButton();
            btn.Caption = label;
            btn.Width = 100;
            btn.OnButtonClick += new ButtonClickDelegate(btn_OnButtonClick);

            ButtonMap.Add(btn, type);

            this.Add(btn);
            return btn;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Adds a button to this message box.
        /// </summary>
        /// <param name="label">Label of the button.</param>
        /// <param name="type">Type of the button to be added.</param>
        /// <param name="InternalHandler">Should the button's click be handled internally?</param>
        /// <returns></returns>
        private UIButton AddButton(string label, UIAlertButtons type, bool InternalHandler)
        {
            var btn = new UIButton();
            btn.Caption = label;
            btn.Width = 100;

            if(InternalHandler)
                btn.OnButtonClick += new ButtonClickDelegate(btn_OnButtonClick);

            ButtonMap.Add(type, btn);

            this.Add(btn);
            return btn;
        }
Exemplo n.º 15
0
        public PersonSelection()
        {
            UIScript ui = null;
            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselection.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselection" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

            m_ExitButton = (UIButton)ui["ExitButton"];

            var numSlots = 3;
            m_PersonSlots = new List<PersonSlot>();

            for (var i = 0; i < numSlots; i++)
            {
                var index = (i + 1).ToString();

                /** Tab Background **/
                var tabBackground = ui.Create<UIImage>("TabBackgroundImage" + index);
                this.Add(tabBackground);

                var enterTabImage = ui.Create<UIImage>("EnterTabImage" + index);
                this.Add(enterTabImage);

                var descTabImage = ui.Create<UIImage>("DescriptionTabImage" + index);
                this.Add(descTabImage);

                var descTabBgImage = ui.Create<UIImage>("DescriptionTabBackgroundImage" + index);
                var enterIcons = ui.Create<UIImage>("EnterTabBackgroundImage" + index);

                var personSlot = new PersonSlot(this)
                {
                    AvatarButton = (UIButton)ui["AvatarButton" + index],
                    CityButton = (UIButton)ui["CityButton" + index],
                    HouseButton = (UIButton)ui["HouseButton" + index],
                    EnterTabButton = (UIButton)ui["EnterTabButton" + index],
                    DescTabButton = (UIButton)ui["DescriptionTabButton" + index],
                    NewAvatarButton = (UIButton)ui["NewAvatarButton" + index],
                    DeleteAvatarButton = (UIButton)ui["DeleteAvatarButton" + index],
                    PersonNameText = (UILabel)ui["PersonNameText" + index],
                    PersonDescriptionScrollUpButton = (UIButton)ui["PersonDescriptionScrollUpButton" + index],
                    PersonDescriptionScrollDownButton = (UIButton)ui["PersonDescriptionScrollDownButton" + index],
                    PersonDescriptionSlider = (UISlider)ui["PersonDescriptionSlider" + index],
                    CityNameText = (UILabel)ui["CityNameText" + index],
                    HouseNameText = (UILabel)ui["HouseNameText" + index],
                    PersonDescriptionText = (UITextEdit)ui["PersonDescriptionText" + index],
                    DescriptionTabBackgroundImage = descTabBgImage,
                    EnterTabBackgroundImage = enterIcons,

                    TabBackground = tabBackground,
                    TabEnterBackground = enterTabImage,
                    TabDescBackground = descTabImage
                };

                this.AddBefore(descTabBgImage, personSlot.PersonDescriptionText);
                this.AddBefore(enterIcons, personSlot.CityButton);

                personSlot.Init();
                personSlot.SetSlotAvailable(true);
                m_PersonSlots.Add(personSlot);

                lock (NetworkFacade.Avatars)
                {
                    if (i < NetworkFacade.Avatars.Count)
                    {
                        personSlot.DisplayAvatar(NetworkFacade.Avatars[i]);
                        personSlot.AvatarButton.OnButtonClick += new ButtonClickDelegate(AvatarButton_OnButtonClick);

                        var SimBox = new UISim(NetworkFacade.Avatars[i].GUID);

                        SimBox.Avatar.Body = NetworkFacade.Avatars[i].Body;
                        SimBox.Avatar.Head = NetworkFacade.Avatars[i].Head;
                        SimBox.Avatar.Handgroup = NetworkFacade.Avatars[i].Body;
                        SimBox.Avatar.Appearance = NetworkFacade.Avatars[i].Avatar.Appearance;

                        SimBox.Position = m_PersonSlots[i].AvatarButton.Position + new Vector2(70, (m_PersonSlots[i].AvatarButton.Size.Y - 35));
                        SimBox.Size = m_PersonSlots[i].AvatarButton.Size;

                        SimBox.Name = NetworkFacade.Avatars[i].Name;

                        m_UISims.Add(SimBox);
                        this.Add(SimBox);
                    }
                }
            }

            this.AddAt(0, new UIImage(BackgroundImage));
            if (BackgroundImageDialog != null)
            {
                this.AddAt(1, new UIImage(BackgroundImageDialog)
                {
                    X = 112,
                    Y = 84
                });
            }

            /**
             * Button plumbing
             */
            CreditsButton.OnButtonClick += new ButtonClickDelegate(CreditsButton_OnButtonClick);
            m_ExitButton.OnButtonClick += new ButtonClickDelegate(m_ExitButton_OnButtonClick);

            /**
             * Music
             */
            var tracks = new string[]{
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas1_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas4.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas5.mp3"
            };
            PlayBackgroundMusic(
                tracks
            );

            NetworkFacade.Controller.OnCityToken += new OnCityTokenDelegate(Controller_OnCityToken);
            NetworkFacade.Controller.OnPlayerAlreadyOnline += new OnPlayerAlreadyOnlineDelegate(Controller_OnPlayerAlreadyOnline);
            NetworkFacade.Controller.OnCharacterRetirement += new OnCharacterRetirementDelegate(Controller_OnCharacterRetirement);
        }
Exemplo n.º 16
0
        public CoreGameScreen()
        {
            /** City Scene **/
            ListenForMouse(new Rectangle(0, 0, ScreenWidth, ScreenHeight), new UIMouseEvent(MouseHandler));

            CityRenderer = new Terrain(GameFacade.Game.GraphicsDevice); //The Terrain class implements the ThreeDAbstract interface so that it can be treated as a scene but manage its own drawing and updates.

            String city = "Queen Margaret's";
            if (PlayerAccount.CurrentlyActiveSim != null)
                city = PlayerAccount.CurrentlyActiveSim.ResidingCity.Name;

            CityRenderer.m_GraphicsDevice = GameFacade.GraphicsDevice;

            CityRenderer.Initialize(city, GameFacade.CDataRetriever);
            CityRenderer.RegenData = true;

            CityRenderer.LoadContent(GameFacade.GraphicsDevice);

            /**
            * Music
            */
            CityMusic = new string[]{
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild1.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap4_v1.mp3"
            };
            m_ZoomLevel = 5; //screen always starts at far zoom, city visible.
            PlayBackgroundMusic(CityMusic);

            VMDebug = new UIButton()
            {
                Caption = "Simantics",
                Y = 45,
                Width = 100,
                X = GlobalSettings.Default.GraphicsWidth - 110
            };
            VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
            this.Add(VMDebug);

            ucp = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(false);
            ucp.UpdateZoomButton();
            this.Add(ucp);

            gizmo = new UIGizmo();
            gizmo.X = ScreenWidth - 500;
            gizmo.Y = ScreenHeight - 300;
            this.Add(gizmo);

            Title = new UIGameTitle();
            Title.SetTitle(city);
            this.Add(Title);

            //OpenInbox();

            this.Add(GameFacade.MessageController);
            GameFacade.MessageController.OnSendLetter += new LetterSendDelegate(MessageController_OnSendLetter);
            GameFacade.MessageController.OnSendMessage += new MessageSendDelegate(MessageController_OnSendMessage);

            NetworkFacade.Controller.OnNewTimeOfDay += new OnNewTimeOfDayDelegate(Controller_OnNewTimeOfDay);
            NetworkFacade.Controller.OnPlayerJoined += new OnPlayerJoinedDelegate(Controller_OnPlayerJoined);

            //THIS IS KEPT HERE AS A DOCUMENTATION OF THE MESSAGE PASSING API FOR NOW.
            /*
            MessageAuthor Author = new MessageAuthor();
            Author.Author = "Whats His Face";
            Author.GUID = Guid.NewGuid().ToString();

            GameFacade.MessageController.PassMessage(Author, "you suck");
            GameFacade.MessageController.PassMessage(Author, "no rly");
            GameFacade.MessageController.PassMessage(Author, "jk im just testing message recieving please love me");

            Author.Author = "yer maw";
            Author.GUID = Guid.NewGuid().ToString();

            GameFacade.MessageController.PassMessage(Author, "dont let whats his face get to you");
            GameFacade.MessageController.PassMessage(Author, "i will always love you");

            Author.Author = "M.O.M.I";
            Author.GUID = Guid.NewGuid().ToString();

            GameFacade.MessageController.PassEmail(Author, "Ban Notice", "You have been banned for playing too well. \r\n\r\nWe don't know why you still have access to the game, but it's probably related to you playing the game pretty well. \r\n\r\nPlease stop immediately.\r\n\r\n - M.O.M.I. (this is just a test message btw, you're not actually banned)");
            */

            GameFacade.Scenes.Add((_3DAbstract)CityRenderer);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Creates a UIButton instance with a texture and a caption, 
        /// and adds it to this UIScreen instance's list of UIButtons.
        /// This function is called from Lua.
        /// </summary>
        /// <param name="id_0">The TypeID of the button's texture.</param>
        /// <param name="id_1">The GroupID of the button's texture.</param>
        /// <param name="X">The X position of the button.</param>
        /// <param name="Y">The Y position of the button.</param>
        /// <param name="Alpha">The masking color for the button's graphic.</param>
        /// <param name="StrID">The button's string ID.</param>
        public virtual UIButton CreateTextButton(uint id_0, uint id_1, int X, int Y, int CaptionID, int Alpha, string StrID)
        {
            ulong ID = (ulong)(((ulong)id_0) << 32 | ((ulong)(id_1 >> 32)));
            MemoryStream TextureStream;
            Texture2D Texture;

            try
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(m_ScreenMgr.GraphicsDevice, TextureStream/*, TCP*/);
            }
            catch (FAR3Exception)
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(m_ScreenMgr.GraphicsDevice, TextureStream);
                TextureStream.Close();
            }

            //Why did some genius at Maxis decide it was 'ok' to operate with three masking colors?!!
            if (Alpha == 1)
                ManualTextureMask(ref Texture, new Color(255, 0, 255));
            else if (Alpha == 2)
                ManualTextureMask(ref Texture, new Color(254, 2, 254));
            else if (Alpha == 3)
                ManualTextureMask(ref Texture, new Color(255, 1, 255));

            UIButton btn = new UIButton(X, Y, Texture, CaptionID, StrID, this);

            m_UIElements.Add(btn);

            return btn;
        }
Exemplo n.º 18
0
        public LotScreenNew()
        {
            var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant07_00.xml"));

            World = new World();
            GameFacade.Scenes.Add(World);

            vm = new VM(new VMContext(World));
            vm.Init();

            var activator = new VMWorldActivator(vm, World);
            var blueprint = activator.LoadFromXML(lotInfo);

            World.InitBlueprint(blueprint);
            vm.Context.Blueprint = blueprint;

            var sim = activator.CreateAvatar();
            //sim.Position = new Vector3(31.5f, 55.5f, 0.0f);
            sim.Position = new Vector3(26.5f, 41.5f, 0.0f);

            VMDebug = new UIButton()
            {
                Caption = "Simantics",
                Y = 45,
                Width = 100,
                X = GlobalSettings.Default.GraphicsWidth - 110
            };
            VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
            this.Add(VMDebug);

            //var lotInfo = HouseData.Parse("C:\\restaurant00_00_small.xml");
            //for (int i = 1; i < 64; i++)
            //{
            //    lotInfo.World.Floors.Add(new HouseDataFloor {
            //         X = 1,
            //         Y = i,
            //         Level = 0,
            //         Value = 9
            //    });
            //}

            //lotInfo.World.Floors.Add(new HouseDataFloor {
            //    X = 0, Y = 0,
            //    Level = 0, Value = 20
            //});

            //lotInfo.World.Floors.Add(new HouseDataFloor
            //{
            //    X = 63,
            //    Y = 63,
            //    Level = 0,
            //    Value = 40
            //});

            //lotInfo.World.Floors.Add(new HouseDataFloor
            //{
            //    X = 0,
            //    Y = 63,
            //    Level = 0,
            //    Value = 20
            //});

            //lotInfo.World.Floors.Add(new HouseDataFloor
            //{
            //    X = 63,
            //    Y = 0,
            //    Level = 0,
            //    Value = 20
            //});

            //Renderer = new HouseRenderer();
            //Renderer.SetModel(lotInfo);
            ////Renderer.Position = new Microsoft.Xna.Framework.Vector3(-32.0f, -40.0f, 0.0f);

            //var scene = new ThreeDScene();
            //var focusPoint = Vector3.Zero;

            //var yValue = (float)Math.Cos(MathHelper.ToRadians(30.0f)) * 96.0f;
            //var cameraOffset = new Vector3(-96.0f, yValue, 96.0f);
            //var rotatedOffset = Vector3.Transform(cameraOffset, Microsoft.Xna.Framework.Matrix.CreateRotationY(MathHelper.PiOver2 * 0.5f));

            ////rotatedOffset = Vector3.Transform(rotatedOffset, Microsoft.Xna.Framework.Matrix.CreateScale(3f));
            ////Renderer.Position = new Vector3(-96.0f, 0.0f, -96.0f);

            //scene.Camera.Position = cameraOffset;// new Microsoft.Xna.Framework.Vector3(0, 0, 80);
            //scene.Add(Renderer);
            //Renderer.Scale = new Vector3(0.005f);

            //GameFacade.Scenes.AddScene(scene);

            ucp = new UIUCP();
            ucp.Y = ScreenHeight - 210;
            ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged);
            ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged);
            this.Add(ucp);
        }
Exemplo n.º 19
0
 /**
  * Utility to add a +/- button to the slider
  */
 public UISliderButtonHandler AttachButtons(UIButton decrease, UIButton increase, int change)
 {
     return new UISliderButtonHandler(this, increase, decrease, change);
 }
Exemplo n.º 20
0
 private void GameFacade_OnContentLoaderReady()
 {
     /**
      * Add a debug button once the content loader is ready so we can load textures
      */
     debugButton = new UIButton()
     {
         Caption = "Debug",
         Y = 10,
         Width = 100,
         X = GlobalSettings.Default.GraphicsWidth - 110
     };
     debugButton.OnButtonClick += new ButtonClickDelegate(debugButton_OnButtonClick);
     mainUI.Add(debugButton);
 }
        /// <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);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Called when the Login button was clicked.
 /// </summary>
 private void m_BtnLogin_ButtonClickEvent(UIButton btn)
 {
     m_Client.Connect(m_TxtAccName.CurrentText.ToUpper(), m_TxtPass.CurrentText.ToUpper());
 }
        void SkinButton_OnButtonClick(UIElement button)
        {
            SelectedAppearanceButton.Selected = false;
            SelectedAppearanceButton = (UIButton)button;
            SelectedAppearanceButton.Selected = true;

            var type = AppearanceType.Light;

            if (button == SkinMediumButton)
            {
                type = AppearanceType.Medium;
            }
            else if (button == SkinDarkButton)
            {
                type = AppearanceType.Dark;
            }

            this.AppearanceType = type;
            RefreshCollections();
        }
Exemplo n.º 24
0
        /// <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);
        }
Exemplo n.º 25
0
 public UIMessageIcon(UIMessageType type)
 {
     var script = this.RenderScript("messageicon.uis");
     button = new UIButton((type == UIMessageType.IM)?BackgroundImageCall:BackgroundImageLetter);
     button.ImageStates = 3;
     this.Add(button);
 }
        private UIButton addButton(ulong ID, float X, float Y, int Alpha, bool Enabled, string StrID)
        {
            MemoryStream TextureStream;
            Texture2D Texture;

            try
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(myScrMgr.GraphicsDevice, TextureStream/*, TCP*/);
            }
            catch (FAR3Exception)
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(myScrMgr.GraphicsDevice, TextureStream);
                TextureStream.Close();
            }

            //Why did some genius at Maxis decide it was 'ok' to operate with three masking colors?!!
            if (Alpha == 1)
                ManualTextureMask(ref Texture, new Color(255, 0, 255));
            else if (Alpha == 2)
                ManualTextureMask(ref Texture, new Color(254, 2, 254));
            else if (Alpha == 3)
                ManualTextureMask(ref Texture, new Color(255, 1, 255));

            UIButton btn = new UIButton(X, Y, Texture, Enabled, StrID, myScreen);

            myScreen.Add(btn);

            return btn;
        }
 void m_OkBtn_OnButtonClick(UIButton btn)
 {
     m_Display = false;
 }
        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);
        }
Exemplo n.º 29
0
        public LoginScreen()
        {
            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f;

            /** Background image **/
            Background = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup));
            Background.ID = "Background";
            BackgroundCtnr.Add(Background);

            var lbl = new UILabel();
            lbl.Caption = "Version " + GlobalSettings.Default.ClientVersion;
            lbl.X = 20;
            lbl.Y = 558;
            BackgroundCtnr.Add(lbl);
            this.Add(BackgroundCtnr);

            LoginProgress = new UILoginProgress();
            LoginProgress.X = (ScreenWidth - (LoginProgress.Width + 20));
            LoginProgress.Y = (ScreenHeight - (LoginProgress.Height + 20));
            LoginProgress.Opacity = 0.9f;
            this.Add(LoginProgress);

            LoginDialog = new UILoginDialog(this);
            LoginDialog.Opacity = 0.9f;
            //Center
            LoginDialog.X = (ScreenWidth - LoginDialog.Width) / 2;
            LoginDialog.Y = (ScreenHeight - LoginDialog.Height) / 2;
            this.Add(LoginDialog);

            NetworkFacade.Controller.OnNetworkError += new NetworkErrorDelegate(Controller_OnNetworkError);
            NetworkFacade.Controller.OnLoginProgress += new OnProgressDelegate(Controller_OnLoginProgress);
            NetworkFacade.Controller.OnLoginStatus += new OnLoginStatusDelegate(Controller_OnLoginStatus);
            var gameplayButton = new UIButton()
            {
                Caption = "Simantics & Lot Debug",
                Y = 10,
                Width = 200,
                X = 10
            };
            this.Add(gameplayButton);
            gameplayButton.OnButtonClick += new ButtonClickDelegate(gameplayButton_OnButtonClick);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Creates a UIButton instance, and adds it to this UIScreen instance's list of UIButtons.
        /// This function is called from Lua.
        /// </summary>
        /// <param name="id_0">The FileID of the texture to use for the button.</param>
        /// <param name="id_1">The TypeID of the texture to use for the button.</param>
        /// <param name="X">The X position of the button.</param>
        /// <param name="Y">The Y position of the button.</param>
        /// <param name="Alpha">The masking color for the button's graphic.</param>
        /// <param name="StrID">The button's string ID.</param>
        public virtual UIButton CreateButton(uint id_0, uint id_1, float X, float Y, int Alpha, bool Disabled, string StrID)
        {
            MemoryStream TextureStream;
            Texture2D Texture;

            ulong ID = (ulong)(((ulong)id_0) << 32 | ((ulong)(id_1 >> 32)));

            try
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(m_ScreenMgr.GraphicsDevice, TextureStream/*, TCP*/);
            }
            catch (FAR3Exception)
            {
                TextureStream = new MemoryStream(ContentManager.GetResourceFromLongID(ID));
                Texture = Texture2D.FromFile(m_ScreenMgr.GraphicsDevice, TextureStream);
                TextureStream.Close();
            }

            try
            {
                //Why did some genius at Maxis decide it was 'ok' to operate with three masking colors?!!
                if (Alpha == 1)
                    ManualTextureMask(ref Texture, new Color(255, 0, 255));
                else if (Alpha == 2)
                    ManualTextureMask(ref Texture, new Color(254, 2, 254));
                else if (Alpha == 3)
                    ManualTextureMask(ref Texture, new Color(255, 1, 255));

                UIButton btn = new UIButton(X, Y, Texture, Disabled, StrID, this);

                m_UIElements.Add(btn);

                return btn;
            }
            catch (Exception e)
            {
                Log.LogThis("Exception in UIScreen.CreateButton!", eloglevel.error);
                return null;
            }
        }