private static void onClickedRemoveTableButton(SleekButton button) { if ((int)EditorSpawns.selectedAnimal < LevelAnimals.tables.Count) { LevelAnimals.removeTable(); EditorSpawnsAnimalsUI.updateTables(); EditorSpawnsAnimalsUI.updateSelection(); EditorSpawnsAnimalsUI.tableScrollBox.state = new Vector2(0f, float.MaxValue); } }
private static void onClickedAddTableButton(SleekButton button) { if (EditorSpawnsAnimalsUI.tableNameField.text != string.Empty) { LevelAnimals.addTable(EditorSpawnsAnimalsUI.tableNameField.text); EditorSpawnsAnimalsUI.tableNameField.text = string.Empty; EditorSpawnsAnimalsUI.updateTables(); EditorSpawnsAnimalsUI.tableScrollBox.state = new Vector2(0f, float.MaxValue); } }
public EditorSpawnsAnimalsUI() { Local local = Localization.read("/Editor/EditorSpawnsAnimals.dat"); Bundle bundle = Bundles.getBundle("/Bundles/Textures/Edit/Icons/EditorSpawnsAnimals/EditorSpawnsAnimals.unity3d"); EditorSpawnsAnimalsUI.container = new Sleek(); EditorSpawnsAnimalsUI.container.positionOffset_X = 10; EditorSpawnsAnimalsUI.container.positionOffset_Y = 10; EditorSpawnsAnimalsUI.container.positionScale_X = 1f; EditorSpawnsAnimalsUI.container.sizeOffset_X = -20; EditorSpawnsAnimalsUI.container.sizeOffset_Y = -20; EditorSpawnsAnimalsUI.container.sizeScale_X = 1f; EditorSpawnsAnimalsUI.container.sizeScale_Y = 1f; EditorUI.window.add(EditorSpawnsAnimalsUI.container); EditorSpawnsAnimalsUI.active = false; EditorSpawnsAnimalsUI.tableScrollBox = new SleekScrollBox(); EditorSpawnsAnimalsUI.tableScrollBox.positionOffset_X = -470; EditorSpawnsAnimalsUI.tableScrollBox.positionOffset_Y = 120; EditorSpawnsAnimalsUI.tableScrollBox.positionScale_X = 1f; EditorSpawnsAnimalsUI.tableScrollBox.sizeOffset_X = 470; EditorSpawnsAnimalsUI.tableScrollBox.sizeOffset_Y = 200; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.tableScrollBox); EditorSpawnsAnimalsUI.tableNameField = new SleekField(); EditorSpawnsAnimalsUI.tableNameField.positionOffset_X = -230; EditorSpawnsAnimalsUI.tableNameField.positionOffset_Y = 330; EditorSpawnsAnimalsUI.tableNameField.positionScale_X = 1f; EditorSpawnsAnimalsUI.tableNameField.sizeOffset_X = 230; EditorSpawnsAnimalsUI.tableNameField.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.tableNameField.maxLength = 64; EditorSpawnsAnimalsUI.tableNameField.addLabel(local.format("TableNameFieldLabelText"), ESleekSide.LEFT); SleekField sleekField = EditorSpawnsAnimalsUI.tableNameField; Delegate onTyped = sleekField.onTyped; if (EditorSpawnsAnimalsUI.< > f__mg$cache4 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache4 = new Typed(EditorSpawnsAnimalsUI.onTypedNameField); } sleekField.onTyped = (Typed)Delegate.Combine(onTyped, EditorSpawnsAnimalsUI.< > f__mg$cache4); EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.tableNameField); EditorSpawnsAnimalsUI.addTableButton = new SleekButtonIcon((Texture2D)bundle.load("Add")); EditorSpawnsAnimalsUI.addTableButton.positionOffset_X = -230; EditorSpawnsAnimalsUI.addTableButton.positionOffset_Y = 370; EditorSpawnsAnimalsUI.addTableButton.positionScale_X = 1f; EditorSpawnsAnimalsUI.addTableButton.sizeOffset_X = 110; EditorSpawnsAnimalsUI.addTableButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.addTableButton.text = local.format("AddTableButtonText"); EditorSpawnsAnimalsUI.addTableButton.tooltip = local.format("AddTableButtonTooltip"); SleekButton sleekButton = EditorSpawnsAnimalsUI.addTableButton; if (EditorSpawnsAnimalsUI.< > f__mg$cache5 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache5 = new ClickedButton(EditorSpawnsAnimalsUI.onClickedAddTableButton); } sleekButton.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cache5; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.addTableButton); EditorSpawnsAnimalsUI.removeTableButton = new SleekButtonIcon((Texture2D)bundle.load("Remove")); EditorSpawnsAnimalsUI.removeTableButton.positionOffset_X = -110; EditorSpawnsAnimalsUI.removeTableButton.positionOffset_Y = 370; EditorSpawnsAnimalsUI.removeTableButton.positionScale_X = 1f; EditorSpawnsAnimalsUI.removeTableButton.sizeOffset_X = 110; EditorSpawnsAnimalsUI.removeTableButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.removeTableButton.text = local.format("RemoveTableButtonText"); EditorSpawnsAnimalsUI.removeTableButton.tooltip = local.format("RemoveTableButtonTooltip"); SleekButton sleekButton2 = EditorSpawnsAnimalsUI.removeTableButton; if (EditorSpawnsAnimalsUI.< > f__mg$cache6 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache6 = new ClickedButton(EditorSpawnsAnimalsUI.onClickedRemoveTableButton); } sleekButton2.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cache6; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.removeTableButton); EditorSpawnsAnimalsUI.updateTables(); EditorSpawnsAnimalsUI.spawnsScrollBox = new SleekScrollBox(); EditorSpawnsAnimalsUI.spawnsScrollBox.positionOffset_X = -470; EditorSpawnsAnimalsUI.spawnsScrollBox.positionOffset_Y = 410; EditorSpawnsAnimalsUI.spawnsScrollBox.positionScale_X = 1f; EditorSpawnsAnimalsUI.spawnsScrollBox.sizeOffset_X = 470; EditorSpawnsAnimalsUI.spawnsScrollBox.sizeOffset_Y = -410; EditorSpawnsAnimalsUI.spawnsScrollBox.sizeScale_Y = 1f; EditorSpawnsAnimalsUI.spawnsScrollBox.area = new Rect(0f, 0f, 5f, 1000f); EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.spawnsScrollBox); EditorSpawnsAnimalsUI.tableColorPicker = new SleekColorPicker(); EditorSpawnsAnimalsUI.tableColorPicker.positionOffset_X = 200; SleekColorPicker sleekColorPicker = EditorSpawnsAnimalsUI.tableColorPicker; if (EditorSpawnsAnimalsUI.< > f__mg$cache7 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache7 = new ColorPicked(EditorSpawnsAnimalsUI.onAnimalColorPicked); } sleekColorPicker.onColorPicked = EditorSpawnsAnimalsUI.< > f__mg$cache7; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.tableColorPicker); EditorSpawnsAnimalsUI.tableIDField = new SleekUInt16Field(); EditorSpawnsAnimalsUI.tableIDField.positionOffset_X = 240; EditorSpawnsAnimalsUI.tableIDField.positionOffset_Y = 130; EditorSpawnsAnimalsUI.tableIDField.sizeOffset_X = 200; EditorSpawnsAnimalsUI.tableIDField.sizeOffset_Y = 30; SleekUInt16Field sleekUInt16Field = EditorSpawnsAnimalsUI.tableIDField; if (EditorSpawnsAnimalsUI.< > f__mg$cache8 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache8 = new TypedUInt16(EditorSpawnsAnimalsUI.onTableIDFieldTyped); } sleekUInt16Field.onTypedUInt16 = EditorSpawnsAnimalsUI.< > f__mg$cache8; EditorSpawnsAnimalsUI.tableIDField.addLabel(local.format("TableIDFieldLabelText"), ESleekSide.LEFT); EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.tableIDField); EditorSpawnsAnimalsUI.tierNameField = new SleekField(); EditorSpawnsAnimalsUI.tierNameField.positionOffset_X = 240; EditorSpawnsAnimalsUI.tierNameField.sizeOffset_X = 200; EditorSpawnsAnimalsUI.tierNameField.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.tierNameField.maxLength = 64; EditorSpawnsAnimalsUI.tierNameField.addLabel(local.format("TierNameFieldLabelText"), ESleekSide.LEFT); SleekField sleekField2 = EditorSpawnsAnimalsUI.tierNameField; if (EditorSpawnsAnimalsUI.< > f__mg$cache9 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache9 = new Typed(EditorSpawnsAnimalsUI.onTypedTierNameField); } sleekField2.onTyped = EditorSpawnsAnimalsUI.< > f__mg$cache9; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.tierNameField); EditorSpawnsAnimalsUI.addTierButton = new SleekButtonIcon((Texture2D)bundle.load("Add")); EditorSpawnsAnimalsUI.addTierButton.positionOffset_X = 240; EditorSpawnsAnimalsUI.addTierButton.sizeOffset_X = 95; EditorSpawnsAnimalsUI.addTierButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.addTierButton.text = local.format("AddTierButtonText"); EditorSpawnsAnimalsUI.addTierButton.tooltip = local.format("AddTierButtonTooltip"); SleekButton sleekButton3 = EditorSpawnsAnimalsUI.addTierButton; if (EditorSpawnsAnimalsUI.< > f__mg$cacheA == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheA = new ClickedButton(EditorSpawnsAnimalsUI.onClickedAddTierButton); } sleekButton3.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cacheA; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.addTierButton); EditorSpawnsAnimalsUI.removeTierButton = new SleekButtonIcon((Texture2D)bundle.load("Remove")); EditorSpawnsAnimalsUI.removeTierButton.positionOffset_X = 345; EditorSpawnsAnimalsUI.removeTierButton.sizeOffset_X = 95; EditorSpawnsAnimalsUI.removeTierButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.removeTierButton.text = local.format("RemoveTierButtonText"); EditorSpawnsAnimalsUI.removeTierButton.tooltip = local.format("RemoveTierButtonTooltip"); SleekButton sleekButton4 = EditorSpawnsAnimalsUI.removeTierButton; if (EditorSpawnsAnimalsUI.< > f__mg$cacheB == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheB = new ClickedButton(EditorSpawnsAnimalsUI.onClickedRemoveTierButton); } sleekButton4.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cacheB; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.removeTierButton); EditorSpawnsAnimalsUI.animalIDField = new SleekUInt16Field(); EditorSpawnsAnimalsUI.animalIDField.positionOffset_X = 240; EditorSpawnsAnimalsUI.animalIDField.sizeOffset_X = 200; EditorSpawnsAnimalsUI.animalIDField.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.animalIDField.addLabel(local.format("AnimalIDFieldLabelText"), ESleekSide.LEFT); EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.animalIDField); EditorSpawnsAnimalsUI.addAnimalButton = new SleekButtonIcon((Texture2D)bundle.load("Add")); EditorSpawnsAnimalsUI.addAnimalButton.positionOffset_X = 240; EditorSpawnsAnimalsUI.addAnimalButton.sizeOffset_X = 95; EditorSpawnsAnimalsUI.addAnimalButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.addAnimalButton.text = local.format("AddAnimalButtonText"); EditorSpawnsAnimalsUI.addAnimalButton.tooltip = local.format("AddAnimalButtonTooltip"); SleekButton sleekButton5 = EditorSpawnsAnimalsUI.addAnimalButton; if (EditorSpawnsAnimalsUI.< > f__mg$cacheC == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheC = new ClickedButton(EditorSpawnsAnimalsUI.onClickedAddAnimalButton); } sleekButton5.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cacheC; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.addAnimalButton); EditorSpawnsAnimalsUI.removeAnimalButton = new SleekButtonIcon((Texture2D)bundle.load("Remove")); EditorSpawnsAnimalsUI.removeAnimalButton.positionOffset_X = 345; EditorSpawnsAnimalsUI.removeAnimalButton.sizeOffset_X = 95; EditorSpawnsAnimalsUI.removeAnimalButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.removeAnimalButton.text = local.format("RemoveAnimalButtonText"); EditorSpawnsAnimalsUI.removeAnimalButton.tooltip = local.format("RemoveAnimalButtonTooltip"); SleekButton sleekButton6 = EditorSpawnsAnimalsUI.removeAnimalButton; if (EditorSpawnsAnimalsUI.< > f__mg$cacheD == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheD = new ClickedButton(EditorSpawnsAnimalsUI.onClickedRemoveAnimalButton); } sleekButton6.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cacheD; EditorSpawnsAnimalsUI.spawnsScrollBox.add(EditorSpawnsAnimalsUI.removeAnimalButton); EditorSpawnsAnimalsUI.selectedBox = new SleekBox(); EditorSpawnsAnimalsUI.selectedBox.positionOffset_X = -230; EditorSpawnsAnimalsUI.selectedBox.positionOffset_Y = 80; EditorSpawnsAnimalsUI.selectedBox.positionScale_X = 1f; EditorSpawnsAnimalsUI.selectedBox.sizeOffset_X = 230; EditorSpawnsAnimalsUI.selectedBox.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.selectedBox.addLabel(local.format("SelectionBoxLabelText"), ESleekSide.LEFT); EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.selectedBox); EditorSpawnsAnimalsUI.updateSelection(); EditorSpawnsAnimalsUI.radiusSlider = new SleekSlider(); EditorSpawnsAnimalsUI.radiusSlider.positionOffset_Y = -100; EditorSpawnsAnimalsUI.radiusSlider.positionScale_Y = 1f; EditorSpawnsAnimalsUI.radiusSlider.sizeOffset_X = 200; EditorSpawnsAnimalsUI.radiusSlider.sizeOffset_Y = 20; EditorSpawnsAnimalsUI.radiusSlider.state = (float)(EditorSpawns.radius - EditorSpawns.MIN_REMOVE_SIZE) / (float)EditorSpawns.MAX_REMOVE_SIZE; EditorSpawnsAnimalsUI.radiusSlider.orientation = ESleekOrientation.HORIZONTAL; EditorSpawnsAnimalsUI.radiusSlider.addLabel(local.format("RadiusSliderLabelText"), ESleekSide.RIGHT); SleekSlider sleekSlider = EditorSpawnsAnimalsUI.radiusSlider; if (EditorSpawnsAnimalsUI.< > f__mg$cacheE == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheE = new Dragged(EditorSpawnsAnimalsUI.onDraggedRadiusSlider); } sleekSlider.onDragged = EditorSpawnsAnimalsUI.< > f__mg$cacheE; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.radiusSlider); EditorSpawnsAnimalsUI.addButton = new SleekButtonIcon((Texture2D)bundle.load("Add")); EditorSpawnsAnimalsUI.addButton.positionOffset_Y = -70; EditorSpawnsAnimalsUI.addButton.positionScale_Y = 1f; EditorSpawnsAnimalsUI.addButton.sizeOffset_X = 200; EditorSpawnsAnimalsUI.addButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.addButton.text = local.format("AddButtonText", new object[] { ControlsSettings.tool_0 }); EditorSpawnsAnimalsUI.addButton.tooltip = local.format("AddButtonTooltip"); SleekButton sleekButton7 = EditorSpawnsAnimalsUI.addButton; if (EditorSpawnsAnimalsUI.< > f__mg$cacheF == null) { EditorSpawnsAnimalsUI.< > f__mg$cacheF = new ClickedButton(EditorSpawnsAnimalsUI.onClickedAddButton); } sleekButton7.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cacheF; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.addButton); EditorSpawnsAnimalsUI.removeButton = new SleekButtonIcon((Texture2D)bundle.load("Remove")); EditorSpawnsAnimalsUI.removeButton.positionOffset_Y = -30; EditorSpawnsAnimalsUI.removeButton.positionScale_Y = 1f; EditorSpawnsAnimalsUI.removeButton.sizeOffset_X = 200; EditorSpawnsAnimalsUI.removeButton.sizeOffset_Y = 30; EditorSpawnsAnimalsUI.removeButton.text = local.format("RemoveButtonText", new object[] { ControlsSettings.tool_1 }); EditorSpawnsAnimalsUI.removeButton.tooltip = local.format("RemoveButtonTooltip"); SleekButton sleekButton8 = EditorSpawnsAnimalsUI.removeButton; if (EditorSpawnsAnimalsUI.< > f__mg$cache10 == null) { EditorSpawnsAnimalsUI.< > f__mg$cache10 = new ClickedButton(EditorSpawnsAnimalsUI.onClickedRemoveButton); } sleekButton8.onClickedButton = EditorSpawnsAnimalsUI.< > f__mg$cache10; EditorSpawnsAnimalsUI.container.add(EditorSpawnsAnimalsUI.removeButton); bundle.unload(); }