설명 없음
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using TMPro;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. public class Main : MonoBehaviour{
  8. public void 截圖(){
  9. string fileName = string.Format("{0}/screenshot_{1}.png", Application.persistentDataPath, System.DateTime.Now.ToString("yyyyMMdd_HHmmss"));
  10. ScreenCapture.CaptureScreenshot(fileName);
  11. }
  12. public static void 清除控件(GameObject content){
  13. List<GameObject> childList = new List<GameObject>();
  14. foreach (Transform child in content.transform) {
  15. childList.Add(child.gameObject);
  16. }
  17. foreach (GameObject child in childList) {
  18. if (child.name.Contains("(Clone)")) {
  19. Destroy(child);
  20. }
  21. }
  22. }
  23. public static void 載入表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,GameObject LinePrefab,bool overflowMode){
  24. 清除控件(ceneter);
  25. ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*70f);
  26. Image centerImage = ceneter.GetComponent<Image>();
  27. if (centerImage == null){
  28. centerImage = ceneter.AddComponent<Image>();
  29. centerImage.type = Image.Type.Sliced;
  30. }
  31. centerImage.sprite = UIsprite;
  32. centerImage.fillCenter = false;
  33. centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  34. float[] width = {220f,448.72f};
  35. //==========動態生成表格==================================
  36. // 取得所有欄位名稱,並建立表頭
  37. for (int i = 0; i < table.Rows.Count; i++){
  38. // 建立資料列
  39. GameObject row = Instantiate(rowPrefab, tableParent);
  40. // 設定資料列位置
  41. row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -70 * i);
  42. // 建立資料列中的所有欄位
  43. for (int j = 0; j < table.Columns.Count; j++){
  44. // 取得欄位值
  45. string value = table.Rows[i][j].ToString();
  46. GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_"+j.ToString());
  47. cellText.transform.SetParent(row.transform, false);
  48. cellText.AddComponent<TextMeshProUGUI>().text = value;
  49. cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
  50. if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
  51. cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0, 1);
  52. cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0, 1);
  53. cellText.GetComponent<RectTransform>().pivot = new Vector2(0, 1);
  54. if(j==0){
  55. cellText.GetComponent<RectTransform>().sizeDelta=new Vector2(width[0],70f);
  56. cellText.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,0);
  57. }else if(j==1){
  58. cellText.GetComponent<RectTransform>().sizeDelta=new Vector2(width[1],70f);
  59. cellText.GetComponent<RectTransform>().anchoredPosition = new Vector2(225f,0);
  60. }else{
  61. cellText.GetComponent<RectTransform>().sizeDelta=new Vector2(width[0],70f);
  62. cellText.GetComponent<RectTransform>().anchoredPosition = new Vector2(678.72f,0);
  63. }
  64. }
  65. }
  66. TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
  67. foreach (TextMeshProUGUI text in texts){
  68. if(text.tag.Contains("Cells")){
  69. text.font = myFont;
  70. text.color = Main.Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
  71. text.alignment = TextAlignmentOptions.Center;
  72. text.fontStyle = FontStyles.Bold;
  73. text.fontSize=28;
  74. /*text.enableAutoSizing = true;
  75. text.autoSizeTextContainer = true;*/
  76. text.margin = new Vector4(10, 0, 10, 0);
  77. }
  78. }
  79. for (int j = 0; j < table.Columns.Count-1; j++){
  80. GameObject Separation = Instantiate(LinePrefab, tableParent);
  81. Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,ceneter.GetComponent<RectTransform>().sizeDelta.y-5f);
  82. Separation.GetComponent<RectTransform>().anchorMin = new Vector2(0, 1);
  83. Separation.GetComponent<RectTransform>().anchorMax = new Vector2(0, 1);
  84. Separation.GetComponent<RectTransform>().pivot = new Vector2(0, 1);
  85. Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
  86. if(j==0){
  87. Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(220f,0);
  88. }else{
  89. Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(673.72f,0);
  90. }
  91. }
  92. }
  93. public static class Global
  94. {
  95. public static int 系統主題=1;
  96. public static string 版本號比對,螢幕方向,螢幕格式,排行榜難度="一般",一般最高="0",困難最高="0",地獄最高="0",夢魘最高="0",關卡難度="一般",使用者UID="",使用者金幣="",使用者鑽石="",
  97. 使用者道具1="",使用者道具2="",使用者道具3="",使用者現金道具1="",使用者ID="",使用者暱稱="",系統語言="中文";
  98. public static bool 已載入現金道具表=false,刷新金幣=false,刷新訂閱時間=false,失去焦點=false,刷新現金道具=false,刷新現金道具2=false;
  99. public static float rate, rate_, 固高, 固寬, 固比, 固比1,登出條件,登入條件;
  100. public static string PA, PB, PC, PD, PE, PF, PG, PH, PI, PJ, PK, PA1, PA2, PA3, PA4, PA5, PA6, PA9, PA20;
  101. public static DataTable 道具清單_tabel,菟幣道具清單_tabel;
  102. public static string[,] PHP = new string[5,2];
  103. public static List<string> 中文姓 = new(){
  104. "趙", "錢", "孫", "李", "周", "吳", "鄭", "王", "馮", "陳", "褚", "衛", "蔣", "沈", "韓", "楊", "朱", "秦", "尤", "許", "何", "呂", "施", "張",
  105. "孔", "曹", "嚴", "華", "金", "魏", "陶", "姜", "戚", "謝", "鄒", "喻", "柏", "水", "竇", "章", "雲", "蘇", "潘", "葛", "奚", "範", "彭", "郎",
  106. "魯", "韋", "昌", "馬", "苗", "鳳", "花", "方", "俞", "任", "袁", "柳", "酆", "鮑", "史", "唐", "費", "廉", "岑", "薛", "雷", "賀", "倪", "湯",
  107. "滕", "殷", "羅", "畢", "郝", "鄔", "安", "常", "樂", "於", "時", "傅", "皮", "卞", "齊", "康", "伍", "余", "元", "卜", "顧", "孟", "平", "黃",
  108. "和", "穆", "蕭", "尹", "姚", "邵", "湛", "汪", "祁", "毛", "禹", "狄", "米", "貝", "明", "臧", "計", "伏", "成", "戴", "談", "宋", "茅", "龐",
  109. "熊", "紀", "舒", "屈", "項", "祝", "董", "梁", "杜", "阮", "藍", "閔", "席", "季", "麻", "強", "賈", "路", "婁", "危", "江", "童", "顏", "郭",
  110. "梅", "盛", "林", "刁", "鍾", "徐", "丘", "駱", "高", "夏", "蔡", "田", "樊", "胡", "凌", "霍", "虞", "萬", "支", "柯", "昝", "管", "盧", "莫",
  111. "經", "房", "裘", "繆", "干", "解", "應", "宗", "丁", "宣", "賁", "鄧", "郁", "單", "杭", "洪", "包", "諸", "左", "石", "崔", "吉", "鈕", "龔",
  112. "程", "嵇", "邢", "滑", "裴", "陸", "榮", "翁", "荀", "羊", "於", "惠", "甄", "曲", "家", "封", "芮", "羿", "儲", "靳", "汲", "邴", "糜", "松",
  113. "井", "段", "富", "巫", "烏", "焦", "巴", "弓", "牧", "隗", "山", "谷", "車", "侯", "宓", "蓬", "全", "郗", "班", "仰", "秋", "仲", "伊", "宮",
  114. "甯", "仇", "欒", "暴", "甘", "鈄", "曆", "戎", "祖", "武", "符", "劉", "景", "詹", "束", "龍", "葉", "幸", "司", "韶", "郜", "黎", "薊", "溥",
  115. "印", "宿", "白", "懷", "蒲", "邰", "從", "鄂", "索", "咸", "籍", "賴", "卓", "藺", "屠", "蒙", "池", "喬", "陰", "欽", "歸", "海", "岳", "帥",
  116. "緱", "亢", "況", "後", "有", "琴", "商", "牟", "佘", "佴", "伯", "賞", "墨", "哈", "譙", "笪", "年", "愛", "陽", "佟", "習",
  117. "夏侯", "諸葛", "聞人", "東方", "赫連", "皇甫", "尉遲", "公羊", "澹臺", "公冶", "宗政", "濮陽", "淳於", "單於", "太叔", "申屠", "公孫", "仲孫", "軒轅",
  118. "令狐", "鍾離", "宇文", "長孫", "慕容", "鮮於", "閭丘", "司徒", "司空", "亓官", "司寇", "仉督", "子車", "顓孫", "端木", "巫馬", "公西", "漆雕", "樂正",
  119. "壤駟", "公良", "拓拔", "夾谷", "宰父", "谷梁", "晉楚", "闕丘", "澹台", "王孫", "司馬", "上官", "歐陽"
  120. };
  121. public static List<string> 中文名 = new(){
  122. "偉", "芳", "明", "潔", "艷", "華", "玲", "軍", "英", "濤", "萍", "強", "娜", "杰", "娟", "剛", "平", "燕", "輝", "靜",
  123. "敏", "波", "斌", "欣", "峰", "霞", "麗", "亮", "琴", "宇", "龍", "彬", "琳", "芬", "虹", "勇", "青", "雯", "楊", "莎",
  124. "瑞", "洪", "旭", "曉", "毅", "婷", "君", "兵", "瑩", "博", "奇", "慧", "嬌", "彤", "丹", "坤", "立", "爽", "俊", "淑",
  125. "宏", "愛", "豪", "楠", "樂", "冬", "若", "萌", "琦", "琳", "碩", "晨", "豪", "嵐", "逸", "飛", "虹", "霖", "哲", "昊",
  126. "文", "偉", "雄", "曉", "楠", "俊", "博", "卓", "皓", "然", "逸", "恆", "凱", "康", "飛", "寧", "維", "啟", "捷", "熙",
  127. "卓", "琛", "峰", "元", "強", "洋", "玉", "飛", "濤", "楓", "輝", "劍", "超", "新", "炎", "曦", "濤", "鵬", "寧", "程",
  128. "翔", "浩", "曉", "宇", "龍", "斌", "毅", "鵬", "華", "剛", "強", "偉", "濤", "杰", "彬", "波", "兵", "宇", "勇", "青",
  129. "峰", "博", "浩", "強", "剛", "文", "濤", "志", "磊", "勇", "彬", "曉", "洪", "鵬", "偉", "華", "軍", "剛", "燕", "靜",
  130. "敏", "萍", "磊", "艷", "霞", "琳", "虹", "勇", "青", "雯", "楊", "莎", "瑞", "洪", "旭", "曉", "毅", "婷", "君", "兵",
  131. "瑩", "博", "奇", "慧", "嬌", "彤", "丹", "坤", "立", "爽", "尼"
  132. };
  133. }
  134. }