Exemple #1
0
	// Use this for initialization
	void Start () {
		FileOperation fo = new FileOperation ("pushup_result.txt");
		List<byte[]> ret = new List<byte[]> ();
		Info = "";
		fo.ReadContentBinary (out ret);
		for (int i = 0; i < ret.Count; i++) {
			Info += Encoding.UTF8.GetString(ret[i], 0, ret[i].Length);
		}
		Infos = Info.Split ('\n');
		Debug.LogWarning (Info);
		
		for (int i = 0; i < Infos.Length - 1; i++) {
			Debug.LogWarning(Infos[i]);
			dic.Add (i + 1, Infos [i]);
			if(i > 2)
				transform.Find ((i-2).ToString()).Find("Title").GetComponent<UILabel>().text = name[i];
			else
				transform.Find ("Piechart").GetComponent<CallDraw>().mData[i] = 1;
		}
		Debug.LogWarning (Infos [Infos.Length - 1]);
		transform.Find ("Label").GetComponent<UILabel> ().text = Infos[Infos.Length - 1];
		//Debug.LogWarning (buf);
		/*FileStream fs;
		fs = new FileStream ("shoulder_result.txt", FileMode.Open);

		StreamReader sr = new StreamReader (fs);
		string Info = sr.ReadToEnd();
		Debug.LogWarning (Info);*/
	}
Exemple #2
0
	void Start () {
		FileOperation fo;
		if (choice == planType.lefthand)
			fo = new FileOperation ("lefthand_history.txt");
		else if (choice == planType.righthand)
			fo = new FileOperation ("righthand_history.txt");
		else if (choice == planType.shoudler)
			fo = new FileOperation ("shoulder_history.txt");
		else
			fo = new FileOperation ("pushup_history.txt");
		
		List<byte[]> ret = new List<byte[]> ();
		Info = "";
		fo.ReadContentBinary (out ret);
		for (int i = 0; i < ret.Count; i++) {
			Info += Encoding.Default.GetString(ret[i], 0, ret[i].Length);
		}
		Infos = Info.Split ('\n');
		Debug.Log (Info);

		if (choice == planType.lefthand || choice == planType.righthand) {
			for (int i = 1; i < 6; i++) {
				Debug.LogWarning (Infos [i]);
				dic.Add (i, Infos [i]);
				transform.Find (i.ToString ()).Find ("Title").GetComponent<UILabel> ().text = lh_name [i];
			}
			transform.Find ("Time").GetComponent<UILabel> ().text = Infos [6].Substring (0, 4);
			for (int i = 8; i < 13; i++) {
				Debug.LogWarning (Infos [i]);
				dic.Add (i - 2, Infos [i]);
				transform.Find ((i - 2).ToString ()).Find ("Title").GetComponent<UILabel> ().text = lh_name [i - 2];
			}
		} else if (choice == planType.shoudler) {
			for (int i = 1; i < 4; i++) {
				Debug.LogWarning (Infos [i]);
				dic.Add (i, Infos [i - 1]);
				transform.Find (i.ToString ()).Find ("Title").GetComponent<UILabel> ().text = arm_name [i];
			}
			transform.Find ("Time").GetComponent<UILabel> ().text = Infos [3].Substring (0, 4);
			for (int i = 5; i < 8; i++) {
				Debug.LogWarning (Infos [i]);
				dic.Add (i - 1, Infos [i - 1]);
				transform.Find ((i - 1).ToString ()).Find ("Title").GetComponent<UILabel> ().text = arm_name [i - 1];
			}
		} else if (choice == planType.body) {
			transform.Find ("Time").GetComponent<UILabel> ().text = Infos [0];
			for(int i = 1; i < 7; i++){
				dic.Add(i,Infos[i+1]);
				transform.Find (i.ToString ()).Find ("Title").GetComponent<UILabel> ().text = body_name [i+1];
			}
		}

	}
Exemple #3
0
	void Start () {
		FileOperation fo;
		if(choice == planType.left)
			fo = new FileOperation ("left_hand_result.txt");
		else
			fo = new FileOperation ("right_hand_result.txt");
		
		List<byte[]> ret = new List<byte[]> ();
		Info = "";
		fo.ReadContentBinary (out ret);
		for (int i = 0; i < ret.Count; i++) {
			Info += Encoding.Default.GetString(ret[i], 0, ret[i].Length);
		}
		
		Infos = Info.Split ('\n');
		
		for (int i = 6; i < Infos.Length - 1; i++) {
			Debug.Log(Infos[i]);
			dic.Add (i - 5, Infos [i]);
			if(i > 8)
				transform.Find ((i-8).ToString()).Find("Title").GetComponent<UILabel>().text = name[i-6];
			else
				transform.Find ("Piechart").GetComponent<CallDraw>().mData[i-6] = float.Parse (Infos [i]);
		}
		
		//byte[] buffer= Encoding.GetEncoding("GBK").GetBytes(Infos [Infos.Length - 1]); 
		//string Text = Encoding.UTF8.GetString(buffer);
		Debug.Log (Infos [Infos.Length - 1]);
		transform.Find ("Label").GetComponent<UILabel> ().text = Infos [Infos.Length - 1];
		
		string temp = "您的平均时间比历史";
		string[] times = Infos[9].Split(':');
		float time1 = float.Parse(times[0]);
		float time2 = float.Parse(times[1]);
		if(time1-time2<0)
			temp+="快了"+(time2-time1).ToString()+"秒";
		else
			temp+="慢了"+(time1-time2).ToString()+"秒";
		transform.Find ("Time").GetComponent<UILabel> ().text = temp;
	}
 public HandDataFileExtraction(string path)
 {
     _path = path;
     _fileOperation = new FileOperation(_path);
 }