Esempio n. 1
0
 public static string folderFound(string path)
 {
     return(ReadWrite.folderFound(path, true));
 }
Esempio n. 2
0
 private static void exportAnimals(string path, Data spawnsData, ref ushort id, bool isLegacy)
 {
     for (int i = 0; i < LevelAnimals.tables.Count; i++)
     {
         AnimalTable animalTable = LevelAnimals.tables[i];
         if (animalTable.tableID == 0)
         {
             animalTable.tableID = id;
             spawnsData.writeString(id.ToString(), Level.info.name + "_" + animalTable.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/Animals/",
                 animalTable.name,
                 "/",
                 animalTable.name,
                 ".dat"
             }), false, true))
             {
                 Data data3 = ReadWrite.readData(string.Concat(new string[]
                 {
                     "/Bundles/Spawns/Animals/",
                     animalTable.name,
                     "/",
                     animalTable.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(), animalTable.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 (animalTable.tiers.Count > 1)
                     {
                         float num = float.MaxValue;
                         for (int j = 0; j < animalTable.tiers.Count; j++)
                         {
                             AnimalTier animalTier = animalTable.tiers[j];
                             if (animalTier.chance < num)
                             {
                                 num = animalTier.chance;
                             }
                         }
                         int num2 = Mathf.CeilToInt(10f / num);
                         data4.writeInt32("Tables", animalTable.tiers.Count);
                         for (int k = 0; k < animalTable.tiers.Count; k++)
                         {
                             AnimalTier animalTier2 = animalTable.tiers[k];
                             data4.writeUInt16("Table_" + k + "_Spawn_ID", id);
                             data4.writeInt32("Table_" + k + "_Weight", (int)(animalTier2.chance * (float)num2));
                             spawnsData.writeString(id.ToString(), animalTable.name + "_" + animalTier2.name);
                             Data data6 = new Data();
                             data6.writeString("Type", "Spawn");
                             Data   data7 = data6;
                             string key3  = "ID";
                             id = (value = id) + 1;
                             data7.writeUInt16(key3, value);
                             data6.writeInt32("Tables", animalTier2.table.Count);
                             for (int l = 0; l < animalTier2.table.Count; l++)
                             {
                                 AnimalSpawn animalSpawn = animalTier2.table[l];
                                 data6.writeUInt16("Table_" + l + "_Asset_ID", animalSpawn.animal);
                                 data6.writeInt32("Table_" + l + "_Weight", 10);
                             }
                             ReadWrite.writeData(string.Concat(new string[]
                             {
                                 path,
                                 "/Animals/",
                                 animalTable.name,
                                 "_",
                                 animalTier2.name,
                                 "/",
                                 animalTable.name,
                                 "_",
                                 animalTier2.name,
                                 ".dat"
                             }), false, false, data6);
                         }
                     }
                     else
                     {
                         AnimalTier animalTier3 = animalTable.tiers[0];
                         data4.writeInt32("Tables", animalTier3.table.Count);
                         for (int m = 0; m < animalTier3.table.Count; m++)
                         {
                             AnimalSpawn animalSpawn2 = animalTier3.table[m];
                             data4.writeUInt16("Table_" + m + "_Asset_ID", animalSpawn2.animal);
                             data4.writeInt32("Table_" + m + "_Weight", 10);
                         }
                     }
                 }
                 ReadWrite.writeData(string.Concat(new string[]
                 {
                     path,
                     "/Animals/",
                     animalTable.name,
                     "/",
                     animalTable.name,
                     ".dat"
                 }), false, false, data4);
             }
             ReadWrite.writeData(string.Concat(new string[]
             {
                 path,
                 "/Animals/",
                 Level.info.name,
                 "_",
                 animalTable.name,
                 "/",
                 Level.info.name,
                 "_",
                 animalTable.name,
                 ".dat"
             }), false, false, data);
         }
     }
 }
Esempio n. 3
0
 public static byte[] readBytes(string path, bool useCloud)
 {
     return(ReadWrite.readBytes(path, useCloud, true));
 }
