// Use this for initialization
 void Awake()
 {
     Log.Level = Log.LogLevel.INFO;
     i18 = I18nManager.Instance;
     i18.LoadDbFile("Epigene/Test/Config/localisation");
     i18.SetLanguage(lang);
 }
 // Use this for initialization
 void Start()
 {
     i18 = I18nManager.Instance;
     checkFileDb("Epigene/Config/localisation", "");
     Debug.Log("<color=green> - - - - - - - - - - - - </color>");
     checkFileDb("Epigene/Config/localisationLevel", "Menu");
 }
        /// <summary>
        /// Set the text properties right after creation.
        /// </summary>
        void Start()
        {
            i18n = I18nManager.Instance;
            Log.Assert(i18n != null, "Missing i18n", gameObject);

            UIText text = (UIText) gameObject.GetComponent(typeof(UIText));
            if(text == null)
            {
                textField = (TextMesh) gameObject.GetComponent(typeof(TextMesh));
                Log.Assert(textField, "Missing textField", gameObject);
            }

            if(keyID != "")
             	text.Text = i18n.Get(keyID);
        }
        // Use this for initialization
        void Awake()
        {
            Debug.Log("<color=cyan>START GAME</color>");

            if (startText == null) Debug.LogError("No <color=cyan>startText</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (screen1 == null) Debug.LogError("No <color=cyan>screen1</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (screen2 == null) Debug.LogError("No <color=cyan>screen2</color> assigned to:<color=cyan>"+gameObject.name+"</color>");

            UIManager ui = UIManager.Instance;
            UIManager.ScreenChanged = notifyScreenChanged;

            ui.AddScreen(screen1);
            ui.AddScreen(screen2);
            ui.ActivateScreen(screen1.name);

            startText.SetActive(false);

            //localisation
            i18nManager = I18nManager.Instance;
            i18nManager.SetLanguage(lang);

            //add an empty main game
            GMGame game = new GMGame("TestGame");
            gm = GameManager.Instance;

            ACondition falseCond = new FalseCondition();
            ACondition trueCond = new TrueCondition();

            ACondition relTimeCond = new TimerCondition(TimerType.Absolute, 8, game.TimeSource);  //true after 1sec
            //this will only be fired, when both fireCondition is true at the same time
            ScriptTrigger<string> trigger3 = new ScriptTrigger<string>();
            trigger3.Value = "TestGame";
            trigger3.Function = TestScriptFunctionString;
            trigger3.Priority = 1;
            trigger3.Repeat = 1;							//only fire once
            trigger3.FireCondition += trueCond.Check;		//always true, but you can check sg extra here
            trigger3.FireCondition += relTimeCond.Check;	//should fire only when time reached
            trigger3.DeleteCondition = falseCond.Check;		//don't remove until repeating
            gm.Add (game);
            game.AddTrigger(trigger3);
            Debug.Log (" ----> AddTrigger 3");
            gm.Start(game.Name);
        }
        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>();
        }
        /// 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);
                }
            }
        }
        // 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);
        }
 static Data()
 {
     i18n = I18nManager.Instance;
 }
        /// <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);
        }
        /// <summary>
        /// Check components
        /// </summary>
        void Awake()
        {
            Log.Assert(popup, "Missing popup holder!" +  gameObject.name);
            Log.Assert(txtTitle, "Missing txtTitle!" +  gameObject.name);
            Log.Assert(txtType, "Missing txtType!" +  gameObject.name);
            Log.Assert(txtMessage, "Missing txtMessage!" +  gameObject.name);
            Log.Assert(bgImage, "Missing bgImage!" +  gameObject.name);
            Log.Assert(button, "Missing button!" +  gameObject.name);

            Show(false);
            GameManager.Instance.RegisterEventHandler("EVENT_POPUP", EventHandler, gameObject);
            i18n = I18nManager.Instance;
        }