Example #1
0
    void fixAtlasFolders(ref retinaProAtlas atlasItem)
    {
        for (int i = 0; i < retinaProDataSerialize.sharedInstance.deviceList.Count; i++)
        {
            retinaProDevice di = retinaProDataSerialize.sharedInstance.deviceList[i];

            if (!di.isDeviceValid())
            {
                continue;
            }

            string reqPath = retinaProConfig.atlasTextureFolder + di.name + "/" + atlasItem.atlasName;

            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + reqPath);
            if (dinfo == null || !dinfo.Exists)
            {
                dinfo.Create();
            }
        }
    }
Example #2
0
    bool showFoldersUI(ref retinaProAtlas atlasItem)
    {
        if (atlasItem == null)
        {
            return(false);
        }

        bool valid = true;

        for (int i = 0; i < retinaProDataSerialize.sharedInstance.deviceList.Count; i++)
        {
            retinaProDevice di = retinaProDataSerialize.sharedInstance.deviceList[i];

            if (!di.isDeviceValid())
            {
                continue;
            }

            string reqPath = retinaProConfig.atlasTextureFolder + di.name + "/" + atlasItem.atlasName;

            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + reqPath);
            if (dinfo != null && dinfo.Exists)
            {
                continue;
            }

            valid = false;

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));

            Color col = GUI.color;
            GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
            GUILayout.Label("Add folder: " + reqPath);
            GUI.color = col;

            GUILayout.EndHorizontal();
        }

        return(valid);
    }
    void showDeviceUI()
    {
        bool save = false;

        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);
        EditorGUILayout.Space();
        GUILayout.Label("Devices", EditorStyles.boldLabel);
        EditorGUILayout.Space();
        EditorGUI.EndDisabledGroup();

        // begin scrolling section which contains all of our device list items
        GUILayout.BeginVertical();

        Vector2 deviceScrollPos = Vector2.zero;

        deviceScrollPos.x = EditorPrefs.GetFloat("deviceScrollPosX", 0.0f);
        deviceScrollPos.y = EditorPrefs.GetFloat("deviceScrollPosY", 0.0f);

        deviceScrollPos = GUILayout.BeginScrollView(deviceScrollPos, false, false);

        EditorPrefs.SetFloat("deviceScrollPosX", deviceScrollPos.x);
        EditorPrefs.SetFloat("deviceScrollPosY", deviceScrollPos.y);

        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);

        // show each device and it's configuration
        if (retinaProDataSerialize.sharedInstance.deviceList != null)
        {
            for (int i = 0; i < retinaProDataSerialize.sharedInstance.deviceList.Count; i++)
            {
                retinaProDevice rpd = retinaProDataSerialize.sharedInstance.deviceList[i];

                GUILayout.BeginHorizontal();

                GUILayout.Label("Name:", GUILayout.Width(60f));
                if (rpd != null)
                {
                    string n = GUILayout.TextField(rpd.name, GUILayout.MaxWidth(150f));
                    if (n.CompareTo(rpd.name) != 0)
                    {
                        rpd.name = n;
                        save     = true;
                    }
                }

//				EditorGUILayout.Space();

                bool removeDevice = GUILayout.Button("Remove", GUILayout.Width(60f));
                if (removeDevice)
                {
                    retinaProDataSerialize.sharedInstance.deviceList.RemoveAt(i);
                    save = true;
                    break;
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Pixel Size:", GUILayout.Width(60f));
                if (rpd != null)
                {
                    float p = EditorGUILayout.FloatField(rpd.pixelSize, GUILayout.Width(60f));
                    if (p != rpd.pixelSize)
                    {
                        rpd.pixelSize = p;
                        save          = true;
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("UIRoot:", GUILayout.Width(60f));
                if (rpd != null)
                {
                    if (!rpd.rootAuto)
                    {
                        {
                            int rw = EditorGUILayout.IntField(rpd.rootWidth, GUILayout.Width(60f));
                            if (rw != rpd.rootWidth)
                            {
                                rpd.rootWidth = rw;
                                save          = true;
                            }
                        }

                        GUILayout.Label("X", GUILayout.Width(15f));

                        {
                            int rh = EditorGUILayout.IntField(rpd.rootHeight, GUILayout.Width(60f));
                            if (rh != rpd.rootHeight)
                            {
                                rpd.rootHeight = rh;
                                save           = true;
                            }
                        }

                        {
                            bool useForBothLandscapePortrait = GUILayout.Toggle(rpd.rootUseBothPortLand, "Port & Land", GUILayout.Width(80f));
                            if (useForBothLandscapePortrait != rpd.rootUseBothPortLand)
                            {
                                rpd.rootUseBothPortLand = useForBothLandscapePortrait;
                                save = true;
                            }
                        }
                    }

                    bool autoRoot = false;
                    if (rpd.rootAuto)
                    {
                        autoRoot = GUILayout.Toggle(rpd.rootAuto, "Auto (sets UIRoot manual height based on screen size)", GUILayout.Width(330f));
                    }
                    else
                    {
                        autoRoot = GUILayout.Toggle(rpd.rootAuto, "Auto", GUILayout.Width(50f));
                    }


                    if (autoRoot != rpd.rootAuto)
                    {
                        rpd.rootAuto = autoRoot;
                        save         = true;
                    }
                }
                GUILayout.EndHorizontal();

                if (rpd.screens != null)
                {
                    for (int rsi = 0; rsi < rpd.screens.Count; rsi++)
                    {
                        retinaProScreen rps = rpd.screens[rsi];

                        if (rps != null)
                        {
                            GUILayout.BeginHorizontal();
                            GUILayout.Label("Screen:", GUILayout.Width(60f));

                            {
                                int w = EditorGUILayout.IntField(rps.width, GUILayout.Width(60f));
                                if (w != rps.width)
                                {
                                    rps.width = w;
                                    save      = true;
                                }
                            }

                            GUILayout.Label("X", GUILayout.Width(15f));

                            {
                                int h = EditorGUILayout.IntField(rps.height, GUILayout.Width(60f));
                                if (h != rps.height)
                                {
                                    rps.height = h;
                                    save       = true;
                                }
                            }

                            {
                                bool useForBothLandscapePortrait = GUILayout.Toggle(rps.useForBothLandscapePortrait, "Port & Land", GUILayout.Width(80f));
                                if (useForBothLandscapePortrait != rps.useForBothLandscapePortrait)
                                {
                                    rps.useForBothLandscapePortrait = useForBothLandscapePortrait;
                                    save = true;
                                }
                            }

                            {
                                bool pressed = GUILayout.Button("X", GUILayout.Width(20f));
                                if (pressed)
                                {
                                    rpd.screens.RemoveAt(rsi);
                                    save = true;
                                    break;
                                }
                            }

                            GUILayout.EndHorizontal();
                        }
                    }
                }

                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(60f));

                    bool pressed = GUILayout.Button("Add Screen", GUILayout.Width(85f));
                    if (pressed)
                    {
                        retinaProScreen newScreen = new retinaProScreen();
                        rpd.screens.Add(newScreen);
                        save = true;
                    }
                    GUILayout.EndHorizontal();
                }



                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
        }


        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(60f));

            bool pressed = GUILayout.Button("Add Device", GUILayout.Width(100f));
            if (pressed)
            {
                retinaProDevice newItem = new retinaProDevice();
                retinaProDataSerialize.sharedInstance.deviceList.Add(newItem);
                save = true;
            }
            GUILayout.EndHorizontal();
        }

        EditorGUI.EndDisabledGroup();

        GUILayout.EndScrollView();
        GUILayout.EndVertical();

        if (save)
        {
            retinaProDataSerialize.sharedInstance.saveSettings();
        }
    }
