using HDL_ON.UI.CSS; using Shared; using System; namespace HDL_ON.UI { /// /// 房间图库界面 /// public class RoomGalleryPage : FrameLayout { FrameLayout bodyView; VerticalScrolViewLayout contentView; string lastPath; Action backAction; public RoomGalleryPage(string lastPath, Action action) { bodyView = this; this.lastPath = lastPath; backAction = action; } public void LoadPage(bool loadSceneGallery) { bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.DefaultGallery)).LoadTopView(); contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(603), }; bodyView.AddChidren(contentView); if(loadSceneGallery) { LoadSceneGallery(); } } /// /// 加载场景图库 /// void LoadSceneGallery() { contentView.RemoveAll(); FrameLayout roomImageRow = new FrameLayout() { Height = Application.GetRealWidth(97), }; for (int i = 0; i < 10; i++) { string curImagePath = $"Classification/Room/Roombg{i + 1}.png"; var sceneImageView = new FrameLayout() { Width = Application.GetRealWidth(172), Height = Application.GetRealWidth(97), BackgroundImagePath = curImagePath, }; if (i % 2 == 0) { roomImageRow = new FrameLayout() { Height = Application.GetRealWidth(97), }; contentView.AddChidren(new Button() { Height = Application.GetRealWidth(12) }); contentView.AddChidren(roomImageRow); sceneImageView.X = Application.GetRealWidth(10); roomImageRow.AddChidren(sceneImageView); } else { sceneImageView.X = Application.GetRealWidth(194); roomImageRow.AddChidren(sceneImageView); } if (lastPath == curImagePath) { var btnLastChooseTip = new Button() { X = Application.GetRealWidth(146), Y = Application.GetRealWidth(6), Width = Application.GetRealWidth(20), Height = Application.GetRealWidth(20), UnSelectedImagePath = "Intelligence/Gallery/chooseTipIcon.png", }; sceneImageView.AddChidren(btnLastChooseTip); } sceneImageView.MouseUpEventHandler = (sender, e) => { this.RemoveFromParent(); backAction(curImagePath); }; } } } }