Inheritance: UnityEngine.MonoBehaviour, UIObject
 // Use this for initialization
 void Start()
 {
     //only add collider if not yet exist
     Collider2D c = gameObject.GetComponent<Collider2D>();
     if(c == null)
     {
         gameObject.AddComponent<BoxCollider2D>();
     }
     tooltipText = tooltip.GetComponent<UIText>();
     if(tooltipText == null)
     {
         gameObject.AddComponent<UIText>();
     }
     tooltip.SetActive(false);
 }
 // /// <summary>
 // /// Parse the content of the dictionary
 // /// and create a new gameobjet with this parameters
 // /// </summary>
 // protected override void Parse(Dictionary<string,object> dict)
 // {
 // 	//Log.Info("<color=green>PARSE!!!!!!!!!!!!!!!!!!!!!!!!!</color>");
 // 	//parse base stuff
 // 	base.Parse(dict);
 // }//Parse()
 /// <summary>
 /// Set the text of the button
 /// 
 /// </summary>
 public void SetText(UIText text)
 {
     Log.Debug("======================= SetText");
     this.text = text;
 }
 /// <summary>
 /// Set the text of the button
 /// 
 /// </summary>
 public void SetText(UIText text)
 {
     this.text = text;
 }
        void Start()
        {
            Log.Assert(popupSettings, "Please assign the popup in "+gameObject.name);
            Log.Assert(txtVersion, "Please assign the txtVersion in "+gameObject.name);
            Log.Assert(btnClose, "Please assign the btnClose in "+gameObject.name);

            GameObject obj = null;

            popupSettings = GetChildObject("popup");
            obj = GetChildObject("popup/txt_Copyright_Content2");
            txtVersion = obj.GetComponent<UIText>();
            txtVersion.text = "Version: "+GameObject.Find("TWISTBueBe").GetComponent<TWISTBueBe.TWISTGame>().buildTime;
            obj = GetChildObject("popup/btn_Close");
            btnClose = obj.GetComponent<Button>();
            obj = GetChildObject("popup/btn_Close/Text");
            UIText btnCloseText = obj.GetComponent<UIText>();
            btnCloseText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "003");

            Hide();
        }
        /// <summary>
        /// set up basic components
        /// </summary>
        void Awake()
        {
            Log.Assert(txtMessage, "Please assign the txtMessage in "+gameObject.name);
            Log.Assert(popup, "Please assign the popup in "+gameObject.name);

            uiManager = UIManager.Instance;
            i18n = I18nManager.Instance;
            decisionPopup = DecisionPopups.Instance;

            GameObject obj = null;

            popup = GetChildObject("popup");
            obj = GetChildObject("popup/txt_Message");
            txtMessage = obj.GetComponent<UIText>();
            obj = GetChildObject("popup/btn_Yes");
            btnYes = obj.GetComponent<Button>();
            obj = GetChildObject("popup/btn_Yes/Text");
            UIText btnYesText = obj.GetComponent<UIText>();
            btnYesText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "001");
            obj = GetChildObject("popup/btn_No");
            btnNo = obj.GetComponent<Button>();
            obj = GetChildObject("popup/btn_No/Text");
            UIText btnNoText = obj.GetComponent<UIText>();
            btnNoText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "002");
            id = "001";

            Hide();

            GameManager.Instance.RegisterEventHandler("POPUP_DECISION", EventHandler);
        }
		/// <summary>
		/// Create the text and set the tail on bubble
		/// </summary>
		void Awake()
		{
			//create text component
			origScale = gameObject.transform.localScale;
			
			tailNames = new string[] {"tail_E", "tail_N", "tail_NE", "tail_NW", 
										   "tail_S", "tail_SE", "tail_SW", "tail_W"};

			tails = new GameObject[8];
			for(int i = 0; i < tailNames.Length; i++)
			{
				string objname = gameObject.name + "/tails/" + tailNames[i];
			 	tails[i] = GameObject.Find(objname);
			 	Log.Assert(tails[i], "Cannot find tail:"+objname);
			}

			//save original size
			scale = origScale;

			string path = (gameObject.transform.parent != null) 
						? gameObject.transform.parent.name + "/" + gameObject.name
						: gameObject.name;
			bubbleObj 		= GameObject.Find(path+"/bubble_scale/bubble_text");			
			bubbleOutline 	= GameObject.Find(path+"/bubble_scale/bubble_outline");
			nameGroup 		= GameObject.Find(path+"/name_group");
			nameObj 		= GameObject.Find(path+"/name_group/name_text");
			nameOutline 	= GameObject.Find(path+"/name_group/name_outline");

			Log.Assert(bubbleObj, "Missing BubbleObject in "+ path);
			Log.Assert(bubbleOutline, "Missing bubbleOutline in "+ gameObject.name);
			Log.Assert(nameGroup, "Missing nameGroup in "+ gameObject.name);
			Log.Assert(nameObj, "Missing nameObj in "+ gameObject.name);
			Log.Assert(nameOutline, "Missing nameOutline in "+ gameObject.name);

			GameObject obj;
			obj = GameObject.Find(path + "/Text");
			if(obj != null)
			{
				//Log.Assert(obj, "Missing Text object in "+path);
				bubbleText = obj.GetComponent<UIText>();				
				Log.Assert(bubbleText, "Cannot find text in bubble " + obj.name);
				bubbleText.isLocalized = false;
				//bubbleText.wrapSize = 30;
			}
			else
			{
				Log.Error("OOPS1"+path+"/Text");
			}
			//grab name
			obj = GameObject.Find(path + "/name_group/Text");
			if(obj != null)
			{
				nameText = obj.GetComponent<UIText>();
				Log.Assert(nameText, "Cannot find name in bubble " + obj.name);
			}
			//grab debugText
			obj = GameObject.Find(path + "/DebugText");
			if(obj != null)
			{
				//Log.Assert(obj, "Missing Text object in "+path);
				debugText = obj.GetComponent<UIText>();				
				Log.Assert(debugText, "Cannot find text in bubble " + obj.name);
				debugText.isLocalized = false;
				//debugText.Text = "";
			}

			//get managers
			uiManager = UIManager.Instance;
			gpm = GameManager.Instance;

		}//Awake()
        //------------------------------------------------------------------------------
        /// <summary>
        /// Initialize the components
        /// </summary>
        public virtual void Awake()
        {
            //Debug.Log ("AchievementsLogs Awake");
            GameObject obj = null;

            uiManager = UIManager.Instance;

            hud = GetChildObject("HUD");
            logPanel = GetChildObject("HUD/popup_Achievements");

            obj = GetChildObject("HUD/popup_Achievements/txt_Note");
            logText = obj.GetComponent<UIText>();
            logText.wrapSize = 40;
            obj = GetChildObject("HUD/popup_Achievements/txt_Time");
            logTime = obj.GetComponent<UIText>();

            //use Slots class here?
            slots = new List<AchievementNpc>();
            slots.Add(GetChildObject(gBadge+"1").GetComponent<AchievementNpc>());
            slots.Add(GetChildObject(gBadge+"2").GetComponent<AchievementNpc>());
            slots.Add(GetChildObject(gBadge+"3").GetComponent<AchievementNpc>());
            slots.Add(GetChildObject(gBadge+"4").GetComponent<AchievementNpc>());

            obj  	   = GetChildObject ("HUD/btn_Arrow_Achievements_left");
            leftArrow  = obj.GetComponent<Button> ();
            obj		   = GetChildObject ("HUD/btn_Arrow_Achievements_right");
            rightArrow = obj.GetComponent<Button> ();
            logs = Achievements.Instance;

            activeSlot = -1;

            logPages = 0;
            activePage = 0;

            //TODO : The GameManager.Remove(EventHandler); is missing
            // Where to set?
            // As the AchievementsLog is only once set in a game it should
            // not be a serious issue
            GameManager.Instance.RegisterEventHandler(
                "ACHIEVEMENT", ProcessAchievementEvent, gameObject);

            Show(false);

            achievementSprite = UIManager.LoadSprite (
                "Game/Sprites/Achievement/badge_Achievements");
            ResetSlots (0);
        }
        /// <summary>
        /// Initialize the components
        /// </summary>
        public virtual void Awake()
        {
            //Log.GameTimes ("EmailView Awake");

            uiManager = UIManager.Instance;
            i18n = I18nManager.Instance;
            emails = Emails.Instance;

            GameObject obj = null;

            inbox = GetChildObject("Inbox");
            mail = GetChildObject("Mail");
            obj = GetChildObject("Mail/txt_Date");
            mailDate = obj.GetComponent<UIText>();
            obj = GetChildObject("Mail/txt_Subject");
            mailSubject = obj.GetComponent<UIText>();
            obj = GetChildObject("Mail/txt_Message");
            mailMessage = obj.GetComponent<UIText>();

            obj = GetChildObject("Mail/btn_Close_Mail/Text");
            UIText btnCloseText = obj.GetComponent<UIText>();
            btnCloseText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "003");

            buttons = new List<UIButton>();
            readMails = new List<Mail>();
        }
        //-------------------------------- basic unity API MonoBehavior class methods -----
        /// <summary>
        /// Initialization, read childe gameobject 
        /// and set the buttons to it's uitext components
        /// </summary>
        void Awake()
        {
            // Log.Info("Awake:" + gameObject.name);
            Reset();

            GameObject obj;

            popup = GameObject.Find(gameObject.name+"popup_MultipleChoice");
            // Log.Assert(popup, "Missing popup_MultipleChoice in "+gameObject.name);

            obj = GameObject.Find(gameObject.name+
                "popup_MultipleChoice/btn_MultipleChoice_Answer_Positive/Text");
            // Log.Assert(obj, "Missing Positive button in "+gameObject.name);
            positiveText = obj.GetComponent<UIText>();
            // Log.Assert(positiveText, "Missing positiveText UIText component!");

            obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Negative/Text");
            // Log.Assert(obj, "Missing Negative button in MultipleChoice popup!");
            negativeText = obj.GetComponent<UIText>();
            // Log.Assert(negativeText, "Missing negativeText UIText component!");

            obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Neutral/Text");
            // Log.Assert(obj, "Missing Neutral button in MultipleChoice popup!");
            neutralText = obj.GetComponent<UIText>();
            // Log.Assert(neutralText, "Missing neutralText UIText component!");

            multichoicePositions = new Vector3[3];
            obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Neutral");
            neutralButton = obj.GetComponent<Button>();
            multichoicePositions[0] = neutralButton.transform.position;

            obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Negative");
            negativeButton = obj.GetComponent<Button>();
            multichoicePositions[1] = negativeButton.transform.position;

            obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Positive");
            positiveButton = obj.GetComponent<Button>();
            multichoicePositions[2] = positiveButton.transform.position;

            bubbles = new Dictionary<string, SpeechBubble>();
            ui = UIManager.Instance;
            gpm = GameManager.Instance;

            //create temp container for dynamic bubbles
            tmpContainer = new GameObject();
            tmpContainer.name = "bubbles";
            tmpContainer.transform.parent = gameObject.transform;

            ActivateAll(false);
        }
        /// <summary>
        /// Initializa main components
        /// </summary>		
        void Awake()
        {
            Log.Assert(popup, "Please assign the popup in "+gameObject.name);
            Log.Assert(txtMessage, "Please assign the txtMessage in "+gameObject.name);
            Log.Assert(btnOk, "Please assign the btnOk in "+gameObject.name);

            uiManager = UIManager.Instance;
            i18n = I18nManager.Instance;
            messagePopup = MessagePopups.Instance;
            GameObject obj = null;

            popup = GetChildObject("popup");
            obj = GetChildObject("popup/txt_Message");
            txtMessage = obj.GetComponent<UIText>();
            obj = GetChildObject("popup/btnOk");
            btnOk = obj.GetComponent<Button>();
            obj = GetChildObject("popup/btnOk/txt_btnOk");
            txtbtnOk = obj.GetComponent<UIText>();
            txtbtnOk.Text = I18nManager.Instance.Get("POPUP_BUTTON", "0031");
            id = "001";

            Hide();

            GameManager.Instance.RegisterEventHandler("POPUP_MESSAGE", EventHandler, gameObject);
        }