Esempio n. 4
0
        // Token: 0x060032EC RID: 13036 RVA: 0x00149C74 File Offset: 0x00148074
        public SleekLevel(LevelInfo level, bool isEditor)
        {
            base.init();
            base.sizeOffset_X        = 400;
            base.sizeOffset_Y        = 100;
            this.button              = new SleekButton();
            this.button.sizeOffset_X = 0;
            this.button.sizeOffset_Y = 0;
            this.button.sizeScale_X  = 1f;
            this.button.sizeScale_Y  = 1f;
            if (level.isEditable || !isEditor)
            {
                this.button.onClickedButton = new ClickedButton(this.onClickedButton);
            }
            base.add(this.button);
            if (ReadWrite.fileExists(level.path + "/Icon.png", false, false))
            {
                byte[]    data      = ReadWrite.readBytes(level.path + "/Icon.png", false, false);
                Texture2D texture2D = new Texture2D(380, 80, TextureFormat.ARGB32, false, true);
                texture2D.name      = "Icon_" + level.name + "_List_Icon";
                texture2D.hideFlags = HideFlags.HideAndDontSave;
                texture2D.LoadImage(data);
                this.icon = new SleekImageTexture();
                this.icon.positionOffset_X     = 10;
                this.icon.positionOffset_Y     = 10;
                this.icon.sizeOffset_X         = -20;
                this.icon.sizeOffset_Y         = -20;
                this.icon.sizeScale_X          = 1f;
                this.icon.sizeScale_Y          = 1f;
                this.icon.texture              = texture2D;
                this.icon.shouldDestroyTexture = true;
                this.button.add(this.icon);
            }
            this.nameLabel = new SleekLabel();
            this.nameLabel.positionOffset_Y = 10;
            this.nameLabel.sizeScale_X      = 1f;
            this.nameLabel.sizeOffset_Y     = 50;
            this.nameLabel.fontAlignment    = TextAnchor.MiddleCenter;
            this.nameLabel.fontSize         = 14;
            this.button.add(this.nameLabel);
            Local local = Localization.tryRead(level.path, false);

            if (local != null && local.has("Name"))
            {
                this.nameLabel.text = local.format("Name");
            }
            else
            {
                this.nameLabel.text = level.name;
            }
            this.infoLabel = new SleekLabel();
            this.infoLabel.positionOffset_Y = 60;
            this.infoLabel.sizeScale_X      = 1f;
            this.infoLabel.sizeOffset_Y     = 30;
            this.infoLabel.fontAlignment    = TextAnchor.MiddleCenter;
            string text = "#SIZE";

            if (level.size == ELevelSize.TINY)
            {
                text = MenuPlaySingleplayerUI.localization.format("Tiny");
            }
            else if (level.size == ELevelSize.SMALL)
            {
                text = MenuPlaySingleplayerUI.localization.format("Small");
            }
            else if (level.size == ELevelSize.MEDIUM)
            {
                text = MenuPlaySingleplayerUI.localization.format("Medium");
            }
            else if (level.size == ELevelSize.LARGE)
            {
                text = MenuPlaySingleplayerUI.localization.format("Large");
            }
            else if (level.size == ELevelSize.INSANE)
            {
                text = MenuPlaySingleplayerUI.localization.format("Insane");
            }
            string text2 = "#TYPE";

            if (level.type == ELevelType.SURVIVAL)
            {
                text2 = MenuPlaySingleplayerUI.localization.format("Survival");
            }
            else if (level.type == ELevelType.HORDE)
            {
                text2 = MenuPlaySingleplayerUI.localization.format("Horde");
            }
            else if (level.type == ELevelType.ARENA)
            {
                text2 = MenuPlaySingleplayerUI.localization.format("Arena");
            }
            this.infoLabel.text = MenuPlaySingleplayerUI.localization.format("Info", new object[]
            {
                text,
                text2
            });
            this.button.add(this.infoLabel);
            if (!level.isEditable && isEditor)
            {
                Bundle            bundle            = Bundles.getBundle("/Bundles/Textures/Menu/Icons/Workshop/MenuWorkshopEditor/MenuWorkshopEditor.unity3d");
                SleekImageTexture sleekImageTexture = new SleekImageTexture();
                sleekImageTexture.positionOffset_X = 20;
                sleekImageTexture.positionOffset_Y = -20;
                sleekImageTexture.positionScale_Y  = 0.5f;
                sleekImageTexture.sizeOffset_X     = 40;
                sleekImageTexture.sizeOffset_Y     = 40;
                sleekImageTexture.texture          = (Texture2D)bundle.load("Lock");
                sleekImageTexture.backgroundTint   = ESleekTint.FOREGROUND;
                this.button.add(sleekImageTexture);
                bundle.unload();
            }
            if (level.configData != null && level.configData.Status != EMapStatus.NONE)
            {
                SleekNew sleek = new SleekNew(level.configData.Status == EMapStatus.UPDATED);
                if (this.icon != null)
                {
                    this.icon.add(sleek);
                }
                else
                {
                    base.add(sleek);
                }
            }
            if (level.configData != null && level.configData.Category == ESingleplayerMapCategory.CURATED && level.configData.CuratedMapMode == ECuratedMapMode.TIMED)
            {
                SleekLabel sleekLabel = new SleekLabel();
                sleekLabel.positionOffset_X = -105;
                sleekLabel.positionScale_X  = 1f;
                sleekLabel.sizeOffset_X     = 100;
                sleekLabel.sizeOffset_Y     = 30;
                sleekLabel.fontAlignment    = TextAnchor.MiddleRight;
                sleekLabel.text             = MenuPlaySingleplayerUI.localization.format("Curated_Map_Timed");
                sleekLabel.foregroundTint   = ESleekTint.NONE;
                sleekLabel.foregroundColor  = Color.green;
                if (level.configData.Status != EMapStatus.NONE)
                {
                    sleekLabel.positionOffset_Y += 30;
                }
                SleekLabel sleekLabel2 = new SleekLabel();
                sleekLabel2.positionOffset_X = -205;
                sleekLabel2.positionOffset_Y = -30;
                sleekLabel2.positionScale_X  = 1f;
                sleekLabel2.positionScale_Y  = 1f;
                sleekLabel2.sizeOffset_X     = 200;
                sleekLabel2.sizeOffset_Y     = 30;
                sleekLabel2.fontAlignment    = TextAnchor.MiddleRight;
                sleekLabel2.text             = MenuPlaySingleplayerUI.localization.format("Curated_Map_Timestamp", new object[]
                {
                    level.configData.getCuratedMapTimestamp().ToString(MenuPlaySingleplayerUI.localization.format("Curated_Map_Timestamp_Format"))
                });
                sleekLabel2.foregroundTint  = ESleekTint.NONE;
                sleekLabel2.foregroundColor = Color.green;
                if (this.icon != null)
                {
                    this.icon.add(sleekLabel);
                    this.icon.add(sleekLabel2);
                }
                else
                {
                    base.add(sleekLabel);
                    base.add(sleekLabel2);
                }
            }
        }
