예제 #1
0
 public static void load()
 {
     if (ReadWrite.fileExists(Level.info.path + "/Editor/Height.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Editor/Height.dat", false, false, 0);
         byte  b     = block.readByte();
         EditorTerrainHeight.brushSize     = block.readByte();
         EditorTerrainHeight.brushStrength = block.readSingle();
         EditorTerrainHeight.brushHeight   = block.readSingle();
         if (b > 1)
         {
             EditorTerrainHeight.brushNoise = block.readSingle();
         }
         else
         {
             EditorTerrainHeight.brushNoise = 0f;
         }
     }
     else
     {
         EditorTerrainHeight.brushSize     = EditorTerrainHeight.MIN_BRUSH_SIZE;
         EditorTerrainHeight.brushStrength = 1f;
         EditorTerrainHeight.brushHeight   = 0f;
         EditorTerrainHeight.brushNoise    = 0f;
     }
 }
예제 #2
0
 // Token: 0x06001FF2 RID: 8178 RVA: 0x000B0694 File Offset: 0x000AEA94
 public static bool fileExists(SteamPlayerID playerID, string path)
 {
     if (PlayerSavedata.hasSync)
     {
         return(ReadWrite.fileExists(string.Concat(new object[]
         {
             "/Sync/",
             playerID.steamID,
             "_",
             playerID.characterID,
             "/",
             Level.info.name,
             path
         }), false));
     }
     return(ServerSavedata.fileExists(string.Concat(new object[]
     {
         "/Players/",
         playerID.steamID,
         "_",
         playerID.characterID,
         "/",
         Level.info.name,
         path
     })));
 }
예제 #3
0
 private void Start()
 {
     EditorObjects._isBuilding  = false;
     EditorObjects._dragStart   = Vector2.zero;
     EditorObjects._dragEnd     = Vector2.zero;
     EditorObjects._isDragging  = false;
     EditorObjects.selection    = new List <EditorSelection>();
     EditorObjects.handlePlane  = default(Plane);
     EditorObjects.group        = new GameObject().transform;
     EditorObjects.group.name   = "Group";
     EditorObjects.group.parent = Level.editing;
     EditorObjects.handle       = ((GameObject)Object.Instantiate(Resources.Load("Edit/Handles"))).transform;
     EditorObjects.handle.name  = "Handle";
     EditorObjects.handle.gameObject.SetActive(false);
     EditorObjects.handle.parent   = Level.editing;
     EditorObjects.transformHandle = EditorObjects.handle.FindChild("Transform");
     EditorObjects.planeHandle     = EditorObjects.handle.FindChild("Plane");
     EditorObjects.rotateHandle    = EditorObjects.handle.FindChild("Rotate");
     EditorObjects.scaleHandle     = EditorObjects.handle.FindChild("Scale");
     EditorObjects.dragMode        = EDragMode.TRANSFORM;
     EditorObjects.dragCoordinate  = EDragCoordinate.GLOBAL;
     EditorObjects.dragable        = new List <EditorDrag>();
     if (ReadWrite.fileExists(Level.info.path + "/Editor/Objects.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Editor/Objects.dat", false, false, 1);
         EditorObjects.snapTransform = block.readSingle();
         EditorObjects.snapRotation  = block.readSingle();
     }
     else
     {
         EditorObjects.snapTransform = 1f;
         EditorObjects.snapRotation  = 15f;
     }
 }
예제 #4
0
 // Token: 0x06001FE6 RID: 8166 RVA: 0x000AFDF4 File Offset: 0x000AE1F4
 public static Local read(string path)
 {
     if (ReadWrite.fileExists(Provider.path + Provider.language + path, false, false))
     {
         return(new Local(ReadWrite.readData(Provider.path + Provider.language + path, false, false)));
     }
     return(new Local());
 }
예제 #5
0
		public static byte[] getLevelHash(string path, bool usePath)
		{
			if (ReadWrite.fileExists(path + "/Level.dat", false, usePath))
			{
				Block block = ReadWrite.readBlock(path + "/Level.dat", false, usePath, 1);
				return block.getHash();
			}
			return new byte[20];
		}
예제 #6
0
 public static void load()
 {
     if (Level.isVR)
     {
         LevelVisibility.roadsVisible       = false;
         LevelVisibility._navigationVisible = false;
         LevelVisibility._nodesVisible      = false;
         LevelVisibility._itemsVisible      = false;
         LevelVisibility.playersVisible     = false;
         LevelVisibility._zombiesVisible    = false;
         LevelVisibility._vehiclesVisible   = false;
         LevelVisibility.borderVisible      = false;
         LevelVisibility._animalsVisible    = false;
         return;
     }
     if (Level.isEditor)
     {
         if (ReadWrite.fileExists(Level.info.path + "/Level/Visibility.dat", false, false))
         {
             River river = new River(Level.info.path + "/Level/Visibility.dat", false);
             byte  b     = river.readByte();
             if (b > 0)
             {
                 LevelVisibility.roadsVisible      = river.readBoolean();
                 LevelVisibility.navigationVisible = river.readBoolean();
                 LevelVisibility.nodesVisible      = river.readBoolean();
                 LevelVisibility.itemsVisible      = river.readBoolean();
                 LevelVisibility.playersVisible    = river.readBoolean();
                 LevelVisibility.zombiesVisible    = river.readBoolean();
                 LevelVisibility.vehiclesVisible   = river.readBoolean();
                 LevelVisibility.borderVisible     = river.readBoolean();
                 if (b > 1)
                 {
                     LevelVisibility.animalsVisible = river.readBoolean();
                 }
                 else
                 {
                     LevelVisibility._animalsVisible = true;
                 }
                 river.closeRiver();
             }
         }
         else
         {
             LevelVisibility._roadsVisible      = true;
             LevelVisibility._navigationVisible = true;
             LevelVisibility._nodesVisible      = true;
             LevelVisibility._itemsVisible      = true;
             LevelVisibility._playersVisible    = true;
             LevelVisibility._zombiesVisible    = true;
             LevelVisibility._vehiclesVisible   = true;
             LevelVisibility._borderVisible     = true;
             LevelVisibility._animalsVisible    = true;
         }
     }
 }
