Beispiel #1
0
    public void OpenFile()
    {
        if (CurrentlySelected == null)
        {
            return;
        }

        //bool bClose = false;

        // Retrieve the name of the directory stored in the button label
        RectTransform _CurrentRect = CurrentlySelected.gameObject.GetComponent <RectTransform>();
        string        _text        = _CurrentRect.Find("Text").gameObject.GetComponent <Text>().text;

        if (CurrentlySelected.gameObject.name == "Folder" || CurrentlySelected.gameObject.name == "Drive")
        {
            // Open the folder if it is one
            _FB.GoInSubDirectory(_text);
        }
        else if (CurrentlySelected.gameObject.name == "File")
        {
            m_pOpenedPath = _FB.GetFilePath(_text);
            ////////////////////////////////////////////////////////////////	Here! Add Custom Function
            originCustomImagePath = m_pOpenedPath;
            ImportCustomImage(originCustomImagePath, destCustomImagePath, _text);

            UIManager.GetComponent <MainUIManager>().CustomImageBrowser_To_SuccesslyImportImage_Popup_CIB();
            CustomImageManager.GetComponent <CustomImageManager>().TravelCustomImageFolder();
            CustomImageManager.GetComponent <CustomImageManager>().SetImageData_InCustomImageManager();
            CustomImageManager.GetComponent <CustomImageManager>().ShowImage_InCustomImageManager();
            CustomImageManager.GetComponent <CustomImageManager>().SetImageData_InLGLevelCreator();
            CustomImageManager.GetComponent <CustomImageManager>().ShowImage_InLGLevelCreator();
            ////////////////////////////////////////////////////////////////
            //bClose = true;
        }

        // Refresh the buttons with the new hierarchy
        RefreshButtons();
        CurrentlySelected = null;

        //if (bClose)
        //Cancel();
    }
Beispiel #2
0
    public void OpenFile()
    {
        if (CurrentlySelected == null)
        {
            return;
        }

        // Retrieve the name of the directory stored in the button label
        RectTransform _CurrentRect = CurrentlySelected.gameObject.GetComponent <RectTransform>();
        string        _text        = _CurrentRect.FindChild("Text").gameObject.GetComponent <Text>().text;

        if (CurrentlySelected.gameObject.name == "Folder" || CurrentlySelected.gameObject.name == "Drive")
        {
            // Open the folder if it is one
            _FB.GoInSubDirectory(_text);
        }
        else if (CurrentlySelected.gameObject.name == "File")
        {
            m_pOpenedPath = _FB.GetFilePath(_text);

            if (currentUiFileBrowserMode == UI_FileBrowserMode.importImageToCurrentCardImage)
            {
                bool isASupportedExtension = false;
                foreach (var supportedImageExtension in SupportedImageFilesList)
                {
                    if (Path.GetExtension(m_pOpenedPath).Contains(supportedImageExtension))
                    {
                        isASupportedExtension = true;
                    }
                }

                if (isASupportedExtension)
                //  ".jpg", ".jpeg", ".png", ".psd", ".tiff", ".tga", ".gif", ".bmp", ".iff", ".pict"
                {
                    MenuManagerCardSetEditor.instance.ReadImageFromImageFileToCurrentCardImage(m_pOpenedPath);
                }
                else
                {
                    /*Unsupported format Pop-Up*/
                }
            }

            if (currentUiFileBrowserMode == UI_FileBrowserMode.importToCurrentCardCardSetEditorCard)
            {
                if (Path.GetExtension(m_pOpenedPath).Contains(".cse-card"))
                {
                    string directory = Path.GetDirectoryName(m_pOpenedPath) + @"\";
                    MenuManagerCardSetEditor.instance.ReadCardFromCardFileToCurrentCard(directory, Path.GetFileNameWithoutExtension(m_pOpenedPath));
                }
            }

            if (currentUiFileBrowserMode == UI_FileBrowserMode.importToCardListCardSetEditorCard)
            {
                if (Path.GetExtension(m_pOpenedPath).Contains(".cse-card"))
                {
                    MenuManagerCardSetEditor.instance.ReadCardFromCardFileAndImportToCardList(m_pOpenedPath);
                }
            }

            if (currentUiFileBrowserMode == UI_FileBrowserMode.importCardSetEditorCardsFromCardSetEditorProject)
            {
                if (Path.GetExtension(m_pOpenedPath).Contains(".cse-project"))
                {
                    MenuManagerCardSetEditor.instance.ReadCardsFromCardSetEditorProjectAndImportToCardList(m_pOpenedPath);
                }
            }

            if (currentUiFileBrowserMode == UI_FileBrowserMode.importCardSetEditorProject)
            {
                if (Path.GetExtension(m_pOpenedPath).Contains(".cse-project"))
                {
                    MenuManagerCardSetEditor.instance.OpenProject(m_pOpenedPath);
                }
            }
        }

        // Refresh the buttons with the new hierarchy
        RefreshButtons();
        CurrentlySelected = null;
    }