Esempio n. 5
0
        public MenuWorkshopModulesUI()
        {
            MenuWorkshopModulesUI.localization = Localization.read("/Menu/Workshop/MenuWorkshopModules.dat");
            MenuWorkshopModulesUI.container    = new Sleek();
            MenuWorkshopModulesUI.container.positionOffset_X = 10;
            MenuWorkshopModulesUI.container.positionOffset_Y = 10;
            MenuWorkshopModulesUI.container.positionScale_Y  = 1f;
            MenuWorkshopModulesUI.container.sizeOffset_X     = -20;
            MenuWorkshopModulesUI.container.sizeOffset_Y     = -20;
            MenuWorkshopModulesUI.container.sizeScale_X      = 1f;
            MenuWorkshopModulesUI.container.sizeScale_Y      = 1f;
            MenuUI.container.add(MenuWorkshopModulesUI.container);
            MenuWorkshopModulesUI.active    = false;
            MenuWorkshopModulesUI.headerBox = new SleekBox();
            MenuWorkshopModulesUI.headerBox.sizeOffset_Y = 50;
            MenuWorkshopModulesUI.headerBox.sizeScale_X  = 1f;
            MenuWorkshopModulesUI.headerBox.fontSize     = 14;
            MenuWorkshopModulesUI.headerBox.text         = MenuWorkshopModulesUI.localization.format("Header");
            MenuWorkshopModulesUI.container.add(MenuWorkshopModulesUI.headerBox);
            MenuWorkshopModulesUI.moduleBox = new SleekScrollBox();
            MenuWorkshopModulesUI.moduleBox.positionOffset_Y = 60;
            MenuWorkshopModulesUI.moduleBox.sizeOffset_Y     = -120;
            MenuWorkshopModulesUI.moduleBox.sizeScale_X      = 1f;
            MenuWorkshopModulesUI.moduleBox.sizeScale_Y      = 1f;
            MenuWorkshopModulesUI.moduleBox.area             = new Rect(0f, 0f, 5f, 0f);
            MenuWorkshopModulesUI.container.add(MenuWorkshopModulesUI.moduleBox);
            if (ModuleHook.modules.Count == 0)
            {
                SleekBox sleekBox = new SleekBox();
                sleekBox.positionOffset_Y = 60;
                sleekBox.sizeOffset_X     = -30;
                sleekBox.sizeOffset_Y     = 50;
                sleekBox.sizeScale_X      = 1f;
                sleekBox.fontSize         = 14;
                sleekBox.text             = MenuWorkshopModulesUI.localization.format("No_Modules");
                MenuWorkshopModulesUI.container.add(sleekBox);
            }
            else
            {
                for (int i = 0; i < ModuleHook.modules.Count; i++)
                {
                    ModuleConfig config    = ModuleHook.modules[i].config;
                    Local        local     = Localization.tryRead(config.DirectoryPath, false);
                    SleekBox     sleekBox2 = new SleekBox();
                    sleekBox2.positionOffset_Y = i * 130;
                    sleekBox2.sizeOffset_X     = -30;
                    sleekBox2.sizeOffset_Y     = 120;
                    sleekBox2.sizeScale_X      = 1f;
                    SleekToggle sleekToggle = new SleekToggle();
                    sleekToggle.positionOffset_X = 5;
                    sleekToggle.positionOffset_Y = -20;
                    sleekToggle.positionScale_Y  = 0.5f;
                    sleekToggle.sizeOffset_X     = 40;
                    sleekToggle.sizeOffset_Y     = 40;
                    sleekToggle.state            = config.IsEnabled;
                    SleekToggle sleekToggle2 = sleekToggle;
                    if (MenuWorkshopModulesUI.< > f__mg$cache0 == null)
                    {
                        MenuWorkshopModulesUI.< > f__mg$cache0 = new Toggled(MenuWorkshopModulesUI.onToggledModuleToggle);
                    }
                    sleekToggle2.onToggled = MenuWorkshopModulesUI.< > f__mg$cache0;
                    sleekBox2.add(sleekToggle);
                    SleekLabel sleekLabel = new SleekLabel();
                    sleekLabel.positionOffset_X = 50;
                    sleekLabel.positionOffset_Y = 5;
                    sleekLabel.sizeOffset_X     = -55;
                    sleekLabel.sizeOffset_Y     = 30;
                    sleekLabel.sizeScale_X      = 1f;
                    sleekLabel.fontSize         = 14;
                    sleekLabel.fontAlignment    = 0;
                    sleekLabel.text             = local.format("Name");
                    sleekBox2.add(sleekLabel);
                    SleekLabel sleekLabel2 = new SleekLabel();
                    sleekLabel2.positionOffset_X = 50;
                    sleekLabel2.positionOffset_Y = 30;
                    sleekLabel2.sizeOffset_X     = -55;
                    sleekLabel2.sizeOffset_Y     = 25;
                    sleekLabel2.sizeScale_X      = 1f;
                    sleekLabel2.fontAlignment    = 0;
                    sleekLabel2.text             = MenuWorkshopModulesUI.localization.format("Version", new object[]
                    {
                        config.Version
                    });
                    sleekBox2.add(sleekLabel2);
                    SleekLabel sleekLabel3 = new SleekLabel();
                    sleekLabel3.positionOffset_X = 50;
                    sleekLabel3.positionOffset_Y = 50;
                    sleekLabel3.sizeOffset_X     = -55;
                    sleekLabel3.sizeOffset_Y     = 65;
                    sleekLabel3.sizeScale_X      = 1f;
                    sleekLabel3.fontSize         = 12;
                    sleekLabel3.fontAlignment    = 0;
                    sleekLabel3.text             = local.format("Description");
                    sleekBox2.add(sleekLabel3);
                    if (ReadWrite.fileExists(config.DirectoryPath + "/Icon.png", false, false))
                    {
                        byte[]    array     = ReadWrite.readBytes(config.DirectoryPath + "/Icon.png", false, false);
                        Texture2D texture2D = new Texture2D(100, 100, 5, false, true);
                        texture2D.name      = "Module_" + config.Name + "_Icon";
                        texture2D.hideFlags = 61;
                        texture2D.LoadImage(array);
                        sleekBox2.add(new SleekImageTexture
                        {
                            positionOffset_X     = 50,
                            positionOffset_Y     = 10,
                            sizeOffset_X         = 100,
                            sizeOffset_Y         = 100,
                            texture              = texture2D,
                            shouldDestroyTexture = true
                        });
                        sleekLabel.positionOffset_X  += 105;
                        sleekLabel.sizeOffset_X      -= 105;
                        sleekLabel2.positionOffset_X += 105;
                        sleekLabel2.sizeOffset_X     -= 105;
                        sleekLabel3.positionOffset_X += 105;
                        sleekLabel3.sizeOffset_X     -= 105;
                    }
                    MenuWorkshopModulesUI.moduleBox.add(sleekBox2);
                }
                MenuWorkshopModulesUI.moduleBox.area = new Rect(0f, 0f, 5f, (float)(ModuleHook.modules.Count * 130 - 10));
            }
            MenuWorkshopModulesUI.backButton = new SleekButtonIcon((Texture2D)MenuDashboardUI.icons.load("Exit"));
            MenuWorkshopModulesUI.backButton.positionOffset_Y = -50;
            MenuWorkshopModulesUI.backButton.positionScale_Y  = 1f;
            MenuWorkshopModulesUI.backButton.sizeOffset_X     = 200;
            MenuWorkshopModulesUI.backButton.sizeOffset_Y     = 50;
            MenuWorkshopModulesUI.backButton.text             = MenuDashboardUI.localization.format("BackButtonText");
            MenuWorkshopModulesUI.backButton.tooltip          = MenuDashboardUI.localization.format("BackButtonTooltip");
            SleekButton sleekButton = MenuWorkshopModulesUI.backButton;

            if (MenuWorkshopModulesUI.< > f__mg$cache1 == null)
            {
                MenuWorkshopModulesUI.< > f__mg$cache1 = new ClickedButton(MenuWorkshopModulesUI.onClickedBackButton);
            }
            sleekButton.onClickedButton = MenuWorkshopModulesUI.< > f__mg$cache1;
            MenuWorkshopModulesUI.backButton.fontSize = 14;
            MenuWorkshopModulesUI.backButton.iconImage.backgroundTint = ESleekTint.FOREGROUND;
            MenuWorkshopModulesUI.container.add(MenuWorkshopModulesUI.backButton);
        }
Esempio n. 6
0
 public static T deserializeJSON <T>(string path, bool useCloud)
 {
     return(ReadWrite.deserializeJSON <T>(path, useCloud, true));
 }