예제 #7
0
 // Token: 0x06001FE5 RID: 8165 RVA: 0x000AFD70 File Offset: 0x000AE170
 public static Local tryRead(string path, bool usePath)
 {
     if (ReadWrite.fileExists(path + "/" + Provider.language + ".dat", false, usePath))
     {
         return(new Local(ReadWrite.readData(path + "/" + Provider.language + ".dat", false, usePath)));
     }
     if (ReadWrite.fileExists(path + "/English.dat", false, usePath))
     {
         return(new Local(ReadWrite.readData(path + "/English.dat", false, usePath)));
     }
     return(new Local());
 }
예제 #8
0
 private static bool checkEntered()
 {
     if (MenuWorkshopSubmitUI.nameField.text.Length == 0)
     {
         MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Name"));
         return(false);
     }
     if (MenuWorkshopSubmitUI.previewField.text.Length == 0 || !ReadWrite.fileExists(MenuWorkshopSubmitUI.previewField.text, false, false) || new FileInfo(MenuWorkshopSubmitUI.previewField.text).Length > 1000000L)
     {
         MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Preview"));
         return(false);
     }
     return(true);
 }
예제 #9
0
 public static void load()
 {
     if (ReadWrite.fileExists(Level.info.path + "/Editor/Spawns.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Editor/Spawns.dat", false, false, 1);
         EditorSpawns.rotation = block.readSingle();
         EditorSpawns.radius   = block.readByte();
     }
     else
     {
         EditorSpawns.rotation = 0f;
         EditorSpawns.radius   = EditorSpawns.MIN_REMOVE_SIZE;
     }
 }
예제 #10
0
        public static void open()
        {
            if (MenuPlayConfigUI.active)
            {
                return;
            }
            MenuPlayConfigUI.active = true;
            if (ReadWrite.fileExists("/Worlds/Singleplayer_" + Characters.selected + "/Config.json", false))
            {
                try
                {
                    MenuPlayConfigUI.configData = ReadWrite.deserializeJSON <ConfigData>("/Worlds/Singleplayer_" + Characters.selected + "/Config.json", false);
                }
                catch
                {
                    MenuPlayConfigUI.configData = null;
                }
                if (MenuPlayConfigUI.configData == null)
                {
                    MenuPlayConfigUI.configData = new ConfigData();
                }
            }
            else
            {
                MenuPlayConfigUI.configData = new ConfigData();
            }
            EGameMode singleplayerMode = PlaySettings.singleplayerMode;

            if (singleplayerMode != EGameMode.EASY)
            {
                if (singleplayerMode != EGameMode.NORMAL)
                {
                    if (singleplayerMode == EGameMode.HARD)
                    {
                        MenuPlayConfigUI.modeConfigData = MenuPlayConfigUI.configData.Hard;
                    }
                }
                else
                {
                    MenuPlayConfigUI.modeConfigData = MenuPlayConfigUI.configData.Normal;
                }
            }
            else
            {
                MenuPlayConfigUI.modeConfigData = MenuPlayConfigUI.configData.Easy;
            }
            MenuPlayConfigUI.refreshConfig();
            MenuPlayConfigUI.container.lerpPositionScale(0f, 0f, ESleekLerp.EXPONENTIAL, 20f);
        }
예제 #11
0
        private static void updateSelection()
        {
            if (PlaySettings.editorMap == null || PlaySettings.editorMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.editorMap);

            if (level == null)
            {
                return;
            }
            Local local = Localization.tryRead(level.path, false);

            if (local != null)
            {
                MenuWorkshopEditorUI.descriptionBox.text = local.format("Description");
            }
            if (local != null && local.has("Name"))
            {
                MenuWorkshopEditorUI.selectedBox.text = local.format("Name");
            }
            else
            {
                MenuWorkshopEditorUI.selectedBox.text = PlaySettings.editorMap;
            }
            if (MenuWorkshopEditorUI.previewImage.texture != null && MenuWorkshopEditorUI.previewImage.shouldDestroyTexture)
            {
                Object.Destroy(MenuWorkshopEditorUI.previewImage.texture);
                MenuWorkshopEditorUI.previewImage.texture = null;
            }
            string path = level.path + "/Preview.png";

            if (!ReadWrite.fileExists(path, false, false))
            {
                path = level.path + "/Level.png";
            }
            if (ReadWrite.fileExists(path, false, false))
            {
                byte[]    array     = ReadWrite.readBytes(path, false, false);
                Texture2D texture2D = new Texture2D(320, 180, 5, false, true);
                texture2D.name       = "Preview_" + PlaySettings.editorMap + "_Selected_Icon";
                texture2D.filterMode = 2;
                texture2D.hideFlags  = 61;
                texture2D.LoadImage(array);
                MenuWorkshopEditorUI.previewImage.texture = texture2D;
            }
        }
예제 #12
0
 // Token: 0x06001EBB RID: 7867 RVA: 0x000A7EE4 File Offset: 0x000A62E4
 public static void load()
 {
     if (ReadWrite.fileExists(Level.info.path + "/Editor/Camera.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Editor/Camera.dat", false, false, 1);
         MainCamera.instance.transform.parent.position = block.readSingleVector3();
         MainCamera.instance.transform.localRotation   = Quaternion.Euler(block.readSingle(), 0f, 0f);
         MainCamera.instance.transform.parent.rotation = Quaternion.Euler(0f, block.readSingle(), 0f);
     }
     else
     {
         MainCamera.instance.transform.parent.position = new Vector3(0f, Level.TERRAIN, 0f);
         MainCamera.instance.transform.parent.rotation = Quaternion.identity;
         MainCamera.instance.transform.localRotation   = Quaternion.identity;
     }
 }
예제 #13
0
 public Bundle(string path, bool usePath, bool loadFromResources)
 {
     this.loadFromResources = loadFromResources;
     if (!loadFromResources && ReadWrite.fileExists(path, false, usePath))
     {
         this.asset = AssetBundle.LoadFromFile((!usePath) ? path : (ReadWrite.PATH + path));
     }
     else
     {
         this.asset = null;
     }
     this.name = ReadWrite.fileName(path);
     if (this.asset == null)
     {
         this.resource = ReadWrite.folderPath(path).Substring(1);
     }
 }
