123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using UnityEngine.Networking;
- using UnityEngine.EventSystems;
- using System.Text.RegularExpressions;
- using System.Data.SqlClient;
- using System.Runtime.InteropServices;
- using System.Text;
- using TMPro;
- using System;
- using System.IO;
- using ZXing;
- using ZXing.QrCode;
- using System.Net;
- using System.Data;
- using SimpleJSON;
- using System.Linq;
- using System.ComponentModel;
- using System.Runtime.InteropServices;
- using System.Globalization;
-
-
- public class Main : MonoBehaviour
- {
- [SerializeField] TextMeshProUGUI 伺服器;
- public CanvasScaler canvasScaler;
-
-
- [SerializeField] GameObject 讀取面板;
- [SerializeField] TextMeshProUGUI 讀取;
-
- [SerializeField] GameObject 彈跳面板;
- [SerializeField] TextMeshProUGUI 彈跳文字;
-
- private string loadingText = "";
- private int dotCount = 0;
-
- private List<Button> bts = new List<Button>();
-
- void Start()
- {
- Screen.autorotateToPortrait = false;
- Screen.orientation = ScreenOrientation.LandscapeLeft;
- float rate = 1600.0f / 1000.0f;
- if (Main.Global.rate>rate)
- {
- canvasScaler.matchWidthOrHeight = 1f;
- }
- else
- {
- canvasScaler.matchWidthOrHeight = 0f;
- }
- if (Main.Global.預設伺服器路徑=="official")
- {
- 伺服器.text="official";
- }
- else
- {
- 伺服器.text="test";
- }
- Debug.Log(Main.Global.阿帕契路徑);
- if (Main.Global.阿帕契路徑==Main.Global.PHP清單[0][1].ToString().Trim('"') || Main.Global.阿帕契路徑==Main.Global.PHP清單[2][1].ToString().Trim('"'))
- {
- Main.Global.阿帕契路徑=Main.Global.PHP清單[2][1].ToString().Trim('"');
- }
- else
- {
- Main.Global.阿帕契路徑=Main.Global.PHP清單[3][1].ToString().Trim('"');
- }
- Debug.Log(Main.Global.阿帕契路徑);
- StartCoroutine(AnimateText());
- 讀取面板.SetActive(true);
- StartCoroutine(讀取CC());
-
- }
- IEnumerator AnimateText()
- {
- string qqq = 讀取.text.ToString();
- while (true)
- {
- yield return new WaitForSeconds(0.5f);
-
- if (dotCount < 3)
- {
- loadingText += ".";
- dotCount++;
- }
- else
- {
- loadingText = "";
- dotCount = 0;
- }
- 讀取.text = qqq+loadingText;
- }
- }
- IEnumerator 讀取CC()
- {
- string strcon = "讀取";
- string name = Main.Global.PA;
- string ps = Main.Global.PB;
- string se = Main.Global.預設伺服器路徑;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&帳號={1}&密碼={2}&se={3}", strcon, name, ps, se);
- Debug.Log(strUrl);
-
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- }
- Debug.Log(request.downloadHandler.text);
- JSONNode json1 = JSON.Parse(request.downloadHandler.text);
- Debug.Log(json1);
- 讀取面板.SetActive(false);
- Main.Global.人員 = json1[0].ToString().Trim('"');
- Main.Global.級別 = json1[129].ToString().Trim('"');
- Main.Global.職稱 = json1[131].ToString().Trim('"');
- //if (json1[104].ToString()=="0")
- //{
- // Main.Global.可選擇車廠型式=false;
- //}
- //else
- //{
- // Main.Global.可選擇車廠型式=true;
- //}
- //if (json1[106].ToString()=="0")
- //{
- // Main.Global.開啟帳本=false;
- //}
- //else
- //{
- // Main.Global.開啟帳本=true;
- //}
-
- //if (json1[124].ToString()=="0")
- //{
- // 物料使用狀況.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(物料使用狀況);
- //}
- //if (json1[125].ToString()=="0")
- //{
- // 庫存查詢.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(庫存查詢);
- //}
- //if (json1[63].ToString()=="0")
- //{
- // 銷售報表.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(銷售報表);
- //}
- //if (json1[126].ToString()=="0")
- //{
- // 車輛入廠紀錄.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(車輛入廠紀錄);
- //}
- //if (json1[93].ToString()=="0")
- //{
- // 收支單一覽表.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(收支單一覽表);
- //}
- //if (json1[92].ToString()=="0")
- //{
- // 收支單審核.gameObject.SetActive(false);
- //}
- //else
- //{
- // bts.Add(收支單審核);
- //}
- //for (int i = 0; i < bts.Count; i++)
- //{
- // // 設定按鈕的位置
- // float x = 150 + (i % 2) * 450; // 在每一行的水平位置
- // float y = -250 - (i / 2) * 475; // 在每一行的垂直位置
- // RectTransform rt = bts[i].GetComponent<RectTransform>();
- // rt.anchoredPosition = new Vector2(x, y);
- //}
- }
- public void 截圖()
- {
- string fileName = string.Format("{0}/screenshot_{1}.png", Application.persistentDataPath, System.DateTime.Now.ToString("yyyyMMdd_HHmmss"));
- ScreenCapture.CaptureScreenshot(fileName);
- }
- public void 配方()
- {
-
- change_Secen(2);
- }
-
- public void 拍照()
- {
- change_Secen(3);
- }
- public void 拍照1()
- {
- change_Secen(4);
- }
- public void 檢點()
- {
-
- change_Secen(5);
- }
- public void changen()
- {
- //Main.Global.判斷是否第一次=true;
- change_Secen(0);
- }
- public void change_Secen(int _screenNum)
- {
- //Main.Global.判斷是否第一次=true;
- SceneManager.LoadScene(_screenNum);
- }
- public static class Global
- {
- public static string 登入人IP, 年,日期 ,職稱,狀態,系統語言, 使用者名稱, 密碼, 進入, 離開, 資料庫版本號, 執行檔版本號,版本號比對,預設伺服器路徑,版本號,選擇組別,阿帕契路徑,阿帕契,CC判別,合約內容,合約編號,級別,ID,查詢日期,人員,連動客戶;
- public static bool 開啟帳本,判斷是否連線,可選擇車廠型式 ,啟動完畢,系統分區控制,登入位置,鏡頭啟動,有無清單 ,讀取完畢, 首次登入, 讀取年份, 快速登入, show1, show2, show3, show4, show5, show6, show7,展示帳號登入,qwe,印尼內網;
- public static int 部門編號,camfps;
- public static float rate, rate_;
- //public static TimeSpan 運行天數;
- public static string PA, PB, PC, PD, PE, PF, PG, PH, PI, PJ, PK, PA1, PA2, PA3, PA4, PA5, PA6, PA9, PA20;
- //public static bool[] 電表異常BL = new bool[999];
- // public static Sprite[] Wnum;
- // public static Sprite[] Bnum;
- public static string[] 系統語言資料;
- // public static string[] CC判斷=new string[999];
- public static Dictionary<string, string> 系統語言字典 = new Dictionary<string, string>() { };
- public static string[,] PHP = new string[5, 2];
- public static JSONArray PHP清單;
- }
- }
|