Esempio n. 7
0
 public static void load()
 {
     LevelNodes._models                 = new GameObject().transform;
     LevelNodes.models.name             = "Nodes";
     LevelNodes.models.parent           = Level.level;
     LevelNodes.models.tag              = "Logic";
     LevelNodes.models.gameObject.layer = LayerMasks.LOGIC;
     LevelNodes._nodes = new List <Node>();
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Nodes.dat", false, false))
     {
         River river = new River(Level.info.path + "/Environment/Nodes.dat", false);
         byte  b     = river.readByte();
         if (b > 0)
         {
             ushort num = (ushort)river.readByte();
             for (ushort num2 = 0; num2 < num; num2 += 1)
             {
                 Vector3   vector    = river.readSingleVector3();
                 ENodeType enodeType = (ENodeType)river.readByte();
                 if (enodeType == ENodeType.LOCATION)
                 {
                     string newName = river.readString();
                     LevelNodes.nodes.Add(new LocationNode(vector, newName));
                 }
                 else if (enodeType == ENodeType.SAFEZONE)
                 {
                     float newRadius = river.readSingle();
                     bool  newHeight = false;
                     if (b > 1)
                     {
                         newHeight = river.readBoolean();
                     }
                     bool newNoWeapons = true;
                     if (b > 4)
                     {
                         newNoWeapons = river.readBoolean();
                     }
                     bool newNoBuildables = true;
                     if (b > 4)
                     {
                         newNoBuildables = river.readBoolean();
                     }
                     LevelNodes.nodes.Add(new SafezoneNode(vector, newRadius, newHeight, newNoWeapons, newNoBuildables));
                 }
                 else if (enodeType == ENodeType.PURCHASE)
                 {
                     float  newRadius2 = river.readSingle();
                     ushort newID      = river.readUInt16();
                     uint   newCost    = river.readUInt32();
                     LevelNodes.nodes.Add(new PurchaseNode(vector, newRadius2, newID, newCost));
                 }
                 else if (enodeType == ENodeType.ARENA)
                 {
                     float newRadius3 = river.readSingle();
                     LevelNodes.nodes.Add(new ArenaNode(vector, newRadius3));
                 }
                 else if (enodeType == ENodeType.DEADZONE)
                 {
                     float newRadius4 = river.readSingle();
                     LevelNodes.nodes.Add(new DeadzoneNode(vector, newRadius4));
                 }
                 else if (enodeType == ENodeType.AIRDROP)
                 {
                     ushort num3 = river.readUInt16();
                     byte   b2;
                     byte   b3;
                     if (SpawnTableTool.resolve(num3) == 0 && Regions.tryGetCoordinate(vector, out b2, out b3))
                     {
                         Assets.errors.Add(string.Concat(new object[]
                         {
                             Level.info.name,
                             " airdrop references invalid spawn table ",
                             num3,
                             " at (",
                             b2,
                             ", ",
                             b3,
                             ")!"
                         }));
                     }
                     LevelNodes.nodes.Add(new AirdropNode(vector, num3));
                 }
                 else if (enodeType == ENodeType.EFFECT)
                 {
                     byte newShape = 0;
                     if (b > 2)
                     {
                         newShape = river.readByte();
                     }
                     float   newRadius5 = river.readSingle();
                     Vector3 newBounds  = Vector3.one;
                     if (b > 2)
                     {
                         newBounds = river.readSingleVector3();
                     }
                     ushort newID2        = river.readUInt16();
                     bool   newNoWater    = river.readBoolean();
                     bool   newNoLighting = false;
                     if (b > 3)
                     {
                         newNoLighting = river.readBoolean();
                     }
                     LevelNodes.nodes.Add(new EffectNode(vector, (ENodeShape)newShape, newRadius5, newBounds, newID2, newNoWater, newNoLighting));
                 }
             }
         }
         river.closeRiver();
     }
 }
Esempio n. 8
0
 public static void writeData(string path, bool useCloud, bool usePath, Data data)
 {
     byte[] bytes = Encoding.UTF8.GetBytes(data.getFile());
     ReadWrite.writeBytes(path, useCloud, usePath, bytes);
 }
Esempio n. 9
0
 public static void writeBlock(string path, bool useCloud, Block block)
 {
     ReadWrite.writeBlock(path, useCloud, true, block);
 }
Esempio n. 10
0
 public static void writeBytes(string path, bool useCloud, bool usePath, byte[] bytes)
 {
     ReadWrite.writeBytes(path, useCloud, usePath, bytes, bytes.Length);
 }
Esempio n. 11
0
 public static void writeData(string path, bool useCloud, Data data)
 {
     ReadWrite.writeData(path, useCloud, true, data);
 }
Esempio n. 12
0
 public static void writeBytes(string path, bool useCloud, byte[] bytes, int size)
 {
     ReadWrite.writeBytes(path, useCloud, true, bytes, size);
 }
Esempio n. 13
0
 public static Block readBlock(string path, bool useCloud, byte prefix)
 {
     return(ReadWrite.readBlock(path, useCloud, true, prefix));
 }
Esempio n. 14
0
 public static Data readData(string path, bool useCloud)
 {
     return(ReadWrite.readData(path, useCloud, true));
 }
Esempio n. 15
0
 public static bool folderExists(string path)
 {
     return(ReadWrite.folderExists(path, true));
 }
Esempio n. 16
0
 public static void deleteFile(string path, bool useCloud)
 {
     ReadWrite.deleteFile(path, useCloud, true);
 }
Esempio n. 17
0
 public static string[] getFiles(string path)
 {
     return(ReadWrite.getFiles(path, true));
 }
Esempio n. 18
0
 public static void deleteFolder(string path)
 {
     ReadWrite.deleteFolder(path, true);
 }