예제 #14
0
 // Token: 0x060025B9 RID: 9657 RVA: 0x000DCC18 File Offset: 0x000DB018
 public static void load()
 {
     LevelPlayers._models                 = new GameObject().transform;
     LevelPlayers.models.name             = "Players";
     LevelPlayers.models.parent           = Level.spawns;
     LevelPlayers.models.tag              = "Logic";
     LevelPlayers.models.gameObject.layer = LayerMasks.LOGIC;
     LevelPlayers._spawns                 = new List <PlayerSpawnpoint>();
     if (ReadWrite.fileExists(Level.info.path + "/Spawns/Players.dat", false, false))
     {
         River river = new River(Level.info.path + "/Spawns/Players.dat", false);
         byte  b     = river.readByte();
         if (b > 1 && b < 3)
         {
             river.readSteamID();
         }
         int  num  = 0;
         int  num2 = 0;
         byte b2   = river.readByte();
         for (int i = 0; i < (int)b2; i++)
         {
             Vector3 point = river.readSingleVector3();
             float   angle = (float)(river.readByte() * 2);
             bool    flag  = false;
             if (b > 3)
             {
                 flag = river.readBoolean();
             }
             if (flag)
             {
                 num2++;
             }
             else
             {
                 num++;
             }
             LevelPlayers.addSpawn(point, angle, flag);
         }
         river.closeRiver();
     }
 }
예제 #15
0
		public static LevelInfo getLevel(string path, bool usePath)
		{
			if (ReadWrite.fileExists(path + "/Level.dat", false, usePath))
			{
				Block block = ReadWrite.readBlock(path + "/Level.dat", false, usePath, 0);
				byte b = block.readByte();
				bool newEditable = block.readSteamID() == Provider.client || ReadWrite.fileExists(path + "/.unlocker", false, usePath);
				ELevelSize newSize = (ELevelSize)block.readByte();
				ELevelType newType = ELevelType.SURVIVAL;
				if (b > 1)
				{
					newType = (ELevelType)block.readByte();
				}
				LevelInfoConfigData levelInfoConfigData;
				if (ReadWrite.fileExists(path + "/Config.json", false, usePath))
				{
					try
					{
						levelInfoConfigData = ReadWrite.deserializeJSON<LevelInfoConfigData>(path + "/Config.json", false, usePath);
					}
					catch
					{
						levelInfoConfigData = null;
					}
					if (levelInfoConfigData == null)
					{
						levelInfoConfigData = new LevelInfoConfigData();
					}
				}
				else
				{
					levelInfoConfigData = new LevelInfoConfigData();
				}
				return new LevelInfo((!usePath) ? path : (ReadWrite.PATH + path), ReadWrite.folderName(path), newSize, newType, newEditable, levelInfoConfigData);
			}
			return null;
		}
예제 #16
0
 public static bool checkLocalizationMeta(string path, bool usePath)
 {
     return(ReadWrite.fileExists(path + "/Localization.meta", false, usePath));
 }
예제 #17
0
 public static void load()
 {
     OptionsSettings.restoreDefaults();
     if (ReadWrite.fileExists("/Options.dat", true))
     {
         Block block = ReadWrite.readBlock("/Options.dat", true, 0);
         if (block != null)
         {
             byte b = block.readByte();
             if (b > 2)
             {
                 OptionsSettings.music = block.readBoolean();
                 if (b < 20)
                 {
                     OptionsSettings.timer = false;
                 }
                 else
                 {
                     OptionsSettings.timer = block.readBoolean();
                 }
                 if (b < 10)
                 {
                     block.readBoolean();
                 }
                 if (b > 7)
                 {
                     OptionsSettings.fov = block.readSingle();
                 }
                 else
                 {
                     OptionsSettings.fov = block.readSingle() * 0.5f;
                 }
                 if (b < 24)
                 {
                     OptionsSettings.fov *= 1.5f;
                     OptionsSettings.fov  = Mathf.Clamp01(OptionsSettings.fov);
                 }
                 if (b > 4)
                 {
                     OptionsSettings.volume = block.readSingle();
                 }
                 else
                 {
                     OptionsSettings.volume = 1f;
                 }
                 if (b > 22)
                 {
                     OptionsSettings.voice = block.readSingle();
                 }
                 else
                 {
                     OptionsSettings.voice = 1f;
                 }
                 OptionsSettings.debug    = block.readBoolean();
                 OptionsSettings.gore     = block.readBoolean();
                 OptionsSettings.filter   = block.readBoolean();
                 OptionsSettings.chatText = block.readBoolean();
                 if (b > 8)
                 {
                     OptionsSettings.chatVoiceIn = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.chatVoiceIn = true;
                 }
                 OptionsSettings.chatVoiceOut = block.readBoolean();
                 OptionsSettings.metric       = block.readBoolean();
                 if (b > 24)
                 {
                     OptionsSettings.talk = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.talk = false;
                 }
                 if (b > 3)
                 {
                     OptionsSettings.hints = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.hints = true;
                 }
                 if (b > 13)
                 {
                     OptionsSettings.ambience = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.ambience = true;
                 }
                 if (b > 12)
                 {
                     OptionsSettings.proUI = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.proUI = true;
                 }
                 if (b > 20)
                 {
                     OptionsSettings.hitmarker = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.hitmarker = false;
                 }
                 if (b > 21)
                 {
                     OptionsSettings.streamer = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.streamer = false;
                 }
                 if (b > 25)
                 {
                     OptionsSettings.featuredWorkshop = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.featuredWorkshop = true;
                 }
                 if (b > 28)
                 {
                     OptionsSettings.matchmakingShowAllMaps = block.readBoolean();
                 }
                 else
                 {
                     OptionsSettings.matchmakingShowAllMaps = false;
                 }
                 if (b > 27)
                 {
                     OptionsSettings.minMatchmakingPlayers = block.readInt32();
                 }
                 else
                 {
                     OptionsSettings.minMatchmakingPlayers = 12;
                 }
                 if (b > 26)
                 {
                     OptionsSettings.maxMatchmakingPing = block.readInt32();
                 }
                 else
                 {
                     OptionsSettings.maxMatchmakingPing = 300;
                 }
                 if (b > 6)
                 {
                     OptionsSettings.crosshairColor         = block.readColor();
                     OptionsSettings.hitmarkerColor         = block.readColor();
                     OptionsSettings.criticalHitmarkerColor = block.readColor();
                     OptionsSettings.cursorColor            = block.readColor();
                 }
                 else
                 {
                     OptionsSettings.crosshairColor         = Color.white;
                     OptionsSettings.hitmarkerColor         = Color.white;
                     OptionsSettings.criticalHitmarkerColor = Color.red;
                     OptionsSettings.cursorColor            = Color.white;
                 }
                 if (b > 18)
                 {
                     OptionsSettings.backgroundColor = block.readColor();
                     OptionsSettings.foregroundColor = block.readColor();
                     OptionsSettings.fontColor       = block.readColor();
                 }
                 else
                 {
                     OptionsSettings.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
                     OptionsSettings.foregroundColor = new Color(0.9f, 0.9f, 0.9f);
                     OptionsSettings.fontColor       = new Color(0.9f, 0.9f, 0.9f);
                 }
                 return;
             }
         }
     }
 }
