using System.Text; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; using UnityEngine.Networking; using System.IO; using System; using Newtonsoft.Json; using System.Text.RegularExpressions; public class FileBrowserController : MonoBehaviour, IPointerDownHandler { //public enum Extensions { Image, VuforiaDB }; //".png, .jpg"".xml, .dat" //public Extensions extensions = Extensions.Image; public InputField inputField; //public Button OpenVuforiaXML; //public Button OpenImage; // Warning: paths returned by FileBrowser dialogs do not contain a trailing '\' character // Warning: FileBrowser can only show 1 dialog at a time #if UNITY_WEBGL && !UNITY_EDITOR // // WebGL // [DllImport("__Internal")] private static extern void UploadFile(string gameObjectName, string methodName, string filter, bool multiple); public void OnPointerDown(PointerEventData eventData) { UploadFile(gameObject.name, "OnFileUpload", ".png, .jpg", false); Debug.Log("OnPointerDown"); } // Called from browser public void OnFileUpload(string url) { StartCoroutine(UpLoadUserData(url)); } #else // // Standalone platforms & editor // public void OnPointerDown(PointerEventData eventData) { } void Start() { // OpenVuforiaXML.onClick.AddListener(() => { ShowLoadDialogCoroutine($"Выбор объекта", new ExtensionFilter("Vuforia Files", "xml", "dat")); }); // OpenImage.onClick.AddListener(() => { ShowLoadDialogCoroutine($"Выбор изображения", new ExtensionFilter("Image Files", "png", "jpg", "jpeg")); }); var button =GetComponent