Esempio n. 19
0
        public static void load()
        {
            Characters.initialApply = false;
            Provider.provider.economyService.refreshInventory();
            if (Characters.list != null)
            {
                byte b = 0;
                while ((int)b < Characters.list.Length)
                {
                    if (Characters.list[(int)b] != null)
                    {
                        if (Characters.onCharacterUpdated != null)
                        {
                            Characters.onCharacterUpdated(b, Characters.list[(int)b]);
                        }
                    }
                    b += 1;
                }
                return;
            }
            Characters.list          = new Character[(int)(Customization.FREE_CHARACTERS + Customization.PRO_CHARACTERS)];
            Characters._packageSkins = new List <ulong>();
            if (ReadWrite.fileExists("/Characters.dat", true))
            {
                Block block = ReadWrite.readBlock("/Characters.dat", true, 0);
                if (block != null)
                {
                    byte b2 = block.readByte();
                    if (b2 >= 12)
                    {
                        if (b2 >= 14)
                        {
                            ushort num = block.readUInt16();
                            for (ushort num2 = 0; num2 < num; num2 += 1)
                            {
                                ulong num3 = block.readUInt64();
                                if (num3 != 0UL)
                                {
                                    Characters.packageSkins.Add(num3);
                                }
                            }
                        }
                        Characters._selected = block.readByte();
                        if (!Provider.isPro && Characters.selected >= Customization.FREE_CHARACTERS)
                        {
                            Characters._selected = 0;
                        }
                        byte b3 = 0;
                        while ((int)b3 < Characters.list.Length)
                        {
                            ushort newShirt           = block.readUInt16();
                            ushort newPants           = block.readUInt16();
                            ushort newHat             = block.readUInt16();
                            ushort newBackpack        = block.readUInt16();
                            ushort newVest            = block.readUInt16();
                            ushort newMask            = block.readUInt16();
                            ushort newGlasses         = block.readUInt16();
                            ulong  newPackageShirt    = block.readUInt64();
                            ulong  newPackagePants    = block.readUInt64();
                            ulong  newPackageHat      = block.readUInt64();
                            ulong  newPackageBackpack = block.readUInt64();
                            ulong  newPackageVest     = block.readUInt64();
                            ulong  newPackageMask     = block.readUInt64();
                            ulong  newPackageGlasses  = block.readUInt64();
                            ushort newPrimaryItem     = block.readUInt16();
                            byte[] newPrimaryState    = block.readByteArray();
                            ushort newSecondaryItem   = block.readUInt16();
                            byte[] newSecondaryState  = block.readByteArray();
                            byte   b4      = block.readByte();
                            byte   b5      = block.readByte();
                            byte   b6      = block.readByte();
                            Color  color   = block.readColor();
                            Color  color2  = block.readColor();
                            bool   newHand = block.readBoolean();
                            string newName = block.readString();
                            if (b2 < 19)
                            {
                                newName = Provider.clientName;
                            }
                            string   newNick  = block.readString();
                            CSteamID csteamID = block.readSteamID();
                            byte     b7       = block.readByte();
                            if (!Provider.provider.communityService.checkGroup(csteamID))
                            {
                                csteamID = CSteamID.Nil;
                            }
                            if (b7 >= Customization.SKILLSETS)
                            {
                                b7 = 0;
                            }
                            if (b2 < 16)
                            {
                                b7 = (byte)Random.Range(1, (int)Customization.SKILLSETS);
                            }
                            if (b2 > 16 && b2 < 20)
                            {
                                block.readBoolean();
                            }
                            if (!Provider.isPro)
                            {
                                if (b4 >= Customization.FACES_FREE)
                                {
                                    b4 = (byte)Random.Range(0, (int)Customization.FACES_FREE);
                                }
                                if (b5 >= Customization.HAIRS_FREE)
                                {
                                    b5 = (byte)Random.Range(0, (int)Customization.HAIRS_FREE);
                                }
                                if (b6 >= Customization.BEARDS_FREE)
                                {
                                    b6 = 0;
                                }
                                if (!Customization.checkSkin(color))
                                {
                                    color = Customization.SKINS[Random.Range(0, Customization.SKINS.Length)];
                                }
                                if (!Customization.checkColor(color2))
                                {
                                    color2 = Customization.COLORS[Random.Range(0, Customization.COLORS.Length)];
                                }
                            }
                            Characters.list[(int)b3] = new Character(newShirt, newPants, newHat, newBackpack, newVest, newMask, newGlasses, newPackageShirt, newPackagePants, newPackageHat, newPackageBackpack, newPackageVest, newPackageMask, newPackageGlasses, newPrimaryItem, newPrimaryState, newSecondaryItem, newSecondaryState, b4, b5, b6, color, color2, newHand, newName, newNick, csteamID, (EPlayerSkillset)b7);
                            if (Characters.onCharacterUpdated != null)
                            {
                                Characters.onCharacterUpdated(b3, Characters.list[(int)b3]);
                            }
                            b3 += 1;
                        }
                    }
                    else
                    {
                        byte b8 = 0;
                        while ((int)b8 < Characters.list.Length)
                        {
                            Characters.list[(int)b8] = new Character();
                            if (Characters.onCharacterUpdated != null)
                            {
                                Characters.onCharacterUpdated(b8, Characters.list[(int)b8]);
                            }
                            b8 += 1;
                        }
                    }
                }
            }
            else
            {
                Characters._selected = 0;
            }
            byte b9 = 0;

            while ((int)b9 < Characters.list.Length)
            {
                if (Characters.list[(int)b9] == null)
                {
                    Characters.list[(int)b9] = new Character();
                    if (Characters.onCharacterUpdated != null)
                    {
                        Characters.onCharacterUpdated(b9, Characters.list[(int)b9]);
                    }
                }
                b9 += 1;
            }
            Characters.apply();
            Characters.hasLoaded = true;
        }
Esempio n. 20
0
 public static void moveFolder(string origin, string target)
 {
     ReadWrite.moveFolder(origin, target, true);
 }