예제 #18
0
 // Token: 0x06002560 RID: 9568 RVA: 0x000D90CC File Offset: 0x000D74CC
 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();
     }
 }
예제 #19
0
 public static void load()
 {
     if (ReadWrite.fileExists("/Play.dat", true))
     {
         Block block = ReadWrite.readBlock("/Play.dat", true, 0);
         if (block != null)
         {
             byte b = block.readByte();
             if (b > 1)
             {
                 PlaySettings.connectIP       = block.readString();
                 PlaySettings.connectPort     = block.readUInt16();
                 PlaySettings.connectPassword = block.readString();
                 if (b > 3)
                 {
                     PlaySettings.serversName = block.readString();
                 }
                 else
                 {
                     PlaySettings.serversName = string.Empty;
                 }
                 PlaySettings.serversPassword  = block.readString();
                 PlaySettings.singleplayerMode = (EGameMode)block.readByte();
                 if (b < 8)
                 {
                     PlaySettings.singleplayerMode = EGameMode.NORMAL;
                 }
                 if (b > 10)
                 {
                     PlaySettings.matchmakingMode = (EGameMode)block.readByte();
                 }
                 else
                 {
                     PlaySettings.matchmakingMode = EGameMode.NORMAL;
                 }
                 if (b < 7)
                 {
                     PlaySettings.singleplayerCheats = false;
                 }
                 else
                 {
                     PlaySettings.singleplayerCheats = block.readBoolean();
                 }
                 if (b > 4)
                 {
                     PlaySettings.singleplayerMap = block.readString();
                     PlaySettings.editorMap       = block.readString();
                 }
                 else
                 {
                     PlaySettings.singleplayerMap = string.Empty;
                     PlaySettings.editorMap       = string.Empty;
                 }
                 if (b > 10)
                 {
                     PlaySettings.matchmakingMap = block.readString();
                 }
                 else
                 {
                     PlaySettings.matchmakingMap = string.Empty;
                 }
                 if (b > 5)
                 {
                     PlaySettings.isVR = block.readBoolean();
                     if (b < 9)
                     {
                         PlaySettings.isVR = false;
                     }
                 }
                 else
                 {
                     PlaySettings.isVR = false;
                 }
                 if (b < 10)
                 {
                     PlaySettings.singleplayerCategory = ESingleplayerMapCategory.OFFICIAL;
                 }
                 else
                 {
                     PlaySettings.singleplayerCategory = (ESingleplayerMapCategory)block.readByte();
                 }
                 return;
             }
         }
     }
     PlaySettings.connectIP            = "127.0.0.1";
     PlaySettings.connectPort          = 27015;
     PlaySettings.connectPassword      = string.Empty;
     PlaySettings.serversName          = string.Empty;
     PlaySettings.serversPassword      = string.Empty;
     PlaySettings.singleplayerMode     = EGameMode.NORMAL;
     PlaySettings.matchmakingMode      = EGameMode.NORMAL;
     PlaySettings.singleplayerCheats   = false;
     PlaySettings.singleplayerMap      = string.Empty;
     PlaySettings.matchmakingMap       = string.Empty;
     PlaySettings.editorMap            = string.Empty;
     PlaySettings.singleplayerCategory = ESingleplayerMapCategory.OFFICIAL;
 }
예제 #20
0
        public static void save()
        {
            River river = new River(Level.info.path + "/Environment/Bounds.dat", false);

            river.writeByte(LevelNavigation.SAVEDATA_BOUNDS_VERSION);
            river.writeByte((byte)LevelNavigation.bounds.Count);
            byte b = 0;

            while ((int)b < LevelNavigation.bounds.Count)
            {
                river.writeSingleVector3(LevelNavigation.bounds[(int)b].center);
                river.writeSingleVector3(LevelNavigation.bounds[(int)b].size);
                b += 1;
            }
            river.closeRiver();
            River river2 = new River(Level.info.path + "/Environment/Flags_Data.dat", false);

            river2.writeByte(LevelNavigation.SAVEDATA_FLAG_DATA_VERSION);
            river2.writeByte((byte)LevelNavigation.flagData.Count);
            byte b2 = 0;

            while ((int)b2 < LevelNavigation.flagData.Count)
            {
                river2.writeString(LevelNavigation.flagData[(int)b2].difficultyGUID);
                river2.writeByte(LevelNavigation.flagData[(int)b2].maxZombies);
                river2.writeBoolean(LevelNavigation.flagData[(int)b2].spawnZombies);
                b2 += 1;
            }
            river2.closeRiver();
            River river3 = new River(Level.info.path + "/Environment/Flags.dat", false);

            river3.writeByte(LevelNavigation.SAVEDATA_FLAGS_VERSION);
            int num = LevelNavigation.flags.Count;

            while (ReadWrite.fileExists(string.Concat(new object[]
            {
                Level.info.path,
                "/Environment/Navigation_",
                num,
                ".dat"
            }), false, false))
            {
                ReadWrite.deleteFile(string.Concat(new object[]
                {
                    Level.info.path,
                    "/Environment/Navigation_",
                    num,
                    ".dat"
                }), false, false);
                num++;
            }
            river3.writeByte((byte)LevelNavigation.flags.Count);
            byte b3 = 0;

            while ((int)b3 < LevelNavigation.flags.Count)
            {
                Flag flag = LevelNavigation.flags[(int)b3];
                river3.writeSingleVector3(flag.point);
                river3.writeSingle(flag.width);
                river3.writeSingle(flag.height);
                if (flag.needsNavigationSave)
                {
                    River river4 = new River(string.Concat(new object[]
                    {
                        Level.info.path,
                        "/Environment/Navigation_",
                        b3,
                        ".dat"
                    }), false);
                    river4.writeByte(LevelNavigation.SAVEDATA_NAVIGATION_VERSION);
                    RecastGraph graph = flag.graph;
                    river4.writeSingleVector3(graph.forcedBoundsCenter);
                    river4.writeSingleVector3(graph.forcedBoundsSize);
                    river4.writeByte((byte)graph.tileXCount);
                    river4.writeByte((byte)graph.tileZCount);
                    RecastGraph.NavmeshTile[] tiles = graph.GetTiles();
                    for (int i = 0; i < graph.tileZCount; i++)
                    {
                        for (int j = 0; j < graph.tileXCount; j++)
                        {
                            RecastGraph.NavmeshTile navmeshTile = tiles[j + i * graph.tileXCount];
                            river4.writeUInt16((ushort)navmeshTile.tris.Length);
                            for (int k = 0; k < navmeshTile.tris.Length; k++)
                            {
                                river4.writeUInt16((ushort)navmeshTile.tris[k]);
                            }
                            river4.writeUInt16((ushort)navmeshTile.verts.Length);
                            for (int l = 0; l < navmeshTile.verts.Length; l++)
                            {
                                Int3 @int = navmeshTile.verts[l];
                                river4.writeInt32(@int.x);
                                river4.writeInt32(@int.y);
                                river4.writeInt32(@int.z);
                            }
                        }
                    }
                    river4.closeRiver();
                    flag.needsNavigationSave = false;
                }
                b3 += 1;
            }
            river3.closeRiver();
        }