Example #4
0
    void OnInspectorUpdate()
    {
        bool refresh = false;

        switch (retinaProState.state)
        {
        default:
        case retinaProState.rpState.kWaiting:
            break;

        case retinaProState.rpState.kGen:
        {
            deviceIndex    = 0;
            fileIndex      = 0;
            progressPeriod = 0.0f;
            progressString = "Atlas " + genAtlasItem.atlasName;

#if RETINAPRO_DEBUGLOG
            Debug.Log(progressString);
#endif

            if (genAtlasItem.isFont)
            {
                retinaProState.state = retinaProState.rpState.kFont;
            }
            else
            {
                // create atlas that will be used as the reference for the device specific atlas
                UIAtlas atlasRef = retinaProNGTools.createAtlas(genAtlasItem.atlasName, null, out oldSpriteData);
                oldSpriteData = null;
                if (atlasRef == null)
                {
                    Debug.LogWarning("Could not create atlas reference for " + genAtlasItem.atlasName);
                    retinaProState.state = retinaProState.rpState.kDone;
                    break;
                }

                retinaProParent parent = atlasRef.gameObject.GetComponent <retinaProParent>();
                if (parent == null)
                {
                    atlasRef.gameObject.AddComponent <retinaProParent>();
                }

                EditorUtility.SetDirty(atlasRef.gameObject);
                retinaProState.state = retinaProState.rpState.kAtlas;
            }

            break;
        }


        case retinaProState.rpState.kAtlas: {
            retinaProDevice deviceItem = retinaProDataSerialize.sharedInstance.deviceList[deviceIndex];
            progressString       = "Atlas " + genAtlasItem.atlasName + " / " + deviceItem.name + " - Processing images";
            retinaProState.state = retinaProState.rpState.kAtlasProcess;
            break;
        }


        case retinaProState.rpState.kAtlasProcess: {
            retinaProDevice deviceItem = retinaProDataSerialize.sharedInstance.deviceList[deviceIndex];

#if RETINAPRO_DEBUGLOG
            Debug.Log("addNewAtlas; " + genAtlasItem.atlasName + ", for device: " + deviceItem.name + ", pixelSize = " + deviceItem.pixelSize);
#endif
            // gather textures for this atlas / device
            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + retinaProConfig.atlasTextureFolder + deviceItem.name + "/" + genAtlasItem.atlasName);
            if (dinfo == null || !dinfo.Exists)
            {
                Debug.LogWarning("Folder does not exist; " + genAtlasItem.atlasName + ", for device: " + deviceItem.name + ", pixelSize = " + deviceItem.pixelSize);
            }
            else
            {
                List <FileInfo> fis;
                retinaProConfig.getValidArtFiles(dinfo, out fis);

                if (fis != null && fis.Count > 0)
                {
                    genAtlas = retinaProNGTools.createAtlas(genAtlasItem.atlasName, deviceItem.name, out oldSpriteData);
                    if (genAtlas == null)
                    {
                        Debug.LogWarning("Could not create atlas for " + genAtlasItem.atlasName + ", device = " + deviceItem.name);
                        retinaProState.state = retinaProState.rpState.kDone;
                        break;
                    }

                    NGUISettings.atlas         = genAtlas;
                    NGUISettings.atlasPadding  = genAtlasItem.atlasPadding;
                    NGUISettings.atlasTrimming = false;
                    NGUISettings.allow4096     = true;
                    NGUISettings.fontTexture   = null;
                    NGUISettings.unityPacking  = true;

                    genAtlas.pixelSize = deviceItem.pixelSize;
                    EditorUtility.SetDirty(genAtlas.gameObject);

                    // add all art files into the atlas (one-pass)
                    List <Texture> textures = new List <Texture>();

                    foreach (FileInfo fi in fis)
                    {
                        // check to see if this file has a corresponding .txt file (i.e. it's a font)
                        bool isFont = false;
                        {
                            string fontName = Path.GetFileNameWithoutExtension(fi.Name);
                            if (dinfo != null && dinfo.Exists)
                            {
                                FileInfo [] fontTextFile = dinfo.GetFiles(fontName + ".txt");
                                if (fontTextFile != null && fontTextFile.Length == 1)
                                {
                                    isFont = true;
                                }
                            }
                        }

                        if (isFont)
                        {
                            progressString = "Atlas " + genAtlasItem.atlasName + " / " + deviceItem.name + " - Fonts in a sprite atlas are not supported!";
                            string fontName = Path.GetFileNameWithoutExtension(fi.Name);
                            Debug.LogWarning("Fonts (" + fontName + ") in a sprite atlas is not supported. Use a font atlas instead, see the example scene.");
                        }
                        else
                        {
                            {
                                string textureName = "Assets" + retinaProConfig.atlasTextureFolder + deviceItem.name + "/" + genAtlasItem.atlasName + "/" + fi.Name;

                                // source texture
                                Texture2D tex = AssetDatabase.LoadAssetAtPath(textureName, typeof(Texture2D)) as Texture2D;
                                if (retinaProDataSerialize.sharedInstance.getUtilityRefreshSourceTextures())                                            // refresh importer settings on source texture?
                                // update texture importer settings on source artwork
                                // this ensures that we don't bring in assets into the atlas that are too small (for their given size)
                                {
                                    TextureImporter tImporter = AssetImporter.GetAtPath(textureName) as TextureImporter;
                                    if (tImporter != null)
                                    {
                                        tImporter.textureType         = TextureImporterType.Advanced;
                                        tImporter.normalmap           = false;
                                        tImporter.linearTexture       = true;
                                        tImporter.alphaIsTransparency = true;
                                        tImporter.convertToNormalmap  = false;
                                        tImporter.grayscaleToAlpha    = false;
                                        tImporter.lightmap            = false;
                                        tImporter.npotScale           = TextureImporterNPOTScale.None;
                                        tImporter.filterMode          = FilterMode.Point;
                                        tImporter.maxTextureSize      = 4096;
                                        tImporter.mipmapEnabled       = false;
                                        tImporter.textureFormat       = TextureImporterFormat.AutomaticTruecolor;
                                        AssetDatabase.ImportAsset(textureName, ImportAssetOptions.ForceUpdate);
                                    }
                                }

                                tex.filterMode = genAtlasItem.atlasFilterMode;
                                tex.wrapMode   = TextureWrapMode.Clamp;
                                textures.Add(tex);

#if RETINAPRO_DEBUGLOG
                                Debug.Log("- added tex: " + textureName);
#endif
                            }
                        }
                    }

                    List <UIAtlasMaker.SpriteEntry> sprites = UIAtlasMaker.CreateSprites(textures);
                    UIAtlasMaker.ExtractSprites(genAtlas, sprites);
                    UIAtlasMaker.UpdateAtlas(genAtlas, sprites);
                    AssetDatabase.SaveAssets();

                    // set texture filter mode
                    {
                        string          newTex    = "Assets" + retinaProConfig.atlasResourceFolder + deviceItem.name + "/" + genAtlasItem.atlasName + "~" + deviceItem.name + ".png";
                        TextureImporter tImporter = AssetImporter.GetAtPath(newTex) as TextureImporter;

                        if (tImporter != null)
                        {
                            tImporter.filterMode    = genAtlasItem.atlasFilterMode;
                            tImporter.textureFormat = genAtlasItem.atlasTextureFormat;
                            AssetDatabase.ImportAsset(newTex, ImportAssetOptions.ForceUpdate);
                        }
                    }

                    // restore the sprite data within the atlas
                    // update the new atlas with the old sprite data
                    retinaProNGTools.updateAtlasSpriteData(ref genAtlas, ref oldSpriteData);
#if RETINAPRO_DEBUGLOG
                    retinaProNGTools.debugAtlasSpriteData(ref genAtlas);
#endif

                    genAtlas.MarkAsChanged();
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();


                    // continue with next device
                    deviceIndex++;
                    if (deviceIndex >= retinaProDataSerialize.sharedInstance.deviceList.Count)
                    {
                        retinaProState.state = retinaProState.rpState.kDone;
                        break;
                    }
                    else
                    {
                        retinaProState.state = retinaProState.rpState.kAtlas;
                    }

                    progressPortion = 0.0f;
                    break;
                }
            }
            break;
        }

        case retinaProState.rpState.kFont:
        {
            retinaProDevice deviceItem = retinaProDataSerialize.sharedInstance.deviceList[deviceIndex];

            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + retinaProConfig.atlasTextureFolder + deviceItem.name + "/" + genAtlasItem.atlasName);
            if (dinfo == null || !dinfo.Exists)
            {
                Debug.LogWarning("Folder does not exist; " + genAtlasItem.atlasName + ", for device: " + deviceItem.name + ", pixelSize = " + deviceItem.pixelSize);
                retinaProState.state = retinaProState.rpState.kDone;
                break;
            }

            FileInfo [] fis    = dinfo.GetFiles("*.png");
            FileInfo [] fisTxt = dinfo.GetFiles("*.txt");

            if (fis == null || fis.Length != 1 || fisTxt == null || fisTxt.Length != 1)
            {
                Debug.LogWarning("Font atlases should contain two files; thefont.png / thefont.txt");
                fileIndex            = fis.Length;
                retinaProState.state = retinaProState.rpState.kDone;
                break;
            }

            FileInfo fi = fis[fileIndex];

            {
                string fontName = Path.GetFileNameWithoutExtension(fi.Name);
                progressString = "Atlas " + genAtlasItem.atlasName + " / " + deviceItem.name + " / " + fontName;

#if RETINAPRO_DEBUGLOG
                Debug.Log("addNewFont; " + fontName + ", for device: " + deviceItem.name + ", pixelSize = " + deviceItem.pixelSize);
#endif

                UIFont font = retinaProNGTools.createFont(genAtlasItem.atlasName, fontName, deviceItem.name);
                //font.pixelSize = deviceItem.pixelSize;
                EditorUtility.SetDirty(font.gameObject);

                // create the reference font version
                UIFont fontRef = retinaProNGTools.createFont(genAtlasItem.atlasName, fontName, null);
                fontRef.replacement = font;
                //fontRef.pixelSize = deviceItem.pixelSize;

                retinaProParent parent = fontRef.gameObject.GetComponent <retinaProParent>();
                if (parent == null)
                {
                    fontRef.gameObject.AddComponent <retinaProParent>();
                }

                EditorUtility.SetDirty(fontRef.gameObject);
            }

            // set texture filter mode
            {
                string          newTex    = "Assets" + retinaProConfig.atlasTextureFolder + deviceItem.name + "/" + genAtlasItem.atlasName + "/" + fis[0].Name;
                TextureImporter tImporter = AssetImporter.GetAtPath(newTex) as TextureImporter;

                if (tImporter != null)
                {
                    tImporter.filterMode    = genAtlasItem.atlasFilterMode;
                    tImporter.textureFormat = genAtlasItem.atlasTextureFormat;
                    AssetDatabase.ImportAsset(newTex, ImportAssetOptions.ForceUpdate);
                }
            }


            fileIndex++;
            if (fileIndex >= fis.Length)
            {
                fileIndex = 0;

                deviceIndex++;
                if (deviceIndex >= retinaProDataSerialize.sharedInstance.deviceList.Count)
                {
                    fileIndex            = fis.Length;
                    retinaProState.state = retinaProState.rpState.kDone;
                }
            }
            progressPortion = (((float)(fileIndex + 1)) / ((float)fis.Length));
            progressPortion = Mathf.Clamp01(progressPortion);
            break;
        }

        case retinaProState.rpState.kDone:
        {
            EditorUtility.ClearProgressBar();
            refresh = true;
            retinaProState.state = retinaProState.rpState.kWaiting;
            Repaint();
            break;
        }
        }

        if (refresh)
        {
#if RETINAPRO_DEBUGLOG
            Debug.Log("refresh called");
#endif
            int             idx = retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx();
            retinaProDevice di  = retinaProDataSerialize.sharedInstance.deviceList[idx];
            if (di.isDeviceValid())
            {
                retinaProNGTools.refreshReferencesForDevice(di, retinaProDataSerialize.sharedInstance.getPreviewScreenIdx(), retinaProDataSerialize.sharedInstance.getPreviewGameViewIdx());
                retinaProNGTools.refresh();
            }
        }

        if (retinaProState.state != retinaProState.rpState.kWaiting)
        {
            Repaint();
        }
    }
