/// <summary>
        /// Enable this button - register it
        /// </summary>
        void OnEnable()
        {
            //Log.Debug("Button OnEnable in "+gameObject.name);

            audioManager = AudioManager.Instance;
            Init();

            //UIManager.ScreenChanged = ScreenChanged;
        }
        /// 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);
                }
            }
        }
        void Awake()
        {
            //only add collider if not yet exist
            Collider c = gameObject.GetComponent<Collider>();
            if(c == null)
            {
                gameObject.AddComponent<SphereCollider>();
            }

            audioManager = AudioManager.Instance;

            //Log.Assert(states[0] != null, "Need to assign at least one state");
        }
        // 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;
        }