Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

歷史資料庫.cs 46KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  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 TMP_Dropdown 年;
  21. public TMP_Dropdown 西元;
  22. public RawImage rawImage;
  23. public RawImage rawImage1;
  24. [SerializeField] TMP_InputField 關鍵字;
  25. [SerializeField] TextMeshProUGUI 選擇書籍標題;
  26. [SerializeField] TextMeshProUGUI 選擇頁標題;
  27. [SerializeField] TextMeshProUGUI 圖片頁標題;
  28. [SerializeField] TextMeshProUGUI 圖片頁標題1;
  29. public CanvasScaler canvasScaler;
  30. [SerializeField] GameObject 細板;
  31. [SerializeField] GameObject 寬板;
  32. [SerializeField] GameObject 回主頁紐;
  33. [SerializeField] GameObject 回選擇書籍紐;
  34. [SerializeField] GameObject 選擇頁面紐;
  35. [SerializeField] GameObject 選擇書籍;
  36. [SerializeField] GameObject 選擇頁面;
  37. [SerializeField] TextMeshProUGUI 書編;
  38. [SerializeField] TextMeshProUGUI 書名s;
  39. [SerializeField] TextMeshProUGUI 書頁名;
  40. [SerializeField] TMP_InputField 第幾頁;
  41. [SerializeField] TextMeshProUGUI 書編1;
  42. [SerializeField] TextMeshProUGUI 書名s1;
  43. [SerializeField] TextMeshProUGUI 書頁名1;
  44. [SerializeField] TMP_InputField 第幾頁1;
  45. [SerializeField] GameObject 讀取面板;
  46. [SerializeField] TextMeshProUGUI 讀取;
  47. [SerializeField] GameObject 彈跳面板;
  48. [SerializeField] TextMeshProUGUI 彈跳文字;
  49. private string loadingText = "";
  50. private int dotCount = 0;
  51. JSONArray 書籍清單;
  52. JSONArray 書籍內容清單;
  53. public GameObject buttonPrefab;
  54. public Transform buttonParent;
  55. public GameObject buttonceneter;
  56. private List<GameObject> copy = new List<GameObject>();
  57. public GameObject buttonPrefab1;
  58. public Transform buttonParent1;
  59. public GameObject buttonceneter1;
  60. private List<GameObject> copy1 = new List<GameObject>();
  61. int 最大頁數;
  62. [SerializeField] Slider scrollbar;
  63. [SerializeField] Slider scrollbar1;
  64. private float initialScale;
  65. private ScreenOrientation currentOrientation;
  66. private float 旋轉角度 = 0f;
  67. Texture2D texture;
  68. bool 判斷;
  69. // Start is called before the first frame update
  70. void Start()
  71. {
  72. //Main.Global.固寬=1000f;
  73. //Main.Global.固高=1600f;
  74. //Main.Global.固比=1f;
  75. //Main.Global.螢幕格式="胖";
  76. //Main.Global.螢幕方向="直";
  77. //Main.Global.資料庫名稱="命名";
  78. //Main.Global.sql="Data Source=180.177.181.162,5264;Initial Catalog=BIFENG-ERP-SYS;User ID=b70340;Password=0911274990";
  79. Main.Global.PA1="";
  80. Main.Global.PA2="";
  81. Main.Global.PA3="";
  82. Main.Global.PA4="";
  83. Screen.autorotateToPortrait = true;
  84. Screen.orientation = ScreenOrientation.AutoRotation;
  85. if (Main.Global.螢幕方向=="直")
  86. {
  87. canvasScaler.referenceResolution = new Vector2(Main.Global.固寬, Main.Global.固高);
  88. canvasScaler.matchWidthOrHeight=Main.Global.固比;
  89. }
  90. else
  91. {
  92. canvasScaler.referenceResolution = new Vector2(Main.Global.固高, Main.Global.固寬);
  93. canvasScaler.matchWidthOrHeight=Main.Global.固比1;
  94. }
  95. currentOrientation = Screen.orientation;
  96. if (Main.Global.資料庫名稱=="流年")
  97. {
  98. 圖片頁標題.text ="西元-年";
  99. 圖片頁標題1.text ="西元-年";
  100. }
  101. else
  102. {
  103. 圖片頁標題.text ="日期";
  104. 圖片頁標題1.text ="日期";
  105. }
  106. if (Main.Global.螢幕格式=="胖")
  107. {
  108. initialScale = rawImage1.transform.localScale.x;
  109. if (Main.Global.PA1 == "")
  110. {
  111. 選擇書籍.SetActive(true);
  112. 回主頁紐.SetActive(true);
  113. 回選擇書籍紐.SetActive(false);
  114. 選擇頁面紐.SetActive(false);
  115. }
  116. else if (Main.Global.PA1 != "" && Main.Global.PA4 !="")
  117. {
  118. 選擇書籍.SetActive(false);
  119. string str1 = Main.Global.PA4;
  120. 細板.SetActive(false);
  121. 寬板.SetActive(true);
  122. 書編1.text =Main.Global.PA1;
  123. 書名s1.text=Main.Global.PA2;
  124. 書頁名1.text=Main.Global.PA3;
  125. 第幾頁1.text=Main.Global.PA4;
  126. 選擇頁面.SetActive(false);
  127. 回主頁紐.SetActive(false);
  128. 回選擇書籍紐.SetActive(true);
  129. 選擇頁面紐.SetActive(true);
  130. 讀取書籍內容清單();
  131. 顯示圖片(str1);
  132. }
  133. }
  134. else
  135. {
  136. initialScale = rawImage.transform.localScale.x;
  137. if (Main.Global.PA1 == "")
  138. {
  139. 選擇書籍.SetActive(true);
  140. 回主頁紐.SetActive(true);
  141. 回選擇書籍紐.SetActive(false);
  142. 選擇頁面紐.SetActive(false);
  143. }
  144. else if (Main.Global.PA1 != "" && Main.Global.PA4 !="")
  145. {
  146. 選擇書籍.SetActive(false);
  147. string str1 = Main.Global.PA4;
  148. 細板.SetActive(true);
  149. 寬板.SetActive(false);
  150. 書編.text =Main.Global.PA1;
  151. 書名s.text=Main.Global.PA2;
  152. 書頁名.text=Main.Global.PA3;
  153. 第幾頁.text=Main.Global.PA4;
  154. 選擇頁面.SetActive(false);
  155. 回主頁紐.SetActive(false);
  156. 回選擇書籍紐.SetActive(true);
  157. 選擇頁面紐.SetActive(true);
  158. 讀取書籍內容清單();
  159. 顯示圖片(str1);
  160. }
  161. }
  162. StartCoroutine(AnimateText());
  163. 讀取年份();
  164. 讀取書籍清單();
  165. }
  166. IEnumerator AnimateText()
  167. {
  168. string qqq = 讀取.text.ToString();
  169. while (true)
  170. {
  171. yield return new WaitForSeconds(0.5f);
  172. if (dotCount < 3)
  173. {
  174. loadingText += ".";
  175. dotCount++;
  176. }
  177. else
  178. {
  179. loadingText = "";
  180. dotCount = 0;
  181. }
  182. 讀取.text = qqq+loadingText;
  183. }
  184. }
  185. void Update()
  186. {
  187. if (Screen.orientation != currentOrientation)
  188. {
  189. if (Screen.orientation == ScreenOrientation.LandscapeLeft)
  190. {
  191. Main.Global.螢幕方向="橫";
  192. if (Main.Global.螢幕格式=="胖")
  193. {
  194. Main.Global.PA1=書編1.text;
  195. Main.Global.PA2=書名s1.text;
  196. Main.Global.PA3=書頁名1.text;
  197. Main.Global.PA4=第幾頁1.text;
  198. }
  199. else
  200. {
  201. Main.Global.PA1=書編.text;
  202. Main.Global.PA2=書名s.text;
  203. Main.Global.PA3=書頁名.text;
  204. Main.Global.PA4=第幾頁.text;
  205. }
  206. change_Secen(6);
  207. }
  208. if (Screen.orientation == ScreenOrientation.Portrait)
  209. {
  210. if (Main.Global.螢幕格式=="胖")
  211. {
  212. Main.Global.PA1=書編1.text;
  213. Main.Global.PA2=書名s1.text;
  214. Main.Global.PA3=書頁名1.text;
  215. Main.Global.PA4=第幾頁1.text;
  216. }
  217. else
  218. {
  219. Main.Global.PA1=書編.text;
  220. Main.Global.PA2=書名s.text;
  221. Main.Global.PA3=書頁名.text;
  222. Main.Global.PA4=第幾頁.text;
  223. }
  224. Main.Global.螢幕方向="直";
  225. change_Secen(5);
  226. }
  227. }
  228. }
  229. public void 讀取年份()
  230. {
  231. 讀取面板.SetActive(true);
  232. 年.options.Clear();
  233. 西元.options.Clear();
  234. List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
  235. List<TMP_Dropdown.OptionData> options1 = new List<TMP_Dropdown.OptionData>();
  236. options.Add(new TMP_Dropdown.OptionData(""));
  237. options1.Add(new TMP_Dropdown.OptionData(""));
  238. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  239. {
  240. try
  241. {
  242. connection.Open();
  243. string query = "SELECT LEFT(西元, 4) AS 西元, 年 FROM 萬年曆 WHERE (RIGHT(西元, 5) LIKE '05/05') GROUP BY LEFT(西元, 4), 年 ORDER BY 西元, 年";
  244. using (SqlCommand command = new SqlCommand(query, connection))
  245. {
  246. using (SqlDataReader reader = command.ExecuteReader())
  247. {
  248. while (reader.Read()) // 假設只取前兩筆資料
  249. {
  250. options.Add(new TMP_Dropdown.OptionData(reader["年"].ToString()));
  251. options1.Add(new TMP_Dropdown.OptionData(reader["西元"].ToString()));
  252. }
  253. 年.AddOptions(options);
  254. 西元.AddOptions(options1);
  255. 年.value = 0;
  256. 西元.value = 0;
  257. 年.onValueChanged.AddListener(OnDropdown1ValueChanged);
  258. 西元.onValueChanged.AddListener(OnDropdown2ValueChanged);
  259. }
  260. }
  261. }
  262. catch (Exception ex)
  263. {
  264. Debug.LogError("Error connecting to the database: " + ex.Message);
  265. 彈跳面板.SetActive(true);
  266. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  267. }
  268. finally
  269. {
  270. connection.Close();
  271. }
  272. }
  273. 讀取面板.SetActive(false);
  274. }
  275. void OnDropdown1ValueChanged(int index)
  276. {
  277. 西元.value = index;
  278. 關鍵字.text = "";
  279. 讀取書籍清單();
  280. }
  281. // 當第二個下拉式清單的值改變時被呼叫
  282. void OnDropdown2ValueChanged(int index)
  283. {
  284. 年.value = index;
  285. 關鍵字.text = "";
  286. 讀取書籍清單();
  287. }
  288. public void 讀取書籍清單()
  289. {
  290. 讀取面板.SetActive(true);
  291. 書籍清單 = new JSONArray();
  292. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  293. {
  294. try
  295. {
  296. connection.Open();
  297. string query = "";
  298. if (關鍵字.text =="")
  299. {
  300. if (Main.Global.資料庫名稱=="風水")
  301. {
  302. query = "SELECT 客戶資料庫.姓名, 風水資料表.日期, 風水資料表.客戶編號, 客戶資料庫.備註 " +
  303. "FROM 風水資料表 LEFT OUTER JOIN 客戶資料庫 ON 風水資料表.客戶編號 = 客戶資料庫.流水號 " +
  304. "WHERE LEFT(風水資料表.日期, 4) LIKE '%"+ 西元.options[西元.value].text +"%' " +
  305. "GROUP BY 客戶資料庫.姓名, 風水資料表.日期, 風水資料表.客戶編號, 客戶資料庫.備註 " +
  306. "ORDER BY 風水資料表.日期 DESC";
  307. }
  308. else if (Main.Global.資料庫名稱=="擇日")
  309. {
  310. query = "SELECT 客戶資料庫.姓名, 擇日資料表.日期, 擇日資料表.客戶編號, 客戶資料庫.備註 " +
  311. "FROM 擇日資料表 LEFT OUTER JOIN 客戶資料庫 ON 擇日資料表.客戶編號 = 客戶資料庫.流水號 " +
  312. "WHERE LEFT(擇日資料表.日期, 4) LIKE '%"+ 西元.options[西元.value].text +"%' " +
  313. "GROUP BY 客戶資料庫.姓名, 擇日資料表.日期, 擇日資料表.客戶編號, 客戶資料庫.備註 " +
  314. "ORDER BY 擇日資料表.日期 DESC";
  315. }
  316. else if (Main.Global.資料庫名稱=="命名")
  317. {
  318. query = "SELECT 客戶資料庫.姓名, 命名資料表.日期, 命名資料表.客戶編號, 客戶資料庫.備註 " +
  319. "FROM 命名資料表 LEFT OUTER JOIN 客戶資料庫 ON 命名資料表.客戶編號 = 客戶資料庫.流水號 " +
  320. "WHERE LEFT(命名資料表.日期, 4) LIKE '%"+ 西元.options[西元.value].text +"%' " +
  321. "GROUP BY 客戶資料庫.姓名, 命名資料表.日期, 命名資料表.客戶編號, 客戶資料庫.備註 " +
  322. "ORDER BY 命名資料表.日期 DESC";
  323. }
  324. else if (Main.Global.資料庫名稱=="流年")
  325. {
  326. query = "SELECT 客戶資料庫.姓名, 流年資料表.西元, 流年資料表.年, 流年資料表.客戶編號, 客戶資料庫.備註 " +
  327. "FROM 流年資料表 LEFT OUTER JOIN 客戶資料庫 ON 流年資料表.客戶編號 = 客戶資料庫.流水號 " +
  328. "WHERE 流年資料表.西元 LIKE '%"+ 西元.options[西元.value].text +"%' AND 流年資料表.年 LIKE '%"+ 年.options[年.value].text +"%' " +
  329. "GROUP BY 客戶資料庫.姓名, 流年資料表.西元, 流年資料表.年, 流年資料表.客戶編號, 客戶資料庫.備註 " +
  330. "ORDER BY 流年資料表.西元 DESC, 流年資料表.年";
  331. }
  332. }
  333. else
  334. {
  335. if (Main.Global.資料庫名稱=="風水")
  336. {
  337. query = "SELECT 客戶資料庫.姓名, 風水資料表.日期, 風水資料表.客戶編號, 客戶資料庫.備註 " +
  338. "FROM 風水資料表 LEFT OUTER JOIN 客戶資料庫 ON 風水資料表.客戶編號 = 客戶資料庫.流水號 " +
  339. "WHERE 客戶資料庫.區域 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.客戶群組 LIKE N'%" + 關鍵字.text + "%' " +
  340. "OR 客戶資料庫.姓名 LIKE N'%" + 關鍵字.text + "%' OR " +
  341. "客戶資料庫.性別 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.電話 LIKE N'%" + 關鍵字.text + "%' OR " +
  342. "客戶資料庫.地址 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.備註 LIKE N'%" + 關鍵字.text + "%' " +
  343. "GROUP BY 客戶資料庫.姓名, 風水資料表.日期, 風水資料表.客戶編號, 客戶資料庫.備註 " +
  344. "ORDER BY 風水資料表.日期 DESC";
  345. }
  346. else if (Main.Global.資料庫名稱=="擇日")
  347. {
  348. query = "SELECT 客戶資料庫.姓名, 擇日資料表.日期, 擇日資料表.客戶編號, 客戶資料庫.備註 " +
  349. "FROM 擇日資料表 LEFT OUTER JOIN 客戶資料庫 ON 擇日資料表.客戶編號 = 客戶資料庫.流水號 " +
  350. "WHERE 客戶資料庫.區域 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.客戶群組 LIKE N'%" + 關鍵字.text + "%' " +
  351. "OR 客戶資料庫.姓名 LIKE N'%" + 關鍵字.text + "%' OR " +
  352. "客戶資料庫.性別 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.電話 LIKE N'%" + 關鍵字.text + "%' OR " +
  353. "客戶資料庫.地址 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.備註 LIKE N'%" + 關鍵字.text + "%' " +
  354. "GROUP BY 客戶資料庫.姓名, 擇日資料表.日期, 擇日資料表.客戶編號, 客戶資料庫.備註 " +
  355. "ORDER BY 擇日資料表.日期 DESC";
  356. }
  357. else if (Main.Global.資料庫名稱=="命名")
  358. {
  359. query = "SELECT 客戶資料庫.姓名, 命名資料表.日期, 命名資料表.客戶編號, 客戶資料庫.備註 " +
  360. "FROM 命名資料表 LEFT OUTER JOIN 客戶資料庫 ON 命名資料表.客戶編號 = 客戶資料庫.流水號 " +
  361. "WHERE 客戶資料庫.區域 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.客戶群組 LIKE N'%" + 關鍵字.text + "%' " +
  362. "OR 客戶資料庫.姓名 LIKE N'%" + 關鍵字.text + "%' OR " +
  363. "客戶資料庫.性別 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.電話 LIKE N'%" + 關鍵字.text + "%' OR " +
  364. "客戶資料庫.地址 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.備註 LIKE N'%" + 關鍵字.text + "%' " +
  365. "GROUP BY 客戶資料庫.姓名, 命名資料表.日期, 命名資料表.客戶編號, 客戶資料庫.備註 " +
  366. "ORDER BY 命名資料表.日期 DESC";
  367. }
  368. else if (Main.Global.資料庫名稱=="流年")
  369. {
  370. query = "SELECT 客戶資料庫.姓名, 流年資料表.西元, 流年資料表.年, 流年資料表.客戶編號, 客戶資料庫.備註 " +
  371. "FROM 流年資料表 LEFT OUTER JOIN 客戶資料庫 ON 流年資料表.客戶編號 = 客戶資料庫.流水號 " +
  372. "WHERE 客戶資料庫.區域 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.客戶群組 LIKE N'%" + 關鍵字.text + "%' " +
  373. "OR 客戶資料庫.姓名 LIKE N'%" + 關鍵字.text + "%' OR " +
  374. "客戶資料庫.性別 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.電話 LIKE N'%" + 關鍵字.text + "%' OR " +
  375. "客戶資料庫.地址 LIKE N'%" + 關鍵字.text + "%' OR 客戶資料庫.備註 LIKE N'%" + 關鍵字.text + "%' " +
  376. "GROUP BY 客戶資料庫.姓名, 流年資料表.西元, 流年資料表.年, 流年資料表.客戶編號, 客戶資料庫.備註 " +
  377. "ORDER BY 流年資料表.西元 DESC, 流年資料表.年";
  378. }
  379. }
  380. using (SqlCommand command = new SqlCommand(query, connection))
  381. {
  382. using (SqlDataReader reader = command.ExecuteReader())
  383. {
  384. while (reader.Read()) // 假設只取前兩筆資料
  385. {
  386. JSONNode newValue = new JSONObject();
  387. if (Main.Global.資料庫名稱=="流年")
  388. {
  389. newValue["姓名"] = reader["姓名"].ToString();
  390. newValue["客戶編號"] = reader["客戶編號"].ToString();
  391. newValue["備註"] = reader["備註"].ToString();
  392. newValue["西元"] = reader["西元"].ToString();
  393. newValue["年"] = reader["年"].ToString();
  394. }
  395. else
  396. {
  397. newValue["姓名"] = reader["姓名"].ToString();
  398. newValue["客戶編號"] = reader["客戶編號"].ToString();
  399. newValue["備註"] = reader["備註"].ToString();
  400. newValue["日期"] = reader["日期"].ToString();
  401. }
  402. 書籍清單.Add(newValue);
  403. }
  404. }
  405. }
  406. }
  407. catch (Exception ex)
  408. {
  409. Debug.LogError("Error connecting to the database: " + ex.Message);
  410. 彈跳面板.SetActive(true);
  411. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  412. }
  413. finally
  414. {
  415. connection.Close();
  416. }
  417. }
  418. if (copy != null)
  419. {
  420. DeleteCopies(copy);
  421. }
  422. int sum = 5;
  423. if (Main.Global.資料庫名稱=="流年")
  424. {
  425. 選擇書籍標題.text ="西元-年";
  426. }
  427. else
  428. {
  429. 選擇書籍標題.text ="日期";
  430. }
  431. for (int i = 0; i < 書籍清單.Count; i++)
  432. {
  433. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  434. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  435. buttonObj.transform.SetParent(buttonParent, false);
  436. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  437. Button bt = buttonObj.GetComponentInChildren<Button>();
  438. int index = i;
  439. bt.onClick.AddListener(() =>
  440. {
  441. 旋轉角度 = 0f;
  442. scrollbar.value=1f;
  443. scrollbar1.value=1f;
  444. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  445. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  446. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  447. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  448. 判斷 = false;
  449. 選擇書籍.SetActive(false);
  450. if (Main.Global.螢幕格式=="胖")
  451. {
  452. 寬板.SetActive(true);
  453. 細板.SetActive(false);
  454. 書編1.text =書籍清單[index][1].ToString().Trim('"');
  455. 書名s1.text=書籍清單[index][0].ToString().Trim('"');
  456. if (Main.Global.資料庫名稱=="流年")
  457. {
  458. 書頁名1.text=書籍清單[index][3].ToString().Trim('"')+"-"+書籍清單[index][4].ToString().Trim('"');
  459. }
  460. else
  461. {
  462. 書頁名1.text=書籍清單[index][3].ToString().Trim('"');
  463. }
  464. }
  465. else
  466. {
  467. 細板.SetActive(true);
  468. 寬板.SetActive(false);
  469. 書編.text =書籍清單[index][1].ToString().Trim('"');
  470. 書名s.text=書籍清單[index][0].ToString().Trim('"');
  471. if (Main.Global.資料庫名稱=="流年")
  472. {
  473. 書頁名.text=書籍清單[index][3].ToString().Trim('"')+"-"+書籍清單[index][4].ToString().Trim('"');
  474. }
  475. else
  476. {
  477. 書頁名.text=書籍清單[index][3].ToString().Trim('"');
  478. }
  479. }
  480. 選擇頁面.SetActive(false);
  481. 回主頁紐.SetActive(false);
  482. 回選擇書籍紐.SetActive(true);
  483. 選擇頁面紐.SetActive(true);
  484. 讀取書籍內容清單();
  485. 顯示圖片("1");
  486. });
  487. if (Main.Global.資料庫名稱=="流年")
  488. {
  489. text[0].text = 書籍清單[i][0].ToString().Trim('"');
  490. text[1].text = 書籍清單[i][3].ToString().Trim('"')+"-"+ 書籍清單[i][4].ToString().Trim('"');
  491. }
  492. else
  493. {
  494. text[0].text = 書籍清單[i][0].ToString().Trim('"');
  495. text[1].text = 書籍清單[i][3].ToString().Trim('"');
  496. }
  497. sum+=120;
  498. copy.Add(buttonObj);
  499. }
  500. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  501. 讀取面板.SetActive(false);
  502. }
  503. public void 讀取書籍內容清單()
  504. {
  505. 讀取面板.SetActive(true);
  506. 書籍內容清單 = new JSONArray();
  507. string str = "";
  508. string str1 = "";
  509. string str2 = "";
  510. if (Main.Global.資料庫名稱=="流年")
  511. {
  512. if (Main.Global.螢幕格式=="胖")
  513. {
  514. str=書編1.text;
  515. string gg = 書頁名1.text;
  516. string[] 分割結果 = gg.Split('-');
  517. str1 = 分割結果[0];
  518. str2 = 分割結果[1];
  519. }
  520. else
  521. {
  522. str=書編.text;
  523. string gg = 書頁名.text;
  524. string[] 分割結果 = gg.Split('-');
  525. str1 = 分割結果[0];
  526. str2 = 分割結果[1];
  527. }
  528. }
  529. else
  530. {
  531. if (Main.Global.螢幕格式=="胖")
  532. {
  533. str=書編1.text;
  534. str1 = 書頁名1.text;
  535. }
  536. else
  537. {
  538. str=書編.text;
  539. str1 = 書頁名.text;
  540. }
  541. }
  542. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  543. {
  544. try
  545. {
  546. connection.Open();
  547. string query = "";
  548. if (Main.Global.資料庫名稱=="風水")
  549. {
  550. query = "SELECT 風水資料表.日期, 頁數, 備註 FROM 風水資料表 WHERE (客戶編號 LIKE '" + str + "' AND " +
  551. "風水資料表.日期 LIKE '" + str1 + "') ORDER BY 日期 DESC, 頁數";
  552. }
  553. else if (Main.Global.資料庫名稱=="擇日")
  554. {
  555. query = "SELECT 擇日資料表.日期, 頁數, 備註 FROM 擇日資料表 WHERE (客戶編號 LIKE '" + str + "' AND " +
  556. "擇日資料表.日期 LIKE '" + str1 + "') ORDER BY 日期 DESC, 頁數";
  557. }
  558. else if (Main.Global.資料庫名稱=="命名")
  559. {
  560. query = "SELECT 命名資料表.日期, 頁數, 備註 FROM 命名資料表 WHERE (客戶編號 LIKE '" + str + "' AND " +
  561. "命名資料表.日期 LIKE '" + str1 + "') ORDER BY 日期 DESC, 頁數";
  562. }
  563. else if (Main.Global.資料庫名稱=="流年")
  564. {
  565. query = "SELECT 西元, 頁數, 備註,年 FROM 流年資料表 WHERE (客戶編號 LIKE '" + str + "' AND " +
  566. "西元 LIKE '" + str1 + "' AND 年 LIKE '" + str2 + "') ORDER BY 西元 DESC, 頁數";
  567. }
  568. using (SqlCommand command = new SqlCommand(query, connection))
  569. {
  570. using (SqlDataReader reader = command.ExecuteReader())
  571. {
  572. while (reader.Read()) // 假設只取前兩筆資料
  573. {
  574. JSONNode newValue = new JSONObject();
  575. if (Main.Global.資料庫名稱=="流年")
  576. {
  577. newValue["西元"] = reader["西元"].ToString();
  578. newValue["頁數"] = reader["頁數"].ToString();
  579. newValue["備註"] = reader["備註"].ToString();
  580. newValue["年"] = reader["年"].ToString();
  581. }
  582. else
  583. {
  584. newValue["日期"] = reader["日期"].ToString();
  585. newValue["頁數"] = reader["頁數"].ToString();
  586. newValue["備註"] = reader["備註"].ToString();
  587. }
  588. 書籍內容清單.Add(newValue);
  589. }
  590. }
  591. }
  592. }
  593. catch (Exception ex)
  594. {
  595. Debug.LogError("Error connecting to the database: " + ex.Message);
  596. 彈跳面板.SetActive(true);
  597. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  598. }
  599. finally
  600. {
  601. connection.Close();
  602. }
  603. }
  604. if (Main.Global.PA4 =="")
  605. {
  606. if (Main.Global.螢幕格式=="胖")
  607. {
  608. if (Main.Global.資料庫名稱=="流年")
  609. {
  610. 書頁名1.text=書籍內容清單[0][0]+"-"+書籍內容清單[0][3];
  611. 第幾頁1.text=書籍內容清單[0][1];
  612. }
  613. else
  614. {
  615. 書頁名1.text=書籍內容清單[0][0];
  616. 第幾頁1.text=書籍內容清單[0][1];
  617. }
  618. }
  619. else
  620. {
  621. if (Main.Global.資料庫名稱=="流年")
  622. {
  623. 書頁名.text=書籍內容清單[0][0]+"-"+書籍內容清單[0][3];
  624. 第幾頁.text=書籍內容清單[0][1];
  625. }
  626. else
  627. {
  628. 書頁名.text=書籍內容清單[0][0];
  629. 第幾頁.text=書籍內容清單[0][1];
  630. }
  631. }
  632. }
  633. 最大頁數 =書籍內容清單.Count;
  634. if (copy1 != null)
  635. {
  636. DeleteCopies(copy1);
  637. }
  638. if (Main.Global.資料庫名稱=="流年")
  639. {
  640. 選擇頁標題.text ="西元-年";
  641. }
  642. else
  643. {
  644. 選擇頁標題.text ="日期";
  645. }
  646. int sum = 5;
  647. for (int i = 0; i < 書籍內容清單.Count; i++)
  648. {
  649. GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
  650. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  651. buttonObj.transform.SetParent(buttonParent1, false);
  652. TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  653. Button bt = buttonObj.GetComponentInChildren<Button>();
  654. int index1 = i;
  655. bt.onClick.AddListener(() =>
  656. {
  657. 選擇頁面.SetActive(!選擇頁面.activeSelf);
  658. string str1 = 書籍內容清單[index1][1].ToString().Trim('"');
  659. if (Main.Global.螢幕格式=="胖")
  660. {
  661. 寬板.SetActive(!寬板.activeSelf);
  662. 第幾頁1.text=書籍內容清單[index1][1].ToString().Trim('"');
  663. 顯示圖片(str1);
  664. }
  665. else
  666. {
  667. 細板.SetActive(!細板.activeSelf);
  668. 第幾頁.text=書籍內容清單[index1][1].ToString().Trim('"');
  669. 顯示圖片(str1);
  670. }
  671. });
  672. text[0].text = 書籍內容清單[i][0].ToString().Trim('"');
  673. text[1].text = 書籍內容清單[i][1].ToString().Trim('"');
  674. sum+=120;
  675. copy1.Add(buttonObj);
  676. }
  677. buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  678. 讀取面板.SetActive(false);
  679. }
  680. public void 顯示圖片(string 頁數)
  681. {
  682. rawImage.texture =Texture2D.blackTexture;
  683. 讀取面板.SetActive(true);
  684. string str = "";
  685. string str1 = "";
  686. string str2 = "";
  687. if (Main.Global.資料庫名稱=="流年")
  688. {
  689. if (Main.Global.螢幕格式=="胖")
  690. {
  691. str=書編1.text;
  692. string gg = 書頁名1.text;
  693. string[] 分割結果 = gg.Split('-');
  694. str1 = 分割結果[0];
  695. str2 = 分割結果[1];
  696. }
  697. else
  698. {
  699. str=書編.text;
  700. string gg = 書頁名.text;
  701. string[] 分割結果 = gg.Split('-');
  702. str1 = 分割結果[0];
  703. str2 = 分割結果[1];
  704. }
  705. }
  706. else
  707. {
  708. if (Main.Global.螢幕格式=="胖")
  709. {
  710. str=書編1.text;
  711. str1 = 書頁名1.text;
  712. }
  713. else
  714. {
  715. str=書編.text;
  716. str1 = 書頁名.text;
  717. }
  718. }
  719. using (SqlConnection connection = new SqlConnection(Main.Global.sql))
  720. {
  721. try
  722. {
  723. connection.Open();
  724. string query = "";
  725. if (Main.Global.資料庫名稱=="風水")
  726. {
  727. query = "SELECT 圖片 FROM 風水資料表 WHERE 客戶編號 LIKE N'" + str + "' AND +" +
  728. "日期 LIKE N'" + str1 + "' AND 頁數 LIKE N'" + 頁數 + "'";
  729. }
  730. else if (Main.Global.資料庫名稱=="擇日")
  731. {
  732. query = "SELECT 圖片 FROM 擇日資料表 WHERE 客戶編號 LIKE N'" + str + "' AND +" +
  733. "日期 LIKE N'" + str1 + "' AND 頁數 LIKE N'" + 頁數 + "'";
  734. }
  735. else if (Main.Global.資料庫名稱=="命名")
  736. {
  737. query = "SELECT 圖片 FROM 命名資料表 WHERE 客戶編號 LIKE N'" + str + "' AND +" +
  738. "日期 LIKE N'" + str1 + "' AND 頁數 LIKE N'" + 頁數 + "'";
  739. }
  740. else if (Main.Global.資料庫名稱=="流年")
  741. {
  742. query = "SELECT 圖片 FROM 流年資料表 WHERE 客戶編號 LIKE N'" + str + "' AND +" +
  743. "西元 LIKE N'" + str1 + "'AND 年 LIKE N'" + str2 + "' AND 頁數 LIKE N'" + 頁數 + "'";
  744. }
  745. Debug.Log(query);
  746. using (SqlCommand command = new SqlCommand(query, connection))
  747. {
  748. using (SqlDataReader reader = command.ExecuteReader())
  749. {
  750. while (reader.Read()) // 假設只取前兩筆資料
  751. {
  752. byte[] bytes = (byte[])reader["圖片"];
  753. texture = new Texture2D(2, 2);
  754. texture.LoadImage(bytes);
  755. 判斷 = false;
  756. 旋轉角度 = 0f;
  757. scrollbar.value=1f;
  758. scrollbar1.value=1f;
  759. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  760. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  761. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  762. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  763. if (Main.Global.螢幕方向 == "直")
  764. {
  765. if (Main.Global.螢幕格式 == "胖")
  766. {
  767. AdjustImageProperties(texture, rawImage1, 1000f, 1230f);
  768. }
  769. else
  770. {
  771. AdjustImageProperties(texture, rawImage, 900f, 1530f);
  772. }
  773. }
  774. else
  775. {
  776. if (Main.Global.螢幕格式 == "胖")
  777. {
  778. AdjustImageProperties(texture, rawImage1, 1600f, 850f);
  779. }
  780. else
  781. {
  782. AdjustImageProperties(texture, rawImage, 1900f, 750f);
  783. }
  784. }
  785. }
  786. }
  787. }
  788. }
  789. catch (Exception ex)
  790. {
  791. Debug.LogError("Error connecting to the database: " + ex.Message);
  792. 彈跳面板.SetActive(true);
  793. 彈跳文字.text = "目前無法連到伺服器,請通知系統管理員";
  794. }
  795. finally
  796. {
  797. connection.Close();
  798. }
  799. }
  800. 讀取面板.SetActive(false);
  801. }
  802. public void AdjustImageProperties(Texture texture, RawImage rawImage, float maxWidth, float maxHeight)
  803. {
  804. rawImage.texture = texture;
  805. rawImage.rectTransform.sizeDelta = new Vector2(maxWidth, maxHeight);
  806. float aspectRatio = (float)texture.width / texture.height;
  807. if (判斷)
  808. {
  809. aspectRatio = 1 / aspectRatio;
  810. }
  811. float aspectRatio1 = maxWidth / maxHeight;
  812. float newWidth ;
  813. float newHeight ;
  814. if (aspectRatio > aspectRatio1)
  815. {
  816. if (判斷)
  817. {
  818. newWidth = Mathf.Min(maxWidth, rawImage.rectTransform.rect.height);
  819. }
  820. else
  821. {
  822. newWidth = Mathf.Min(maxWidth, rawImage.rectTransform.rect.width);
  823. }
  824. newHeight = newWidth / aspectRatio;
  825. }
  826. else
  827. {
  828. if (判斷)
  829. {
  830. newHeight = Mathf.Min(maxHeight, rawImage.rectTransform.rect.width);
  831. }
  832. else
  833. {
  834. newHeight = Mathf.Min(maxHeight, rawImage.rectTransform.rect.height);
  835. }
  836. newWidth = newHeight * aspectRatio;
  837. }
  838. if (判斷)
  839. {
  840. rawImage.rectTransform.sizeDelta = new Vector2(newHeight, newWidth);
  841. }
  842. else
  843. {
  844. rawImage.rectTransform.sizeDelta = new Vector2(newWidth, newHeight);
  845. }
  846. Debug.Log(旋轉角度);
  847. Debug.Log(判斷);
  848. Debug.Log(aspectRatio);
  849. Debug.Log(aspectRatio1);
  850. Debug.Log(texture.width);
  851. Debug.Log(texture.height);
  852. Debug.Log(newWidth);
  853. Debug.Log(newHeight);
  854. }
  855. public void 選單按鈕()
  856. {
  857. if (Main.Global.螢幕格式=="胖")
  858. {
  859. 寬板.SetActive(!寬板.activeSelf);
  860. }
  861. else
  862. {
  863. 細板.SetActive(!細板.activeSelf);
  864. }
  865. 選擇頁面.SetActive(!選擇頁面.activeSelf);
  866. }
  867. public void 倍率改變()
  868. {
  869. float scaleFactor = scrollbar.value;
  870. rawImage.transform.localScale = new Vector3(initialScale * scaleFactor, initialScale * scaleFactor, 1f);
  871. }
  872. public void 倍率改變1()
  873. {
  874. float scaleFactor = scrollbar1.value;
  875. rawImage1.transform.localScale = new Vector3(initialScale * scaleFactor, initialScale * scaleFactor, 1f);
  876. }
  877. public void 旋轉正()
  878. {
  879. 判斷 = !判斷;
  880. scrollbar.value=1f;
  881. scrollbar1.value=1f;
  882. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  883. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  884. 旋轉角度 += 90f;
  885. if (旋轉角度 >= 360f)
  886. {
  887. 旋轉角度 -= 360f;
  888. }
  889. 圖片顯示();
  890. }
  891. public void 旋轉負()
  892. {
  893. 判斷 = !判斷;
  894. scrollbar.value=1f;
  895. scrollbar1.value=1f;
  896. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  897. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  898. 旋轉角度 -= 90f;
  899. if (旋轉角度 < 0f)
  900. {
  901. 旋轉角度 += 360f;
  902. }
  903. 圖片顯示();
  904. }
  905. public void 圖片顯示()
  906. {
  907. if (Main.Global.螢幕方向 == "直")
  908. {
  909. if (Main.Global.螢幕格式 == "胖")
  910. {
  911. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  912. AdjustImageProperties(texture, rawImage1, 1000f, 1230f);
  913. }
  914. else
  915. {
  916. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  917. AdjustImageProperties(texture, rawImage, 900f, 1530f);
  918. }
  919. }
  920. else
  921. {
  922. if (Main.Global.螢幕格式 == "胖")
  923. {
  924. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  925. AdjustImageProperties(texture, rawImage1, 1600f, 850f);
  926. }
  927. else
  928. {
  929. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  930. AdjustImageProperties(texture, rawImage, 1900f, 750f);
  931. }
  932. }
  933. }
  934. public void 上頁()
  935. {
  936. int currentPage = 0;
  937. if (Main.Global.螢幕格式=="胖")
  938. {
  939. currentPage = int.Parse(第幾頁1.text);
  940. }
  941. else
  942. {
  943. currentPage = int.Parse(第幾頁.text);
  944. }
  945. if (currentPage < 1 || currentPage > 最大頁數)
  946. {
  947. 彈跳面板.SetActive(true);
  948. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  949. }
  950. else
  951. {
  952. 判斷 = false;
  953. 旋轉角度 = 0f;
  954. scrollbar.value=1f;
  955. scrollbar1.value=1f;
  956. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  957. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  958. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  959. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  960. int newPage = Mathf.Max(1, currentPage - 1); // 確保不會小於 1
  961. if (Main.Global.螢幕格式=="胖")
  962. {
  963. 第幾頁1.text = newPage.ToString();
  964. string str1 = 第幾頁1.text;
  965. 顯示圖片(str1);
  966. }
  967. else
  968. {
  969. 第幾頁.text = newPage.ToString();
  970. string str1 = 第幾頁.text;
  971. 顯示圖片(str1);
  972. }
  973. }
  974. }
  975. public void 下頁()
  976. {
  977. int currentPage = 0;
  978. if (Main.Global.螢幕格式=="胖")
  979. {
  980. currentPage = int.Parse(第幾頁1.text);
  981. }
  982. else
  983. {
  984. currentPage = int.Parse(第幾頁.text);
  985. }
  986. if (currentPage < 1 || currentPage > 最大頁數)
  987. {
  988. 彈跳面板.SetActive(true);
  989. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  990. }
  991. else
  992. {
  993. 判斷 = false;
  994. 旋轉角度 = 0f;
  995. scrollbar.value=1f;
  996. scrollbar1.value=1f;
  997. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  998. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  999. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  1000. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  1001. int newPage = Mathf.Min(最大頁數, currentPage + 1); // 確保不會超過最大頁數
  1002. if (Main.Global.螢幕格式=="胖")
  1003. {
  1004. 第幾頁1.text = newPage.ToString();
  1005. string str1 = 第幾頁1.text;
  1006. 顯示圖片(str1);
  1007. }
  1008. else
  1009. {
  1010. 第幾頁.text = newPage.ToString();
  1011. string str1 = 第幾頁.text;
  1012. 顯示圖片(str1);
  1013. }
  1014. }
  1015. }
  1016. public void 指定()
  1017. {
  1018. int currentPage = 0;
  1019. if (Main.Global.螢幕格式=="胖")
  1020. {
  1021. currentPage = int.Parse(第幾頁1.text);
  1022. }
  1023. else
  1024. {
  1025. currentPage = int.Parse(第幾頁.text);
  1026. }
  1027. if (currentPage < 1 || currentPage > 最大頁數)
  1028. {
  1029. 彈跳面板.SetActive(true);
  1030. 彈跳文字.text = "超過最大頁數,或小於最小頁數";
  1031. }
  1032. else
  1033. {
  1034. 判斷 = false;
  1035. 旋轉角度 = 0f;
  1036. scrollbar.value=1f;
  1037. scrollbar1.value=1f;
  1038. rawImage1.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  1039. rawImage.rectTransform.rotation = Quaternion.Euler(0f, 0f, 旋轉角度);
  1040. rawImage.transform.localScale = new Vector3(1f, 1f, 1f);
  1041. rawImage1.transform.localScale = new Vector3(1f, 1f, 1f);
  1042. if (Main.Global.螢幕格式=="胖")
  1043. {
  1044. string str1 = 第幾頁1.text;
  1045. 顯示圖片(str1);
  1046. }
  1047. else
  1048. {
  1049. string str1 = 第幾頁.text;
  1050. 顯示圖片(str1);
  1051. }
  1052. }
  1053. }
  1054. public void 彈跳面板關閉()
  1055. {
  1056. 彈跳面板.SetActive(false);
  1057. 彈跳文字.text = "";
  1058. }
  1059. public void 回選書()
  1060. {
  1061. 選擇書籍.SetActive(true);
  1062. 細板.SetActive(false);
  1063. 寬板.SetActive(false);
  1064. 選擇頁面.SetActive(false);
  1065. 回主頁紐.SetActive(true);
  1066. 回選擇書籍紐.SetActive(false);
  1067. 選擇頁面紐.SetActive(false);
  1068. 書編1.text="";
  1069. 書名s1.text="";
  1070. 書頁名1.text="";
  1071. 第幾頁1.text="";
  1072. 書編.text="";
  1073. 書名s.text="";
  1074. 書頁名.text="";
  1075. 第幾頁.text="";
  1076. }
  1077. public void 回主()
  1078. {
  1079. if (Main.Global.螢幕方向=="直")
  1080. {
  1081. change_Secen(1);
  1082. }
  1083. else
  1084. {
  1085. change_Secen(3);
  1086. }
  1087. }
  1088. private void DeleteCopies(List<GameObject> copyList)
  1089. {
  1090. foreach (GameObject copy in copyList)
  1091. {
  1092. Destroy(copy);
  1093. }
  1094. copyList.Clear();
  1095. }
  1096. public void change_Secen(int _screenNum)
  1097. {
  1098. SceneManager.LoadScene(_screenNum);
  1099. }
  1100. }