コード例 #1
0
 // Use this for initialization
 void Awake()
 {
     Log.Level = Log.LogLevel.INFO;
     i18 = I18nManager.Instance;
     i18.LoadDbFile("Epigene/Test/Config/localisation");
     i18.SetLanguage(lang);
 }
コード例 #2
0
        // 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;
        }