예제 #1
0
 private void AddSwitchButton()
 {
     SortButton.defaultButton.title.Text = "最新";
     SortButton.AddButton("播放");
     SortButton.AddButton("评论");
     SortButton.AddButton("弹幕");
 }
예제 #2
0
        private void SetSortButtonPresentation()
        {
            string sortField     = Fetch.QueryUrl("sortField");
            int    sortDirection = Fetch.QueryUrlAsIntegerOrDefault("sortDirection", 0);

            if (sortField.Length == 0)
            {
                apNameSorter.Activated = true;
                _activatedSorter       = apNameSorter;
                return;
            }

            SortButton[] sortButtons = { apNameSorter, updateTimeSorter };
            foreach (var button in sortButtons)
            {
                if (button.SortKey == sortField)
                {
                    button.Activated     = true;
                    button.SortDirection = (SortDirection)sortDirection;
                    _activatedSorter     = button;
                    continue;
                }
                button.Activated = false;
            }
        }
예제 #3
0
    public void Initialize()
    {
        //GUIManagerから参照をもらう
        GameObject camera = GameObject.Find("Main Camera").gameObject;

        pm = camera.GetComponent <PhotoManager>();
        GUIManager gm = camera.GetComponent <GUIManager>();

        xAxisBar = gm.xAxisBar;
        yAxisBar = gm.yAxisBar;
        zAxisBar = gm.zAxisBar;
        buttonX  = gm.buttonX.GetComponent <SortButton>();
        buttonY  = gm.buttonY.GetComponent <SortButton>();
        buttonZ  = gm.buttonZ.GetComponent <SortButton>();
        if (zAxisBar != null)
        {
            zSlider = gm.zSlider.GetComponent <Slider>();
        }
        if (xAxisBar != null) // Sort Slider
        {
            xSliderMin = gm.xSliderMin.GetComponent <Slider>();
            xSliderMax = gm.xSliderMax.GetComponent <Slider>();
        }
        if (yAxisBar != null)
        {
            ySliderMin = gm.ySliderMin.GetComponent <Slider>();
            ySliderMax = gm.ySliderMax.GetComponent <Slider>();
        }
    }
예제 #4
0
    // Use this for initialization
    public void Initialize()
    {
        //GUIManagerから参照をもらう
        GUIManager gm = GameObject.Find("Main Camera").gameObject.GetComponent <GUIManager>();

        buttonS        = gm.buttonS.GetComponent <SortButton>();
        sBar           = gm.sAxisBar;
        colliderToggle = gm.colliderToggle;
        sSlider        = gm.sSlider;
    }
        protected void SetupWidgetBar()
        {
            pm_button   = new PartyModeButton();
            fs_button   = new FullscreenButton();
            sort_button = new SortButton();

            widget_bar = new ClutterWidgetBar(new Actor[] { pm_button, fs_button, sort_button });
            widget_bar.ShowAll();
            Stage.Add(widget_bar);
            widget_bar.SetPosition(5, 5);
        }
        void Sort(SortButton sender, PlayerComparer comparer)
        {
            if (ActiveSortButton == null)
            {
                ActiveSortButton = sender;
            }
            else if (ActiveSortButton != sender)
            {
                ActiveSortButton.ResetSortRequest();
                ActiveSortButton = sender;
            }

            VMGameDetails.Sort(comparer);
        }
예제 #7
0
 private void RectifyFocus()
 {
     if (_isViewPreferencesOpen && _previousFocus != "DisplayPreferencesButton")
     {
         DisplayPreferencesButton.Focus();
     }
     else if (_isSortPreferencesOpen && _previousFocus != "SortButton")
     {
         SortButton.Focus();
     }
     else
     {
         CloseViewGrid(DisplayPreferencesButton);
         CloseSortGrid(SortButton);
     }
 }