Esempio n. 21
0
 public static void load()
 {
     LevelObjects._models                 = new GameObject().transform;
     LevelObjects.models.name             = "Objects";
     LevelObjects.models.parent           = Level.level;
     LevelObjects.models.tag              = "Logic";
     LevelObjects.models.gameObject.layer = LayerMasks.LOGIC;
     LevelObjects._objects                = new List <LevelObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._buildables             = new List <LevelBuildableObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._total              = 0;
     LevelObjects._regions            = new bool[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._loads              = new int[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects.shouldInstantlyLoad = true;
     LevelObjects.isHierarchyReady    = false;
     for (byte b = 0; b < Regions.WORLD_SIZE; b += 1)
     {
         for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1)
         {
             LevelObjects.loads[(int)b, (int)b2] = -1;
         }
     }
     for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1)
     {
         for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1)
         {
             LevelObjects.objects[(int)b3, (int)b4]    = new List <LevelObject>();
             LevelObjects.buildables[(int)b3, (int)b4] = new List <LevelBuildableObject>();
         }
     }
     if (Level.info.configData.Use_Legacy_Objects)
     {
         if (ReadWrite.fileExists(Level.info.path + "/Level/Objects.dat", false, false))
         {
             River river = new River(Level.info.path + "/Level/Objects.dat", false);
             byte  b5    = river.readByte();
             bool  flag  = true;
             if (b5 > 0)
             {
                 if (b5 > 1 && b5 < 3)
                 {
                     river.readSteamID();
                 }
                 if (b5 > 8)
                 {
                     LevelObjects.availableInstanceID = river.readUInt32();
                 }
                 else
                 {
                     LevelObjects.availableInstanceID = 1u;
                 }
                 for (byte b6 = 0; b6 < Regions.WORLD_SIZE; b6 += 1)
                 {
                     for (byte b7 = 0; b7 < Regions.WORLD_SIZE; b7 += 1)
                     {
                         ushort num = river.readUInt16();
                         for (ushort num2 = 0; num2 < num; num2 += 1)
                         {
                             Vector3    vector      = river.readSingleVector3();
                             Quaternion newRotation = river.readSingleQuaternion();
                             Vector3    newScale;
                             if (b5 > 3)
                             {
                                 newScale = river.readSingleVector3();
                             }
                             else
                             {
                                 newScale = Vector3.one;
                             }
                             ushort num3    = river.readUInt16();
                             string newName = string.Empty;
                             if (b5 > 5)
                             {
                                 newName = river.readString();
                             }
                             Guid newGUID = Guid.Empty;
                             if (b5 > 7)
                             {
                                 newGUID = river.readGUID();
                             }
                             ELevelObjectPlacementOrigin newPlacementOrigin = ELevelObjectPlacementOrigin.MANUAL;
                             if (b5 > 6)
                             {
                                 newPlacementOrigin = (ELevelObjectPlacementOrigin)river.readByte();
                             }
                             uint newInstanceID;
                             if (b5 > 8)
                             {
                                 newInstanceID = river.readUInt32();
                             }
                             else
                             {
                                 newInstanceID = LevelObjects.generateUniqueInstanceID();
                             }
                             if (num3 != 0)
                             {
                                 LevelObject levelObject = new LevelObject(vector, newRotation, newScale, num3, newName, newGUID, newPlacementOrigin, newInstanceID);
                                 if (levelObject.asset == null)
                                 {
                                     flag = false;
                                 }
                                 if (Level.isEditor)
                                 {
                                     byte b8;
                                     byte b9;
                                     Regions.tryGetCoordinate(vector, out b8, out b9);
                                     if (b8 != b6 || b9 != b7)
                                     {
                                         Debug.LogError(string.Concat(new object[]
                                         {
                                             num3,
                                             " should be in ",
                                             b8,
                                             ", ",
                                             b9,
                                             " but was in ",
                                             b6,
                                             ", ",
                                             b7,
                                             "!"
                                         }));
                                     }
                                     LevelObjects.objects[(int)b8, (int)b9].Add(levelObject);
                                 }
                                 else
                                 {
                                     LevelObjects.objects[(int)b6, (int)b7].Add(levelObject);
                                 }
                                 LevelObjects._total++;
                             }
                         }
                     }
                 }
             }
             if (flag)
             {
                 LevelObjects._hash = river.getHash();
             }
             else
             {
                 LevelObjects._hash = new byte[20];
             }
             river.closeRiver();
         }
         else
         {
             for (byte b10 = 0; b10 < Regions.WORLD_SIZE; b10 += 1)
             {
                 for (byte b11 = 0; b11 < Regions.WORLD_SIZE; b11 += 1)
                 {
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Objects/Objects_",
                         b10,
                         "_",
                         b11,
                         ".dat"
                     }), false, false))
                     {
                         River river2 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Objects/Objects_",
                             b10,
                             "_",
                             b11,
                             ".dat"
                         }), false);
                         byte b12 = river2.readByte();
                         if (b12 > 0)
                         {
                             ushort num4 = river2.readUInt16();
                             for (ushort num5 = 0; num5 < num4; num5 += 1)
                             {
                                 Vector3    position = river2.readSingleVector3();
                                 Quaternion rotation = river2.readSingleQuaternion();
                                 ushort     num6     = river2.readUInt16();
                                 string     empty    = string.Empty;
                                 Guid       empty2   = Guid.Empty;
                                 ELevelObjectPlacementOrigin placementOrigin = ELevelObjectPlacementOrigin.MANUAL;
                                 if (num6 != 0)
                                 {
                                     LevelObjects.addObject(position, rotation, Vector3.one, num6, empty, empty2, placementOrigin);
                                 }
                             }
                         }
                         river2.closeRiver();
                     }
                 }
             }
             LevelObjects._hash = new byte[20];
         }
     }
     else
     {
         LevelObjects._hash = new byte[20];
     }
     if ((Provider.isServer || Level.isEditor) && ReadWrite.fileExists(Level.info.path + "/Level/Buildables.dat", false, false))
     {
         River river3 = new River(Level.info.path + "/Level/Buildables.dat", false);
         river3.readByte();
         for (byte b13 = 0; b13 < Regions.WORLD_SIZE; b13 += 1)
         {
             for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1)
             {
                 ushort num7 = river3.readUInt16();
                 for (ushort num8 = 0; num8 < num7; num8 += 1)
                 {
                     Vector3    vector2      = river3.readSingleVector3();
                     Quaternion newRotation2 = river3.readSingleQuaternion();
                     ushort     num9         = river3.readUInt16();
                     if (num9 != 0)
                     {
                         LevelBuildableObject item = new LevelBuildableObject(vector2, newRotation2, num9);
                         if (Level.isEditor)
                         {
                             byte b15;
                             byte b16;
                             Regions.tryGetCoordinate(vector2, out b15, out b16);
                             if (b15 != b13 || b16 != b14)
                             {
                                 Debug.LogError(string.Concat(new object[]
                                 {
                                     num9,
                                     " should be in ",
                                     b15,
                                     ", ",
                                     b16,
                                     " but was in ",
                                     b13,
                                     ", ",
                                     b14,
                                     "!"
                                 }));
                             }
                             LevelObjects.buildables[(int)b15, (int)b16].Add(item);
                         }
                         else
                         {
                             LevelObjects.buildables[(int)b13, (int)b14].Add(item);
                         }
                         LevelObjects._total++;
                     }
                 }
             }
         }
         river3.closeRiver();
     }
     if (Level.info.configData.Use_Legacy_Objects && !Dedicator.isDedicated && !Level.isEditor)
     {
         for (byte b17 = 0; b17 < Regions.WORLD_SIZE; b17 += 1)
         {
             for (byte b18 = 0; b18 < Regions.WORLD_SIZE; b18 += 1)
             {
                 for (int i = 0; i < LevelObjects.objects[(int)b17, (int)b18].Count; i++)
                 {
                     LevelObject levelObject2 = LevelObjects.objects[(int)b17, (int)b18][i];
                     if (levelObject2.asset != null && !(levelObject2.transform == null))
                     {
                         if (levelObject2.asset.lod != EObjectLOD.NONE)
                         {
                             ObjectsLOD objectsLOD = levelObject2.transform.gameObject.AddComponent <ObjectsLOD>();
                             objectsLOD.lod    = levelObject2.asset.lod;
                             objectsLOD.bias   = levelObject2.asset.lodBias;
                             objectsLOD.center = levelObject2.asset.lodCenter;
                             objectsLOD.size   = levelObject2.asset.lodSize;
                             objectsLOD.calculateBounds();
                         }
                     }
                 }
             }
         }
     }
     if (Level.isEditor)
     {
         LevelObjects.reun  = new IReun[256];
         LevelObjects.step  = 0;
         LevelObjects.frame = 0;
     }
 }
Esempio n. 22
0
 public static void createFolder(string path)
 {
     ReadWrite.createFolder(path, true);
 }
Esempio n. 23
0
 // Token: 0x060025DC RID: 9692 RVA: 0x000DDDD4 File Offset: 0x000DC1D4
 public static void load()
 {
     LevelVehicles._models                 = new GameObject().transform;
     LevelVehicles.models.name             = "Vehicles";
     LevelVehicles.models.parent           = Level.spawns;
     LevelVehicles.models.tag              = "Logic";
     LevelVehicles.models.gameObject.layer = LayerMasks.LOGIC;
     if (Level.isEditor || Provider.isServer)
     {
         LevelVehicles._tables = new List <VehicleTable>();
         LevelVehicles._spawns = new List <VehicleSpawnpoint>();
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Vehicles.dat", false, false))
         {
             River river = new River(Level.info.path + "/Spawns/Vehicles.dat", false);
             byte  b     = river.readByte();
             if (b > 1 && b < 3)
             {
                 river.readSteamID();
             }
             byte b2 = river.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Color  newColor = river.readColor();
                 string text     = river.readString();
                 ushort num;
                 if (b > 3)
                 {
                     num = river.readUInt16();
                     if (num != 0 && SpawnTableTool.resolve(num) == 0)
                     {
                         Assets.errors.Add(string.Concat(new object[]
                         {
                             Level.info.name,
                             " vehicle table \"",
                             text,
                             "\" references invalid spawn table ",
                             num,
                             "!"
                         }));
                     }
                 }
                 else
                 {
                     num = 0;
                 }
                 List <VehicleTier> list = new List <VehicleTier>();
                 byte b4 = river.readByte();
                 for (byte b5 = 0; b5 < b4; b5 += 1)
                 {
                     string newName            = river.readString();
                     float  newChance          = river.readSingle();
                     List <VehicleSpawn> list2 = new List <VehicleSpawn>();
                     byte b6 = river.readByte();
                     for (byte b7 = 0; b7 < b6; b7 += 1)
                     {
                         ushort newVehicle = river.readUInt16();
                         list2.Add(new VehicleSpawn(newVehicle));
                     }
                     list.Add(new VehicleTier(list2, newName, newChance));
                 }
                 LevelVehicles.tables.Add(new VehicleTable(list, newColor, text, num));
                 if (!Level.isEditor)
                 {
                     LevelVehicles.tables[(int)b3].buildTable();
                 }
             }
             ushort num2 = river.readUInt16();
             for (int i = 0; i < (int)num2; i++)
             {
                 byte    newType  = river.readByte();
                 Vector3 newPoint = river.readSingleVector3();
                 float   newAngle = (float)(river.readByte() * 2);
                 LevelVehicles.spawns.Add(new VehicleSpawnpoint(newType, newPoint, newAngle));
             }
             river.closeRiver();
         }
     }
 }
