public UINewspaperGraphTab() { DateLabels = new UILabel[7]; for (int i = 0; i < 7; i++) { var label = new UILabel { Size = new Vector2(31, 13), Alignment = TextAlignment.Center | TextAlignment.Middle, Position = new Vector2(125 + i * 45, 55 - 16) }; label.CaptionStyle = label.CaptionStyle.Clone(); label.CaptionStyle.Size = 9; label.CaptionStyle.Shadow = true; Add(label); DateLabels[i] = label; } SkillLabels = new UIClickableLabel[8]; for (int i = 0; i < 8; i++) { var label = new UIClickableLabel(); var id = i; label.Position = new Vector2(125 - 44, 55 - 13 + i * 15); label.CaptionStyle = label.CaptionStyle.Clone(); label.CaptionStyle.Color = SkillTypeCol[i]; label.CaptionStyle.Size = 9; label.CaptionStyle.Shadow = true; label.OnMouseEvtExt += (type, state) => OnSkillHover(type, state, id); label.Size = new Vector2(45, 15); label.Alignment = TextAlignment.Left | TextAlignment.Top; label.Caption = GameFacade.Strings.GetString("f108", (i + 1).ToString()); Add(label); SkillLabels[i] = label; } Graph = new UINewspaperGraph { Position = new Vector2(80 + 45, 55) }; Add(Graph); }
public UILotPage() { var script = RenderScript("housepage.uis"); BackgroundNumOccupantsImage = script.Create <UIImage>("BackgroundNumOccupantsImage"); AddAt(0, BackgroundNumOccupantsImage); BackgroundHouseCategoryThumbImage = script.Create <UIImage>("BackgroundHouseCategoryThumbImage"); AddAt(0, BackgroundHouseCategoryThumbImage); BackgroundHouseLeaderThumbImage = script.Create <UIImage>("BackgroundHouseLeaderThumbImage"); AddAt(0, BackgroundHouseLeaderThumbImage); BackgroundDescriptionEditImage = script.Create <UIImage>("BackgroundDescriptionEditImage"); AddAt(0, BackgroundDescriptionEditImage); BackgroundDescriptionImage = script.Create <UIImage>("BackgroundDescriptionImage"); AddAt(0, BackgroundDescriptionImage); BackgroundContractedImage = new UIImage(); BackgroundContractedImage.Texture = ContractedBackgroundImage; this.AddAt(0, BackgroundContractedImage); BackgroundExpandedImage = new UIImage(); BackgroundExpandedImage.Texture = ExpandedBackgroundImage; this.AddAt(0, BackgroundExpandedImage); ContractButton.OnButtonClick += (x) => Open = false; ExpandButton.OnButtonClick += (x) => Open = true; ExpandedCloseButton.OnButtonClick += Close; ContractedCloseButton.OnButtonClick += Close; LotThumbnail = script.Create <UILotThumbButton>("HouseThumbSetup"); LotThumbnail.Init(RoommateThumbButtonImage, VisitorThumbButtonImage); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); LotThumbnail.SetThumbnail(DefaultThumb, 0); Add(LotThumbnail); RoommateList = script.Create <UIRoommateList>("RoommateList"); Add(RoommateList); SkillGameplayLabel = new UIClickableLabel(); SkillGameplayLabel.Position = RoommateList.Position + new Vector2(-1, 24); SkillGameplayLabel.Size = new Vector2(180, 18); SkillGameplayLabel.Alignment = TextAlignment.Center; SkillGameplayLabel.OnButtonClick += SkillGameplayLabel_OnButtonClick; SkillGameplayLabel.CaptionStyle = SkillGameplayLabel.CaptionStyle.Clone(); SkillGameplayLabel.CaptionStyle.Size = 9; Add(SkillGameplayLabel); OwnerButton = script.Create <UIPersonButton>("HouseLeaderThumbSetup"); OwnerButton.FrameSize = UIPersonButtonSize.LARGE; Add(OwnerButton); /** Drag **/ UIUtils.MakeDraggable(BackgroundContractedImage, this, true); UIUtils.MakeDraggable(BackgroundExpandedImage, this, true); /** Description scroll **/ HouseDescriptionSlider.AttachButtons(HouseDescriptionScrollUpButton, HouseDescriptionScrollDownButton, 1); HouseDescriptionTextEdit.AttachSlider(HouseDescriptionSlider); HouseLinkButton.OnButtonClick += JoinLot; HouseCategoryButton.OnButtonClick += ChangeCategory; HouseNameButton.OnButtonClick += ChangeName; LotThumbnail.OnLotClick += JoinLot; NeighborhoodNameButton.OnButtonClick += (btn) => { if (CurrentLot != null && CurrentLot.Value != null && CurrentLot.Value.Lot_NeighborhoodID != 0) { FindController <CoreGameScreenController>().ShowNeighPage(CurrentLot.Value.Lot_NeighborhoodID); } }; var ui = Content.Content.Get().CustomUI; HouseCategory_CommunityButtonImage = ui.Get("lotp_community_small.png").Get(GameFacade.GraphicsDevice); CurrentLot = new Binding <Lot>() .WithBinding(HouseNameButton, "Caption", "Lot_Name") .WithBinding(NeighborhoodNameButton, "Caption", "Lot_NeighborhoodName") .WithBinding(HouseValueLabel, "Caption", "Lot_Price", x => MoneyFormatter.Format((uint)x)) .WithBinding(OccupantsNumberLabel, "Caption", "Lot_NumOccupants", x => x.ToString()) .WithBinding(OwnerButton, "AvatarId", "Lot_LeaderID") .WithBinding(HouseCategoryButton, "Texture", "Lot_Category", x => { var category = (LotCategory)Enum.Parse(typeof(LotCategory), x.ToString()); switch (category) { case LotCategory.none: return(HouseCategory_NoCategoryButtonImage); case LotCategory.welcome: return(HouseCategory_WelcomeButtonImage); case LotCategory.money: return(HouseCategory_MoneyButtonImage); case LotCategory.entertainment: return(HouseCategory_EntertainmentButtonImage); case LotCategory.games: return(HouseCategory_GamesButtonImage); case LotCategory.offbeat: return(HouseCategory_OffbeatButtonImage); case LotCategory.residence: return(HouseCategory_ResidenceButtonImage); case LotCategory.romance: return(HouseCategory_RomanceButtonImage); case LotCategory.services: return(HouseCategory_ServicesButtonImage); case LotCategory.shopping: return(HouseCategory_ShoppingButtonImage); case LotCategory.skills: return(HouseCategory_SkillsButtonImage); case LotCategory.community: return(HouseCategory_CommunityButtonImage); default: return(HouseCategory_CommunityButtonImage); } }).WithBinding(HouseCategoryButton, "Position", "Lot_Category", x => { return(new Vector2(69 + 11 - HouseCategoryButton.Texture.Width / 8, 164 + 11 - HouseCategoryButton.Texture.Height / 2)); }) .WithMultiBinding(x => RefreshUI(), "Lot_LeaderID", "Lot_IsOnline", "Lot_Thumbnail", "Lot_Description", "Lot_RoommateVec"); RefreshUI(); //NeighborhoodNameButton.Visible = false; Size = BackgroundExpandedImage.Size.ToVector2(); SendToFront(ExpandButton, ContractButton); }
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); }