예제 #1
0
        private static void onClickedAddTableSpawnButton(SleekButton button)
        {
            if (MenuWorkshopSpawnsUI.addTableIDField.state == 0)
            {
                return;
            }
            for (int i = 0; i < MenuWorkshopSpawnsUI.asset.tables.Count; i++)
            {
                if (MenuWorkshopSpawnsUI.asset.tables[i].spawnID == MenuWorkshopSpawnsUI.addTableIDField.state)
                {
                    return;
                }
            }
            SpawnAsset spawnAsset = (SpawnAsset)Assets.find(EAssetType.SPAWN, MenuWorkshopSpawnsUI.addTableIDField.state);

            if (spawnAsset == null)
            {
                return;
            }
            SpawnTable spawnTable = new SpawnTable();

            spawnTable.spawnID = MenuWorkshopSpawnsUI.asset.id;
            spawnAsset.roots.Add(spawnTable);
            SpawnTable spawnTable2 = new SpawnTable();

            spawnTable2.spawnID = MenuWorkshopSpawnsUI.addTableIDField.state;
            MenuWorkshopSpawnsUI.asset.tables.Add(spawnTable2);
            MenuWorkshopSpawnsUI.addTableIDField.state = 0;
            MenuWorkshopSpawnsUI.refresh();
        }
예제 #2
0
        private static void onClickedNewButton(SleekButton button)
        {
            SpawnAsset spawnAsset = new SpawnAsset(MenuWorkshopSpawnsUI.viewIDField.state);

            Assets.add(spawnAsset);
            MenuWorkshopSpawnsUI.refresh();
        }
        // Token: 0x06003475 RID: 13429 RVA: 0x00157AF8 File Offset: 0x00155EF8
        public static ushort resolve(ushort id)
        {
            SpawnAsset spawnAsset = (SpawnAsset)Assets.find(EAssetType.SPAWN, id);

            if (spawnAsset == null)
            {
                return(0);
            }
            bool flag;

            spawnAsset.resolve(out id, out flag);
            if (flag)
            {
                id = SpawnTableTool.resolve(id);
            }
            return(id);
        }
예제 #4
0
        private static void onClickedRemoveTableButton(SleekButton button)
        {
            int        index      = MenuWorkshopSpawnsUI.tablesBox.search(button.parent);
            SpawnTable spawnTable = MenuWorkshopSpawnsUI.asset.tables[index];

            if (spawnTable.spawnID != 0)
            {
                SpawnAsset spawnAsset = (SpawnAsset)Assets.find(EAssetType.SPAWN, spawnTable.spawnID);
                if (spawnAsset != null)
                {
                    for (int i = 0; i < spawnAsset.roots.Count; i++)
                    {
                        if (spawnAsset.roots[i].spawnID == MenuWorkshopSpawnsUI.asset.id)
                        {
                            spawnAsset.roots.RemoveAt(i);
                            break;
                        }
                    }
                }
            }
            MenuWorkshopSpawnsUI.asset.tables.RemoveAt(index);
            MenuWorkshopSpawnsUI.refresh();
        }
예제 #5
0
        private static string getRaw(SpawnAsset asset)
        {
            string text = "Type Spawn";

            text = text + "\nID " + asset.id;
            int num  = 0;
            int num2 = 0;

            for (int i = 0; i < asset.roots.Count; i++)
            {
                SpawnTable spawnTable = asset.roots[i];
                if (spawnTable.isLink && spawnTable.weight > 0)
                {
                    num++;
                }
            }
            if (num > 0)
            {
                text += "\n";
                text  = text + "\nRoots " + num;
                for (int j = 0; j < asset.roots.Count; j++)
                {
                    SpawnTable spawnTable2 = asset.roots[j];
                    if (spawnTable2.isLink && spawnTable2.weight > 0)
                    {
                        string text2 = text;
                        text = string.Concat(new object[]
                        {
                            text2,
                            "\nRoot_",
                            num2,
                            "_Spawn_ID ",
                            spawnTable2.spawnID
                        });
                        text2 = text;
                        text  = string.Concat(new object[]
                        {
                            text2,
                            "\nRoot_",
                            num2,
                            "_Weight ",
                            spawnTable2.weight
                        });
                        num2++;
                    }
                }
            }
            int num3 = 0;
            int num4 = 0;

            for (int k = 0; k < asset.tables.Count; k++)
            {
                SpawnTable spawnTable3 = asset.tables[k];
                if (!spawnTable3.isLink && spawnTable3.weight > 0)
                {
                    num3++;
                }
            }
            if (num3 > 0)
            {
                text += "\n";
                text  = text + "\nTables " + asset.tables.Count;
                for (int l = 0; l < asset.tables.Count; l++)
                {
                    SpawnTable spawnTable4 = asset.tables[l];
                    if (!spawnTable4.isLink && spawnTable4.weight > 0)
                    {
                        string text2;
                        if (spawnTable4.assetID != 0)
                        {
                            text2 = text;
                            text  = string.Concat(new object[]
                            {
                                text2,
                                "\nTable_",
                                num4,
                                "_Asset_ID ",
                                spawnTable4.assetID
                            });
                        }
                        else
                        {
                            text2 = text;
                            text  = string.Concat(new object[]
                            {
                                text2,
                                "\nTable_",
                                num4,
                                "_Spawn_ID ",
                                spawnTable4.spawnID
                            });
                        }
                        text2 = text;
                        text  = string.Concat(new object[]
                        {
                            text2,
                            "\nTable_",
                            num4,
                            "_Weight ",
                            spawnTable4.weight
                        });
                        num4++;
                    }
                }
            }
            return(text);
        }
예제 #6
0
        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));
        }