暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

書架.cs 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6. using UnityEngine.Networking;
  7. using System.Text.RegularExpressions;
  8. using System.Data.SqlClient;
  9. using TMPro;
  10. using System;
  11. using System.IO;
  12. using ZXing;
  13. using ZXing.QrCode;
  14. using System.Net;
  15. using SimpleJSON;
  16. using System.ComponentModel;
  17. using System.Runtime.InteropServices;
  18. public class 書架 : MonoBehaviour
  19. {
  20. public RawImage rawImage;
  21. public RawImage rawImage1;
  22. public CanvasScaler canvasScaler;
  23. [SerializeField] GameObject 細板;
  24. [SerializeField] GameObject 寬板;
  25. [SerializeField] GameObject 回主頁紐;
  26. [SerializeField] GameObject 回選擇書籍紐;
  27. [SerializeField] GameObject 選擇頁面紐;
  28. [SerializeField] GameObject 選擇書籍;
  29. [SerializeField] GameObject 選擇頁面;
  30. [SerializeField] TextMeshProUGUI 書編;
  31. [SerializeField] TextMeshProUGUI 書名s;
  32. [SerializeField] TextMeshProUGUI 書頁名;
  33. [SerializeField] TMP_InputField 第幾頁;
  34. [SerializeField] TextMeshProUGUI 書編1;
  35. [SerializeField] TextMeshProUGUI 書名s1;
  36. [SerializeField] TextMeshProUGUI 書頁名1;
  37. [SerializeField] TMP_InputField 第幾頁1;
  38. [SerializeField] GameObject 讀取面板;
  39. [SerializeField] TextMeshProUGUI 讀取;
  40. [SerializeField] GameObject 彈跳面板;
  41. [SerializeField] TextMeshProUGUI 彈跳文字;
  42. private string loadingText = "";
  43. private int dotCount = 0;
  44. JSONArray 書籍清單;
  45. JSONArray 書籍內容清單;
  46. public GameObject buttonPrefab;
  47. public Transform buttonParent;
  48. public GameObject buttonceneter;
  49. private List<GameObject> copy = new List<GameObject>();
  50. public GameObject buttonPrefab1;
  51. public Transform buttonParent1;
  52. public GameObject buttonceneter1;
  53. private List<GameObject> copy1 = new List<GameObject>();
  54. int 最大頁數;
  55. [SerializeField] Slider scrollbar;
  56. [SerializeField] Slider scrollbar1;
  57. private float initialScale;
  58. private ScreenOrientation currentOrientation;
  59. private float 旋轉角度 = 0f;
  60. private float 旋轉角度1 = 0f;
  61. void Start()
  62. {
  63. //Main.Global.固寬=1000f;
  64. //Main.Global.固高=1600f;
  65. //Main.Global.固比=1f;
  66. //Main.Global.螢幕格式="胖";
  67. //Main.Global.sql="Data Source=180.177.181.162,5264;Initial Catalog=BIFENG-ERP-SYS;User ID=b70340;Password=0911274990";
  68. Screen.autorotateToPortrait = true;
  69. Screen.orientation = ScreenOrientation.AutoRotation;
  70. if (Main.Global.螢幕方向=="直")
  71. {
  72. canvasScaler.referenceResolution = new Vector2(Main.Global.固寬, Main.Global.固高);
  73. canvasScaler.matchWidthOrHeight=Main.Global.固比;
  74. }
  75. else
  76. {
  77. canvasScaler.referenceResolution = new Vector2(Main.Global.固高, Main.Global.固寬);
  78. canvasScaler.matchWidthOrHeight=Main.Global.固比1;
  79. }
  80. currentOrientation = Screen.orientation;
  81. if (Main.Global.螢幕格式=="胖")
  82. {
  83. initialScale = rawImage1.transform.localScale.x;
  84. if (Main.Global.PA1 == "")
  85. {
  86. 選擇書籍.SetActive(true);
  87. 回主頁紐.SetActive(true);
  88. 回選擇書籍紐.SetActive(false);
  89. 選擇頁面紐.SetActive(false);
  90. }
  91. else if (Main.Global.PA1 != "" && Main.Global.PA4 !="")
  92. {
  93. 選擇書籍.SetActive(false);
  94. string str = Main.Global.PA1;
  95. string str1 = Main.Global.PA4;
  96. 細板.SetActive(false);
  97. 寬板.SetActive(true);
  98. 書編1.text =Main.Global.PA1;
  99. 書名s1.text=Main.Global.PA2;
  100. 書頁名1.text=Main.Global.PA3;
  101. 第幾頁1.text=Main.Global.PA4;
  102. 選擇頁面.SetActive(false);
  103. 回主頁紐.SetActive(false);
  104. 回選擇書籍紐.SetActive(true);
  105. 選擇頁面紐.SetActive(true);
  106. 讀取書籍內容清單(str);
  107. 顯示圖片(str, str1);
  108. }
  109. }
  110. else
  111. {
  112. initialScale = rawImage.transform.localScale.x;
  113. if (Main.Global.PA1 == "")
  114. {
  115. 選擇書籍.SetActive(true);
  116. 回主頁紐.SetActive(true);
  117. 回選擇書籍紐.SetActive(false);
  118. 選擇頁面紐.SetActive(false);
  119. }
  120. else if (Main.Global.PA1 != "" && Main.Global.PA4 !="")
  121. {
  122. 選擇書籍.SetActive(false);
  123. string str = Main.Global.PA1;
  124. string str1 = Main.Global.PA4;
  125. 細板.SetActive(true);
  126. 寬板.SetActive(false);
  127. 書編.text =Main.Global.PA1;
  128. 書名s.text=Main.Global.PA2;
  129. 書頁名.text=Main.Global.PA3;
  130. 第幾頁.text=Main.Global.PA4;
  131. 選擇頁面.SetActive(false);
  132. 回主頁紐.SetActive(false);
  133. 回選擇書籍紐.SetActive(true);
  134. 選擇頁面紐.SetActive(true);
  135. 讀取書籍內容清單(str);
  136. 顯示圖片(str, str1);
  137. }
  138. }
  139. StartCoroutine(AnimateText());
  140. 讀取書籍清單();
  141. }
  142. void Update()
  143. {
  144. if (Screen.orientation != currentOrientation)
  145. {
  146. if (Screen.orientation == ScreenOrientation.LandscapeLeft)
  147. {
  148. Main.Global.螢幕方向="橫";
  149. if (Main.Global.螢幕格式=="胖")
  150. {
  151. Main.Global.PA1=書編1.text;
  152. Main.Global.PA2=書名s1.text;
  153. Main.Global.PA3=書頁名1.text;
  154. Main.Global.PA4=第幾頁1.text;
  155. }
  156. else
  157. {
  158. Main.Global.PA1=書編.text;
  159. Main.Global.PA2=書名s.text;
  160. Main.Global.PA3=書頁名.text;
  161. Main.Global.PA4=第幾頁.text;
  162. }
  163. change_Secen(4);
  164. }
  165. if (Screen.orientation == ScreenOrientation.Portrait)
  166. {
  167. if (Main.Global.螢幕格式=="胖")
  168. {
  169. Main.Global.PA1=書編1.text;
  170. Main.Global.PA2=書名s1.text;
  171. Main.Global.PA3=書頁名1.text;
  172. Main.Global.PA4=第幾頁1.text;
  173. }
  174. else
  175. {
  176. Main.Global.PA1=書編.text;
  177. Main.Global.PA2=書名s.text;
  178. Main.Global.PA3=書頁名.text;
  179. Main.Global.PA4=第幾頁.text;
  180. }
  181. Main.Global.螢幕方向="直";
  182. change_Secen(2);
  183. }
  184. }
  185. }
  186. IEnumerator AnimateText()
  187. {
  188. string qqq = 讀取.text.ToString();
  189. while (true)
  190. {
  191. yield return new WaitForSeconds(0.5f);
  192. if (dotCount < 3)
  193. {
  194. loadingText += ".";
  195. dotCount++;
  196. }
  197. else
  198. {
  199. loadingText = "";
  200. dotCount = 0;
  201. }
  202. 讀取.text = qqq+loadingText;
  203. }
  204. }
  205. public void 讀取書籍清單()
  206. {
  207. 讀取面板.SetActive(true);
  208. 書籍清單 = new JSONArray();
  209. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  210. {
  211. try
  212. {
  213. connection.Open();
  214. string query = "SELECT 書名, 書籍編號 FROM 書籍資料庫 GROUP BY 書籍編號, 書名 ORDER BY 書籍編號";
  215. using (SqlCommand command = new SqlCommand(query, connection))
  216. {
  217. using (SqlDataReader reader = command.ExecuteReader())
  218. {
  219. while (reader.Read()) // 假設只取前兩筆資料
  220. {
  221. JSONNode newValue = new JSONObject();
  222. newValue["書名"] = reader["書名"].ToString();
  223. newValue["書籍編號"] = reader["書籍編號"].ToString();
  224. 書籍清單.Add(newValue);
  225. }
  226. }
  227. }
  228. }
  229. catch (Exception ex)
  230. {
  231. Debug.LogError("Error connecting to the database: " + ex.Message);
  232. 彈跳面板.SetActive(true);
  233. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  234. }
  235. finally
  236. {
  237. connection.Close();
  238. }
  239. }
  240. int sum = 5;
  241. for (int i = 0; i < 書籍清單.Count; i++)
  242. {
  243. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  244. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  245. buttonObj.transform.SetParent(buttonParent, false);
  246. TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
  247. Button bt = buttonObj.GetComponentInChildren<Button>();
  248. int index = i;
  249. bt.onClick.AddListener(() =>
  250. {
  251. 選擇書籍.SetActive(false);
  252. string str = 書籍清單[index][1].ToString().Trim('"');
  253. if (Main.Global.螢幕格式=="胖")
  254. {
  255. 寬板.SetActive(true);
  256. 細板.SetActive(false);
  257. 書編1.text =書籍清單[index][1].ToString().Trim('"');
  258. 書名s1.text=書籍清單[index][0].ToString().Trim('"');
  259. }
  260. else
  261. {
  262. 細板.SetActive(true);
  263. 寬板.SetActive(false);
  264. 書編.text =書籍清單[index][1].ToString().Trim('"');
  265. 書名s.text=書籍清單[index][0].ToString().Trim('"');
  266. }
  267. 選擇頁面.SetActive(false);
  268. 回主頁紐.SetActive(false);
  269. 回選擇書籍紐.SetActive(true);
  270. 選擇頁面紐.SetActive(true);
  271. 讀取書籍內容清單(str);
  272. 顯示圖片(str, "1");
  273. });
  274. text.text = 書籍清單[i][0].ToString().Trim('"');
  275. sum+=120;
  276. copy.Add(buttonObj);
  277. }
  278. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  279. 讀取面板.SetActive(false);
  280. }
  281. public void 讀取書籍內容清單(string 書名)
  282. {
  283. 讀取面板.SetActive(true);
  284. 書籍內容清單 = new JSONArray();
  285. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  286. {
  287. try
  288. {
  289. connection.Open();
  290. string query = "SELECT 書頁名, 頁數, 備註 FROM 書籍資料庫 WHERE (書籍編號 LIKE '" + 書名 + "') ORDER BY 頁數";
  291. using (SqlCommand command = new SqlCommand(query, connection))
  292. {
  293. using (SqlDataReader reader = command.ExecuteReader())
  294. {
  295. while (reader.Read()) // 假設只取前兩筆資料
  296. {
  297. JSONNode newValue = new JSONObject();
  298. newValue["書頁名"] = reader["書頁名"].ToString();
  299. newValue["頁數"] = reader["頁數"].ToString();
  300. newValue["備註"] = reader["備註"].ToString();
  301. 書籍內容清單.Add(newValue);
  302. }
  303. }
  304. }
  305. }
  306. catch (Exception ex)
  307. {
  308. Debug.LogError("Error connecting to the database: " + ex.Message);
  309. 彈跳面板.SetActive(true);
  310. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  311. }
  312. finally
  313. {
  314. connection.Close();
  315. }
  316. }
  317. if (Main.Global.PA4 =="")
  318. {
  319. if (Main.Global.螢幕格式=="胖")
  320. {
  321. 書頁名1.text=書籍內容清單[0][0];
  322. 第幾頁1.text=書籍內容清單[0][1];
  323. }
  324. else
  325. {
  326. 書頁名.text=書籍內容清單[0][0];
  327. 第幾頁.text=書籍內容清單[0][1];
  328. }
  329. }
  330. 最大頁數 =書籍內容清單.Count;
  331. if (copy1 != null)
  332. {
  333. DeletetextCopies1();
  334. }
  335. int sum = 5;
  336. for (int i = 0; i < 書籍內容清單.Count; i++)
  337. {
  338. GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
  339. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  340. buttonObj.transform.SetParent(buttonParent1, false);
  341. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  342. Button bt = buttonObj.GetComponentInChildren<Button>();
  343. int index = i;
  344. bt.onClick.AddListener(() =>
  345. {
  346. 選擇頁面.SetActive(!選擇頁面.activeSelf);
  347. string str1 = 書籍內容清單[index][1].ToString().Trim('"');
  348. if (Main.Global.螢幕格式=="胖")
  349. {
  350. 寬板.SetActive(!寬板.activeSelf);
  351. string str = 書編1.text;
  352. 書頁名1.text=書籍內容清單[index][0].ToString().Trim('"');
  353. 第幾頁1.text=書籍內容清單[index][1].ToString().Trim('"');
  354. 顯示圖片(str, str1);
  355. }
  356. else
  357. {
  358. 細板.SetActive(!細板.activeSelf);
  359. string str = 書編.text;
  360. 書頁名.text=書籍內容清單[index][0].ToString().Trim('"');
  361. 第幾頁.text=書籍內容清單[index][1].ToString().Trim('"');
  362. 顯示圖片(str, str1);
  363. }
  364. });
  365. text[0].text = 書籍內容清單[i][0].ToString().Trim('"');
  366. text[1].text = 書籍內容清單[i][1].ToString().Trim('"');
  367. sum+=120;
  368. copy1.Add(buttonObj);
  369. }
  370. buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  371. 讀取面板.SetActive(false);
  372. }
  373. public void 顯示圖片(string 書名 , string 頁數)
  374. {
  375. rawImage.texture =Texture2D.blackTexture;
  376. 讀取面板.SetActive(true);
  377. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  378. {
  379. try
  380. {
  381. connection.Open();
  382. string query = "SELECT 圖片 FROM 書籍資料庫 WHERE 書籍編號 LIKE N'" + 書名 + "' AND 頁數 LIKE N'" + 頁數 + "'";
  383. Debug.Log(query);
  384. using (SqlCommand command = new SqlCommand(query, connection))
  385. {
  386. using (SqlDataReader reader = command.ExecuteReader())
  387. {
  388. while (reader.Read()) // 假設只取前兩筆資料
  389. {
  390. byte[] bytes = (byte[])reader["圖片"];
  391. Texture2D texture = new Texture2D(2, 2);
  392. texture.LoadImage(bytes);
  393. if (Main.Global.螢幕方向=="直")
  394. {
  395. if (Main.Global.螢幕格式=="胖")
  396. {
  397. rawImage1.texture = texture;
  398. float aspectRatio = (float)texture.width / texture.height;
  399. float newWidth = Mathf.Min(1000f, rawImage1.rectTransform.rect.width);
  400. float newHeight = newWidth / aspectRatio;
  401. rawImage1.rectTransform.sizeDelta = new Vector2(newWidth, newHeight);
  402. }
  403. else
  404. {
  405. rawImage.texture = texture;
  406. float aspectRatio = (float)texture.width / texture.height;
  407. float newWidth = Mathf.Min(900f, rawImage.rectTransform.rect.width);
  408. float newHeight = newWidth / aspectRatio;
  409. rawImage.rectTransform.sizeDelta = new Vector2(newWidth, newHeight);
  410. }
  411. }
  412. else
  413. {
  414. if (Main.Global.螢幕格式=="胖")
  415. {
  416. rawImage1.texture = texture;
  417. float aspectRatio = (float)texture.width / texture.height;
  418. float newHeight = Mathf.Min(850f, rawImage1.rectTransform.rect.height);
  419. float newWidth = newHeight * aspectRatio;
  420. rawImage1.rectTransform.sizeDelta = new Vector2(newWidth, newHeight);
  421. }
  422. else
  423. {
  424. rawImage.texture = texture;
  425. float aspectRatio = (float)texture.width / texture.height;
  426. float newHeight = Mathf.Min(750f, rawImage.rectTransform.rect.height);
  427. float newWidth = newHeight * aspectRatio;
  428. rawImage.rectTransform.sizeDelta = new Vector2(newWidth, newHeight);
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. catch (Exception ex)
  436. {
  437. Debug.LogError("Error connecting to the database: " + ex.Message);
  438. 彈跳面板.SetActive(true);
  439. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  440. }
  441. finally
  442. {
  443. connection.Close();
  444. }
  445. }
  446. 讀取面板.SetActive(false);
  447. }
  448. public void 選單按鈕()
  449. {
  450. if (Main.Global.螢幕格式=="胖")
  451. {
  452. 寬板.SetActive(!寬板.activeSelf);
  453. }
  454. else
  455. {
  456. 細板.SetActive(!細板.activeSelf);
  457. }
  458. 選擇頁面.SetActive(!選擇頁面.activeSelf);
  459. }
  460. public void 倍率改變()
  461. {
  462. float scaleFactor = scrollbar.value;
  463. rawImage.transform.localScale = new Vector3(initialScale * scaleFactor, initialScale * scaleFactor, 1f);
  464. }
  465. public void 倍率改變1()
  466. {
  467. float scaleFactor = scrollbar1.value;
  468. rawImage1.transform.localScale = new Vector3(initialScale * scaleFactor, initialScale * scaleFactor, 1f);
  469. }
  470. public void DeletetextCopies1()
  471. {
  472. // 刪除複製出來的物件
  473. foreach (GameObject copy in copy1)
  474. {
  475. Destroy(copy);
  476. }
  477. copy1.Clear();
  478. }
  479. public void 上頁()
  480. {
  481. int currentPage = 0;
  482. if (Main.Global.螢幕格式=="胖")
  483. {
  484. currentPage = int.Parse(第幾頁1.text);
  485. }
  486. else
  487. {
  488. currentPage = int.Parse(第幾頁.text);
  489. }
  490. if (currentPage < 1 || currentPage > 最大頁數)
  491. {
  492. 彈跳面板.SetActive(true);
  493. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  494. }
  495. else
  496. {
  497. int newPage = Mathf.Max(1, currentPage - 1); // 確保不會小於 1
  498. if (Main.Global.螢幕格式=="胖")
  499. {
  500. 書頁名1.text=書籍內容清單[newPage-1][0];
  501. 第幾頁1.text = newPage.ToString();
  502. string str = 書編1.text;
  503. string str1 = 第幾頁1.text;
  504. 顯示圖片(str, str1);
  505. }
  506. else
  507. {
  508. 書頁名.text=書籍內容清單[newPage-1][0];
  509. 第幾頁.text = newPage.ToString();
  510. string str = 書編.text;
  511. string str1 = 第幾頁.text;
  512. 顯示圖片(str, str1);
  513. }
  514. }
  515. }
  516. public void 下頁()
  517. {
  518. int currentPage = 0;
  519. if (Main.Global.螢幕格式=="胖")
  520. {
  521. currentPage = int.Parse(第幾頁1.text);
  522. }
  523. else
  524. {
  525. currentPage = int.Parse(第幾頁.text);
  526. }
  527. if (currentPage < 1 || currentPage > 最大頁數)
  528. {
  529. 彈跳面板.SetActive(true);
  530. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  531. }
  532. else
  533. {
  534. int newPage = Mathf.Min(最大頁數, currentPage + 1); // 確保不會超過最大頁數
  535. if (Main.Global.螢幕格式=="胖")
  536. {
  537. 書頁名1.text=書籍內容清單[newPage-1][0];
  538. 第幾頁1.text = newPage.ToString();
  539. string str = 書編1.text;
  540. string str1 = 第幾頁1.text;
  541. 顯示圖片(str, str1);
  542. }
  543. else
  544. {
  545. 書頁名.text=書籍內容清單[newPage-1][0];
  546. 第幾頁.text = newPage.ToString();
  547. string str = 書編.text;
  548. string str1 = 第幾頁.text;
  549. 顯示圖片(str, str1);
  550. }
  551. }
  552. }
  553. public void 指定()
  554. {
  555. int currentPage = 0;
  556. if (Main.Global.螢幕格式=="胖")
  557. {
  558. currentPage = int.Parse(第幾頁1.text);
  559. }
  560. else
  561. {
  562. currentPage = int.Parse(第幾頁.text);
  563. }
  564. if (currentPage < 1 || currentPage > 最大頁數)
  565. {
  566. 彈跳面板.SetActive(true);
  567. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  568. }
  569. else
  570. {
  571. if (Main.Global.螢幕格式=="胖")
  572. {
  573. 書頁名1.text=書籍內容清單[currentPage-1][0];
  574. string str = 書編1.text;
  575. string str1 = 第幾頁1.text;
  576. 顯示圖片(str, str1);
  577. }
  578. else
  579. {
  580. 書頁名.text=書籍內容清單[currentPage-1][0];
  581. string str = 書編.text;
  582. string str1 = 第幾頁.text;
  583. 顯示圖片(str, str1);
  584. }
  585. }
  586. }
  587. public void 彈跳面板關閉()
  588. {
  589. 彈跳面板.SetActive(false);
  590. 彈跳文字.text = "";
  591. }
  592. public void 回選書()
  593. {
  594. 選擇書籍.SetActive(true);
  595. 細板.SetActive(false);
  596. 寬板.SetActive(false);
  597. 選擇頁面.SetActive(false);
  598. 回主頁紐.SetActive(true);
  599. 回選擇書籍紐.SetActive(false);
  600. 選擇頁面紐.SetActive(false);
  601. 書編1.text="";
  602. 書名s1.text="";
  603. 書頁名1.text="";
  604. 第幾頁1.text="";
  605. 書編.text="";
  606. 書名s.text="";
  607. 書頁名.text="";
  608. 第幾頁.text="";
  609. }
  610. public void 回主()
  611. {
  612. if (Main.Global.螢幕方向=="直")
  613. {
  614. change_Secen(1);
  615. }
  616. else
  617. {
  618. change_Secen(3);
  619. }
  620. }
  621. public void change_Secen(int _screenNum)
  622. {
  623. SceneManager.LoadScene(_screenNum);
  624. }
  625. public void 截圖()
  626. {
  627. string fileName = string.Format("{0}/screenshot_{1}.png", Application.persistentDataPath, System.DateTime.Now.ToString("yyyyMMdd_HHmmss"));
  628. ScreenCapture.CaptureScreenshot(fileName);
  629. }
  630. }