VisualElement CreateVenueUi(TokenAuthWidget tokenAuth, UserInfo userInfo) { var container = new VisualElement() { style = { flexDirection = FlexDirection.Row, flexGrow = 1, } }; var sidePane = new VisualElement() { style = { borderColor = new StyleColor(Color.gray), borderRightWidth = 1, paddingRight = 4, } }; var mainPane = new VisualElement() { style = { flexGrow = 1 } }; container.Add(sidePane); container.Add(mainPane); // Side var sideMenu = new SideMenuVenueList(userInfo); sideMenu.AddView(sidePane); ReactiveBinder.Bind(sideMenu.reactiveForceLogout, forceLogout => { if (forceLogout) { tokenAuth.Logout(); } }); // Main ReactiveBinder.Bind(sideMenu.reactiveCurrentVenue, currentVenue => { mainPane.Clear(); if (currentVenue != null) { var venueContent = new ScrollView(ScrollViewMode.Vertical) { style = { flexGrow = 1 } }; new EditAndUploadVenueView(userInfo, currentVenue, () => { sideMenu.RefetchVenueWithoutChangingSelection(); }).AddView(venueContent); mainPane.Add(venueContent); } }); return(container); }
VisualElement CreateVenueUi(TokenAuthWidget tokenAuth, VisualElement tokenAuthView, UserInfo?userInfo) { var container = new VisualElement { style = { flexDirection = FlexDirection.Row, flexGrow = 1, } }; var sidePane = new VisualElement { style = { #if UNITY_2019_3_OR_NEWER borderLeftColor = new StyleColor(Color.gray), borderRightColor = new StyleColor(Color.gray), borderTopColor = new StyleColor(Color.gray), borderBottomColor = new StyleColor(Color.gray), #else borderColor = new StyleColor(Color.gray), #endif borderRightWidth = 1, width = 250, } }; sidePane.EnableInClassList("pane", true); var mainPane = new VisualElement { style = { flexGrow = 1 } }; mainPane.EnableInClassList("pane", true); container.Add(sidePane); container.Add(mainPane); // Side sidePane.Add(tokenAuthView); if (userInfo.HasValue) { var sideMenu = new SideMenuVenueList(userInfo.Value); sideMenu.AddView(sidePane); ReactiveBinder.Bind(sideMenu.reactiveForceLogout, forceLogout => { if (forceLogout) { tokenAuth.Logout(); } }); // Main ReactiveBinder.Bind(sideMenu.reactiveCurrentVenue, currentVenue => { mainPane.Clear(); if (currentVenue != null) { var venueContent = new ScrollView(ScrollViewMode.Vertical) { style = { flexGrow = 1 } }; new EditAndUploadVenueView(userInfo.Value, currentVenue, () => { sideMenu.RefetchVenueWithoutChangingSelection(); }).AddView(venueContent); mainPane.Add(venueContent); } }); } else { mainPane.Clear(); } return(container); }