User interface manager. This class will manage the UI.
        /// <summary>
        /// Awake this instance.
        /// </summary>
        void Awake()
        {
            Debug.Log("<color=cyan>"+gameObject.name+"</color> AWAKEN");

            if (bgScreen == null) Debug.LogError("No bgScreen assigned to:"+gameObject.name);
            if (btnBye == null) Debug.LogError("No btnBye assigned to:"+gameObject.name);
            //use static creation for now
            uiManager = UIManager.Instance;
            //uiManager.AddButton(btnBye, "Sprites/btnBye", nextScreen, null, null);
            UIButton b = (UIButton)uiManager.Add(UIType.Button, btnBye, "Sprites/btnBye");
            b.Register(UIEvent.Click, nextScreen);
        }
        /// <summary>
        /// Awake this instance.
        /// </summary>
        void Awake()
        {
            Debug.Log("<color=cyan>"+gameObject.name+"</color> AWAKEN");

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

            //TODO dynamic creation from file
            //uiManager.CreateFromFile("Config/screen");
            if (btnMir == null) Debug.LogError("No <color=cyan>btnMir</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (bgScreen == null) Debug.LogError("No <color=cyan>bgScreen</color> assigned to:<color=cyan>"+gameObject.name+"</color>");

            //use static creation for now
            //uiManager.AddButton(btnMir, "Sprites/btn_erzaehls_mir", nextScreen, null /*testOnRelease*/, null /*testOnOver*/);
            UIButton button = (UIButton)uiManager.Add(UIType.Button, btnMir, "Sprites/btn_erzaehls_mir");
            button.Register(UIEvent.Click, nextScreen);
        }
        public override void Awake()
        {
            //Log.GameTimes ("EmailView Awake");
            base.Awake();

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

            GameObject obj = null;

            inbox = GetChildObject("Inbox");
            obj = GetChildObject("Mail/txt_Date");
            obj = GetChildObject("Mail/txt_Subject");
            obj = GetChildObject("Mail/txt_Message");

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

            buttons = new List<UIButton>();
        }
        /// <summary>
        /// Parse the trigger json definition
        /// </summary>
        private void Parse(Dictionary<string,object> screen)
        {
            // Log.Debug("PARSE Screen: "+screen["id"].ToString());

            //TODO we might want to create the game object here?
            //set parameters
            gameObject.name = screen["id"].ToString();
            nextDefaultScreenName = screen["next"].ToString();
            backScreenName = screen["back"].ToString();
            string layers = screen["layers"].ToString();

            string[] listOfLayers = layers.Split(',');
            foreach(string layer in listOfLayers)
            {
                this.layerMask |= 1 << LayerMask.NameToLayer(layer);
            }

            //parse list of objects
            if(screen.ContainsKey("objects"))
            {
                uiManager = UIManager.Instance;

                screenObjects = uiManager.LoadResources(screen, gameObject);
                huds = uiManager.GetHudNames(screen);
                popups = uiManager.GetPopupNames(screen);

                hudDefaultTransforms = new List<StoreTransform>();
                foreach (string hud in huds)
                {
                    GameObject obj = uiManager.GetHud(hud);

                    StoreTransform transform = new StoreTransform(obj.transform.position, obj.transform.rotation, obj.transform.localScale);
                    hudDefaultTransforms.Add(transform);
                }
            }
        }
        /// TODO this might goes to CTOR?
        /// <summary>
        /// Basic initialization
        /// </summary>
        public virtual void InitScreen()
        {
            Log.Assert(nextDefaultScreenName != "",
                "Missing nextDefaultScreenName, please set one in "+gameObject.name);

            uiManager = UIManager.Instance;
            gameManager = GameManager.Instance;
            audioManager = AudioManager.Instance;
            i18n = I18nManager.Instance;

            UIManager.UICamera.cullingMask = layerMask;

            //set every hud active, which used in this screen
            if(huds != null && hudDefaultTransforms != null)
            {
                Log.Assert(hudDefaultTransforms.Count == huds.Count);

                for (int i = 0; i < huds.Count; i++)
                {
                    GameObject obj = uiManager.GetHud(huds[i]);
                    obj.SetActive(true);

                    obj.transform.position = hudDefaultTransforms[i].position;
                    obj.transform.localScale = hudDefaultTransforms[i].localScale;
                    obj.transform.rotation = hudDefaultTransforms[i].rotation;
                }
            }

            //set every popup inactive, which used in this screen
            if(popups != null)
            {
                foreach(string name in popups)
                {
                    GameObject obj = uiManager.GetPopup(name);
                    obj.SetActive(false);
                }
            }
        }
        /// <summary>
        /// Initializ the buttons and register event handler
        /// </summary>
        void Awake()
        {
            Log.Debug("Awake "+gameObject.name);

            childrens = new List<GameObject>();

            foreach (Transform child in transform)
            {
                childrens.Add(child.gameObject);
                child.gameObject.SetActive(true);
            }

            uiManager = UIManager.Instance;

            //register handler for screen change
            //UIManager.ScreenChanged = ScreenChanged;
        }
        // Use this for initialization
        public virtual void Awake()
        {
            Log.Debug("__________________________________ AWAKE _____________________________");

            parameters = new Dictionary<string, string>();

            // if(useDBModule)
            // {
            // 	// StartCoroutine("xmlLoadRoutine");
            // 	LoadAppConfigurationXml();
            // }

            //testParameters instead of document.location.search
            // for testing Web Player: Variables in PHP are
            // $UserName and $SessionToken

            Log.Level = logLevel;
            Log.Info("Starting MainGame ... name "+this.name);

            ui = UIManager.Instance;

            ui.InitUI(gameObject);

            if (!GameManager.Instance.offline)
                GameManager.Instance.offline = offline;
            else
                offline = GameManager.Instance.offline;

            ui.ConfigResources = configResources;
            if(tooltip)
                ui.Tooltip = (UITooltip)Instantiate(tooltip, Vector3.zero, Quaternion.identity);

            //set ui camera to custom 2D camera
            Log.Assert(camera2D != null, "You have to assign a 2D camera in "+gameObject.name);
            UIManager.UICamera = camera2D;

            gm = GameManager.Instance;
            gm.mainGame  = this;
            gm.debugMode = debug;
            gm.standaloneBetaMode = standaloneBeta;
            gm.standaloneSingleLevelMode = standaloneSingleLevel;
            gm.BalanceSheetAchievementMode = true;
            gm.muteSfx = muteSfx;
            if(gm.setTouch)
                gm.hidTouch = hidTouch;
            else
                hidTouch = gm.hidTouch;
            gm.muteSoundBackground = muteSoundBackground;

            //localisation

            i18n = I18nManager.Instance;
            i18n.LoadDbFile(localizatoinDB);

            if(i18n.Language == null || i18n.Language.Length == 0)
            {
                //first time set
                string lang = "";
                switch(language)
                {
                    case Languages.DE:
                        lang = "DE";
                        break;
                    case Languages.DEP:
                        lang = "DEP";
                        break;
                    case Languages.EN:
                        lang = "EN";
                        break;
                    case Languages.NL:
                        lang = "NL";
                        break;
                }

                i18n.Language = lang;
            }
            else
            {
                //lang has already been set,
                //but better to set local game's language to avoid confusion
                switch(i18n.Language)
                {
                    case "DE":
                        language = Languages.DE;
                        break;
                    case "DEP":
                        language = Languages.DEP;
                        break;
                    case "EN":
                        language = Languages.EN;
                        break;
                    case "NL":
                        language = Languages.NL;
                        break;
                }

                I18nManager.Instance.SetLanguage(i18n.Language);
            }

            //Audio using localization db
            am = AudioManager.Instance;
            am.InitAudio();
            try
            {
                // Log.Debug("---------- am:"+am);
                Log.Debug("---------- audioResources:"+audioResources);
                am.LoadResources("AUDIO", audioResources);
                am.MuteMusic = muteSoundBackground;
                am.MuteSfx = muteSfx;
            }
            catch
            {
                //TODO only hide when in editor mode
                //we hide error for now due to editor
                Log.Error("---------- audioResources:"+audioResources);
            }

            // DialogGame can be seen as a MainGame and a requirement
            GMGame game = new GMGame(this.name);
            gm.Add(game);
            gm.DialogGame = game;
        }
        /// <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>
        ///
        ///</summary>
        void Awake()
        {
            Log.Debug(gameObject.name+" AWAKEN");

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

            //TODO dynamic creation from file
            if (mainMenu == null) LogCyan("mainMenu", gameObject.name);
            if (buildMenu == null) LogCyan("buildMenu", gameObject.name);
            if (txtBuildMenu == null) LogCyan("txtBuildMenu", gameObject.name);
            if (financeMenu == null) LogCyan("financeMenu", gameObject.name);
            if (txtFinanceMenu == null) LogCyan("txtFinanceMenu", gameObject.name);
            if (staticsMenu == null) LogCyan("staticsMenu", gameObject.name);
            if (txtStaticsMenu == null) LogCyan("txtStaticsMenu", gameObject.name);
            if (buildButton == null) LogCyan("buildButton", gameObject.name);
            if (financeButton == null) LogCyan("financeButton", gameObject.name);
            if (statisticsButton == null) LogCyan("statisticsButton", gameObject.name);
            if (cursorIcon_Pipe == null) LogCyan("cursorIcon_Pipe", gameObject.name);
            if (cursorIcon_Filter == null) LogCyan("cursorIcon_Filter", gameObject.name);
            if (btnMap == null) LogCyan("btnMap", gameObject.name);

            txtBuildMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "004");
            txtFinanceMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "005");
            txtStaticsMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "006");
        }
		/// <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>
		///
		///</summary>
		void Awake()
		{
			Log.Debug(gameObject.name+" AWAKEN");
			
			//get managers
			uiManager = UIManager.Instance;
			gpm = GameManager.Instance;
			//financeManager = F0000_FinanceManager.Instance;
			
			//TODO dynamic creation from file		
			//if (mainMenu == null) LogCyan("mainMenu", gameObject.name);

			hudOpen = false;
		}//Awake()
        //-------------------------------- 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);
        }