Example #5
0
    bool showFilesUI(ref retinaProAtlas atlasItem)
    {
        if (atlasItem.atlasName == null || atlasItem.atlasName.Length == 0)
        {
            return(false);
        }

        bool            valid   = true;
        List <FileInfo> fisLast = null;

        FileInfo [] fontImageFilesLast = null;
        FileInfo [] fontTxtFilesLast   = null;

        for (int i = 0; i < retinaProDataSerialize.sharedInstance.deviceList.Count; i++)
        {
            retinaProDevice di = retinaProDataSerialize.sharedInstance.deviceList[i];

            if (!di.isDeviceValid())
            {
                continue;
            }

            string reqPath = retinaProConfig.atlasTextureFolder + di.name + "/" + atlasItem.atlasName;

            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + reqPath);
            if (dinfo == null || !dinfo.Exists)
            {
                continue;
            }

            if (atlasItem.isFont)
            {
                FileInfo [] fontImageFiles = dinfo.GetFiles("*.png");
                FileInfo [] fontTxtFiles   = dinfo.GetFiles("*.txt");

                if (fontImageFiles == null || fontImageFiles.Length == 0)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label("Add a single <fontname>.png: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();
                }

                if (fontTxtFiles == null || fontTxtFiles.Length == 0)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label("Add a single <fontname>.txt: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();
                }

                if (!valid)
                {
                    continue;
                }

                if (fontImageFiles.Length > 1)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label("Only supports single <font>.png: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();
                }

                if (fontTxtFiles.Length > 1)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label("Only supports single <font>.txt: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();
                }

                if (!valid)
                {
                    continue;
                }

                string fontImageName = Path.GetFileNameWithoutExtension(fontImageFiles[0].Name);
                string fontTxtName   = Path.GetFileNameWithoutExtension(fontTxtFiles[0].Name);

                if (fontImageName.CompareTo(fontTxtName) != 0)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label(".png / .txt filenames need to match: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();
                }

                if (!valid)
                {
                    continue;
                }


                if (fontImageFilesLast != null && fontTxtFilesLast != null)
                {
                    if (fontImageFiles[0].Name.CompareTo(fontImageFilesLast[0].Name) != 0)
                    {
                        // font image names don't match across devices
                        valid = false;

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("", GUILayout.Width(50f));

                        Color col = GUI.color;
                        GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                        GUILayout.Label("<font>.png files mismatch: " + reqPath);
                        GUI.color = col;

                        GUILayout.EndHorizontal();
                    }

                    if (fontTxtFiles[0].Name.CompareTo(fontTxtFilesLast[0].Name) != 0)
                    {
                        // font txt names don't match across devices
                        valid = false;

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("", GUILayout.Width(50f));

                        Color col = GUI.color;
                        GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                        GUILayout.Label("<font>.txt files mismatch: " + reqPath);
                        GUI.color = col;

                        GUILayout.EndHorizontal();
                    }

                    if (!valid)
                    {
                        continue;
                    }
                }

                fontImageFilesLast = (FileInfo [])fontImageFiles.Clone();
                fontTxtFilesLast   = (FileInfo [])fontTxtFiles.Clone();
            }
            else
            {
                List <FileInfo> fis;
                retinaProConfig.getValidArtFiles(dinfo, out fis);
                if (fis == null || fis.Count == 0)
                {
                    valid = false;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(50f));

                    Color col = GUI.color;
                    GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                    GUI.skin.button.wordWrap = true;
                    GUILayout.Label("Add art assets to: " + reqPath);
                    GUI.skin.button.wordWrap = false;
                    GUI.color = col;

                    GUILayout.EndHorizontal();

                    continue;
                }

                if (fisLast != null)
                {
                    // are they the same length?
                    if (fis.Count != fisLast.Count)
                    {
                        valid = false;

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("", GUILayout.Width(50f));

                        Color col = GUI.color;
                        GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                        GUILayout.Label("Art asset mismatch: " + reqPath);
                        GUI.color = col;

                        GUILayout.EndHorizontal();

                        continue;
                    }

                    // compare this file list to previous file list
                    // if they don't match, reject it
                    for (int f = 0; f < fis.Count; f++)
                    {
                        if (fis[f].Name.CompareTo(fisLast[f].Name) != 0)
                        {
                            valid = false;

                            GUILayout.BeginHorizontal();
                            GUILayout.Label("", GUILayout.Width(50f));

                            Color col = GUI.color;
                            GUI.color = new Color(1f, 0.4f, 0.4f, 1f);
                            GUILayout.Label("Art asset mismatch: " + reqPath);
                            GUI.color = col;

                            GUILayout.EndHorizontal();

                            continue;
                        }
                    }
                }

                if (fis != null)
                {
                    fisLast = new List <FileInfo>(fis);
                }

                if (fis != null)
                {
                    fis.Clear();
                    fis = null;
                }
            }
        }

        if (fisLast != null)
        {
            fisLast.Clear();
            fisLast = null;
        }


        fontImageFilesLast = null;
        fontTxtFilesLast   = null;


        return(valid);
    }