예제 #8
0
 public void Initiarize()
 {
     pm       = GameObject.Find("Main Camera").GetComponent <PhotoManager>();
     xAxisBar = GameObject.Find("XAxisBar");
     yAxisBar = GameObject.Find("YAxisBar");
     zAxisBar = GameObject.Find("ZAxisBar");
     sAxisBar = GameObject.Find("SAxisBar");
     buttonX  = GameObject.Find("Xbutton").transform.Find("Button").gameObject.GetComponent <SortButton>();
     buttonY  = GameObject.Find("Ybutton").transform.Find("Button").gameObject.GetComponent <SortButton>();
     buttonZ  = GameObject.Find("Zbutton").transform.Find("Button").gameObject.GetComponent <SortButton>();
     buttonS  = GameObject.Find("Sbutton").transform.Find("Button").gameObject.GetComponent <SortButton>();
     if (zAxisBar != null)
     {
         zSlider = zAxisBar.transform.Find("ZSlider").gameObject.GetComponent <Slider>();
     }
     colliderToggle = GameObject.Find("ColliderToggle");
 }
예제 #9
0
        // Make sure focusing is restricted when pop out menu is activated and call the correct animations
        private void Button_IsKeyboardFocusedChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var listItem = sender as FrameworkElement;

            if (listItem == null)
            {
                return;
            }
            var name = listItem.Name;

            if ((bool)e.NewValue)
            {
                if (name == "DisplayPreferencesButton")
                {
                    if (_isSortPreferencesOpen && _previousFocus != "SortButton")
                    {
                        SortButton.Focus();
                    }
                    else
                    {
                        if (!_isViewPreferencesOpen)
                        {
                            CloseSortGrid(SortButton);
                            OpenViewGrid(DisplayPreferencesButton);
                        }
                    }
                }
                else if (name == "SortButton")
                {
                    if (_isViewPreferencesOpen && _previousFocus != "DisplayPreferencesButton")
                    {
                        DisplayPreferencesButton.Focus();
                    }
                    else
                    {
                        if (!_isSortPreferencesOpen)
                        {
                            CloseViewGrid(DisplayPreferencesButton);
                            OpenSortGrid(SortButton);
                        }
                    }
                }
                else if (name == "BtnClose")
                {
                    RectifyFocus();
                }
                else if (name == "HomeButton")
                {
                    RectifyFocus();
                }
                else if (name == "LogoutButton")
                {
                    RectifyFocus();
                }
                else if (name == "SettingsButton")
                {
                    RectifyFocus();
                }
                else if (Name == "ShutdownAppButton")
                {
                    RectifyFocus();
                }
                else if (name == "SleepButton")
                {
                    RectifyFocus();
                }
                else if (name == "RestartButton")
                {
                    RectifyFocus();
                }
                else if (name == "ShutdownButton")
                {
                    RectifyFocus();
                }
            }
            else if (!(bool)e.NewValue)
            {
                _previousFocus = name;
            }
        }
예제 #10
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (Grid != null)
                {
                    if (!Grid.IsDisposed)
                    {
                        Grid.Dispose();
                    }

                    Grid = null;
                }


                if (TitleLabel != null)
                {
                    if (!TitleLabel.IsDisposed)
                    {
                        TitleLabel.Dispose();
                    }

                    TitleLabel = null;
                }

                if (GoldLabel != null)
                {
                    if (!GoldLabel.IsDisposed)
                    {
                        GoldLabel.Dispose();
                    }

                    GoldLabel = null;
                }

                if (GameGoldLabel != null)
                {
                    if (!GameGoldLabel.IsDisposed)
                    {
                        GameGoldLabel.Dispose();
                    }

                    GameGoldLabel = null;
                }

                if (WeightLabel != null)
                {
                    if (!WeightLabel.IsDisposed)
                    {
                        WeightLabel.Dispose();
                    }

                    WeightLabel = null;
                }

                if (CurrencyLabel != null)
                {
                    if (!CurrencyLabel.IsDisposed)
                    {
                        CurrencyLabel.Dispose();
                    }

                    CurrencyLabel = null;
                }

                if (CloseButton != null)
                {
                    if (!CloseButton.IsDisposed)
                    {
                        CloseButton.Dispose();
                    }

                    CloseButton = null;
                }

                if (SortButton != null)
                {
                    if (!SortButton.IsDisposed)
                    {
                        SortButton.Dispose();
                    }

                    SortButton = null;
                }

                if (TrashButton != null)
                {
                    if (!TrashButton.IsDisposed)
                    {
                        TrashButton.Dispose();
                    }

                    TrashButton = null;
                }

                if (GoldTitle != null)
                {
                    if (!GoldTitle.IsDisposed)
                    {
                        GoldTitle.Dispose();
                    }

                    GameGoldTitle = null;
                }

                if (GameGoldTitle != null)
                {
                    if (!GameGoldTitle.IsDisposed)
                    {
                        GameGoldTitle.Dispose();
                    }

                    GameGoldTitle = null;
                }
            }
        }
