void Awake() { GlobalWindowManager windowManager = FindObjectOfType <GlobalWindowManager>(); if (windowManager == null) { throw new NotFoundException("Not found the GlobalWindowManager."); } context = Context.GetApplicationContext(); IServiceContainer container = context.GetContainer(); /* Initialize the data binding service */ LuaBindingServiceBundle bundle = new LuaBindingServiceBundle(context.GetContainer()); bundle.Start(); /* Initialize the ui view locator and register UIViewLocator */ container.Register <IUIViewLocator>(new DefaultUIViewLocator()); /* Initialize the localization service */ //CultureInfo cultureInfo = Locale.GetCultureInfoByLanguage (SystemLanguage.English); CultureInfo cultureInfo = Locale.GetCultureInfo(); var localization = Localization.Current; localization.CultureInfo = cultureInfo; localization.AddDataProvider(new DefaultDataProvider("LuaLocalizations", new XmlDocumentParser())); /* register Localization */ container.Register <Localization>(Localization.Current); var luaEnv = LuaEnvironment.LuaEnv; #if UNITY_EDITOR foreach (string dir in Directory.GetDirectories(Application.dataPath, "LuaScripts", SearchOption.AllDirectories)) { luaEnv.AddLoader(new FileLoader(dir, ".lua")); luaEnv.AddLoader(new FileLoader(dir, ".lua.txt")); } #else /* Pre-compiled and encrypted */ //var decryptor = new RijndaelCryptograph(128,Encoding.ASCII.GetBytes("E4YZgiGQ0aqe5LEJ"), Encoding.ASCII.GetBytes("5Hh2390dQlVh0AqC")); //luaEnv.AddLoader( new DecodableLoader(new FileLoader(Application.streamingAssetsPath + "/LuaScripts/", ".bytes"), decryptor)); //luaEnv.AddLoader( new DecodableLoader(new FileLoader(Application.persistentDataPath + "/LuaScripts/", ".bytes"), decryptor)); /* Lua source code */ luaEnv.AddLoader(new FileLoader(Application.streamingAssetsPath + "/LuaScripts/", ".bytes")); luaEnv.AddLoader(new FileLoader(Application.persistentDataPath + "/LuaScripts/", ".bytes")); #endif InitLuaEnv(); if (onAwake != null) { onAwake(this); } }
void Awake() { GlobalWindowManager windowManager = FindObjectOfType <GlobalWindowManager>(); if (windowManager == null) { throw new NotFoundException("Not found the GlobalWindowManager."); } context = Context.GetApplicationContext(); IServiceContainer container = context.GetContainer(); /* Initialize the data binding service */ LuaBindingServiceBundle bundle = new LuaBindingServiceBundle(context.GetContainer()); bundle.Start(); /* Initialize the ui view locator and register UIViewLocator */ container.Register <IUIViewLocator>(new ResourcesViewLocator()); /* Initialize the localization service */ //CultureInfo cultureInfo = Locale.GetCultureInfoByLanguage (SystemLanguage.English); CultureInfo cultureInfo = Locale.GetCultureInfo(); var localization = Localization.Current; localization.CultureInfo = cultureInfo; localization.AddDataProvider(new ResourcesDataProvider("LocalizationExamples", new XmlDocumentParser())); /* register Localization */ container.Register <Localization>(Localization.Current); /* register AccountRepository */ IAccountRepository accountRepository = new AccountRepository(); container.Register <IAccountService>(new AccountService(accountRepository)); InitLuaEnv(); if (onAwake != null) { onAwake(this); } }