예제 #1
0
            internal TypeSelectCategory(TypeSelectControl parent, Tag categoryTag,
                                        string overrideName = null)
            {
                Control     = parent ?? throw new ArgumentNullException("parent");
                CategoryTag = categoryTag;
                string title = string.IsNullOrEmpty(overrideName) ? CategoryTag.ProperName() :
                               overrideName;
                var selectBox = new PCheckBox("SelectCategory")
                {
                    Text      = title, DynamicSize = true, OnChecked = OnCheck,
                    CheckSize = ROW_SIZE, InitialState = PCheckBox.STATE_CHECKED,
                    TextStyle = PUITuning.Fonts.TextDarkStyle
                };

                selectBox.OnRealize += (obj) => { CheckBox = obj; };
                Header = new PPanel("TypeSelectCategory")
                {
                    Direction = PanelDirection.Horizontal, Alignment = TextAnchor.MiddleLeft,
                    Spacing   = 5
                }.AddChild(new PToggle("ShowHide")
                {
                    OnStateChanged = OnToggle, Size = new Vector2(ROW_SIZE.x * 0.5f,
                                                                  ROW_SIZE.y * 0.5f), Color = PUITuning.Colors.ComponentLightStyle
                }).AddChild(selectBox).Build();
                children = new SortedList <Tag, TypeSelectElement>(16, TagAlphabetComparer.
                                                                   INSTANCE);
                ChildPanel = new PPanel("Children")
                {
                    Direction = PanelDirection.Vertical, Alignment = TextAnchor.UpperLeft,
                    Spacing   = ROW_SPACING, Margin = new RectOffset(INDENT, 0, 0, 0)
                }.Build();
                ChildPanel.transform.localScale = Vector3.zero;
            }
예제 #2
0
		protected override void OnPrefabInit() {
			var us = Traverse.Create(this);
			base.OnPrefabInit();
			Instance = this;
			interceptNumberKeysForPriority = true;
			populateHitsList = true;
			gameObject.AddComponent<FilteredClearHover>();
			// Get the cursor from the existing sweep tool
			var trSweep = Traverse.Create(ClearTool.Instance);
			cursor = trSweep.GetField<Texture2D>("cursor");
			us.SetField("boxCursor", cursor);
			// Get the area visualizer from the sweep tool
			var avTemplate = trSweep.GetField<GameObject>("areaVisualizer");
			if (avTemplate != null) {
				var areaVisualizer = Util.KInstantiate(avTemplate, gameObject,
					"FilteredClearToolAreaVisualizer");
				areaVisualizer.SetActive(false);
				areaVisualizerSpriteRenderer = areaVisualizer.GetComponent<SpriteRenderer>();
				// The visualizer is private so we need to set it with reflection
				us.SetField("areaVisualizer", areaVisualizer);
				us.SetField("areaVisualizerTextPrefab", trSweep.GetField<GameObject>(
					"areaVisualizerTextPrefab"));
			}
			visualizer = Util.KInstantiate(trSweep.GetField<GameObject>("visualizer"),
				gameObject, "FilteredClearToolSprite");
			visualizer.SetActive(false);
			TypeSelect = new TypeSelectControl();
		}
예제 #3
0
		protected override void OnCleanUp() {
			base.OnCleanUp();
			// Clean up everything needed
			if (TypeSelect != null) {
				Destroy(TypeSelect.RootPanel);
				TypeSelect = null;
			}
			DoneDrag();
		}
예제 #4
0
        protected override void OnPrefabInit()
        {
            base.OnPrefabInit();
            var inst = ClearTool.Instance;

            Instance = this;
            interceptNumberKeysForPriority = true;
            populateHitsList = true;
            // Get the cursor from the existing sweep tool
            if (inst != null)
            {
                gameObject.AddComponent <FilteredClearHover>();
                cursor = CURSOR.Get(inst);
                BOX_CURSOR.Set(this, cursor);
                // Get the area visualizer from the sweep tool
                var avTemplate = AREA_VISUALIZER.Get(inst);
                if (avTemplate != null)
                {
                    var areaVisualizer = Util.KInstantiate(avTemplate, gameObject,
                                                           "FilteredClearToolAreaVisualizer");
                    areaVisualizer.SetActive(false);
                    areaVisualizerSpriteRenderer = areaVisualizer.GetComponent <
                        SpriteRenderer>();
                    // The visualizer is private so we need to set it with reflection
                    AREA_VISUALIZER.Set(this, areaVisualizer);
                    AREA_VISUALIZER_TEXT_PREFAB.Set(this, AREA_VISUALIZER_TEXT_PREFAB.Get(
                                                        inst));
                }
                visualizer = Util.KInstantiate(VISUALIZER.Get(inst), gameObject,
                                               "FilteredClearToolSprite");
                visualizer.SetActive(false);
            }
            // Allow icons to be disabled
            TypeSelect = new TypeSelectControl(SweepByTypePatches.Options?.DisableIcons ??
                                               false);
        }
예제 #5
0
 internal FilteredClearTool()
 {
     cachedTypes = null;
     TypeSelect  = null;
 }
예제 #6
0
		public FilteredClearTool() {
			cachedTypes = null;
			TypeSelect = null;
		}