Exemplo n.º 1
0
        private void InitializeSearchBox()
        {
            if (_searchBox != null)
            {
                return;
            }

            _searchBox             = new TextBox();
            _searchBox.Location    = new Point(0, 0);
            _searchBox.Size        = new Size(70, _searchBox.Height);
            _searchBox.BorderStyle = BorderStyle.Fixed3D;
            _searchBox.Font        = new Font("Tahoma", 8.25f);

            _searchBoxBackColor = _searchBox.BackColor;

            _searchBox.TextChanged += (s, _) => ApplyFilter();

            // Hack: let's remove the read-only flag on the toolstrip controls collection
            var rofield = new FieldAccessor(ToolStrip.Controls, "_isReadOnly");

            rofield.Set(false);
            ToolStrip.Controls.Add(_searchBox);
            rofield.Set(true);

            ToolStrip.SizeChanged += (s, _) => FixSearchBoxLocation();

            FixSearchBoxLocation();

            // And now initialize accessors
            InitializeAccessors();

            PropertyTabChanged     += (s, _) => _searchBox.Text = string.Empty;
            PropertySortChanged    += (s, _) => _searchBox.Text = string.Empty;
            SelectedObjectsChanged += (s, _) => _searchBox.Text = string.Empty;
        }
Exemplo n.º 2
0
 private void Parse(Transform parentTransform)
 {
     if (!parsed)
     {
         BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "PauseChamp.UI.Views.SettingsModal.bsml"), parentTransform.gameObject, this);
         modalPosition = modalTransform.position;
         parsed        = true;
     }
     modalTransform.position = modalPosition;
     FieldAccessor <ModalView, bool> .Set(ref modalView, "_animateParentCanvas", true);
 }
        private void SetGridViewItems(GridItem[] newItems)
        {
            var items = allGridEntriesAccessor.Get();

            if (items == null)
            {
                return;
            }

            if (newItems == null)
            {
                newItems = new GridItem[0];
            }

            var wasFocused = searchBox.Focused;

            if (gridViewEntriesAccessor == null)
            {
                gridViewEntriesAccessor = new FieldAccessor(items, "entries");
            }

            setScrollOffsetAccessor.Invoke(reflectedGridView, 0);

            gridViewEntriesAccessor.Set(newItems, items);
            gridViewEntriesAccessor.Set(newItems, topLevelGridEntriesAccessor.Get());

            totalPropsAccessor.Set(newItems.Length);
            selectedRowAccessor.Set(0);

            if (newItems.Length > 0)
            {
                selectedGridEntryAccessor.Set(newItems[0]);
            }

            ((Control)reflectedGridView).Invalidate();

            if (wasFocused)
            {
                searchBox.Focus();
            }
        }