예제 #11
0
        protected View CreateHeader()
        {
            var type = GetListItemType();

            if (type == null)
            {
                _header.BackgroundColor = headerBackgroundColor;
                return(_header);
            }

            var attrib = type.GetAttribute <AutoFormsListUIAttribute>();

            _header = new Grid
            {
                ColumnSpacing     = attrib.ColumnSpacing,
                RowSpacing        = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                RowDefinitions    = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };
            Grid.SetRow(_header, 1);

            _header.Padding = new Thickness(attrib.ListItemPaddingLeft, attrib.ListHeaderPaddingTop, attrib.ListItemPaddingRight, attrib.ListHeaderPaddingBottom);

            var headerStyle = attrib?.ColumnHeaderGridStyle ?? null;

            if (string.IsNullOrEmpty(headerStyle) == false &&
                Application.Current.Resources.TryGetValue(headerStyle, out object headerObj))
            {
                _header.Style = (Style)headerObj;
            }
            else
            {
                _header.BackgroundColor = headerBackgroundColor;
            }

            var props = AttributeHelper.GetPropertyAttributes <AutoFormsListItemAttribute>(type);

            var   style           = LabelStyle;
            Style sortButtonStyle = null;

            var headerLabelStyle      = attrib?.ColumnHeaderLabelStyle ?? null;
            var headerSortButtonStyle = attrib?.ColumnHeaderSortButtonStyle ?? null;

            if (string.IsNullOrEmpty(headerLabelStyle) == false &&
                Application.Current.Resources.TryGetValue(headerLabelStyle, out object obj))
            {
                style = (Style)obj;
            }

            if (string.IsNullOrEmpty(headerSortButtonStyle) == false &&
                Application.Current.Resources.TryGetValue(headerSortButtonStyle, out object sortButtonStyleObj))
            {
                sortButtonStyle = (Style)sortButtonStyleObj;
            }

            string sortedStateProperty = null;

            if (_config.Attribute is AutoFormsListAttribute listAttribute)
            {
                sortedStateProperty = listAttribute.SortedStateProperty;
            }

            foreach (var p in props)
            {
                var property  = p.Item1;
                var attribute = GetFilteredAttribute(Filter, p.Item2);

                if (property == null || attribute == null)
                {
                    continue;
                }

                _header.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(attribute.Value, attribute.GridType)
                });

                View view;
                if (attribute.SortValue != null && !string.IsNullOrWhiteSpace(sortedStateProperty))
                {
                    view = new SortButton
                    {
                        Text              = attribute.Label,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.StartAndExpand,
                        SortValue         = attribute.SortValue
                    };
                    if (sortButtonStyle != null)
                    {
                        view.Style = sortButtonStyle;
                    }
                    view.SetBinding(SortButton.SortedStateProperty, sortedStateProperty);
                }
                else
                {
                    view = new Label
                    {
                        Style                   = style,
                        Text                    = attribute.Label,
                        VerticalOptions         = LayoutOptions.CenterAndExpand,
                        VerticalTextAlignment   = TextAlignment.Start,
                        HorizontalOptions       = LayoutOptions.StartAndExpand,
                        HorizontalTextAlignment = attribute.HorizontalHeaderAlignment,
                        LineBreakMode           = LineBreakMode.TailTruncation,
                    };
                }

                //view.BackgroundColor = Color.Green;

                Grid.SetColumn(view, _header.ColumnDefinitions.Count - 1);
                _header.Children.Add(view);
            }

            if (HasActions)
            {
                _header.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(ActionButtonWidth, GridUnitType.Absolute)
                });
            }

            _header.DebugGrid(Color.Transparent);

            return(_header);
        }