Exemple #1
0
    IEnumerator AssembleHTBlock()
    {
        if (working && currentLoadingHTerrainBlock.Count > 0)
        {
            Area.AreaDataType areaData    = AreaData.areas.Dequeue();
            QueueItem         HTGroupItem = currentLoadingHTerrainBlock.Dequeue();
            if (HTGroupItem.Block != null)
            {
                HTGroupItem.Block.SetActive(false);
                loadedTerrainLoD1Materials.Add(new Material(terrainDefault));
                int frameSpread = 8; // spreading terrain chunks creation over multiple frames
                for (int i = 1; i <= frameSpread; i++)
                {
                    GenerateQuarterAreaTerrain(frameSpread, i, areaData, HTGroupItem.Block, HTGroupItem.mapName, HTGroupItem.x, HTGroupItem.y);
                    yield return(null);
                }
                HTGroupItem.Block.transform.SetParent(transform);
                HTGroupItem.Block.transform.localScale = new Vector3(-1, 1, -1);
                HTGroupItem.Block.SetActive(true);

                // LoD Material //
                TexFile   texFile    = new TexFile();
                string    mapName    = HTGroupItem.mapName;
                int       x          = HTGroupItem.x;
                int       y          = HTGroupItem.y;
                string    texPath    = @"AIDX\Map\" + mapName + @"\" + mapName + "." + x.ToString("X").ToLower() + y.ToString("X").ToLower() + ".tex";
                Texture2D LoDTexture = texFile.ReadToTexture2D(texPath);
                if (LoDTexture != null)
                {
                    loadedTerrainLoD1Materials[loadedTerrainLoD1Materials.Count - 1].mainTexture = LoDTexture;
                }
            }
        }
        frameBusy = false;
    }
Exemple #2
0
    private void Update()
    {
        if (interacted)
        {
            interacted = false;
            // clicked folder //
            if (currentPath != previousPath)
            {
                previousPath = currentPath;
                BreadCrumb.GetComponent <UnityEngine.UI.Text>().text = currentPath;
                OpenFolder();
            }
            // clicked file //
            if (currentSelected != previousSelected)
            {
                previousSelected = currentSelected;
                if (previousSelectedFileIcon != null)
                {
                    previousSelectedFileIcon.GetComponent <UnityEngine.UI.Image>().color = Color.white;
                }
                currentSelectedFileIcon.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 1, .2f);
                string infoText = "";
                infoText += currentPath + "\\" + currentSelected + "\n";
                //infoText += "Name Offset: " + fileList[currentSelected].nameOffset + "\n";
                string compression = "Uncompressed";
                if (fileList[currentSelected].flags == 3)
                {
                    compression = "ZLib";
                }
                else if (fileList[currentSelected].flags == 5)
                {
                    compression = "LZMA";
                }
                infoText += "Compression: " + fileList[currentSelected].flags + " " + compression + "\n";
                DateTime date = new DateTime((long)fileList[currentSelected].writeTime);
                infoText += "Write Time: " + date.Hour + ":" + date.Minute + " - " + date.Day + "\\" + date.Month + "\\" + date.Year + "\n";
                infoText += "Uncompressed Size: " + fileList[currentSelected].uncompressedSize + "\n";
                infoText += "Compressed Size: " + fileList[currentSelected].compressedSize + "\n";
                infoText += "Hash: " + DataManager.ToHex(fileList[currentSelected].hash, false) + "\n";
                infoText += "Unknown: " + fileList[currentSelected].unk2 + "\n";
                fileProperties.GetComponent <UnityEngine.UI.Text>().text = infoText;

                DataManager.ExtractFile(currentPath + "\\" + currentSelected);
                //DataManager.GetFileBytes(currentPath + "\\" + currentSelected);

                // Texture File //
                if (Path.GetExtension(currentSelected).ToLower() == ".tex")
                {
                    TexFile texFile = new TexFile();

                    texFile.Read(currentPath + @"\" + currentSelected);
                    Texture2D tex = texFile.ReadToTexture2D(currentPath + @"\" + currentSelected);
                    texturePreview.GetComponent <UnityEngine.UI.RawImage>().texture = tex;

                    string texPropertiesString = "";
                    texPropertiesString += "Type: " + texFile.header2.version + "\n";
                    texPropertiesString += "Dimensions: " + texFile.header2.width + "x" + +texFile.header2.height + "\n";
                    texPropertiesString += "Depth: " + texFile.header2.depth + "\n";
                    texPropertiesString += "Sides: " + texFile.header2.faces + "\n";
                    texPropertiesString += "MipmapCount: " + texFile.header2.mipCount + "\n";
                    string format = texFile.header2.format.ToString();

                    /*
                     * if (texFile.header2.format == 13)
                     *  format = "DXT1";
                     * else if (texFile.header2.format == 14)
                     *  format = "DXT3";
                     * else if (texFile.header2.format == 15)
                     *  format = "DXT5";
                     */
                    texPropertiesString += "Format: " + format + "\n";
                    texPropertiesString += "Sizes: " + texFile.header2.sizes[0] + " " + texFile.header2.sizes[1] + " " + texFile.header2.sizes[2] + " " + texFile.header2.sizes[3] + " " + texFile.header2.sizes[4] + " " + texFile.header2.sizes[5] + " " +
                                           texFile.header2.sizes[6] + " " + texFile.header2.sizes[7] + " " + texFile.header2.sizes[8] + " " + texFile.header2.sizes[9] + " " + texFile.header2.sizes[10] + " " + texFile.header2.sizes[11] + " " + texFile.header2.sizes[12] + " " +
                                           texFile.header2.sizes[13] + " " + "\n";
                    texPropertiesString += "unk1: " + texFile.header2.unk1 + "\n";
                    texPropertiesString += "unk2: " + texFile.header2.unk2[0] + " " + texFile.header2.unk2[1] + " " + texFile.header2.unk2[2] + " " + "\n";
                    texPropertiesString += "unk3: " + texFile.header2.unk3 + "\n";
                    specificProperties.GetComponent <UnityEngine.UI.Text>().text = texPropertiesString;
                }
            }
        }
    }