Exemplo n.º 4
0
        private void SetGridViewItems(GridItem[] newItems)
        {
            object items = _allGridEntriesAccessor.Get();

            if (items == null)
            {
                return;
            }

            if (newItems == null)
            {
                newItems = new GridItem[0];
            }

            bool wasFocused = _searchBox.Focused;

            if (_gridViewEntriesAccessor == null)
            {
                _gridViewEntriesAccessor = new FieldAccessor(items, "entries");
            }

            _setScrollOffsetAccessor.Invoke(_reflectedGridView, 0);

            _gridViewEntriesAccessor.Set(newItems, items);
            _gridViewEntriesAccessor.Set(newItems, _topLevelGridEntriesAccessor.Get());

            _totalPropsAccessor.Set(newItems.Length);
            _selectedRowAccessor.Set(0);

            if (newItems.Length > 0)
            {
                _selectedGridEntryAccessor.Set(newItems[0]);
            }

            ((Control)_reflectedGridView).Invalidate();

            if (wasFocused)
            {
                _searchBox.Focus();
            }
        }
 private void Parse(RectTransform parent)
 {
     if (!parsed)
     {
         BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "ControllerTweaks.UI.Views.ControllerOffsetSettingsModal.bsml"), parent.gameObject, this);
         modalPosition = modalTransform.localPosition;
         parsed        = true;
     }
     modalTransform.SetParent(parent);
     modalTransform.localPosition = modalPosition;
     FieldAccessor <ModalView, bool> .Set(ref modalView, "_animateParentCanvas", true);
 }
        public static void Judge(FlyingScoreEffect scoreEffect, int score, int before, int after, int accuracy)
        {
            var instance = ConfigProvider.CurrentConfig;

            if (instance == null)
            {
                return;
            }

            // as of 0.13, the TextMeshPro is private; use reflection to grab it out of a private field
            var text = FlyingScoreEffectText(ref scoreEffect);

            // enable rich text
            text.richText = true;
            // disable word wrap, make sure full text displays
            text.enableWordWrapping = false;
            text.overflowMode       = TextOverflowModes.Overflow;

            // save in case we need to fade
            var index    = instance.Judgments !.FindIndex(j => j.Threshold <= score);
            var judgment = index >= 0 ? instance.Judgments[index] : Judgment.Default;

            Color color;

            if (judgment.Fade)
            {
                var fadeJudgment = instance.Judgments[index - 1];
                var baseColor    = judgment.Color.ToColor();
                var fadeColor    = fadeJudgment.Color.ToColor();
                var lerpDistance = Mathf.InverseLerp(judgment.Threshold, fadeJudgment.Threshold, score);
                color = Color.Lerp(baseColor, fadeColor, lerpDistance);
            }
            else
            {
                color = judgment.Color.ToColor();
            }

            FieldAccessor <FlyingScoreEffect, Color> .Set(scoreEffect, "_color", color);

            scoreEffect.SetField("_color", color);

            text.text = instance.DisplayMode switch
            {
                "format" => DisplayModeFormat(score, before, after, accuracy, judgment, instance),
                "textOnly" => judgment.Text,
                "numeric" => score.ToString(),
                "scoreOnTop" => $"{score}\n{judgment.Text}\n",
                _ => $"{judgment.Text}\n{score}\n"
            };
        }
Exemplo n.º 7
0
        private void Parse(Transform parent)
        {
            if (!parsed)
            {
                BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "NiceMiss.UI.hitscoreModal.bsml"), parent.gameObject, this);

                parsed             = true;
                hitscoreColorModal = hitscoreColorSetting.transform.Find("BSMLModalColorPicker").GetComponent <ModalView>();

                SliderButton.Register(GameObject.Instantiate(leftButton), GameObject.Instantiate(rightButton), minSlider, 1);
                SliderButton.Register(GameObject.Instantiate(leftButton), GameObject.Instantiate(rightButton), maxSlider, 1);
                GameObject.Destroy(leftButton.gameObject);
                GameObject.Destroy(rightButton.gameObject);
            }
            FieldAccessor <ModalView, bool> .Set(ref hitscoreColorModal, "_animateParentCanvas", false);

            FieldAccessor <ModalView, bool> .Set(ref modalView, "_animateParentCanvas", true);
        }