Example #6
0
    void showAtlasUI()
    {
        bool save    = false;
        bool refresh = false;

        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);
        EditorGUILayout.Space();
        GUILayout.Label("Atlases", EditorStyles.boldLabel);
        EditorGUILayout.Space();
        EditorGUI.EndDisabledGroup();

        // begin scrolling section which contains all of our atlas list items
        float buttonHeight = 22.0f;
        float numLines     = 2.0f;

        if (retinaProDataSerialize.sharedInstance.atlasList != null)
        {
            numLines = (float)retinaProDataSerialize.sharedInstance.atlasList.Count;
            if (numLines > 12)
            {
                numLines = 12;
            }
        }

        float scrollHeight = (numLines * buttonHeight) + (numLines * 3.0f);

        GUILayout.BeginVertical(GUILayout.Height(scrollHeight));

        Vector2 atlasScrollPos = Vector2.zero;

        atlasScrollPos.x = EditorPrefs.GetFloat("atlasScrollPosX", 0.0f);
        atlasScrollPos.y = EditorPrefs.GetFloat("atlasScrollPosY", 0.0f);

        atlasScrollPos = GUILayout.BeginScrollView(atlasScrollPos, false, false);

        EditorPrefs.SetFloat("atlasScrollPosX", atlasScrollPos.x);
        EditorPrefs.SetFloat("atlasScrollPosY", atlasScrollPos.y);

        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);



        // show each atlas and it's configuration
        if (retinaProDataSerialize.sharedInstance.atlasList != null)
        {
            for (int i = 0; i < retinaProDataSerialize.sharedInstance.atlasList.Count; i++)
            {
                retinaProAtlas rpd = retinaProDataSerialize.sharedInstance.atlasList[i];

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(50f));

                if (rpd != null)
                {
                    bool selected = false;
                    if (editorSelectedAtlasIdx == i)
                    {
                        selected = true;
                    }

                    string str = rpd.atlasName;
                    if (selected)
                    {
                        str = "[X]  " + str;
                    }

                    bool selectAtlas = GUILayout.Button(str, GUILayout.Width(250f), GUILayout.Height(buttonHeight));
                    if (selectAtlas)
                    {
                        editorSelectedAtlasIdx = i;
                    }
                }


                GUILayout.EndHorizontal();
            }
        }

        EditorGUI.EndDisabledGroup();

        GUILayout.EndScrollView();
        GUILayout.EndVertical();


        EditorGUILayout.Space();
        EditorGUILayout.Space();

        // show the add atlas button
        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));

            bool pressed = GUILayout.Button("Add Atlas", GUILayout.Width(200f));
            if (pressed)
            {
                retinaProAtlas newItem = new retinaProAtlas();
                retinaProDataSerialize.sharedInstance.atlasList.Add(newItem);

                editorSelectedAtlasIdx = retinaProDataSerialize.sharedInstance.atlasList.Count - 1;

                save = true;
            }
            GUILayout.EndHorizontal();
        }

        EditorGUI.EndDisabledGroup();

        if (editorSelectedAtlasIdx != -1)
        {
            retinaProAtlas editorSelectedAtlas = retinaProDataSerialize.sharedInstance.atlasList[editorSelectedAtlasIdx];

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.Space();
            GUILayout.Label("Selected Atlas", EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);

            GUILayout.BeginHorizontal();

            GUILayout.Label("Name:", GUILayout.Width(50f));
            if (editorSelectedAtlas != null)
            {
                string n = GUILayout.TextField(editorSelectedAtlas.atlasName, GUILayout.MaxWidth(150f));
                if (n.CompareTo(editorSelectedAtlas.atlasName) != 0)
                {
                    editorSelectedAtlas.atlasName = n;
                    save = true;
                }
            }

            if (editorSelectedAtlas != null)
            {
                bool isFont = GUILayout.Toggle(editorSelectedAtlas.isFont, "Font", GUILayout.Width(50f));
                if (isFont != editorSelectedAtlas.isFont)
                {
                    editorSelectedAtlas.isFont = isFont;
                    save = true;
                }
            }

            bool removeDevice = GUILayout.Button("Remove Atlas", GUILayout.Width(100f));
            if (removeDevice)
            {
                for (int i = 0; i < retinaProDataSerialize.sharedInstance.atlasList.Count; i++)
                {
                    if (retinaProDataSerialize.sharedInstance.atlasList[i].atlasName.CompareTo(editorSelectedAtlas.atlasName) == 0)
                    {
                        retinaProDataSerialize.sharedInstance.atlasList.RemoveAt(i);
                        break;
                    }
                }

                editorSelectedAtlasIdx = -1;
                editorSelectedAtlas    = null;
                save = true;
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Padding:", GUILayout.Width(50f));
            if (editorSelectedAtlas != null)
            {
                int p = EditorGUILayout.IntField(editorSelectedAtlas.atlasPadding, GUILayout.Width(100f));
                if (p != editorSelectedAtlas.atlasPadding)
                {
                    editorSelectedAtlas.atlasPadding = p;
                    save = true;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Filter:", GUILayout.Width(50f));
            if (editorSelectedAtlas != null)
            {
                FilterMode f = (FilterMode)EditorGUILayout.EnumPopup(editorSelectedAtlas.atlasFilterMode, GUILayout.Width(100f));
                if (f != editorSelectedAtlas.atlasFilterMode)
                {
                    editorSelectedAtlas.atlasFilterMode = f;
                    save = true;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Format:", GUILayout.Width(50f));
            if (editorSelectedAtlas != null)
            {
                TextureImporterFormat f = (TextureImporterFormat)EditorGUILayout.EnumPopup(editorSelectedAtlas.atlasTextureFormat, GUILayout.Width(200f));
                if (f != editorSelectedAtlas.atlasTextureFormat)
                {
                    editorSelectedAtlas.atlasTextureFormat = f;
                    save = true;
                }
            }
            GUILayout.EndHorizontal();

            // display required folders
            bool foldersValid = showFoldersUI(ref editorSelectedAtlas);

            if (foldersValid)
            {
                // folders exist
                // validate the files within the folders
                bool filesValid = showFilesUI(ref editorSelectedAtlas);

                if (filesValid)
                {
                    if (editorSelectedAtlas.atlasName != null && editorSelectedAtlas.atlasName.Length > 0)
                    {
                        // allow user to create / refresh the atlas
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("", GUILayout.Width(50f));

                        bool refreshAtlas = false;
                        bool atlasExists  = isAtlasExist(editorSelectedAtlas.atlasName);
                        if (atlasExists)
                        {
                            refreshAtlas = GUILayout.Button("Refresh", GUILayout.Width(60f));
                        }
                        else
                        {
                            refreshAtlas = GUILayout.Button("Create", GUILayout.Width(60f));
                        }

                        if (refreshAtlas)
                        {
                            genAtlasItem = editorSelectedAtlas;

                            EditorUtility.ClearProgressBar();
                            progressPeriod       = 0.0f;
                            progressPortion      = 0.0f;
                            progressString       = "Preparing...";
                            retinaProState.state = retinaProState.rpState.kGen;
                            deviceIndex          = 0;
                            fileIndex            = 0;
                            progressPeriod       = 0.0f;
                        }

                        GUILayout.EndHorizontal();
                    }
                }
                else
                {
                }
            }
            else
            {
                // provide option for fixing folders for this atlas
                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(50f));

                bool fixFolders = GUILayout.Button("Fix Folders", GUILayout.Width(100f));
                if (fixFolders)
                {
                    fixAtlasFolders(ref editorSelectedAtlas);
                }

                GUILayout.EndHorizontal();
            }

            EditorGUI.EndDisabledGroup();
        }

        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.Space();
            GUILayout.Label("Utilities", EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("This will fix all missing folders for all atlases.", GUILayout.Width(260f));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));

            bool fixAllFolders = GUILayout.Button("Fix ALL Folder Issues", GUILayout.Width(200f));
            if (fixAllFolders)
            {
                for (int i = 0; i < retinaProDataSerialize.sharedInstance.atlasList.Count; i++)
                {
                    retinaProAtlas rpd = retinaProDataSerialize.sharedInstance.atlasList[i];

                    bool foldersValid = showFoldersUI(ref rpd);

                    if (!foldersValid)
                    {
                        fixAtlasFolders(ref rpd);
                    }
                }
            }

            GUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("When an atlas is refreshed this setting changes", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("the texture import settings on all of the source", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("textures. It makes sure they are set to the", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("maximum size and not compressed.", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("This ensures that the created atlas textures are", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("the correct size and quality for being rendered", GUILayout.Width(260f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            GUILayout.Label("pixel perfect.", GUILayout.Width(260f));
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(50f));
            bool refreshSourceTextures = GUILayout.Toggle(retinaProDataSerialize.sharedInstance.getUtilityRefreshSourceTextures(), "Refresh Source Textures (Recommended)", GUILayout.Width(260f));
            if (refreshSourceTextures != retinaProDataSerialize.sharedInstance.getUtilityRefreshSourceTextures())
            {
                retinaProDataSerialize.sharedInstance.setUtilityRefreshSourceTextures(refreshSourceTextures);
                save = true;
            }
            GUILayout.EndHorizontal();


            EditorGUI.EndDisabledGroup();
        }

        if (save)
        {
            retinaProDataSerialize.sharedInstance.saveSettings();
        }

        if (refresh)
        {
            int             idx = retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx();
            retinaProDevice di  = retinaProDataSerialize.sharedInstance.deviceList[idx];
            if (di.isDeviceValid())
            {
                retinaProNGTools.refreshReferencesForDevice(di, retinaProDataSerialize.sharedInstance.getPreviewScreenIdx(), retinaProDataSerialize.sharedInstance.getPreviewGameViewIdx());
                retinaProNGTools.refresh();
            }
        }
    }
Example #7
0
    // gameViewOrientation, 0 = portrait, 1 = landscape (only used if the device is used for both landscape / portrait)
    // this is a work around because Screen.width / Screen.height returns bogus values
    // screenIndex is an index into the device screen list

    public static void refreshReferencesForDevice(retinaProDevice deviceItem, int screenIndex, int gameViewOrientation)
    {
        if (deviceItem == null)
        {
            return;
        }

        if (!deviceItem.isDeviceValid())
        {
            return;
        }

        if (screenIndex < 0 || screenIndex >= deviceItem.screens.Count)
        {
            return;
        }

        int manualHeight = 0;

        float width;
        float height;
        bool  useBothPortLand;

        if (deviceItem.rootAuto)
        {
            retinaProScreen rps = deviceItem.screens[screenIndex];

            width           = (float)rps.width;
            height          = (float)rps.height;
            useBothPortLand = rps.useForBothLandscapePortrait;
        }
        else
        {
            width           = (float)deviceItem.rootWidth;
            height          = (float)deviceItem.rootHeight;
            useBothPortLand = deviceItem.rootUseBothPortLand;
        }

        if (useBothPortLand)
        {
            if (width >= height)                        // landscape
            {
                if (gameViewOrientation == 1)
                {
                    // screen game view is also landscape
                    manualHeight = (int)(height * deviceItem.pixelSize);
                }
                else
                {
                    // screen game view is opposite (portrait)
                    manualHeight = (int)(width * deviceItem.pixelSize);
                }
            }
            else                                                                                                                        // portrait
            {
                if (gameViewOrientation == 1)
                {
                    // screen game view is opposite (landscape)
                    manualHeight = (int)(width * deviceItem.pixelSize);
                }
                else
                {
                    // screen game view is also portrait
                    manualHeight = (int)(height * deviceItem.pixelSize);
                }
            }
        }
        else
        {
            manualHeight = (int)(height * deviceItem.pixelSize);
        }

        retinaProNGTools.setRootManualHeight(manualHeight);

        {
            DirectoryInfo dinfo = new DirectoryInfo(retinaProFileLock.baseDataPath + retinaProConfig.atlasResourceFolder);
            if (dinfo != null && dinfo.Exists)
            {
                FileInfo [] fis = dinfo.GetFiles("*.prefab");

                foreach (FileInfo fi in fis)
                {
                    GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath("Assets" + retinaProConfig.atlasResourceFolder + fi.Name, typeof(GameObject));
                    if (prefab == null)
                    {
                        continue;
                    }

                    UIAtlas atlas = prefab.GetComponent <UIAtlas>();
                    if (atlas != null)
                    {
                        string newAR = "Assets" + retinaProConfig.atlasResourceFolder + deviceItem.name + "/" + Path.GetFileNameWithoutExtension(fi.Name) + "~" + deviceItem.name + ".prefab";

                        UIAtlas ar = (UIAtlas)AssetDatabase.LoadAssetAtPath(newAR, typeof(UIAtlas));
                        atlas.replacement = ar;
                    }

                    UIFont font = prefab.GetComponent <UIFont>();
                    if (font != null)
                    {
                        string newFR = "Assets" + retinaProConfig.atlasResourceFolder + deviceItem.name + "/" + Path.GetFileNameWithoutExtension(fi.Name) + "~" + deviceItem.name + ".prefab";
                        UIFont fr    = (UIFont)AssetDatabase.LoadAssetAtPath(newFR, typeof(UIFont));
                        font.replacement = fr;
                    }
                }
            }
        }
    }
    void showEditorPreviewUI()
    {
        bool save    = false;
        bool refresh = false;

        EditorGUI.BeginDisabledGroup(retinaProState.state != retinaProState.rpState.kWaiting);
        EditorGUILayout.Space();
        GUILayout.Label("Editor Preview", EditorStyles.boldLabel);
        EditorGUILayout.Space();

        string [] availableDevices = new string[retinaProDataSerialize.sharedInstance.deviceList.Count];
        for (int i = 0; i < retinaProDataSerialize.sharedInstance.deviceList.Count; i++)
        {
            if (retinaProDataSerialize.sharedInstance.deviceList[i].isDeviceValid())
            {
                availableDevices[i] = retinaProDataSerialize.sharedInstance.deviceList[i].name;
            }
            else
            {
                availableDevices[i] = "";
            }
        }

        bool showRefreshButton = true;

        if (availableDevices.Length == 0)
        {
            retinaProConfig.showValidDeviceNeededUI();
            showRefreshButton = false;
        }
        else if (retinaProDataSerialize.sharedInstance.atlasList.Count == 0)
        {
            GUILayout.Label("Add at least one atlas");
            showRefreshButton = false;
        }
        else if (retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx() >= availableDevices.Length)
        {
            int idx = retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx();
            idx %= availableDevices.Length;
            retinaProDataSerialize.sharedInstance.setPreviewDeviceIdx(idx);

            // refresh the atlas references
            refresh = true;
            save    = true;
        }
        else
        {
            int currentDeviceIdx = retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx();
            int newDeviceIdx     = EditorGUILayout.Popup(currentDeviceIdx, availableDevices, GUILayout.Width(150f));
            if (currentDeviceIdx != newDeviceIdx)
            {
                retinaProDataSerialize.sharedInstance.setPreviewDeviceIdx(newDeviceIdx);

                // refresh the atlas references
                refresh = true;
                save    = true;
            }

            retinaProDevice di = retinaProDataSerialize.sharedInstance.deviceList[retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx()];
            if (di.isDeviceValid())
            {
                if (di.screens != null && di.screens.Count > 0)
                {
                    string [] screens = new string [di.screens.Count];
                    for (int rsi = 0; rsi < di.screens.Count; rsi++)
                    {
                        retinaProScreen rps = di.screens[rsi];

                        screens[rsi] = "" + rps.width + " x " + rps.height;
                    }

                    int currentScreenViewIdx = retinaProDataSerialize.sharedInstance.getPreviewScreenIdx();
                    int newScreenViewIdx     = EditorGUILayout.Popup(currentScreenViewIdx, screens, GUILayout.Width(150f));
                    if (newScreenViewIdx != currentScreenViewIdx)
                    {
                        retinaProDataSerialize.sharedInstance.setPreviewScreenIdx(newScreenViewIdx);

                        // refresh the atlas references
                        refresh = true;
                        save    = true;
                    }

                    {
                        retinaProScreen rps = di.screens[retinaProDataSerialize.sharedInstance.getPreviewScreenIdx()];
                        if (rps.useForBothLandscapePortrait)
                        {
                            string [] gameViews = { "Portrait", "Landscape" };

                            int currentGameViewIdx = retinaProDataSerialize.sharedInstance.getPreviewGameViewIdx();
                            int newGameViewIdx     = EditorGUILayout.Popup(currentGameViewIdx, gameViews, GUILayout.Width(150f));

                            if (currentGameViewIdx != newGameViewIdx)
                            {
                                retinaProDataSerialize.sharedInstance.setPreviewGameViewIdx(newGameViewIdx);

                                // refresh the atlas references
                                refresh = true;
                                save    = true;
                            }
                        }
                    }
                }
            }
        }

        if (showRefreshButton)
        {
            bool pressed = GUILayout.Button("Refresh Atlas References", GUILayout.Width(150f));
            if (pressed)
            {
                refresh = true;
            }
        }

        EditorGUI.EndDisabledGroup();

        if (save)
        {
            retinaProDataSerialize.sharedInstance.saveSettings();
        }

        if (refresh)
        {
            int             idx = retinaProDataSerialize.sharedInstance.getPreviewDeviceIdx();
            retinaProDevice di  = retinaProDataSerialize.sharedInstance.deviceList[idx];
            if (di.isDeviceValid())
            {
                retinaProNGTools.refreshReferencesForDevice(di, retinaProDataSerialize.sharedInstance.getPreviewScreenIdx(), retinaProDataSerialize.sharedInstance.getPreviewGameViewIdx());
                retinaProNGTools.refresh();
            }
        }
    }