Exemplo n.º 1
0
        protected override void InitUI(UIWidget layout)
        {
            UIListView listView = GetTarget <UIListView>();

            UIEnumFieldWidget movementType = new UIEnumFieldWidget("MovementType", listView.movementType);

            movementType.OnValueChanged = (Object value) =>
            {
                listView.movementType = (ScrollRect.MovementType)value;
                UpdateElasticity(layout, movementType);
            };
            layout.Add(movementType);
            UpdateElasticity(layout, movementType);

            ////////////////////////////////////////////////////////////
            UIBooleanFieldWidget inertia = new UIBooleanFieldWidget("Inertia", listView.inertia);

            inertia.OnValueChanged = (Object value) =>
            {
                listView.inertia = (bool)value;
                UpdateDecelerationRate(layout, inertia);
            };
            layout.Add(inertia);
            UpdateDecelerationRate(layout, inertia);

            ////////////////////////////////////////////////////////////
            UIFloatFieldWidget scrollSensitivity = new UIFloatFieldWidget("ScrollSensitivity", listView.scrollSensitivity);

            scrollSensitivity.OnValueChanged = (Object value) =>
            {
                listView.scrollSensitivity = (float)value;
            };
            layout.Add(scrollSensitivity);

            ////////////////////////////////////////////////////////////
            UIEnumFieldWidget direction = new UIEnumFieldWidget("Direction", listView.Direction);

            direction.OnValueChanged = (Object value) =>
            {
                listView.Direction = (ScrollDirection)value;
            };
            layout.Add(direction);

            GUIButton btn = new GUIButton();

            btn.Text           = "Format";
            btn.TriggerHandler = (Widget w) =>
            {
                listView.FormatScrollView();
            };
            layout.Add(btn);
        }