예제 #21
0
 public static void load()
 {
     LevelNavigation._models                 = new GameObject().transform;
     LevelNavigation.models.name             = "Navigation";
     LevelNavigation.models.parent           = Level.level;
     LevelNavigation.models.tag              = "Logic";
     LevelNavigation.models.gameObject.layer = LayerMasks.LOGIC;
     LevelNavigation._bounds                 = new List <Bounds>();
     LevelNavigation.flagData                = new List <FlagData>();
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Bounds.dat", false, false))
     {
         River river = new River(Level.info.path + "/Environment/Bounds.dat", false);
         byte  b     = river.readByte();
         if (b > 0)
         {
             byte b2 = river.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Vector3 vector  = river.readSingleVector3();
                 Vector3 vector2 = river.readSingleVector3();
                 LevelNavigation.bounds.Add(new Bounds(vector, vector2));
             }
         }
         river.closeRiver();
     }
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Flags_Data.dat", false, false))
     {
         River river2 = new River(Level.info.path + "/Environment/Flags_Data.dat", false);
         byte  b4     = river2.readByte();
         if (b4 > 0)
         {
             byte b5 = river2.readByte();
             for (byte b6 = 0; b6 < b5; b6 += 1)
             {
                 string newDifficultyGUID = river2.readString();
                 byte   newMaxZombies     = 64;
                 if (b4 > 1)
                 {
                     newMaxZombies = river2.readByte();
                 }
                 bool newSpawnZombies = true;
                 if (b4 > 2)
                 {
                     newSpawnZombies = river2.readBoolean();
                 }
                 LevelNavigation.flagData.Add(new FlagData(newDifficultyGUID, newMaxZombies, newSpawnZombies));
             }
         }
         river2.closeRiver();
     }
     if (LevelNavigation.flagData.Count < LevelNavigation.bounds.Count)
     {
         for (int i = LevelNavigation.flagData.Count; i < LevelNavigation.bounds.Count; i++)
         {
             LevelNavigation.flagData.Add(new FlagData(string.Empty, 64, true));
         }
     }
     if (Level.isEditor)
     {
         LevelNavigation.flags = new List <Flag>();
         Object.Destroy(AstarPath.active.GetComponent <TileHandlerHelpers>());
         if (ReadWrite.fileExists(Level.info.path + "/Environment/Flags.dat", false, false))
         {
             River river3 = new River(Level.info.path + "/Environment/Flags.dat", false);
             byte  b7     = river3.readByte();
             if (b7 > 2)
             {
                 byte b8 = river3.readByte();
                 for (byte b9 = 0; b9 < b8; b9 += 1)
                 {
                     Vector3 newPoint = river3.readSingleVector3();
                     float   num      = river3.readSingle();
                     float   num2     = river3.readSingle();
                     if (b7 < 4)
                     {
                         num  *= 0.5f;
                         num2 *= 0.5f;
                     }
                     RecastGraph recastGraph = null;
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Environment/Navigation_",
                         b9,
                         ".dat"
                     }), false, false))
                     {
                         River river4 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Environment/Navigation_",
                             b9,
                             ".dat"
                         }), false);
                         byte b10 = river4.readByte();
                         if (b10 > 0)
                         {
                             recastGraph = LevelNavigation.buildGraph(river4);
                         }
                         river4.closeRiver();
                     }
                     if (recastGraph == null)
                     {
                         recastGraph = LevelNavigation.addGraph();
                     }
                     LevelNavigation.flags.Add(new Flag(newPoint, num, num2, recastGraph, LevelNavigation.flagData[(int)b9]));
                 }
             }
             river3.closeRiver();
         }
     }
     else if (Provider.isServer)
     {
         byte b11 = 0;
         while (ReadWrite.fileExists(string.Concat(new object[]
         {
             Level.info.path,
             "/Environment/Navigation_",
             b11,
             ".dat"
         }), false, false))
         {
             River river5 = new River(string.Concat(new object[]
             {
                 Level.info.path,
                 "/Environment/Navigation_",
                 b11,
                 ".dat"
             }), false);
             byte b12 = river5.readByte();
             if (b12 > 0)
             {
                 LevelNavigation.buildGraph(river5);
             }
             river5.closeRiver();
             b11 += 1;
         }
     }
 }
