void InitialGameUI() { //初次進入進行遊戲畫面初始化 btn_hintLA = this.GameStartUI.GetComponentsInChildren <Button>()[0]; btn_hintST = this.GameStartUI.GetComponentsInChildren <Button>()[1]; //提示按鈕監聽事件 btn_hintLA.onClick.AddListener(ListenAgain); btn_hintST.onClick.AddListener(ShowTranslation); for (int i = 0; i < PhotonNetwork.room.PlayerCount; i++) { PhotonPlayer local = PhotonNetwork.player; PhotonNetwork.playerList[i].SetScore(0);//重置玩家分數 LocalPlayerText.text = local.GetScore().ToString("D2"); player = PhotonNetwork.playerList; //player[i].SetScore(0); Text remote = Instantiate(RemotePlayerText); GameObject GameRank = GameObject.FindGameObjectWithTag("GameRank"); remote.transform.SetParent(GameRank.transform); remote.transform.localPosition = new Vector3(28, -i * 80 + 140, 0); remote.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); remote.name = (i + 1) + ""; remote.text = player[i].NickName + " " + player[i].GetScore().ToString("D2") + "分"; } xmlprocess.createCompeteRecord(); xmlprocess.ScceneHistoryRecord("StartCompete", DateTime.Now.ToString("HH:mm:ss")); }
void goPractice() { ClickBtn.Play(); //xmlprocess.New_timeHistoryRecord(levelName + "_Practice", System.DateTime.Now.ToString("HH-mm-ss")); xmlprocess.ScceneHistoryRecord("Learning", DateTime.Now.ToString("HH:mm:ss")); SceneManager.LoadScene("LearningArea"); }
public IEnumerator CheckRegister(string fileName, string[] str) { WWWForm phpform = new WWWForm(); phpform.AddField("user_id", str[0]); phpform.AddField("user_pwd", str[1]); phpform.AddField("user_name", str[2]); phpform.AddField("user_sex", str[3]); WWW reg = new WWW(serverlink + fileName, phpform); yield return(reg); if (reg.error == null) { if (reg.text == "0") { AccountInfo = new string[] { str[0], str[2], "1", str[3] }; state = 0;//帳號不重複 Debug.Log(state + " " + AccountInfo); xmlprocess = new Xmlprocess(AccountInfo[0], AccountInfo); //xmlprocess.setUserInfo(AccountInfo);//將註冊資訊傳至XmlNode //xmlprocess.timeHistoryRecord("Register"); xmlprocess.ScceneHistoryRecord("Register", DateTime.Now.ToString("HH:mm:ss")); } else { state = 1; } } else { Debug.Log("error msg" + reg.error); } }
//MySQLAccess mySQLAccess; public IEnumerator CheckLogin(string fileName, string[] str) { //mySQLAccess = new MySQLAccess("140.115.126.137", "maze", "106524006", "quik"); WWWForm phpform = new WWWForm(); phpform.AddField("user_id", str[0]); phpform.AddField("user_pwd", str[1]); WWW reg = new WWW(serverlink + fileName, phpform); yield return(reg); //s_state = reg.ToString(); if (reg.error == null) { if (reg.text == "0") { state = 0;//帳密錯誤 } else if (reg.text == "1") { state = 2;//連線失敗 } else if (reg.text == "2") { state = 3;//發生錯誤 } else//帳密正確 { AccountInfo = reg.text.Split(','); state = 1; xmlprocess = new Xmlprocess(AccountInfo[0], AccountInfo); //xmlprocess.setUserInfo(AccountInfo);//ID,pwd,level,sex xmlprocess.ScceneHistoryRecord("Login", DateTime.Now.ToString("HH:mm:ss")); } /* else { * state = 0; * s_state = reg.ToString(); * }*/ } else { Debug.Log("error msg" + reg.error); } }
void gamestart() { //-----------暫時不使用創建方式------------------ // createUser(); //obj_gamestart.gameObject.SetActive(false); //----------------------------------------------------------- ClickBtn.Play(); xmlprocess.ScceneHistoryRecord("WaitingCompete", DateTime.Now.ToString("HH:mm:ss")); if (PhotonNetwork.AuthValues == null) { PhotonNetwork.AuthValues = new AuthenticationValues(); } PhotonNetwork.AuthValues.UserId = xmlprocess.getUserInfo()[0];//學號 Debug.Log("playerName: " + username.text + "AuthValues userID: " + PhotonNetwork.AuthValues.UserId); PhotonNetwork.playerName = username.text; PlayerPrefs.SetString(NickNamePlayerPrefsKey, username.text); PhotonNetwork.ConnectUsingSettings("0.5"); PhotonHandler.StopFallbackSendAckThread(); StartCoroutine(getQuestion()); StartCoroutine(getOption()); }