Esempio n. 24
0
 public static void createHidden(string path)
 {
     ReadWrite.createHidden(path, true);
 }
Esempio n. 25
0
 // Token: 0x060025C9 RID: 9673 RVA: 0x000DD148 File Offset: 0x000DB548
 public static void load()
 {
     LevelRoads._models                 = new GameObject().transform;
     LevelRoads.models.name             = "Roads";
     LevelRoads.models.parent           = Level.level;
     LevelRoads.models.tag              = "Logic";
     LevelRoads.models.gameObject.layer = LayerMasks.LOGIC;
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Roads.unity3d", false, false))
     {
         Bundle bundle = Bundles.getBundle(Level.info.path + "/Environment/Roads.unity3d", false);
         UnityEngine.Object[] array = bundle.load();
         bundle.unload();
         LevelRoads._materials = new RoadMaterial[array.Length];
         for (int i = 0; i < LevelRoads.materials.Length; i++)
         {
             LevelRoads.materials[i] = new RoadMaterial((Texture2D)array[i]);
         }
     }
     else
     {
         LevelRoads._materials = new RoadMaterial[0];
     }
     LevelRoads.roads = new List <Road>();
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Roads.dat", false, false))
     {
         River river = new River(Level.info.path + "/Environment/Roads.dat", false);
         byte  b     = river.readByte();
         if (b > 0)
         {
             byte b2 = river.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 if ((int)b3 >= LevelRoads.materials.Length)
                 {
                     break;
                 }
                 LevelRoads.materials[(int)b3].width  = river.readSingle();
                 LevelRoads.materials[(int)b3].height = river.readSingle();
                 LevelRoads.materials[(int)b3].depth  = river.readSingle();
                 if (b > 1)
                 {
                     LevelRoads.materials[(int)b3].offset = river.readSingle();
                 }
                 LevelRoads.materials[(int)b3].isConcrete = river.readBoolean();
             }
         }
         river.closeRiver();
     }
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Paths.dat", false, false))
     {
         River river2 = new River(Level.info.path + "/Environment/Paths.dat", false);
         byte  b4     = river2.readByte();
         if (b4 > 1)
         {
             ushort num = river2.readUInt16();
             for (ushort num2 = 0; num2 < num; num2 += 1)
             {
                 ushort           num3        = river2.readUInt16();
                 byte             newMaterial = river2.readByte();
                 bool             newLoop     = b4 > 2 && river2.readBoolean();
                 List <RoadJoint> list        = new List <RoadJoint>();
                 for (ushort num4 = 0; num4 < num3; num4 += 1)
                 {
                     Vector3   vertex = river2.readSingleVector3();
                     Vector3[] array2 = new Vector3[2];
                     if (b4 > 2)
                     {
                         array2[0] = river2.readSingleVector3();
                         array2[1] = river2.readSingleVector3();
                     }
                     ERoadMode mode;
                     if (b4 > 2)
                     {
                         mode = (ERoadMode)river2.readByte();
                     }
                     else
                     {
                         mode = ERoadMode.FREE;
                     }
                     float offset;
                     if (b4 > 4)
                     {
                         offset = river2.readSingle();
                     }
                     else
                     {
                         offset = 0f;
                     }
                     bool      ignoreTerrain = b4 > 3 && river2.readBoolean();
                     RoadJoint item          = new RoadJoint(vertex, array2, mode, offset, ignoreTerrain);
                     list.Add(item);
                 }
                 if (b4 < 3)
                 {
                     for (ushort num5 = 0; num5 < num3; num5 += 1)
                     {
                         RoadJoint roadJoint = list[(int)num5];
                         if (num5 == 0)
                         {
                             roadJoint.setTangent(0, (roadJoint.vertex - list[(int)(num5 + 1)].vertex).normalized * 2.5f);
                             roadJoint.setTangent(1, (list[(int)(num5 + 1)].vertex - roadJoint.vertex).normalized * 2.5f);
                         }
                         else if (num5 == num3 - 1)
                         {
                             roadJoint.setTangent(0, (list[(int)(num5 - 1)].vertex - roadJoint.vertex).normalized * 2.5f);
                             roadJoint.setTangent(1, (roadJoint.vertex - list[(int)(num5 - 1)].vertex).normalized * 2.5f);
                         }
                         else
                         {
                             roadJoint.setTangent(0, (list[(int)(num5 - 1)].vertex - roadJoint.vertex).normalized * 2.5f);
                             roadJoint.setTangent(1, (list[(int)(num5 + 1)].vertex - roadJoint.vertex).normalized * 2.5f);
                         }
                     }
                 }
                 LevelRoads.roads.Add(new Road(newMaterial, num2, newLoop, list));
             }
         }
         else if (b4 > 0)
         {
             byte b5 = river2.readByte();
             for (byte b6 = 0; b6 < b5; b6 += 1)
             {
                 byte             b7           = river2.readByte();
                 byte             newMaterial2 = river2.readByte();
                 List <RoadJoint> list2        = new List <RoadJoint>();
                 for (byte b8 = 0; b8 < b7; b8 += 1)
                 {
                     Vector3   vertex2  = river2.readSingleVector3();
                     Vector3[] tangents = new Vector3[2];
                     ERoadMode mode2    = ERoadMode.FREE;
                     RoadJoint item2    = new RoadJoint(vertex2, tangents, mode2, 0f, false);
                     list2.Add(item2);
                 }
                 for (byte b9 = 0; b9 < b7; b9 += 1)
                 {
                     RoadJoint roadJoint2 = list2[(int)b9];
                     if (b9 == 0)
                     {
                         roadJoint2.setTangent(0, (roadJoint2.vertex - list2[(int)(b9 + 1)].vertex).normalized * 2.5f);
                         roadJoint2.setTangent(1, (list2[(int)(b9 + 1)].vertex - roadJoint2.vertex).normalized * 2.5f);
                     }
                     else if (b9 == b7 - 1)
                     {
                         roadJoint2.setTangent(0, (list2[(int)(b9 - 1)].vertex - roadJoint2.vertex).normalized * 2.5f);
                         roadJoint2.setTangent(1, (roadJoint2.vertex - list2[(int)(b9 - 1)].vertex).normalized * 2.5f);
                     }
                     else
                     {
                         roadJoint2.setTangent(0, (list2[(int)(b9 - 1)].vertex - roadJoint2.vertex).normalized * 2.5f);
                         roadJoint2.setTangent(1, (list2[(int)(b9 + 1)].vertex - roadJoint2.vertex).normalized * 2.5f);
                     }
                 }
                 LevelRoads.roads.Add(new Road(newMaterial2, (ushort)b6, false, list2));
             }
         }
         river2.closeRiver();
     }
     if (LevelGround.terrain != null)
     {
         LevelRoads.buildMeshes();
     }
     if (!LevelRoads.isListeningForLandscape)
     {
         LevelRoads.isListeningForLandscape = true;
         if (LevelRoads.< > f__mg$cache0 == null)
         {
             LevelRoads.< > f__mg$cache0 = new LandscapeLoadedHandler(LevelRoads.handleLandscapeLoaded);
         }
         Landscape.loaded += LevelRoads.< > f__mg$cache0;
     }
 }