예제 #22
0
 public static void load()
 {
     ControlsSettings.restoreDefaults();
     if (ReadWrite.fileExists("/Controls.dat", true))
     {
         Block block = ReadWrite.readBlock("/Controls.dat", true, 0);
         if (block != null)
         {
             byte b = block.readByte();
             if (b > 10)
             {
                 ControlsSettings.sensitivity = block.readSingle();
                 if (b < 16)
                 {
                     ControlsSettings.sensitivity = 1f;
                 }
                 ControlsSettings.invert = block.readBoolean();
                 if (b > 13)
                 {
                     ControlsSettings.invertFlight = block.readBoolean();
                 }
                 else
                 {
                     ControlsSettings.invertFlight = false;
                 }
                 if (b > 11)
                 {
                     ControlsSettings.aiming    = (EControlMode)block.readByte();
                     ControlsSettings.crouching = (EControlMode)block.readByte();
                     ControlsSettings.proning   = (EControlMode)block.readByte();
                 }
                 else
                 {
                     ControlsSettings.aiming    = EControlMode.HOLD;
                     ControlsSettings.crouching = EControlMode.TOGGLE;
                     ControlsSettings.proning   = EControlMode.TOGGLE;
                 }
                 if (b > 12)
                 {
                     ControlsSettings.sprinting = (EControlMode)block.readByte();
                 }
                 else
                 {
                     ControlsSettings.sprinting = EControlMode.HOLD;
                 }
                 if (b > 14)
                 {
                     ControlsSettings.leaning = (EControlMode)block.readByte();
                 }
                 else
                 {
                     ControlsSettings.leaning = EControlMode.HOLD;
                 }
                 byte b2 = block.readByte();
                 for (byte b3 = 0; b3 < b2; b3 += 1)
                 {
                     if ((int)b3 >= ControlsSettings.bindings.Length)
                     {
                         block.readByte();
                     }
                     else
                     {
                         ushort key = block.readUInt16();
                         ControlsSettings.bind(b3, key);
                     }
                 }
                 if (b < 17)
                 {
                     ControlsSettings.bind(ControlsSettings.DEQUIP, 301);
                 }
             }
         }
     }
 }
예제 #23
0
 public static bool fileExists(string path)
 {
     return(ReadWrite.fileExists(ServerSavedata.directory + "/" + Provider.serverID + path, false));
 }
예제 #24
0
        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[]    array     = ReadWrite.readBytes(level.path + "/Icon.png", false, false);
                Texture2D texture2D = new Texture2D(380, 80, 5, false, true);
                texture2D.name      = "Icon_" + level.name + "_List_Icon";
                texture2D.hideFlags = 61;
                texture2D.LoadImage(array);
                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    = 4;
            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    = 4;
            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);
                }
            }
        }
예제 #25
0
 // Token: 0x060024E6 RID: 9446 RVA: 0x000D33D8 File Offset: 0x000D17D8
 public static void load()
 {
     LevelItems._models                 = new GameObject().transform;
     LevelItems.models.name             = "Items";
     LevelItems.models.parent           = Level.spawns;
     LevelItems.models.tag              = "Logic";
     LevelItems.models.gameObject.layer = LayerMasks.LOGIC;
     if (Level.isEditor || Provider.isServer)
     {
         LevelItems._tables = new List <ItemTable>();
         LevelItems._spawns = new List <ItemSpawnpoint> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Items.dat", false, false))
         {
             Block block = ReadWrite.readBlock(Level.info.path + "/Spawns/Items.dat", false, false, 0);
             byte  b     = block.readByte();
             if (b > 1 && b < 3)
             {
                 block.readSteamID();
             }
             byte b2 = block.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Color  newColor = block.readColor();
                 string text     = block.readString();
                 ushort num;
                 if (b > 3)
                 {
                     num = block.readUInt16();
                     if (num != 0 && SpawnTableTool.resolve(num) == 0)
                     {
                         Assets.errors.Add(string.Concat(new object[]
                         {
                             Level.info.name,
                             " item table \"",
                             text,
                             "\" references invalid spawn table ",
                             num,
                             "!"
                         }));
                     }
                 }
                 else
                 {
                     num = 0;
                 }
                 List <ItemTier> list = new List <ItemTier>();
                 byte            b4   = block.readByte();
                 for (byte b5 = 0; b5 < b4; b5 += 1)
                 {
                     string           newName   = block.readString();
                     float            newChance = block.readSingle();
                     List <ItemSpawn> list2     = new List <ItemSpawn>();
                     byte             b6        = block.readByte();
                     for (byte b7 = 0; b7 < b6; b7 += 1)
                     {
                         ushort    num2      = block.readUInt16();
                         ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, num2);
                         if (itemAsset != null && !itemAsset.isPro)
                         {
                             list2.Add(new ItemSpawn(num2));
                         }
                     }
                     if (list2.Count > 0)
                     {
                         list.Add(new ItemTier(list2, newName, newChance));
                     }
                 }
                 LevelItems.tables.Add(new ItemTable(list, newColor, text, num));
                 if (!Level.isEditor)
                 {
                     LevelItems.tables[(int)b3].buildTable();
                 }
             }
         }
         for (byte b8 = 0; b8 < Regions.WORLD_SIZE; b8 += 1)
         {
             for (byte b9 = 0; b9 < Regions.WORLD_SIZE; b9 += 1)
             {
                 LevelItems.spawns[(int)b8, (int)b9] = new List <ItemSpawnpoint>();
             }
         }
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Jars.dat", false, false))
         {
             River river = new River(Level.info.path + "/Spawns/Jars.dat", false);
             byte  b10   = river.readByte();
             if (b10 > 0)
             {
                 for (byte b11 = 0; b11 < Regions.WORLD_SIZE; b11 += 1)
                 {
                     for (byte b12 = 0; b12 < Regions.WORLD_SIZE; b12 += 1)
                     {
                         ushort num3 = river.readUInt16();
                         for (ushort num4 = 0; num4 < num3; num4 += 1)
                         {
                             byte    newType  = river.readByte();
                             Vector3 newPoint = river.readSingleVector3();
                             LevelItems.spawns[(int)b11, (int)b12].Add(new ItemSpawnpoint(newType, newPoint));
                         }
                     }
                 }
             }
             river.closeRiver();
         }
         else
         {
             for (byte b13 = 0; b13 < Regions.WORLD_SIZE; b13 += 1)
             {
                 for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1)
                 {
                     LevelItems.spawns[(int)b13, (int)b14] = new List <ItemSpawnpoint>();
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Spawns/Items_",
                         b13,
                         "_",
                         b14,
                         ".dat"
                     }), false, false))
                     {
                         River river2 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Spawns/Items_",
                             b13,
                             "_",
                             b14,
                             ".dat"
                         }), false);
                         byte b15 = river2.readByte();
                         if (b15 > 0)
                         {
                             ushort num5 = river2.readUInt16();
                             for (ushort num6 = 0; num6 < num5; num6 += 1)
                             {
                                 byte    newType2  = river2.readByte();
                                 Vector3 newPoint2 = river2.readSingleVector3();
                                 LevelItems.spawns[(int)b13, (int)b14].Add(new ItemSpawnpoint(newType2, newPoint2));
                             }
                         }
                         river2.closeRiver();
                     }
                 }
             }
         }
     }
 }
