<commit_before>﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

/*
 * v0.2 2015/09/06
 *   - add sample UI components in each panel
 * v0.1 2015/09/05
 *   - show/hide panels
 */

public class PanelDisplayControl : MonoBehaviour {

	public GameObject PageSelect;
	public GameObject PanelGroup;

	private Vector2[] orgSize;

	void Start() {
		orgSize = new Vector2[4];
		int idx=0;

		foreach (Transform child in PanelGroup.transform) {
			orgSize[idx].x = child.gameObject.GetComponent<RectTransform>().rect.width;
			orgSize[idx].y = child.gameObject.GetComponent<RectTransform>().rect.height;

			bool isOn = getIsOn (idx + 1);
			DisplayPanel (idx + 1, isOn);

			idx++;
		}

	}

	bool getIsOn(int idx_st1) {
		Toggle selected = null;
		string name;
		foreach (Transform child in PageSelect.transform) {
			name = child.gameObject.name;
			if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
				selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
				break;
			}
		}
		return selected.isOn;
	}

	void DisplayPanel(int idx_st1, bool doShow)
	{
		GameObject panel = GameObject.Find ("Panel" + idx_st1.ToString ());
		if (panel == null) {
			return;
		}

		RectTransform rect = panel.GetComponent (typeof(RectTransform)) as RectTransform;
		Vector2 size = rect.sizeDelta;
		if (doShow) {
			size.x = orgSize[idx_st1 - 1].x;
			size.y = orgSize[idx_st1 - 1].y;
		} else {
			size.x = 0;
			size.y = 0;
		}
		rect.sizeDelta = size;<commit_msg>use tag to find target panels, instead of panel name<commit_after>﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

/*
 * v0.3 2015/09/06
 *   - use Tag for Panel to find target panels, instead of panel name
 * v0.2 2015/09/06
 *   - add sample UI components in each panel
 * v0.1 2015/09/05
 *   - show/hide panels
 */

public class PanelDisplayControl : MonoBehaviour {

	public GameObject PageSelect;
	public GameObject PanelGroup;

	private Vector2[] orgSize;

	void Start() {
		orgSize = new Vector2[4];
		int idx=0;

		foreach (Transform child in PanelGroup.transform) {
			orgSize[idx].x = child.gameObject.GetComponent<RectTransform>().rect.width;
			orgSize[idx].y = child.gameObject.GetComponent<RectTransform>().rect.height;

			bool isOn = getIsOn (idx + 1);
			DisplayPanel (idx + 1, isOn);

			idx++;
		}

	}

	bool getIsOn(int idx_st1) {
		Toggle selected = null;
		string name;
		foreach (Transform child in PageSelect.transform) {
			name = child.gameObject.name;
			if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
				selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
				break;
			}
		}
		return selected.isOn;
	}

	void DisplayPanel(int idx_st1, bool doShow)
	{
		GameObject [] panels = GameObject.FindGameObjectsWithTag ("TagP" + idx_st1.ToString ());

		if (panels == null) {
			return;
		}

		foreach (GameObject panel in panels) {
			RectTransform rect = panel.GetComponent (typeof(RectTransform)) as RectTransform;
			Vector2 size = rect.sizeDelta;
			if (doShow) {
				size.x = orgSize [idx_st1 - 1].x;
				size.y = orgSize [idx_st1 - 1].y;
			} else {
				size.x = 0;
				size.y = 0;
			}
			rect.sizeDelta = size;
		}
{'fraction_non_alphanumeric': 0.1275797373358349, 'fraction_numerical': 0.027517198248905566, 'mean_word_length': 3.3583106267029974, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '96472', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1096, 'n_words': 275}