private static void onTypedTableWeightField(SleekInt32Field field, int state) { int index = MenuWorkshopSpawnsUI.tablesBox.search(field.parent); MenuWorkshopSpawnsUI.asset.tables[index].weight = state; }
private static void refresh() { MenuWorkshopSpawnsUI.rawField.isVisible = false; MenuWorkshopSpawnsUI.rootsBox.isVisible = true; MenuWorkshopSpawnsUI.tablesBox.isVisible = true; MenuWorkshopSpawnsUI.rootsBox.remove(); MenuWorkshopSpawnsUI.tablesBox.remove(); MenuWorkshopSpawnsUI.asset = (SpawnAsset)Assets.find(EAssetType.SPAWN, MenuWorkshopSpawnsUI.viewIDField.state); switch (MenuWorkshopSpawnsUI.typeButton.state) { case 0: MenuWorkshopSpawnsUI.type = EAssetType.ITEM; break; case 1: MenuWorkshopSpawnsUI.type = EAssetType.VEHICLE; break; case 2: MenuWorkshopSpawnsUI.type = EAssetType.ANIMAL; break; default: MenuWorkshopSpawnsUI.type = EAssetType.NONE; return; } int num = 120; MenuWorkshopSpawnsUI.rootsBox.positionOffset_Y = num; num += 40; if (MenuWorkshopSpawnsUI.asset != null) { MenuWorkshopSpawnsUI.rootsBox.text = MenuWorkshopSpawnsUI.localization.format("Roots_Box", new object[] { MenuWorkshopSpawnsUI.viewIDField.state + " " + MenuWorkshopSpawnsUI.asset.name }); for (int i = 0; i < MenuWorkshopSpawnsUI.asset.roots.Count; i++) { SpawnTable spawnTable = MenuWorkshopSpawnsUI.asset.roots[i]; if (spawnTable.spawnID != 0) { SleekButton sleekButton = new SleekButton(); sleekButton.positionOffset_Y = 40 + i * 40; sleekButton.sizeOffset_X = -260; sleekButton.sizeScale_X = 1f; sleekButton.sizeOffset_Y = 30; SleekButton sleekButton2 = sleekButton; if (MenuWorkshopSpawnsUI.< > f__mg$cache0 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache0 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRootButton); } sleekButton2.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache0; MenuWorkshopSpawnsUI.rootsBox.add(sleekButton); num += 40; SpawnAsset spawnAsset = (SpawnAsset)Assets.find(EAssetType.SPAWN, spawnTable.spawnID); if (spawnAsset != null) { sleekButton.text = spawnTable.spawnID + " " + spawnAsset.name; } else { sleekButton.text = spawnTable.spawnID + " ?"; } SleekInt32Field sleekInt32Field = new SleekInt32Field(); sleekInt32Field.positionOffset_X = 10; sleekInt32Field.positionScale_X = 1f; sleekInt32Field.sizeOffset_X = 55; sleekInt32Field.sizeOffset_Y = 30; sleekInt32Field.state = spawnTable.weight; sleekInt32Field.tooltip = MenuWorkshopSpawnsUI.localization.format("Weight_Tooltip"); SleekInt32Field sleekInt32Field2 = sleekInt32Field; Delegate onTypedInt = sleekInt32Field2.onTypedInt; if (MenuWorkshopSpawnsUI.< > f__mg$cache1 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache1 = new TypedInt32(MenuWorkshopSpawnsUI.onTypedRootWeightField); } sleekInt32Field2.onTypedInt = (TypedInt32)Delegate.Combine(onTypedInt, MenuWorkshopSpawnsUI.< > f__mg$cache1); sleekButton.add(sleekInt32Field); sleekButton.add(new SleekBox { positionOffset_X = 75, positionScale_X = 1f, sizeOffset_X = 55, sizeOffset_Y = 30, text = (Math.Round((double)(spawnTable.chance * 1000f)) / 10.0).ToString() + "%", tooltip = MenuWorkshopSpawnsUI.localization.format("Chance_Tooltip") }); SleekButtonIcon sleekButtonIcon = new SleekButtonIcon((Texture2D)MenuWorkshopEditorUI.icons.load("Remove")); sleekButtonIcon.positionOffset_X = 140; sleekButtonIcon.positionScale_X = 1f; sleekButtonIcon.sizeOffset_X = 120; sleekButtonIcon.sizeOffset_Y = 30; sleekButtonIcon.text = MenuWorkshopSpawnsUI.localization.format("Remove_Root_Button"); sleekButtonIcon.tooltip = MenuWorkshopSpawnsUI.localization.format("Remove_Root_Button_Tooltip"); SleekButton sleekButton3 = sleekButtonIcon; if (MenuWorkshopSpawnsUI.< > f__mg$cache2 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache2 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRemoveRootButton); } sleekButton3.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache2; sleekButton.add(sleekButtonIcon); } } MenuWorkshopSpawnsUI.addRootIDField.positionOffset_Y = num; MenuWorkshopSpawnsUI.addRootSpawnButton.positionOffset_Y = num; num += 40; MenuWorkshopSpawnsUI.addRootIDField.isVisible = true; MenuWorkshopSpawnsUI.addRootSpawnButton.isVisible = true; } else { MenuWorkshopSpawnsUI.rootsBox.text = MenuWorkshopSpawnsUI.localization.format("Roots_Box", new object[] { MenuWorkshopSpawnsUI.viewIDField.state + " ?" }); MenuWorkshopSpawnsUI.addRootIDField.isVisible = false; MenuWorkshopSpawnsUI.addRootSpawnButton.isVisible = false; } num += 40; MenuWorkshopSpawnsUI.tablesBox.positionOffset_Y = num; num += 40; if (MenuWorkshopSpawnsUI.asset != null) { MenuWorkshopSpawnsUI.tablesBox.text = MenuWorkshopSpawnsUI.localization.format("Tables_Box", new object[] { MenuWorkshopSpawnsUI.viewIDField.state + " " + MenuWorkshopSpawnsUI.asset.name }); for (int j = 0; j < MenuWorkshopSpawnsUI.asset.tables.Count; j++) { SpawnTable spawnTable2 = MenuWorkshopSpawnsUI.asset.tables[j]; Sleek sleek = null; if (spawnTable2.spawnID != 0) { SleekButton sleekButton4 = new SleekButton(); sleekButton4.positionOffset_Y = 40 + j * 40; sleekButton4.sizeOffset_X = -260; sleekButton4.sizeScale_X = 1f; sleekButton4.sizeOffset_Y = 30; SleekButton sleekButton5 = sleekButton4; if (MenuWorkshopSpawnsUI.< > f__mg$cache3 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache3 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedTableButton); } sleekButton5.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache3; MenuWorkshopSpawnsUI.tablesBox.add(sleekButton4); sleek = sleekButton4; num += 40; SpawnAsset spawnAsset2 = (SpawnAsset)Assets.find(EAssetType.SPAWN, spawnTable2.spawnID); if (spawnAsset2 != null) { sleekButton4.text = spawnTable2.spawnID + " " + spawnAsset2.name; } else { sleekButton4.text = spawnTable2.spawnID + " ?"; } } else if (spawnTable2.assetID != 0) { SleekBox sleekBox = new SleekBox(); sleekBox.positionOffset_Y = 40 + j * 40; sleekBox.sizeOffset_X = -260; sleekBox.sizeScale_X = 1f; sleekBox.sizeOffset_Y = 30; MenuWorkshopSpawnsUI.tablesBox.add(sleekBox); sleek = sleekBox; num += 40; Asset asset = Assets.find(MenuWorkshopSpawnsUI.type, spawnTable2.assetID); if (asset != null) { sleekBox.text = spawnTable2.assetID + " " + asset.name; if (MenuWorkshopSpawnsUI.type == EAssetType.ITEM) { ItemAsset itemAsset = asset as ItemAsset; if (MenuWorkshopSpawnsUI.asset != null) { sleekBox.foregroundTint = ESleekTint.NONE; sleekBox.foregroundColor = ItemTool.getRarityColorUI(itemAsset.rarity); } } else if (MenuWorkshopSpawnsUI.type == EAssetType.VEHICLE) { VehicleAsset vehicleAsset = asset as VehicleAsset; if (MenuWorkshopSpawnsUI.asset != null) { sleekBox.foregroundTint = ESleekTint.NONE; sleekBox.foregroundColor = ItemTool.getRarityColorUI(vehicleAsset.rarity); } } } else { sleekBox.text = spawnTable2.assetID + " ?"; } } if (sleek != null) { SleekInt32Field sleekInt32Field3 = new SleekInt32Field(); sleekInt32Field3.positionOffset_X = 10; sleekInt32Field3.positionScale_X = 1f; sleekInt32Field3.sizeOffset_X = 55; sleekInt32Field3.sizeOffset_Y = 30; sleekInt32Field3.state = spawnTable2.weight; sleekInt32Field3.tooltip = MenuWorkshopSpawnsUI.localization.format("Weight_Tooltip"); SleekInt32Field sleekInt32Field4 = sleekInt32Field3; Delegate onTypedInt2 = sleekInt32Field4.onTypedInt; if (MenuWorkshopSpawnsUI.< > f__mg$cache4 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache4 = new TypedInt32(MenuWorkshopSpawnsUI.onTypedTableWeightField); } sleekInt32Field4.onTypedInt = (TypedInt32)Delegate.Combine(onTypedInt2, MenuWorkshopSpawnsUI.< > f__mg$cache4); sleek.add(sleekInt32Field3); float num2 = spawnTable2.chance; if (j > 0) { num2 -= MenuWorkshopSpawnsUI.asset.tables[j - 1].chance; } sleek.add(new SleekBox { positionOffset_X = 75, positionScale_X = 1f, sizeOffset_X = 55, sizeOffset_Y = 30, text = (Math.Round((double)(num2 * 1000f)) / 10.0).ToString() + "%", tooltip = MenuWorkshopSpawnsUI.localization.format("Chance_Tooltip") }); SleekButtonIcon sleekButtonIcon2 = new SleekButtonIcon((Texture2D)MenuWorkshopEditorUI.icons.load("Remove")); sleekButtonIcon2.positionOffset_X = 140; sleekButtonIcon2.positionScale_X = 1f; sleekButtonIcon2.sizeOffset_X = 120; sleekButtonIcon2.sizeOffset_Y = 30; sleekButtonIcon2.text = MenuWorkshopSpawnsUI.localization.format("Remove_Table_Button"); sleekButtonIcon2.tooltip = MenuWorkshopSpawnsUI.localization.format("Remove_Table_Button_Tooltip"); SleekButton sleekButton6 = sleekButtonIcon2; if (MenuWorkshopSpawnsUI.< > f__mg$cache5 == null) { MenuWorkshopSpawnsUI.< > f__mg$cache5 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRemoveTableButton); } sleekButton6.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache5; sleek.add(sleekButtonIcon2); } } MenuWorkshopSpawnsUI.addTableIDField.positionOffset_Y = num; MenuWorkshopSpawnsUI.addTableAssetButton.positionOffset_Y = num; MenuWorkshopSpawnsUI.addTableSpawnButton.positionOffset_Y = num; num += 40; MenuWorkshopSpawnsUI.addTableIDField.isVisible = true; MenuWorkshopSpawnsUI.addTableAssetButton.isVisible = true; MenuWorkshopSpawnsUI.addTableSpawnButton.isVisible = true; } else { MenuWorkshopSpawnsUI.tablesBox.text = MenuWorkshopSpawnsUI.localization.format("Tables_Box", new object[] { MenuWorkshopSpawnsUI.viewIDField.state + " ?" }); MenuWorkshopSpawnsUI.addTableIDField.isVisible = false; MenuWorkshopSpawnsUI.addTableAssetButton.isVisible = false; MenuWorkshopSpawnsUI.addTableSpawnButton.isVisible = false; } if (MenuWorkshopSpawnsUI.asset != null) { MenuWorkshopSpawnsUI.applyWeightsButton.positionOffset_Y = num; num += 40; MenuWorkshopSpawnsUI.applyWeightsButton.isVisible = true; } else { MenuWorkshopSpawnsUI.applyWeightsButton.isVisible = false; } MenuWorkshopSpawnsUI.spawnsBox.area = new Rect(0f, 0f, 5f, (float)(num - 10)); }