private void ExportText(Unity_Studio.AssetPreloadData asset) { Unity_Studio.TextAsset m_TextAsset = new Unity_Studio.TextAsset(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/text"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/text/" + asset.Text; string fileName = fileCandidate + asset.extension; m_TextAsset = new Unity_Studio.TextAsset(asset, true); while (File.Exists(fileName)) { return;// Fixme; } using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { writer.Write(m_TextAsset.Deobfuscate(finder.ObfuscateKey())); writer.Close(); } // Run monster data extration tool if in dev if (Application.isEditor && asset.Text.Equals("Localization")) { if (finder is MoMFinder) { ExtractDataTool.MoM(m_TextAsset.Deobfuscate(finder.ObfuscateKey())); } } }
private void ExportFont(Unity_Studio.AssetPreloadData asset) { Unity_Studio.unityFont m_Font = new Unity_Studio.unityFont(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/fonts"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/fonts/" + asset.Text; string fileName = fileCandidate + ".ttf"; m_Font = new Unity_Studio.unityFont(asset, true); if (m_Font.m_FontData == null) { return; } while (File.Exists(fileName)) { return;// Fixme; } using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { writer.Write(m_Font.m_FontData); writer.Close(); } }
// Save text to file private void ExportText(Unity_Studio.AssetPreloadData asset) { Unity_Studio.TextAsset m_TextAsset = new Unity_Studio.TextAsset(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/text"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/text/" + asset.Text; string fileName = fileCandidate + asset.extension; m_TextAsset = new Unity_Studio.TextAsset(asset, true); // This should apend a postfix to the name to avoid collisions, but as we import multiple times // This is broken while (File.Exists(fileName)) { return;// Fixme; } // Write to disk using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { // Pass the Deobfuscate key to decrypt writer.Write(m_TextAsset.Deobfuscate(finder.ObfuscateKey())); writer.Close(); } // Run monster data extration tool if in dev if (Application.isEditor && asset.Text.Equals("Localization")) { if (finder is MoMFinder) { ExtractDataTool.MoM(m_TextAsset.Deobfuscate(finder.ObfuscateKey())); } } }
// Save TTF font to dist private void ExportFont(Unity_Studio.AssetPreloadData asset) { Unity_Studio.unityFont m_Font = new Unity_Studio.unityFont(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/fonts"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/fonts/" + asset.Text; string fileName = fileCandidate + ".ttf"; m_Font = new Unity_Studio.unityFont(asset, true); if (m_Font.m_FontData == null) { return; } // This should apend a postfix to the name to avoid collisions, but as we import multiple times // This is broken while (File.Exists(fileName)) { return;// Fixme; } // Write to disk using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { writer.Write(m_Font.m_FontData); writer.Close(); } }
// Check if an import is required public bool NeedImport() { // Read the import log logFile = ContentData.ContentPath() + gameType + "/ffg/import.ini"; IniData log = IniRead.ReadFromIni(logFile); // If no import log, import is required if (log == null) { return(true); } bool appVersionOK = false; bool valkVersionOK = false; // Check that the FFG app version in import is new enough string lastImport = log.Get("Import", "FFG"); appVersionOK = VersionNewerOrEqual(finder.RequiredFFGVersion(), lastImport); // Check that the Valkyrie version in import is new enough lastImport = log.Get("Import", "Valkyrie"); valkVersionOK = VersionNewerOrEqual(requiredValkyrieVersion, lastImport); return(!appVersionOK || !valkVersionOK); }
// Write log of import private void WriteImportLog(string logFile) { string[] log = new string[3]; log[0] = "[Import]"; log[1] = "Valkyrie=" + Game.Get().version; log[2] = "FFG=" + fetchAppVersion(); // Write out data try { Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); logFile = ContentData.ContentPath() + gameType + "/ffg/import.ini"; if (File.Exists(logFile)) { File.Delete(logFile); } File.WriteAllLines(logFile, log); } catch (System.Exception) { ValkyrieDebug.Log("Warning: Unable to create import log"); } }
public static void MoM(byte[] data) { List <string> labels = ReadLabels(data); Dictionary <string, Monster> monsters = new Dictionary <string, Monster>(); string attacks = ""; foreach (string m in labels) { string mName = ExtractMonsterName(m); if (mName.Length > 0) { if (!monsters.ContainsKey(mName)) { monsters.Add(mName, new Monster(mName)); } monsters[mName].Add(m); } if (m.IndexOf("ATTACK_") == 0) { attacks += GetAttack(m); } } string evade = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { evade += kv.Value.GetEvade(); } string file = ContentData.ContentPath() + "/extract-evade.ini"; File.WriteAllText(file, evade); string horror = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { horror += kv.Value.GetHorror(); } file = ContentData.ContentPath() + "/extract-horror.ini"; File.WriteAllText(file, horror); string activation = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { activation += kv.Value.GetActivation(); } file = ContentData.ContentPath() + "/extract-activation.ini"; File.WriteAllText(file, activation); file = ContentData.ContentPath() + "/extract-attacks.ini"; File.WriteAllText(file, attacks); }
//Clean old fetched data private bool CleanImport() { if (!Directory.Exists(ContentData.ContentPath() + gameType + "/ffg")) { return(true); } try { Directory.Delete(ContentData.ContentPath() + gameType + "/ffg", true); } catch (System.Exception) { ValkyrieDebug.Log("Warning: Unable to remove temporary files."); return(false); } if (Directory.Exists(ContentData.ContentPath() + gameType + "/ffg")) { return(false); } return(true); }
public bool NeedImport() { logFile = ContentData.ContentPath() + gameType + "/ffg/import.ini"; IniData log = IniRead.ReadFromIni(logFile); if (log == null) { return(true); } bool appVersionOK = false; bool valkVersionOK = false; string lastImport = log.Get("Import", "FFG"); appVersionOK = VersionNewerOrEqual(finder.RequiredFFGVersion(), lastImport); lastImport = log.Get("Import", "Valkyrie"); valkVersionOK = VersionNewerOrEqual(requiredValkyrieVersion, lastImport); return(!appVersionOK || !valkVersionOK); }
private void ExportAudioClip(Unity_Studio.AssetPreloadData asset) { Unity_Studio.AudioClip m_AudioClip = new Unity_Studio.AudioClip(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/audio"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/audio/" + asset.Text; string fileName = fileCandidate + asset.extension; m_AudioClip = new Unity_Studio.AudioClip(asset, true); while (File.Exists(fileName)) { return;// Fixme; } using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { writer.Write(m_AudioClip.m_AudioData); writer.Close(); } }
// Save audio to file private void ExportAudioClip(Unity_Studio.AssetPreloadData asset) { Unity_Studio.AudioClip m_AudioClip = new Unity_Studio.AudioClip(asset, false); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/audio"); string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/audio/" + asset.Text; string fileName = fileCandidate + ".ogg"; // This should apend a postfix to the name to avoid collisions, but as we import multiple times // This is broken while (File.Exists(fileName)) { return;// Fixme; } // Pass to FSB Export m_AudioClip = new Unity_Studio.AudioClip(asset, true); FSBExport.Write(m_AudioClip.m_AudioData, fileName); }
// Unity fires off this function void Awake() { // Find the common objects we use. These are created by unity. cc = GameObject.FindObjectOfType <CameraController>(); uICanvas = GameObject.Find("UICanvas").GetComponent <Canvas>(); boardCanvas = GameObject.Find("BoardCanvas").GetComponent <Canvas>(); tokenCanvas = GameObject.Find("TokenCanvas").GetComponent <Canvas>(); tokenBoard = GameObject.FindObjectOfType <TokenBoard>(); heroCanvas = GameObject.FindObjectOfType <HeroCanvas>(); monsterCanvas = GameObject.FindObjectOfType <MonsterCanvas>(); // Create some things uiScaler = new UIScaler(uICanvas); config = new ConfigFile(); GameObject go = new GameObject("audio"); audioControl = go.AddComponent <Audio>(); updateList = new List <IUpdateListener>(); stats = new StatsManager(); stats.DownloadStats(); if (config.data.Get("UserConfig") == null) { // English is the default current language config.data.Add("UserConfig", "currentLang", "English"); config.Save(); } currentLang = config.data.Get("UserConfig", "currentLang"); string vSet = config.data.Get("UserConfig", "editorTransparency"); if (vSet == "") { editorTransparency = 0.3f; } else { float.TryParse(vSet, out editorTransparency); } string s_debug_tests = config.data.Get("Debug", "tests"); if (s_debug_tests != "") { s_debug_tests = s_debug_tests.ToLower(); if (s_debug_tests == "true" || s_debug_tests == "1") { debugTests = true; } } // On android extract streaming assets for use if (Application.platform == RuntimePlatform.Android) { System.IO.Directory.CreateDirectory(ContentData.ContentPath()); using (ZipFile jar = ZipFile.Read(Application.dataPath)) { foreach (ZipEntry e in jar) { if (!e.FileName.StartsWith("assets")) { continue; } if (e.FileName.StartsWith("assets/bin")) { continue; } e.Extract(ContentData.ContentPath() + "../..", ExtractExistingFileAction.OverwriteSilently); } } } DictionaryI18n valDict = new DictionaryI18n(); foreach (string file in System.IO.Directory.GetFiles(ContentData.ContentPath() + "../text", "Localization*.txt")) { valDict.AddDataFromFile(file); } LocalizationRead.AddDictionary("val", valDict); roundControl = new RoundController(); // Read the version and add it to the log TextAsset versionFile = Resources.Load("version") as TextAsset; version = versionFile.text.Trim(); // The newline at the end stops the stack trace appearing in the log ValkyrieDebug.Log("Valkyrie Version: " + version + System.Environment.NewLine); #if UNITY_STANDALONE_WIN SetScreenOrientationToLandscape(); #endif // Bring up the Game selector gameSelect = new GameSelectionScreen(); }
public static void MoM(byte[] data) { List <string> labels = ReadLabels(data); List <string> mythosList = new List <string>(); Dictionary <string, Monster> monsters = new Dictionary <string, Monster>(); string attacks = ""; string items = ""; string mythos = ""; string allText = Encoding.UTF8.GetString(data, 0, data.Length); foreach (string m in labels) { string mName = ExtractMonsterName(m); if (mName.Length > 0) { if (!monsters.ContainsKey(mName)) { monsters.Add(mName, new Monster(mName)); } monsters[mName].Add(m, allText); } if (m.IndexOf("ATTACK_") == 0) { attacks += GetAttack(m); } if (m.IndexOf("UNIQUE_ITEM") == 0 || m.IndexOf("COMMON_ITEM") == 0) { items += GetItem(m); } if (m.IndexOf("MYTHOS_EVENT") == 0) { mythos += GetMythos(m, mythosList); } } string evade = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { evade += kv.Value.GetEvade(); } string file = ContentData.ContentPath() + "/MoM/ffg/extract-evade.ini"; File.WriteAllText(file, evade); string horror = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { horror += kv.Value.GetHorror(); } file = ContentData.ContentPath() + "/MoM/ffg/extract-horror.ini"; File.WriteAllText(file, horror); string activation = ""; foreach (KeyValuePair <string, Monster> kv in monsters) { activation += kv.Value.GetActivation(); } file = ContentData.ContentPath() + "/MoM/ffg/extract-activation.ini"; File.WriteAllText(file, activation); file = ContentData.ContentPath() + "/MoM/ffg/extract-attacks.ini"; File.WriteAllText(file, attacks); file = ContentData.ContentPath() + "/MoM/ffg/extract-items.ini"; File.WriteAllText(file, items); mythos += "[MythosPool]\n"; string mythosAll = "event1="; foreach (string s in mythosList) { mythosAll += s + " "; } mythos += mythosAll.Substring(0, mythosAll.Length - 1); mythos += "\nbutton1=\"Continue\"\n"; mythos += "trigger=Mythos\n"; file = ContentData.ContentPath() + "MoM/ffg/extract-mythos.ini"; File.WriteAllText(file, mythos); }
/// <summary> /// Get the default server list location /// </summary> /// <returns>the path to the remote files</returns> public static string GetServerLocation() { string[] text = File.ReadAllLines(ContentData.ContentPath() + "../text/download.txt"); return(text[0] + Game.Get().gameType.TypeName() + Path.DirectorySeparatorChar); }
public void Draw() { // This will destroy all Destroyer.Destroy(); Game game = Game.Get(); game.gameType = new NoGameType(); // Get the current content for games if (Application.platform == RuntimePlatform.OSXPlayer) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.MacOS, ContentData.ContentPath(), Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.MacOS, ContentData.ContentPath(), Application.isEditor); } else { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Windows, ContentData.ContentPath(), Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Windows, ContentData.ContentPath(), Application.isEditor); } fcD2E.Inspect(); fcMoM.Inspect(); // Banner Image Sprite bannerSprite; Texture2D newTex = Resources.Load("sprites/banner") as Texture2D; GameObject banner = new GameObject("banner"); banner.tag = Game.DIALOG; banner.transform.SetParent(game.uICanvas.transform); RectTransform trans = banner.AddComponent <RectTransform>(); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit()); banner.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>(); bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1); image.sprite = bannerSprite; image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); DialogBox db; Color startColor = Color.white; // If we need to import we can't play this type if (fcD2E.NeedImport()) { startColor = Color.gray; } // Draw D2E button TextButton tb = new TextButton( new Vector2((UIScaler.GetWidthUnits() - 30) / 2, 10), new Vector2(30, 4f), D2E_NAME, delegate { D2E(); }, startColor); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); // Draw D2E import button if (fcD2E.ImportAvailable()) { StringKey keyText = fcD2E.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 14.2f), new Vector2(10, 2f), keyText, delegate { Import("D2E"); }); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); } else // Import unavailable { db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 24) / 2, 14.2f), new Vector2(24, 1f), D2E_APP_NOT_FOUND, Color.red); db.AddBorder(); } // Draw MoM button startColor = Color.white; if (fcMoM.NeedImport()) { startColor = Color.gray; } tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 30) / 2, 19), new Vector2(30, 4f), MOM_NAME, delegate { MoM(); }, startColor); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); // Draw MoM import button if (fcMoM.ImportAvailable()) { StringKey keyText = fcMoM.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 23.2f), new Vector2(10, 2f), keyText, delegate { Import("MoM"); }); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); } else // Import unavailable { db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 24) / 2, 23.2f), new Vector2(24, 1f), MOM_APP_NOT_FOUND, Color.red); db.AddBorder(); } new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), CommonStringKeys.EXIT, delegate { Exit(); }, Color.red); }
// Save texture to disk private void ExportTexture(Unity_Studio.AssetPreloadData asset) { Unity_Studio.Texture2D m_Texture2D = new Unity_Studio.Texture2D(asset, false); m_Texture2D = new Unity_Studio.Texture2D(asset, true); Directory.CreateDirectory(ContentData.ContentPath()); Directory.CreateDirectory(ContentData.ContentPath() + gameType); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg"); Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/img"); // Default file name string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/img/" + asset.Text; string fileName = fileCandidate + asset.extension; // This should apend a postfix to the name to avoid collisions, but as we import multiple times // This is broken while (File.Exists(fileName)) { return;// Fixme; } switch (m_Texture2D.m_TextureFormat) { #region DDS case 1: //Alpha8 case 2: //A4R4G4B4 case 3: //B8G8R8 //confirmed on X360, iOS //PS3 unsure case 4: //G8R8A8B8 //confirmed on X360, iOS case 5: //B8G8R8A8 //confirmed on X360, PS3, Web, iOS case 7: //R5G6B5 //confirmed switched on X360; confirmed on iOS case 10: //DXT1 case 12: //DXT5 case 13: //R4G4B4A4, iOS (only?) using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { // We have to manually add a header because unity doesn't have it writer.Write(0x20534444); writer.Write(0x7C); writer.Write(m_Texture2D.dwFlags); writer.Write(m_Texture2D.m_Height); writer.Write(m_Texture2D.m_Width); writer.Write(m_Texture2D.dwPitchOrLinearSize); //should be main tex size without mips); writer.Write((int)0); //dwDepth not implemented writer.Write(m_Texture2D.dwMipMapCount); writer.Write(new byte[44]); //dwReserved1[11] writer.Write(m_Texture2D.dwSize); writer.Write(m_Texture2D.dwFlags2); writer.Write(m_Texture2D.dwFourCC); writer.Write(m_Texture2D.dwRGBBitCount); writer.Write(m_Texture2D.dwRBitMask); writer.Write(m_Texture2D.dwGBitMask); writer.Write(m_Texture2D.dwBBitMask); writer.Write(m_Texture2D.dwABitMask); writer.Write(m_Texture2D.dwCaps); writer.Write(m_Texture2D.dwCaps2); writer.Write(new byte[12]); //dwCaps3&4 & dwReserved2 // Write image data writer.Write(m_Texture2D.image_data); writer.Close(); } break; #endregion #region PVR case 30: //PVRTC_RGB2 case 31: //PVRTC_RGBA2 case 32: //PVRTC_RGB4 case 33: //PVRTC_RGBA4 case 34: //ETC_RGB4 using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { // We have to manually add a header because unity doesn't have it writer.Write(m_Texture2D.pvrVersion); writer.Write(m_Texture2D.pvrFlags); writer.Write(m_Texture2D.pvrPixelFormat); writer.Write(m_Texture2D.pvrColourSpace); writer.Write(m_Texture2D.pvrChannelType); writer.Write(m_Texture2D.m_Height); writer.Write(m_Texture2D.m_Width); writer.Write(m_Texture2D.pvrDepth); writer.Write(m_Texture2D.pvrNumSurfaces); writer.Write(m_Texture2D.pvrNumFaces); writer.Write(m_Texture2D.dwMipMapCount); writer.Write(m_Texture2D.pvrMetaDataSize); // Write image data writer.Write(m_Texture2D.image_data); writer.Close(); } break; #endregion case 28: //DXT1 Crunched case 29: //DXT1 Crunched default: using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create))) { writer.Write(m_Texture2D.image_data); writer.Close(); } break; } }
// Unity fires off this function void Start() { // Find the common objects we use. These are created by unity. cc = GameObject.FindObjectOfType <CameraController>(); uICanvas = GameObject.Find("UICanvas").GetComponent <Canvas>(); boardCanvas = GameObject.Find("BoardCanvas").GetComponent <Canvas>(); tokenCanvas = GameObject.Find("TokenCanvas").GetComponent <Canvas>(); tokenBoard = GameObject.FindObjectOfType <TokenBoard>(); heroCanvas = GameObject.FindObjectOfType <HeroCanvas>(); monsterCanvas = GameObject.FindObjectOfType <MonsterCanvas>(); // Create some things uiScaler = new UIScaler(uICanvas); config = new ConfigFile(); GameObject go = new GameObject("audio"); audioControl = go.AddComponent <Audio>(); updateList = new List <IUpdateListener>(); if (config.data.Get("UserConfig") == null) { // English is the default current language config.data.Add("UserConfig", "currentLang", "English"); config.Save(); } currentLang = config.data.Get("UserConfig", "currentLang"); // On android extract streaming assets for use if (Application.platform == RuntimePlatform.Android) { System.IO.Directory.CreateDirectory(ContentData.ContentPath()); using (ZipFile jar = ZipFile.Read(Application.dataPath)) { foreach (ZipEntry e in jar) { if (e.FileName.IndexOf("assets") != 0) { continue; } if (e.FileName.IndexOf("assets/bin") == 0) { continue; } e.Extract(ContentData.ContentPath() + "../..", ExtractExistingFileAction.OverwriteSilently); } } } DictionaryI18n valDict = new DictionaryI18n(); foreach (string file in System.IO.Directory.GetFiles(ContentData.ContentPath() + "../text", "Localization*.txt")) { valDict.AddDataFromFile(file); } LocalizationRead.AddDictionary("val", valDict); roundControl = new RoundController(); // Read the version and add it to the log TextAsset versionFile = Resources.Load("version") as TextAsset; version = versionFile.text.Trim(); // The newline at the end stops the stack trace appearing in the log ValkyrieDebug.Log("Valkyrie Version: " + version + System.Environment.NewLine); // Bring up the Game selector gameSelect = new GameSelectionScreen(); }
public override string DataDirectory() { return(ContentData.ContentPath() + "D2E/"); }