// Token: 0x06003567 RID: 13671 RVA: 0x001654E8 File Offset: 0x001638E8 private static void onDraggedChanceSlider(SleekSlider slider, float state) { if ((int)EditorSpawns.selectedVehicle < LevelVehicles.tables.Count) { int num = (slider.parent.positionOffset_Y - 170) / 70; LevelVehicles.tables[(int)EditorSpawns.selectedVehicle].updateChance(num, state); for (int i = 0; i < LevelVehicles.tables[(int)EditorSpawns.selectedVehicle].tiers.Count; i++) { VehicleTier vehicleTier = LevelVehicles.tables[(int)EditorSpawns.selectedVehicle].tiers[i]; SleekSlider sleekSlider = (SleekSlider)EditorSpawnsVehiclesUI.tierButtons[i].children[0]; if (i != num) { sleekSlider.state = vehicleTier.chance; } sleekSlider.updateLabel(Mathf.RoundToInt(vehicleTier.chance * 100f) + "%"); } } }
public static void save() { River river = new River(Level.info.path + "/Spawns/Vehicles.dat", false); river.writeByte(LevelVehicles.SAVEDATA_VERSION); river.writeByte((byte)LevelVehicles.tables.Count); byte b = 0; while ((int)b < LevelVehicles.tables.Count) { VehicleTable vehicleTable = LevelVehicles.tables[(int)b]; river.writeColor(vehicleTable.color); river.writeString(vehicleTable.name); river.writeUInt16(vehicleTable.tableID); river.writeByte((byte)vehicleTable.tiers.Count); byte b2 = 0; while ((int)b2 < vehicleTable.tiers.Count) { VehicleTier vehicleTier = vehicleTable.tiers[(int)b2]; river.writeString(vehicleTier.name); river.writeSingle(vehicleTier.chance); river.writeByte((byte)vehicleTier.table.Count); byte b3 = 0; while ((int)b3 < vehicleTier.table.Count) { VehicleSpawn vehicleSpawn = vehicleTier.table[(int)b3]; river.writeUInt16(vehicleSpawn.vehicle); b3 += 1; } b2 += 1; } b += 1; } river.writeUInt16((ushort)LevelVehicles.spawns.Count); for (int i = 0; i < LevelVehicles.spawns.Count; i++) { VehicleSpawnpoint vehicleSpawnpoint = LevelVehicles.spawns[i]; river.writeByte(vehicleSpawnpoint.type); river.writeSingleVector3(vehicleSpawnpoint.point); river.writeByte(MeasurementTool.angleToByte(vehicleSpawnpoint.angle)); } river.closeRiver(); }
public ushort getVehicle() { if (this.tableID != 0) { return(SpawnTableTool.resolve(this.tableID)); } float value = Random.value; if (this.tiers.Count == 0) { return(0); } int i = 0; while (i < this.tiers.Count) { if (value < this.tiers[i].chance) { VehicleTier vehicleTier = this.tiers[i]; if (vehicleTier.table.Count > 0) { return(vehicleTier.table[Random.Range(0, vehicleTier.table.Count)].vehicle); } return(0); } else { i++; } } VehicleTier vehicleTier2 = this.tiers[Random.Range(0, this.tiers.Count)]; if (vehicleTier2.table.Count > 0) { return(vehicleTier2.table[Random.Range(0, vehicleTier2.table.Count)].vehicle); } return(0); }
// Token: 0x06003477 RID: 13431 RVA: 0x00157C1C File Offset: 0x0015601C private static bool isVariantVehicleTier(VehicleTier tier) { if (tier.table.Count < 6) { return(false); } VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, tier.table[0].vehicle); if (vehicleAsset == null) { return(false); } int num = vehicleAsset.vehicleName.IndexOf(" "); if (num <= 0) { return(false); } string text = vehicleAsset.vehicleName.Substring(num + 1); if (text.Length <= 1) { Debug.LogError(vehicleAsset.vehicleName + " name has a trailing space!"); return(false); } for (int i = 1; i < tier.table.Count; i++) { VehicleAsset vehicleAsset2 = (VehicleAsset)Assets.find(EAssetType.VEHICLE, tier.table[i].vehicle); if (!vehicleAsset2.vehicleName.Contains(text)) { return(false); } } tier.name = text; return(true); }
// Token: 0x06003561 RID: 13665 RVA: 0x00164CDC File Offset: 0x001630DC public static void updateSelection() { if ((int)EditorSpawns.selectedVehicle < LevelVehicles.tables.Count) { VehicleTable vehicleTable = LevelVehicles.tables[(int)EditorSpawns.selectedVehicle]; EditorSpawnsVehiclesUI.selectedBox.text = vehicleTable.name; EditorSpawnsVehiclesUI.tableNameField.text = vehicleTable.name; EditorSpawnsVehiclesUI.tableIDField.state = vehicleTable.tableID; EditorSpawnsVehiclesUI.tableColorPicker.state = vehicleTable.color; if (EditorSpawnsVehiclesUI.tierButtons != null) { for (int i = 0; i < EditorSpawnsVehiclesUI.tierButtons.Length; i++) { EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.tierButtons[i]); } } EditorSpawnsVehiclesUI.tierButtons = new SleekButton[vehicleTable.tiers.Count]; for (int j = 0; j < EditorSpawnsVehiclesUI.tierButtons.Length; j++) { VehicleTier vehicleTier = vehicleTable.tiers[j]; SleekButton sleekButton = new SleekButton(); sleekButton.positionOffset_X = 240; sleekButton.positionOffset_Y = 170 + j * 70; sleekButton.sizeOffset_X = 200; sleekButton.sizeOffset_Y = 30; sleekButton.text = vehicleTier.name; SleekButton sleekButton2 = sleekButton; if (EditorSpawnsVehiclesUI.< > f__mg$cache1 == null) { EditorSpawnsVehiclesUI.< > f__mg$cache1 = new ClickedButton(EditorSpawnsVehiclesUI.onClickedTierButton); } sleekButton2.onClickedButton = EditorSpawnsVehiclesUI.< > f__mg$cache1; EditorSpawnsVehiclesUI.spawnsScrollBox.add(sleekButton); SleekSlider sleekSlider = new SleekSlider(); sleekSlider.positionOffset_Y = 40; sleekSlider.sizeOffset_X = 200; sleekSlider.sizeOffset_Y = 20; sleekSlider.orientation = ESleekOrientation.HORIZONTAL; sleekSlider.state = vehicleTier.chance; sleekSlider.addLabel(Mathf.RoundToInt(vehicleTier.chance * 100f) + "%", ESleekSide.LEFT); SleekSlider sleekSlider2 = sleekSlider; if (EditorSpawnsVehiclesUI.< > f__mg$cache2 == null) { EditorSpawnsVehiclesUI.< > f__mg$cache2 = new Dragged(EditorSpawnsVehiclesUI.onDraggedChanceSlider); } sleekSlider2.onDragged = EditorSpawnsVehiclesUI.< > f__mg$cache2; sleekButton.add(sleekSlider); EditorSpawnsVehiclesUI.tierButtons[j] = sleekButton; } EditorSpawnsVehiclesUI.tierNameField.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70; EditorSpawnsVehiclesUI.addTierButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 40; EditorSpawnsVehiclesUI.removeTierButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 40; if (EditorSpawnsVehiclesUI.vehicleButtons != null) { for (int k = 0; k < EditorSpawnsVehiclesUI.vehicleButtons.Length; k++) { EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.vehicleButtons[k]); } } if ((int)EditorSpawnsVehiclesUI.selectedTier < vehicleTable.tiers.Count) { EditorSpawnsVehiclesUI.tierNameField.text = vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].name; EditorSpawnsVehiclesUI.vehicleButtons = new SleekButton[vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table.Count]; for (int l = 0; l < EditorSpawnsVehiclesUI.vehicleButtons.Length; l++) { SleekButton sleekButton3 = new SleekButton(); sleekButton3.positionOffset_X = 240; sleekButton3.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + l * 40; sleekButton3.sizeOffset_X = 200; sleekButton3.sizeOffset_Y = 30; VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table[l].vehicle); string str = "?"; if (vehicleAsset != null) { if (string.IsNullOrEmpty(vehicleAsset.vehicleName)) { str = vehicleAsset.name; } else { str = vehicleAsset.vehicleName; } } sleekButton3.text = vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table[l].vehicle.ToString() + " " + str; SleekButton sleekButton4 = sleekButton3; if (EditorSpawnsVehiclesUI.< > f__mg$cache3 == null) { EditorSpawnsVehiclesUI.< > f__mg$cache3 = new ClickedButton(EditorSpawnsVehiclesUI.onClickVehicleButton); } sleekButton4.onClickedButton = EditorSpawnsVehiclesUI.< > f__mg$cache3; EditorSpawnsVehiclesUI.spawnsScrollBox.add(sleekButton3); EditorSpawnsVehiclesUI.vehicleButtons[l] = sleekButton3; } } else { EditorSpawnsVehiclesUI.tierNameField.text = string.Empty; EditorSpawnsVehiclesUI.vehicleButtons = new SleekButton[0]; } EditorSpawnsVehiclesUI.vehicleIDField.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40; EditorSpawnsVehiclesUI.addVehicleButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 40; EditorSpawnsVehiclesUI.removeVehicleButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 40; EditorSpawnsVehiclesUI.spawnsScrollBox.area = new Rect(0f, 0f, 5f, (float)(170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 70)); } else { EditorSpawnsVehiclesUI.selectedBox.text = string.Empty; EditorSpawnsVehiclesUI.tableNameField.text = string.Empty; EditorSpawnsVehiclesUI.tableIDField.state = 0; EditorSpawnsVehiclesUI.tableColorPicker.state = Color.white; if (EditorSpawnsVehiclesUI.tierButtons != null) { for (int m = 0; m < EditorSpawnsVehiclesUI.tierButtons.Length; m++) { EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.tierButtons[m]); } } EditorSpawnsVehiclesUI.tierButtons = null; EditorSpawnsVehiclesUI.tierNameField.text = string.Empty; EditorSpawnsVehiclesUI.tierNameField.positionOffset_Y = 170; EditorSpawnsVehiclesUI.addTierButton.positionOffset_Y = 210; EditorSpawnsVehiclesUI.removeTierButton.positionOffset_Y = 210; if (EditorSpawnsVehiclesUI.vehicleButtons != null) { for (int n = 0; n < EditorSpawnsVehiclesUI.vehicleButtons.Length; n++) { EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.vehicleButtons[n]); } } EditorSpawnsVehiclesUI.vehicleButtons = null; EditorSpawnsVehiclesUI.vehicleIDField.positionOffset_Y = 250; EditorSpawnsVehiclesUI.addVehicleButton.positionOffset_Y = 290; EditorSpawnsVehiclesUI.removeVehicleButton.positionOffset_Y = 290; EditorSpawnsVehiclesUI.spawnsScrollBox.area = new Rect(0f, 0f, 5f, 320f); } }
// Token: 0x06003479 RID: 13433 RVA: 0x001584AC File Offset: 0x001568AC private static void exportVehicles(string path, Data spawnsData, ref ushort id, bool isLegacy) { for (int i = 0; i < LevelVehicles.tables.Count; i++) { VehicleTable vehicleTable = LevelVehicles.tables[i]; if (vehicleTable.tableID == 0) { vehicleTable.tableID = id; spawnsData.writeString(id.ToString(), Level.info.name + "_" + vehicleTable.name); Data data = new Data(); data.writeString("Type", "Spawn"); Data data2 = data; string key = "ID"; ushort value; id = (value = id) + 1; data2.writeUInt16(key, value); if (ReadWrite.fileExists(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, true)) { Data data3 = ReadWrite.readData(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, true); data.writeInt32("Tables", 1); data.writeUInt16("Table_0_Spawn_ID", data3.readUInt16("ID")); data.writeInt32("Table_0_Weight", 100); } else { data.writeInt32("Tables", 1); data.writeUInt16("Table_0_Spawn_ID", id); data.writeInt32("Table_0_Weight", 100); spawnsData.writeString(id.ToString(), vehicleTable.name); Data data4 = new Data(); data4.writeString("Type", "Spawn"); Data data5 = data4; string key2 = "ID"; id = (value = id) + 1; data5.writeUInt16(key2, value); if (isLegacy) { if (vehicleTable.tiers.Count > 1) { float num = float.MaxValue; for (int j = 0; j < vehicleTable.tiers.Count; j++) { VehicleTier vehicleTier = vehicleTable.tiers[j]; if (vehicleTier.chance < num) { num = vehicleTier.chance; } } int num2 = Mathf.CeilToInt(10f / num); data4.writeInt32("Tables", vehicleTable.tiers.Count); for (int k = 0; k < vehicleTable.tiers.Count; k++) { VehicleTier vehicleTier2 = vehicleTable.tiers[k]; bool flag = SpawnTableTool.isVariantVehicleTier(vehicleTier2); if (flag && ReadWrite.fileExists(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, true)) { Data data6 = ReadWrite.readData(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, true); data4.writeUInt16("Table_" + k + "_Spawn_ID", data6.readUInt16("ID")); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); } else if (flag && ReadWrite.fileExists(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false)) { Data data7 = ReadWrite.readData(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false); data4.writeUInt16("Table_" + k + "_Spawn_ID", data7.readUInt16("ID")); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); } else { data4.writeUInt16("Table_" + k + "_Spawn_ID", id); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); if (flag) { spawnsData.writeString(id.ToString(), vehicleTier2.name); } else { spawnsData.writeString(id.ToString(), vehicleTable.name + "_" + vehicleTier2.name); } Data data8 = new Data(); data8.writeString("Type", "Spawn"); Data data9 = data8; string key3 = "ID"; id = (value = id) + 1; data9.writeUInt16(key3, value); data8.writeInt32("Tables", vehicleTier2.table.Count); for (int l = 0; l < vehicleTier2.table.Count; l++) { VehicleSpawn vehicleSpawn = vehicleTier2.table[l]; data8.writeUInt16("Table_" + l + "_Asset_ID", vehicleSpawn.vehicle); data8.writeInt32("Table_" + l + "_Weight", 10); } if (flag) { ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false, data8); } else { ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTable.name, "_", vehicleTier2.name, "/", vehicleTable.name, "_", vehicleTier2.name, ".dat" }), false, false, data8); } } } } else { VehicleTier vehicleTier3 = vehicleTable.tiers[0]; data4.writeInt32("Tables", vehicleTier3.table.Count); for (int m = 0; m < vehicleTier3.table.Count; m++) { VehicleSpawn vehicleSpawn2 = vehicleTier3.table[m]; data4.writeUInt16("Table_" + m + "_Asset_ID", vehicleSpawn2.vehicle); data4.writeInt32("Table_" + m + "_Weight", 10); } } } ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, false, data4); } ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", Level.info.name, "_", vehicleTable.name, "/", Level.info.name, "_", vehicleTable.name, ".dat" }), false, false, data); } } }