コード例 #1
0
        void OnEnable()
        {
            var tokenAuth = new TokenAuthWidget();

            tokenAuth.AddView(rootVisualElement);
            rootVisualElement.Add(UiUtils.Separator());

            VisualElement loggedInUiContainer = null;

            ReactiveBinder.Bind(tokenAuth.reactiveUserInfo, userInfo =>
            {
                if (loggedInUiContainer != null)
                {
                    rootVisualElement.Remove(loggedInUiContainer);
                }

                if (userInfo.HasValue)
                {
                    loggedInUiContainer = CreateVenueUi(userInfo.Value);
                    rootVisualElement.Add(loggedInUiContainer);
                }
                else
                {
                    loggedInUiContainer = null;
                }
            });
        }
コード例 #2
0
ファイル: VenueUploadWindow.cs プロジェクト: AkimiM/stage_360
        void OnEnable()
        {
            var tokenAuth     = new TokenAuthWidget();
            var tokenAuthView = tokenAuth.CreateView(); // .Bindで作り直すとなぜかYogaNodeがStackoverflowするので使い回す

            rootVisualElement.Add(tokenAuthView);

            VisualElement venueUi = null;

            ReactiveBinder.Bind(tokenAuth.reactiveUserInfo, userInfo =>
            {
                if (venueUi != null)
                {
                    rootVisualElement.Remove(venueUi);
                    venueUi = null;
                }

                if (userInfo.HasValue)
                {
                    venueUi = CreateVenueUi(tokenAuth, userInfo.Value);
                    rootVisualElement.Add(venueUi);

                    tokenAuthView.style.display = DisplayStyle.None;
                }
                else
                {
                    tokenAuthView.style.display = DisplayStyle.Flex;
                }
            });
        }
コード例 #3
0
 void OnEnable()
 {
     tokenAuth = new TokenAuthWidget();
     rootVisualElement.Add(tokenAuth.CreateView());
     rootVisualElement.Add(UiUtils.Separator());
     rootVisualElement.Add(new IMGUIContainer(LegacyOnGUI));
 }
コード例 #4
0
ファイル: VenueUploadWindow.cs プロジェクト: AkimiM/stage_360
        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);
        }