예제 #26
0
 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);
         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, 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, 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;
     }
 }
예제 #27
0
 public static void load()
 {
     if (ReadWrite.fileExists("/Filters.dat", true))
     {
         Block block = ReadWrite.readBlock("/Filters.dat", true, 0);
         if (block != null)
         {
             byte b = block.readByte();
             if (b > 2)
             {
                 FilterSettings.filterMap = block.readString();
                 if (b > 5)
                 {
                     FilterSettings.filterPassword = (EPassword)block.readByte();
                     FilterSettings.filterWorkshop = (EWorkshop)block.readByte();
                 }
                 else
                 {
                     block.readBoolean();
                     block.readBoolean();
                     FilterSettings.filterPassword = EPassword.NO;
                     FilterSettings.filterWorkshop = EWorkshop.NO;
                 }
                 if (b < 7)
                 {
                     FilterSettings.filterPlugins = EPlugins.ANY;
                 }
                 else
                 {
                     FilterSettings.filterPlugins = (EPlugins)block.readByte();
                 }
                 FilterSettings.filterAttendance    = (EAttendance)block.readByte();
                 FilterSettings.filterVACProtection = (EVACProtectionFilter)block.readByte();
                 if (b > 10)
                 {
                     FilterSettings.filterBattlEyeProtection = (EBattlEyeProtectionFilter)block.readByte();
                 }
                 else
                 {
                     FilterSettings.filterBattlEyeProtection = EBattlEyeProtectionFilter.Secure;
                 }
                 FilterSettings.filterCombat = (ECombat)block.readByte();
                 if (b < 8)
                 {
                     FilterSettings.filterCheats = ECheats.NO;
                 }
                 else
                 {
                     FilterSettings.filterCheats = (ECheats)block.readByte();
                 }
                 FilterSettings.filterMode = (EGameMode)block.readByte();
                 if (b < 9)
                 {
                     FilterSettings.filterMode = EGameMode.NORMAL;
                 }
                 if (b > 3)
                 {
                     FilterSettings.filterCamera = (ECameraMode)block.readByte();
                 }
                 else
                 {
                     FilterSettings.filterCamera = ECameraMode.ANY;
                 }
                 return;
             }
         }
     }
     FilterSettings.filterMap                = string.Empty;
     FilterSettings.filterPassword           = EPassword.NO;
     FilterSettings.filterWorkshop           = EWorkshop.NO;
     FilterSettings.filterPlugins            = EPlugins.ANY;
     FilterSettings.filterAttendance         = EAttendance.SPACE;
     FilterSettings.filterVACProtection      = EVACProtectionFilter.Secure;
     FilterSettings.filterBattlEyeProtection = EBattlEyeProtectionFilter.Secure;
     FilterSettings.filterCombat             = ECombat.ANY;
     FilterSettings.filterCheats             = ECheats.NO;
     FilterSettings.filterMode               = EGameMode.NORMAL;
     FilterSettings.filterCamera             = ECameraMode.ANY;
 }
예제 #28
0
 public static bool checkMapMeta(string path, bool usePath)
 {
     return(ReadWrite.fileExists(path + "/Map.meta", false, usePath));
 }