Exemplo n.º 8
0
        public static void SetNoteColour(ColorNoteVisuals noteVis, Color c)
        {
            FieldAccessor <ColorNoteVisuals, Color> .Set(ref noteVis, "_noteColor", c);

            SpriteRenderer ____arrowGlowSpriteRenderer = FieldAccessor <ColorNoteVisuals, SpriteRenderer> .Get(ref noteVis, "_arrowGlowSpriteRenderer");

            SpriteRenderer ____circleGlowSpriteRenderer = FieldAccessor <ColorNoteVisuals, SpriteRenderer> .Get(ref noteVis, "_circleGlowSpriteRenderer");

            MaterialPropertyBlockController[] ____materialPropertyBlockController = FieldAccessor <ColorNoteVisuals, MaterialPropertyBlockController[]> .Get(ref noteVis, "_materialPropertyBlockControllers");

            if (____arrowGlowSpriteRenderer != null)
            {
                ____arrowGlowSpriteRenderer.color = c;
            }
            if (____circleGlowSpriteRenderer != null)
            {
                ____circleGlowSpriteRenderer.color = c;
            }
            foreach (var block in ____materialPropertyBlockController)
            {
                block.materialPropertyBlock.SetColor(colorID, c);
                block.ApplyChanges();
            }
        }
        public PerfTests.Classes.AzureEntityFramework.Address Deserialize()
        {
            // Result object
            PerfTests.Classes.AzureEntityFramework.Address result = new PerfTests.Classes.AzureEntityFramework.Address();

            // Do we have to load full data (when it's not null or cached object)?
            if (!ShouldLoadFullData(ref result))
            {
                return(result);
            }

            // <StreetName>k__BackingField - WKT Deserialization
            String _StreetName_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_StreetName_k__BackingField.Set(result, _StreetName_k__BackingFieldValue);

            // <Building>k__BackingField - WKT Deserialization
            String _Building_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Building_k__BackingField.Set(result, _Building_k__BackingFieldValue);

            // <City>k__BackingField - WKT Deserialization
            String _City_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_City_k__BackingField.Set(result, _City_k__BackingFieldValue);

            // <PostCode>k__BackingField - WKT Deserialization
            String _PostCode_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_PostCode_k__BackingField.Set(result, _PostCode_k__BackingFieldValue);

            // <Country>k__BackingField - WKT Deserialization
            String _Country_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Country_k__BackingField.Set(result, _Country_k__BackingFieldValue);

            // <ExternalId1>k__BackingField - WKT Deserialization
            Guid _ExternalId1_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId1_k__BackingField.Set(result, _ExternalId1_k__BackingFieldValue);

            // <ExternalId2>k__BackingField - WKT Deserialization
            Guid _ExternalId2_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId2_k__BackingField.Set(result, _ExternalId2_k__BackingFieldValue);

            // <ExternalId3>k__BackingField - WKT Deserialization
            Guid _ExternalId3_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId3_k__BackingField.Set(result, _ExternalId3_k__BackingFieldValue);

            // <ExternalId4>k__BackingField - WKT Deserialization
            Guid _ExternalId4_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId4_k__BackingField.Set(result, _ExternalId4_k__BackingFieldValue);

            // <ExternalId5>k__BackingField - WKT Deserialization
            Guid _ExternalId5_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId5_k__BackingField.Set(result, _ExternalId5_k__BackingFieldValue);

            // Update cache when necessary
            UpdateRefObjectsCache(result);

            // Return result
            return(result);
        }
        public PerfTests.Classes.AzureEntityFramework.Person Deserialize()
        {
            // Result object
            PerfTests.Classes.AzureEntityFramework.Person result = new PerfTests.Classes.AzureEntityFramework.Person();

            // Do we have to load full data (when it's not null or cached object)?
            if (!ShouldLoadFullData(ref result))
            {
                return(result);
            }

            // <PersonID>k__BackingField - WKT Deserialization
            Guid _PersonID_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_PersonID_k__BackingField.Set(result, _PersonID_k__BackingFieldValue);

            // <FirstName>k__BackingField - WKT Deserialization
            String _FirstName_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_FirstName_k__BackingField.Set(result, _FirstName_k__BackingFieldValue);

            // <LastName>k__BackingField - WKT Deserialization
            String _LastName_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_LastName_k__BackingField.Set(result, _LastName_k__BackingFieldValue);

            // <BirthDate>k__BackingField - WKT Deserialization
            DateTime _BirthDate_k__BackingFieldValue = WKTSerializers.DateTime.Deserialize();

            s_Accessor4_BirthDate_k__BackingField.Set(result, _BirthDate_k__BackingFieldValue);

            // <ExternalId1>k__BackingField - WKT Deserialization
            Guid _ExternalId1_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId1_k__BackingField.Set(result, _ExternalId1_k__BackingFieldValue);

            // <ExternalId2>k__BackingField - WKT Deserialization
            Guid _ExternalId2_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId2_k__BackingField.Set(result, _ExternalId2_k__BackingFieldValue);

            // <ExternalId3>k__BackingField - WKT Deserialization
            Guid _ExternalId3_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId3_k__BackingField.Set(result, _ExternalId3_k__BackingFieldValue);

            // <ExternalId4>k__BackingField - WKT Deserialization
            Guid _ExternalId4_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId4_k__BackingField.Set(result, _ExternalId4_k__BackingFieldValue);

            // <ExternalId5>k__BackingField - WKT Deserialization
            Guid _ExternalId5_k__BackingFieldValue = WKTSerializers.Guid.Deserialize();

            s_Accessor4_ExternalId5_k__BackingField.Set(result, _ExternalId5_k__BackingFieldValue);

            // <Sallary1>k__BackingField - WKT Deserialization
            Decimal _Sallary1_k__BackingFieldValue = WKTSerializers.Decimal.Deserialize();

            s_Accessor4_Sallary1_k__BackingField.Set(result, _Sallary1_k__BackingFieldValue);

            // <Sallary2>k__BackingField - WKT Deserialization
            Decimal _Sallary2_k__BackingFieldValue = WKTSerializers.Decimal.Deserialize();

            s_Accessor4_Sallary2_k__BackingField.Set(result, _Sallary2_k__BackingFieldValue);

            // <Sallary3>k__BackingField - WKT Deserialization
            Decimal _Sallary3_k__BackingFieldValue = WKTSerializers.Decimal.Deserialize();

            s_Accessor4_Sallary3_k__BackingField.Set(result, _Sallary3_k__BackingFieldValue);

            // <Sallary4>k__BackingField - WKT Deserialization
            Decimal _Sallary4_k__BackingFieldValue = WKTSerializers.Decimal.Deserialize();

            s_Accessor4_Sallary4_k__BackingField.Set(result, _Sallary4_k__BackingFieldValue);

            // <Sallary5>k__BackingField - WKT Deserialization
            Decimal _Sallary5_k__BackingFieldValue = WKTSerializers.Decimal.Deserialize();

            s_Accessor4_Sallary5_k__BackingField.Set(result, _Sallary5_k__BackingFieldValue);

            // <Result1>k__BackingField - WKT Deserialization
            Double _Result1_k__BackingFieldValue = WKTSerializers.Double.Deserialize();

            s_Accessor4_Result1_k__BackingField.Set(result, _Result1_k__BackingFieldValue);

            // <Result2>k__BackingField - WKT Deserialization
            Double _Result2_k__BackingFieldValue = WKTSerializers.Double.Deserialize();

            s_Accessor4_Result2_k__BackingField.Set(result, _Result2_k__BackingFieldValue);

            // <Result3>k__BackingField - WKT Deserialization
            Double _Result3_k__BackingFieldValue = WKTSerializers.Double.Deserialize();

            s_Accessor4_Result3_k__BackingField.Set(result, _Result3_k__BackingFieldValue);

            // <Result4>k__BackingField - WKT Deserialization
            Double _Result4_k__BackingFieldValue = WKTSerializers.Double.Deserialize();

            s_Accessor4_Result4_k__BackingField.Set(result, _Result4_k__BackingFieldValue);

            // <Result5>k__BackingField - WKT Deserialization
            Double _Result5_k__BackingFieldValue = WKTSerializers.Double.Deserialize();

            s_Accessor4_Result5_k__BackingField.Set(result, _Result5_k__BackingFieldValue);

            // <Skill1>k__BackingField - WKT Deserialization
            String _Skill1_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Skill1_k__BackingField.Set(result, _Skill1_k__BackingFieldValue);

            // <Skill2>k__BackingField - WKT Deserialization
            String _Skill2_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Skill2_k__BackingField.Set(result, _Skill2_k__BackingFieldValue);

            // <Skill3>k__BackingField - WKT Deserialization
            String _Skill3_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Skill3_k__BackingField.Set(result, _Skill3_k__BackingFieldValue);

            // <Skill4>k__BackingField - WKT Deserialization
            String _Skill4_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Skill4_k__BackingField.Set(result, _Skill4_k__BackingFieldValue);

            // <Skill5>k__BackingField - WKT Deserialization
            String _Skill5_k__BackingFieldValue = WKTSerializers.String.Deserialize();

            s_Accessor4_Skill5_k__BackingField.Set(result, _Skill5_k__BackingFieldValue);

            // <KnownAddresses>k__BackingField - the array of normal elements - element type is PerfTests.Classes.AzureEntityFramework.Address
            PerfTests.Classes.AzureEntityFramework.Address[] _KnownAddresses_k__BackingFieldValue = new SZRefArraySerializer <PerfTests.Classes.AzureEntityFramework.Address>(SerializerStorage,
                                                                                                                                                                              elem => { new PerfTests_Classes_AzureEntityFramework_AddressSerializer(SerializerStorage, ObjectCache, ValObjectsCache).Serialize(elem); },
                                                                                                                                                                              () => new PerfTests_Classes_AzureEntityFramework_AddressSerializer(SerializerStorage, ObjectCache, ValObjectsCache).Deserialize()
                                                                                                                                                                              ).Deserialize();
            s_Accessor4_KnownAddresses_k__BackingField.Set(result, _KnownAddresses_k__BackingFieldValue);

            // Update cache when necessary
            UpdateRefObjectsCache(result);

            // Return result
            return(result);
        }