using UnityEngine; using UnityEngine.UI; using UnityEditor; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine.EventSystems; //using SFB; using System.Xml; using UnityEngine.Networking; using System.IO; using System.Text; [RequireComponent(typeof(Button))] public class Save_Plan : MonoBehaviour, IPointerDownHandler { #if UNITY_WEBGL && !UNITY_EDITOR [DllImport("__Internal")] private static extern void DownloadFile(string gameObjectName, string methodName, string filename, byte[] byteArray, int byteArraySize); // Broser plugin should be called in OnPointerDown. public void OnPointerDown(PointerEventData eventData) { _G.PDFname = GameObject.Find("InputPDFName").gameObject.GetComponent().text; var bytes = _G.PDF; DownloadFile(gameObject.name, "OnFileDownload", _G.PDFname + ".pdf", bytes, bytes.Length); } // Called from browser public void OnFileDownload() { GameObject.Find("HIDER").transform.Find("EnterPDFName").transform.gameObject.SetActive(false); _M.PH(2, 0, "ffffff", 1, 1); } #else public void OnPointerDown(PointerEventData eventData) { } public void SavePlan() { /* _G.PDFname = GameObject.Find("InputPDFName").gameObject.GetComponent().text; var path = EditorUtility.SaveFilePanel("Save as pdt", "", _G.PDFname, "pdf"); System.IO.File.WriteAllBytes(path, _G.PDF); //output.text = _G.PDFname; GameObject.Find("PNL").transform.Find("PDFpnl").transform.gameObject.SetActive(false); _M.PH(2, 0, "ffffff", 1, 1);*/ } #endif }