예제 #29
0
 public static void load()
 {
     LevelZombies._models                 = new GameObject().transform;
     LevelZombies.models.name             = "Zombies";
     LevelZombies.models.parent           = Level.spawns;
     LevelZombies.models.tag              = "Logic";
     LevelZombies.models.gameObject.layer = LayerMasks.LOGIC;
     LevelZombies.tables = new List <ZombieTable>();
     if (ReadWrite.fileExists(Level.info.path + "/Spawns/Zombies.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Spawns/Zombies.dat", false, false, 0);
         byte  b     = block.readByte();
         if (b > 3 && b < 5)
         {
             block.readSteamID();
         }
         if (b > 2)
         {
             byte b2 = block.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Color  newColor     = block.readColor();
                 string newName      = block.readString();
                 bool   flag         = block.readBoolean();
                 ushort newHealth    = block.readUInt16();
                 byte   newDamage    = block.readByte();
                 byte   newLootIndex = block.readByte();
                 ushort newLootID;
                 if (b > 6)
                 {
                     newLootID = block.readUInt16();
                 }
                 else
                 {
                     newLootID = 0;
                 }
                 uint newXP;
                 if (b > 7)
                 {
                     newXP = block.readUInt32();
                 }
                 else if (flag)
                 {
                     newXP = 40u;
                 }
                 else
                 {
                     newXP = 3u;
                 }
                 float newRegen = 10f;
                 if (b > 5)
                 {
                     newRegen = block.readSingle();
                 }
                 string newDifficultyGUID = string.Empty;
                 if (b > 8)
                 {
                     newDifficultyGUID = block.readString();
                 }
                 ZombieSlot[] array = new ZombieSlot[4];
                 byte         b4    = block.readByte();
                 for (byte b5 = 0; b5 < b4; b5 += 1)
                 {
                     List <ZombieCloth> list = new List <ZombieCloth>();
                     float newChance         = block.readSingle();
                     byte  b6 = block.readByte();
                     for (byte b7 = 0; b7 < b6; b7 += 1)
                     {
                         ushort num = block.readUInt16();
                         if ((ItemAsset)Assets.find(EAssetType.ITEM, num) != null)
                         {
                             list.Add(new ZombieCloth(num));
                         }
                     }
                     array[(int)b5] = new ZombieSlot(newChance, list);
                 }
                 LevelZombies.tables.Add(new ZombieTable(array, newColor, newName, flag, newHealth, newDamage, newLootIndex, newLootID, newXP, newRegen, newDifficultyGUID));
             }
         }
         else
         {
             byte b8 = block.readByte();
             for (byte b9 = 0; b9 < b8; b9 += 1)
             {
                 Color        newColor2     = block.readColor();
                 string       newName2      = block.readString();
                 byte         newLootIndex2 = block.readByte();
                 ZombieSlot[] array2        = new ZombieSlot[4];
                 byte         b10           = block.readByte();
                 for (byte b11 = 0; b11 < b10; b11 += 1)
                 {
                     List <ZombieCloth> list2 = new List <ZombieCloth>();
                     float newChance2         = block.readSingle();
                     byte  b12 = block.readByte();
                     for (byte b13 = 0; b13 < b12; b13 += 1)
                     {
                         ushort num2 = block.readUInt16();
                         if ((ItemAsset)Assets.find(EAssetType.ITEM, num2) != null)
                         {
                             list2.Add(new ZombieCloth(num2));
                         }
                     }
                     array2[(int)b11] = new ZombieSlot(newChance2, list2);
                 }
                 LevelZombies.tables.Add(new ZombieTable(array2, newColor2, newName2, false, 100, 15, newLootIndex2, 0, 5u, 10f, string.Empty));
             }
         }
     }
     LevelZombies._spawns = new List <ZombieSpawnpoint> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1)
     {
         for (byte b15 = 0; b15 < Regions.WORLD_SIZE; b15 += 1)
         {
             LevelZombies.spawns[(int)b14, (int)b15] = new List <ZombieSpawnpoint>();
         }
     }
     if (Level.isEditor)
     {
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Animals.dat", false, false))
         {
             River river = new River(Level.info.path + "/Spawns/Animals.dat", false);
             byte  b16   = river.readByte();
             if (b16 > 0)
             {
                 for (byte b17 = 0; b17 < Regions.WORLD_SIZE; b17 += 1)
                 {
                     for (byte b18 = 0; b18 < Regions.WORLD_SIZE; b18 += 1)
                     {
                         ushort num3 = river.readUInt16();
                         for (ushort num4 = 0; num4 < num3; num4 += 1)
                         {
                             byte    newType  = river.readByte();
                             Vector3 newPoint = river.readSingleVector3();
                             LevelZombies.spawns[(int)b17, (int)b18].Add(new ZombieSpawnpoint(newType, newPoint));
                         }
                     }
                 }
             }
             river.closeRiver();
         }
         else
         {
             for (byte b19 = 0; b19 < Regions.WORLD_SIZE; b19 += 1)
             {
                 for (byte b20 = 0; b20 < Regions.WORLD_SIZE; b20 += 1)
                 {
                     LevelZombies.spawns[(int)b19, (int)b20] = new List <ZombieSpawnpoint>();
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Spawns/Animals_",
                         b19,
                         "_",
                         b20,
                         ".dat"
                     }), false, false))
                     {
                         River river2 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Spawns/Animals_",
                             b19,
                             "_",
                             b20,
                             ".dat"
                         }), false);
                         byte b21 = river2.readByte();
                         if (b21 > 0)
                         {
                             ushort num5 = river2.readUInt16();
                             for (ushort num6 = 0; num6 < num5; num6 += 1)
                             {
                                 byte    newType2  = river2.readByte();
                                 Vector3 newPoint2 = river2.readSingleVector3();
                                 LevelZombies.spawns[(int)b19, (int)b20].Add(new ZombieSpawnpoint(newType2, newPoint2));
                             }
                             river2.closeRiver();
                         }
                     }
                 }
             }
         }
     }
     else if (Provider.isServer)
     {
         LevelZombies._zombies = new List <ZombieSpawnpoint> [LevelNavigation.bounds.Count];
         for (int i = 0; i < LevelZombies.zombies.Length; i++)
         {
             LevelZombies.zombies[i] = new List <ZombieSpawnpoint>();
         }
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Animals.dat", false, false))
         {
             River river3 = new River(Level.info.path + "/Spawns/Animals.dat", false);
             byte  b22    = river3.readByte();
             if (b22 > 0)
             {
                 for (byte b23 = 0; b23 < Regions.WORLD_SIZE; b23 += 1)
                 {
                     for (byte b24 = 0; b24 < Regions.WORLD_SIZE; b24 += 1)
                     {
                         ushort num7 = river3.readUInt16();
                         for (ushort num8 = 0; num8 < num7; num8 += 1)
                         {
                             byte    newType3 = river3.readByte();
                             Vector3 vector   = river3.readSingleVector3();
                             byte    b25;
                             if (LevelNavigation.tryGetBounds(vector, out b25) && LevelNavigation.checkNavigation(vector))
                             {
                                 LevelZombies.zombies[(int)b25].Add(new ZombieSpawnpoint(newType3, vector));
                             }
                         }
                     }
                 }
             }
             river3.closeRiver();
         }
         else
         {
             for (byte b26 = 0; b26 < Regions.WORLD_SIZE; b26 += 1)
             {
                 for (byte b27 = 0; b27 < Regions.WORLD_SIZE; b27 += 1)
                 {
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Spawns/Animals_",
                         b26,
                         "_",
                         b27,
                         ".dat"
                     }), false, false))
                     {
                         River river4 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Spawns/Animals_",
                             b26,
                             "_",
                             b27,
                             ".dat"
                         }), false);
                         byte b28 = river4.readByte();
                         if (b28 > 0)
                         {
                             ushort num9 = river4.readUInt16();
                             for (ushort num10 = 0; num10 < num9; num10 += 1)
                             {
                                 byte    newType4 = river4.readByte();
                                 Vector3 vector2  = river4.readSingleVector3();
                                 byte    b29;
                                 if (LevelNavigation.tryGetBounds(vector2, out b29) && LevelNavigation.checkNavigation(vector2))
                                 {
                                     LevelZombies.zombies[(int)b29].Add(new ZombieSpawnpoint(newType4, vector2));
                                 }
                             }
                             river4.closeRiver();
                         }
                     }
                 }
             }
         }
     }
 }
예제 #30
0
 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();
         }
     }
 }