Esempio n. 26
0
 public static bool fileExists(string path, bool useCloud)
 {
     return(ReadWrite.fileExists(path, useCloud, true));
 }
Esempio n. 27
0
 private static void exportItems(string path, Data spawnsData, ref ushort id, bool isLegacy)
 {
     for (int i = 0; i < LevelItems.tables.Count; i++)
     {
         ItemTable itemTable = LevelItems.tables[i];
         if (itemTable.tableID == 0)
         {
             itemTable.tableID = id;
             spawnsData.writeString(id.ToString(), Level.info.name + "_" + itemTable.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/Items/",
                 itemTable.name,
                 "/",
                 itemTable.name,
                 ".dat"
             }), false, true))
             {
                 Data data3 = ReadWrite.readData(string.Concat(new string[]
                 {
                     "/Bundles/Spawns/Items/",
                     itemTable.name,
                     "/",
                     itemTable.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(), itemTable.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 (itemTable.tiers.Count > 1)
                     {
                         float num = float.MaxValue;
                         for (int j = 0; j < itemTable.tiers.Count; j++)
                         {
                             ItemTier itemTier = itemTable.tiers[j];
                             if (itemTier.chance < num)
                             {
                                 num = itemTier.chance;
                             }
                         }
                         int num2 = Mathf.CeilToInt(10f / num);
                         data4.writeInt32("Tables", itemTable.tiers.Count);
                         for (int k = 0; k < itemTable.tiers.Count; k++)
                         {
                             ItemTier itemTier2 = itemTable.tiers[k];
                             bool     flag      = SpawnTableTool.isVariantItemTier(itemTier2);
                             if (flag && ReadWrite.fileExists(string.Concat(new string[]
                             {
                                 "/Bundles/Spawns/Items/",
                                 itemTier2.name,
                                 "/",
                                 itemTier2.name,
                                 ".dat"
                             }), false, true))
                             {
                                 Data data6 = ReadWrite.readData(string.Concat(new string[]
                                 {
                                     "/Bundles/Spawns/Items/",
                                     itemTier2.name,
                                     "/",
                                     itemTier2.name,
                                     ".dat"
                                 }), false, true);
                                 data4.writeUInt16("Table_" + k + "_Spawn_ID", data6.readUInt16("ID"));
                                 data4.writeInt32("Table_" + k + "_Weight", (int)(itemTier2.chance * (float)num2));
                             }
                             else if (flag && ReadWrite.fileExists(string.Concat(new string[]
                             {
                                 path,
                                 "/Items/",
                                 itemTier2.name,
                                 "/",
                                 itemTier2.name,
                                 ".dat"
                             }), false, false))
                             {
                                 Data data7 = ReadWrite.readData(string.Concat(new string[]
                                 {
                                     path,
                                     "/Items/",
                                     itemTier2.name,
                                     "/",
                                     itemTier2.name,
                                     ".dat"
                                 }), false, false);
                                 data4.writeUInt16("Table_" + k + "_Spawn_ID", data7.readUInt16("ID"));
                                 data4.writeInt32("Table_" + k + "_Weight", (int)(itemTier2.chance * (float)num2));
                             }
                             else
                             {
                                 data4.writeUInt16("Table_" + k + "_Spawn_ID", id);
                                 data4.writeInt32("Table_" + k + "_Weight", (int)(itemTier2.chance * (float)num2));
                                 if (flag)
                                 {
                                     spawnsData.writeString(id.ToString(), itemTier2.name);
                                 }
                                 else
                                 {
                                     spawnsData.writeString(id.ToString(), itemTable.name + "_" + itemTier2.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", itemTier2.table.Count);
                                 for (int l = 0; l < itemTier2.table.Count; l++)
                                 {
                                     ItemSpawn itemSpawn = itemTier2.table[l];
                                     data8.writeUInt16("Table_" + l + "_Asset_ID", itemSpawn.item);
                                     data8.writeInt32("Table_" + l + "_Weight", 10);
                                 }
                                 if (flag)
                                 {
                                     ReadWrite.writeData(string.Concat(new string[]
                                     {
                                         path,
                                         "/Items/",
                                         itemTier2.name,
                                         "/",
                                         itemTier2.name,
                                         ".dat"
                                     }), false, false, data8);
                                 }
                                 else
                                 {
                                     ReadWrite.writeData(string.Concat(new string[]
                                     {
                                         path,
                                         "/Items/",
                                         itemTable.name,
                                         "_",
                                         itemTier2.name,
                                         "/",
                                         itemTable.name,
                                         "_",
                                         itemTier2.name,
                                         ".dat"
                                     }), false, false, data8);
                                 }
                             }
                         }
                     }
                     else
                     {
                         ItemTier itemTier3 = itemTable.tiers[0];
                         data4.writeInt32("Tables", itemTier3.table.Count);
                         for (int m = 0; m < itemTier3.table.Count; m++)
                         {
                             ItemSpawn itemSpawn2 = itemTier3.table[m];
                             data4.writeUInt16("Table_" + m + "_Asset_ID", itemSpawn2.item);
                             data4.writeInt32("Table_" + m + "_Weight", 10);
                         }
                     }
                 }
                 ReadWrite.writeData(string.Concat(new string[]
                 {
                     path,
                     "/Items/",
                     itemTable.name,
                     "/",
                     itemTable.name,
                     ".dat"
                 }), false, false, data4);
             }
             ReadWrite.writeData(string.Concat(new string[]
             {
                 path,
                 "/Items/",
                 Level.info.name,
                 "_",
                 itemTable.name,
                 "/",
                 Level.info.name,
                 "_",
                 itemTable.name,
                 ".dat"
             }), false, false, data);
         }
     }
 }
Esempio n. 28
0
 public static void serializeXML <T>(string path, bool useCloud, T instance)
 {
     ReadWrite.serializeXML <T>(path, useCloud, true, instance);
 }