Exemple #1
0
        protected override void InitDrawer()
        {
            _Drawer.Init(_Adapters, true, false, false, false, false, false);
            _Drawer.galleryEffectSetting.slider.value = 0f;
            _Drawer.forceLowFPSSetting.gameObject.SetActive(false);
            _Drawer.galleryEffectSetting.gameObject.SetActive(false);
            _DepthPanel = _Drawer.AddLabelWithInputPanel("Max Depth");
            _DepthPanel.inputField.characterLimit  = 1;
            _DepthPanel.inputField.onValidateInput = (string text, int charIndex, char addedChar) =>
            {
                if (!char.IsDigit(addedChar) || addedChar == '9' || addedChar == '8')
                {
                    return('\0');
                }

                if (addedChar == '0')
                {
                    return('1');
                }

                return(addedChar);
            };
            _DepthPanel.inputField.text = "3";
            var bpanel = _Drawer.AddButtonsWithOptionalInputPanel("Collapse All", "ExpandAll");

            bpanel.button1.onClick.AddListener(_Adapters[0].CollapseAll);
            bpanel.button2.onClick.AddListener(_Adapters[0].ExpandAll);
        }
        protected override void InitDrawer()
        {
            _Drawer.Init(_Adapters, false, false, false, false, false, false);
            _Drawer.galleryEffectSetting.slider.value = 0f;
            _Drawer.galleryEffectSetting.gameObject.SetActive(false);
            //_Drawer.scrollToPanel.gameObject.SetActive(false); // scrollTo is not accurate for this kind of layout yet, because only scrolling to a group index is possible

            _NumCategoriesPanel = _Drawer.AddLabelWithInputPanel("Categories");
            _NumCategoriesPanel.transform.SetSiblingIndex(0);
            _NumCategoriesPanel.inputField.text           = "99";
            _NumCategoriesPanel.inputField.characterLimit = 2;             // 100 catgories max

            // We add a custom SetCount panel, disabling the previous one
            _Drawer.setCountPanel.gameObject.SetActive(false);
            var refreshItemsButtonPanel = _Drawer.AddButtonWithInputPanel("Set max items in category & update");

            refreshItemsButtonPanel.transform.SetSiblingIndex(1);
            refreshItemsButtonPanel.inputField.characterLimit = 5;             // max 99999 items in category
            refreshItemsButtonPanel.inputField.text           = "13";
            refreshItemsButtonPanel.button.onClick.AddListener(() => OnRegenerateModelsRequested(refreshItemsButtonPanel.InputFieldValueAsInt));

            //_RandomAspectRatiosTogglePanel = _Drawer.AddLabelWithTogglePanel("Random aspect ratios");
            //_RandomAspectRatiosTogglePanel.toggle.isOn = false;
            //_RandomAspectRatiosTogglePanel.transform.SetSiblingIndex(4);

            // Auto click the button refreshing the items
            refreshItemsButtonPanel.button.onClick.Invoke();
        }
Exemple #3
0
        /// <inheritdoc/>
        protected override void Start()
        {
            base.Start();

            DrawerCommandPanel.Instance.Init(this, false, false, true, true, false);
            DrawerCommandPanel.Instance.galleryEffectSetting.slider.value = 0f;
            DrawerCommandPanel.Instance.ItemCountChangeRequested         += UpdateCapacity;

            _FetchCountSetting = DrawerCommandPanel.Instance.AddLabelWithInputPanel("Max items to fetch:");
            _FetchCountSetting.inputField.text           = _Params.preFetchedItemsCount + "";
            _FetchCountSetting.inputField.keyboardType   = TouchScreenKeyboardType.NumberPad;
            _FetchCountSetting.inputField.characterLimit = 2;
            _FetchCountSetting.inputField.onEndEdit.AddListener(_ => _Params.preFetchedItemsCount = _FetchCountSetting.InputFieldValueAsInt);

            _RandomSizesForNewItemsSetting = DrawerCommandPanel.Instance.AddLabelWithTogglePanel("Random sizes for new items");
        }
        protected override void InitDrawer()
        {
            _Drawer.Init(_Adapters, false, false, true, true, false, false);
            _Drawer.galleryEffectSetting.slider.value = 0f;

            _Drawer.freezeContentEndEdgeToggle.onValueChanged.AddListener(OnFreezeContentEndEdgeToggleValueChanged);
            _Drawer.serverDelaySetting.inputField.onEndEdit.AddListener(_ => OnSimulatedServerDelayChanged());

            _FetchCountSetting = _Drawer.AddLabelWithInputPanel("Max items to fetch:");
            _FetchCountSetting.inputField.keyboardType   = TouchScreenKeyboardType.NumberPad;
            _FetchCountSetting.inputField.characterLimit = 2;
            _FetchCountSetting.inputField.text           = _Adapters[0].Parameters.preFetchedItemsCount + "";
            _FetchCountSetting.inputField.onEndEdit.AddListener(_ => _Adapters[0].Parameters.preFetchedItemsCount = _FetchCountSetting.InputFieldValueAsInt);

            _RandomSizesForNewItemsSetting = _Drawer.AddLabelWithTogglePanel("Random sizes for new items");
            _RandomSizesForNewItemsSetting.toggle.onValueChanged.AddListener(OnRandomSizesForNewItemsToggleValueChanged);
        }
Exemple #5
0
        public void Init(
            IOSA[] adapters,
            bool addGravityCommand           = true,
            bool addItemEdgeFreezeCommand    = true,
            bool addContentEdgeFreezeCommand = true,
            bool addServerDelaySetting       = true,
            bool addOneItemAddRemovePanel    = true,
            bool addInsertRemoveAtIndexPanel = true
            )
        {
            _Adapters = adapters;

            scrollToPanel.mainSubPanel.button.onClick.AddListener(RequestSmoothScrollToSpecified);
            setCountPanel.button.onClick.AddListener(RequestChangeItemCountToSpecifiedIgnoringServerDelay);

            if (addGravityCommand)
            {
                contentGravityPanel = AddLabelWithTogglesPanel("Gravity when content smaller than viewport", "Start", "Center", "End");
                contentGravityPanel.ToggleChanged += (toggleIdx, isOn) =>
                {
                    if (!isOn)
                    {
                        return;
                    }

                    DoForAllAdapters((adapter) =>
                    {
                        if (adapter.IsInitialized)
                        {
                            adapter.BaseParameters.Gravity = (BaseParams.ContentGravity)(toggleIdx + 1);
                            adapter.BaseParameters.UpdateContentPivotFromGravityType();
                            //adapter.SetVirtualAbstractNormalizedScrollPosition(1d, true); // scrollto start
                        }
                    });
                };
            }

            if (addItemEdgeFreezeCommand)
            {
                freezeItemEndEdgeToggle = AddLabelWithTogglePanel("Freeze item end edge when expanding/collapsing").toggle;
            }
            if (addContentEdgeFreezeCommand)
            {
                freezeContentEndEdgeToggle = AddLabelWithTogglePanel("Freeze content end edge on add/remove/resize").toggle;
            }

            if (addServerDelaySetting)
            {
                serverDelaySetting = AddLabelWithInputPanel("Server simulated delay:");
                serverDelaySetting.inputField.text           = 1 + "";       // 1 second, initially
                serverDelaySetting.inputField.keyboardType   = TouchScreenKeyboardType.NumberPad;
                serverDelaySetting.inputField.characterLimit = 1;
            }

            if (addOneItemAddRemovePanel)
            {
                addRemoveOnePanel = AddButtonsWithOptionalInputPanel("+1 tail", "+1 head", "-1 tail", "-1 head");
                addRemoveOnePanel.transform.SetSiblingIndex(1);
                addRemoveOnePanel.button1.onClick.AddListener(() => { AddItemWithChecks(true); });
                addRemoveOnePanel.button2.onClick.AddListener(() => { AddItemWithChecks(false); });
                addRemoveOnePanel.button3.onClick.AddListener(() => { RemoveItemWithChecks(true); });
                addRemoveOnePanel.button4.onClick.AddListener(() => { RemoveItemWithChecks(false); });
            }

            if (addInsertRemoveAtIndexPanel)
            {
                addRemoveOneAtIndexPanel = AddButtonsWithOptionalInputPanel("+1 at", "-1 at", "", "", "index");
                addRemoveOneAtIndexPanel.transform.SetSiblingIndex(1);
                addRemoveOneAtIndexPanel.button1.onClick.AddListener(() => AddItemWithChecks(addRemoveOneAtIndexPanel.InputFieldValueAsInt));
                addRemoveOneAtIndexPanel.button2.onClick.AddListener(() => RemoveItemWithChecks(addRemoveOneAtIndexPanel.InputFieldValueAsInt));
            }

            galleryEffectSetting = AddLabelWithSliderPanel("Gallery effect", "None", "Max");
            galleryEffectSetting.slider.onValueChanged.AddListener((v) =>
                                                                   DoForAllAdapters((adapter) =>
            {
                var gal = adapter.BaseParameters.effects.Gallery;
                //gal.OverallAmount = gal.Scale.Amount = gal.Rotation.Amount = v;
                gal.OverallAmount = v;
            })
                                                                   );
            galleryEffectSetting.Set(0f, 1f, .1f);

            // Simulate low end device toggle
            int vSyncCountBefore      = QualitySettings.vSyncCount;
            int targetFrameRateBefore = Application.targetFrameRate;

            forceLowFPSSetting = AddLabelWithTogglePanel("Force low FPS");
            forceLowFPSSetting.transform.SetAsLastSibling();
            forceLowFPSSetting.toggle.onValueChanged.AddListener(isOn =>
            {
                if (isOn)
                {
                    vSyncCountBefore      = QualitySettings.vSyncCount;
                    targetFrameRateBefore = Application.targetFrameRate;

                    QualitySettings.vSyncCount  = 0;                     // VSync must be disabled for Application.targetFrameRate to work
                    Application.targetFrameRate = TARGET_FRAMERATE_FOR_SIMULATING_SLOW_DEVICES;
                }
                else
                {
                    if (QualitySettings.vSyncCount == 0)                     // if it wasn't modified since the last time we modified it (i.e. if it was modified externally, don't override that value)
                    {
                        QualitySettings.vSyncCount = vSyncCountBefore;
                    }

                    if (Application.targetFrameRate == TARGET_FRAMERATE_FOR_SIMULATING_SLOW_DEVICES)                     // item comment as above
                    {
                        Application.targetFrameRate = targetFrameRateBefore;
                    }
                }
            });
        }