void Update() { if (Program.I().deckManager != null) { if (loaded_code != code) { Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults); if (t != null) { uiTexture.mainTexture = t; uiTexture.aspectRatio = ((float)t.width) / ((float)t.height); uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio)); loaded_code = code; loaded_banlist = null; } } if (loaded_banlist != Program.I().deckManager.currentBanlist) { loaded_banlist = Program.I().deckManager.currentBanlist; if (ico != null) { if (loaded_banlist == null) { ico.show(3); return; } ico.show(loaded_banlist.GetQuantity(code)); } } } }
void Update() { if (loadedPicCode != cardData.Id) { Texture2D pic = GameTextureManager.get(cardData.Id, GameTextureType.card_picture); if (pic != null) { loadedPicCode = cardData.Id; gameObject.transform.FindChild("face").GetComponent <Renderer>().material.mainTexture = pic; } } if (Program.I().deckManager.currentBanlist != loaded_banlist) { ban_icon ico = GetComponentInChildren <ban_icon>(); loaded_banlist = Program.I().deckManager.currentBanlist; if (loaded_banlist != null) { ico.show(loaded_banlist.GetQuantity(cardData.Id)); } else { ico.show(3); } } if (isDraging) { gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f; } if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON) { killIt(); } }
/// <summary> /// Texture used by the UITexture. You can set it directly, without the need to specify a material. /// </summary> /// protected override void OnStart() { base.OnStart(); if (mOutPath != "") { mainTexture = GameTextureManager.get(mOutPath); } }
/// <summary> /// Change the visual state. /// </summary> public override void SetState(State state, bool immediate) { base.SetState(state, immediate); if (mSprite != null) { switch (state) { case State.Normal: SetSprite(mNormalSprite); break; case State.Hover: SetSprite(string.IsNullOrEmpty(hoverSprite) ? mNormalSprite : hoverSprite); break; case State.Pressed: SetSprite(pressedSprite); break; case State.Disabled: SetSprite(disabledSprite); break; } } else if (mSprite2D != null) { switch (state) { case State.Normal: SetSprite(mNormalSprite2D); break; case State.Hover: SetSprite(hoverSprite2D == null ? mNormalSprite2D : hoverSprite2D); break; case State.Pressed: SetSprite(pressedSprite2D); break; case State.Disabled: SetSprite(disabledSprite2D); break; } } if (texure2d == null) { texure2d = GetComponentInChildren <UITexture>(); } if (texure2d != null) { switch (state) { case State.Normal: if (mTextureOutNormal != "") { texure2d.mainTexture = GameTextureManager.get(mTextureOutNormal); } break; case State.Hover: case State.Pressed: if (mTextureOutPressed != "") { texure2d.mainTexture = GameTextureManager.get(mTextureOutPressed); } break; } } }
void Update() { if (coli != null) { if (Program.InputGetMouseButtonDown_0) { if (Program.pointedCollider == coli) { ((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack, "", true); } } } if (Program.I().deckManager != null) { if (loaded_code != code) { Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults); if (t != null) { uiTexture.mainTexture = t; uiTexture.aspectRatio = ((float)t.width) / ((float)t.height); uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio)); loaded_code = code; loaded_banlist = null; } } if (loaded_banlist != Program.I().deckManager.currentBanlist) { loaded_banlist = Program.I().deckManager.currentBanlist; if (ico != null) { if (loaded_banlist == null) { ico.show(3); return; } ico.show(loaded_banlist.GetQuantity(code)); } if (ico_ot != null) { //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime] if (data.Ot == 2 || data.Ot == 4) { ico_ot.show(data.Ot); return; } ico_ot.show(3); } } } }
public void show(int i) { UITexture t = gameObject.GetComponent <UITexture>(); if (t != null) { t.mainTexture = GameTextureManager.get("ban_" + i.ToString()); } else { Renderer r = GetComponent <Renderer>(); r.material.mainTexture = GameTextureManager.get("ban_" + i.ToString()); } }
void Start() { pics[0] = GameTextureManager.get("jiandao"); pics[1] = GameTextureManager.get("shitou"); pics[2] = GameTextureManager.get("bu"); texture_0.mainTexture = pics[me]; texture_1.mainTexture = pics[op]; GameObject_0.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0)); iTweenExtensions.MoveToAction(GameObject_0, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => { Destroy(GameObject_0, 0.3f); }, 0); GameObject_1.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)); iTweenExtensions.MoveToAction(GameObject_1, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => { Destroy(GameObject_1, 0.3f); }, 0); }
public static void charge() { if (Program.TimePassed() - lastChargeTime > 5 * 60 * 1000) { lastChargeTime = Program.TimePassed(); try { GameTextureManager.clearAll(); Resources.UnloadUnusedAssets(); GC.Collect(); } catch (System.Exception e) { UnityEngine.Debug.Log(e); } } }
public void show(int i) { UITexture t = gameObject.GetComponent <UITexture>(); if (t != null) { if (i == 2 || i == 4) //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime] { if (File.Exists("texture/ui/ban_ot_" + i.ToString() + ".png")) { t.mainTexture = GameTextureManager.get("ban_ot_" + i.ToString()); } else { Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_" + i.ToString()); t.mainTexture = icon; } } else { Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_3"); t.mainTexture = icon; } } else { Renderer r = GetComponent <Renderer>(); if (i == 2 || i == 4) //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime] { if (File.Exists("texture/ui/ban_ot_" + i.ToString() + ".png")) { r.material.mainTexture = GameTextureManager.get("ban_ot_" + i.ToString()); } else { Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_" + i.ToString()); r.material.mainTexture = icon; } } else { Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_3"); r.material.mainTexture = icon; } } }
void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { InterString.initialize("config/translation.conf"); GameTextureManager.initialize(); Config.initialize("config/config.conf"); if (!Directory.Exists("expansions")) { try { Directory.CreateDirectory("expansions"); } catch { } } var fileInfos = new FileInfo[0]; if (Directory.Exists("expansions")) { fileInfos = (new DirectoryInfo("expansions")).GetFiles(); foreach (FileInfo file in fileInfos) { if (file.Name.ToLower().EndsWith(".ypk")) { GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + file.Name)); } if (file.Name.ToLower().EndsWith(".conf")) { GameStringManager.initialize("expansions/" + file.Name); } if (file.Name.ToLower().EndsWith(".cdb")) { YGOSharp.CardsManager.initialize("expansions/" + file.Name); } } } if (Directory.Exists("cdb")) { fileInfos = (new DirectoryInfo("cdb")).GetFiles(); foreach (FileInfo file in fileInfos) { if (file.Name.ToLower().EndsWith(".conf")) { GameStringManager.initialize("cdb/" + file.Name); } if (file.Name.ToLower().EndsWith(".cdb")) { YGOSharp.CardsManager.initialize("cdb/" + file.Name); } } } if (Directory.Exists("diy")) { fileInfos = (new DirectoryInfo("diy")).GetFiles(); foreach (FileInfo file in fileInfos) { if (file.Name.ToLower().EndsWith(".conf")) { GameStringManager.initialize("diy/" + file.Name); } if (file.Name.ToLower().EndsWith(".cdb")) { YGOSharp.CardsManager.initialize("diy/" + file.Name); } } } if (Directory.Exists("data")) { fileInfos = (new DirectoryInfo("data")).GetFiles(); foreach (FileInfo file in fileInfos) { if (file.Name.ToLower().EndsWith(".zip")) { GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("data/" + file.Name)); } } } foreach (ZipFile zip in GameZipManager.Zips) { if (zip.Name.ToLower().EndsWith("script.zip")) { continue; } foreach (string file in zip.EntryFileNames) { if (file.ToLower().EndsWith(".conf")) { MemoryStream ms = new MemoryStream(); ZipEntry e = zip[file]; e.Extract(ms); GameStringManager.initializeContent(Encoding.UTF8.GetString(ms.ToArray())); } if (file.ToLower().EndsWith(".cdb")) { ZipEntry e = zip[file]; string tempfile = Path.Combine(Path.GetTempPath(), file); e.Extract(Path.GetTempPath(), ExtractExistingFileAction.OverwriteSilently); YGOSharp.CardsManager.initialize(tempfile); File.Delete(tempfile); } } } GameStringManager.initialize("config/strings.conf"); YGOSharp.BanlistManager.initialize("config/lflist.conf"); if (Directory.Exists("pack")) { fileInfos = (new DirectoryInfo("pack")).GetFiles(); foreach (FileInfo file in fileInfos) { if (file.Name.ToLower().EndsWith(".db")) { YGOSharp.PacksManager.initialize("pack/" + file.Name); } } YGOSharp.PacksManager.initializeSec(); } initializeALLservants(); loadResources(); }); }
void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { Config.initialize("Assets/essential/config/config.conf"); localSha = new ShaCache(); try { UpdateClient("Assets/essential/cdb/", cdbID); UpdateClient("Assets/essential/config/", configID); } catch { // TODO: I would like to log to the chat log but that doesn't get initalized till initializeALLservants // book.add("Auto Update Failed...\nCheck your network connection and relaunch the game..."); } InterString.initialize("Assets/essential/config/translation.conf"); InterString.initialize("Assets/essential/config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); GameStringManager.initialize("Assets/essential/config/strings.conf"); if (File.Exists("Assets/essential/config/strings.conf")) { GameStringManager.initialize("Assets/essential/config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("Assets/essential/config/lflist.conf"); if (File.Exists("expansions/lflist.conf")) { YGOSharp.BanlistManager.initialize("expansions/lflist.conf"); } FileInfo[] fileInfos; if (Directory.Exists("expansions")) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().Where(x => x.Extension == ".cdb").OrderBy(x => x.Name).ToArray(); if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles().Where(x => x.Extension == ".cdb").OrderBy(x => x.Name).ToArray(); } for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } fileInfos = (new DirectoryInfo("Assets/essential/cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("Assets/essential/cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("Assets/essential/cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } fileInfos = (new DirectoryInfo("Assets/essential/pack")).GetFiles(); fileInfos = (new DirectoryInfo("Assets/essential/pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("Assets/essential/pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("Assets/essential/pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }
private void printSelected() { GameTextureManager.clearUnloaded(); YGOSharp.Deck deck; DeckManager.FromYDKtoCodedDeck(DECK_PATH + deckSelected + ".ydk", out deck); int mainAll = 0; int mainMonster = 0; int mainSpell = 0; int mainTrap = 0; int sideAll = 0; int sideMonster = 0; int sideSpell = 0; int sideTrap = 0; int extraAll = 0; int extraFusion = 0; int extraLink = 0; int extraSync = 0; int extraXyz = 0; int currentIndex = 0; int[] hangshu = UIHelper.get_decklieshuArray(deck.Main.Count); foreach (var item in deck.Main) { mainAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Monster) > 0) { mainMonster++; } if ((c.Type & (UInt32)CardType.Spell) > 0) { mainSpell++; } if ((c.Type & (UInt32)CardType.Trap) > 0) { mainTrap++; } quickCards[currentIndex].reCode(item); Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu); quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x], 10) , 161.6f - v.x * 60f , 0 ); if (currentIndex <= 198) { currentIndex++; } } foreach (var item in deck.Side) { sideAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Monster) > 0) { sideMonster++; } if ((c.Type & (UInt32)CardType.Spell) > 0) { sideSpell++; } if ((c.Type & (UInt32)CardType.Trap) > 0) { sideTrap++; } quickCards[currentIndex].reCode(item); quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count, 10) , -181.1f , 0 ); if (currentIndex <= 198) { currentIndex++; } } foreach (var item in deck.Extra) { extraAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Fusion) > 0) { extraFusion++; } if ((c.Type & (UInt32)CardType.Synchro) > 0) { extraSync++; } if ((c.Type & (UInt32)CardType.Xyz) > 0) { extraXyz++; } if ((c.Type & (UInt32)CardType.Link) > 0) { extraLink++; } quickCards[currentIndex].reCode(item); quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, extraAll - 1, deck.Extra.Count, 10) , -99.199f , 0 ); if (currentIndex <= 198) { currentIndex++; } } while (true) { quickCards[currentIndex].clear(); if (currentIndex <= 198) { currentIndex++; } else { break; } } deckPanel.leftMain.text = GameStringHelper._zhukazu + mainAll; deckPanel.leftExtra.text = GameStringHelper._ewaikazu + extraAll; deckPanel.leftSide.text = GameStringHelper._fukazu + sideAll; deckPanel.rightMain.text = GameStringHelper._guaishou + mainMonster + " " + GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap; deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink; deckPanel.rightSide.text = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap; }
void initialize() { #if !UNITY_EDITOR && UNITY_STANDALONE_OSX //Mac string GamePaths = Application.streamingAssetsPath; // .app/Contents/Resources/Data/StreamingAssets/ Environment.CurrentDirectory = GamePaths; System.IO.Directory.SetCurrentDirectory(GamePaths); #endif go(1, () => { GAME_VERSION = PRO_VERSION() + "-fix2"; UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { InterString.initialize("config/translation.conf"); GameTextureManager.initialize(); Config.initialize("config/config.conf"); if (File.Exists("config/strings.conf")) { GameStringManager.initialize("config/strings.conf"); } //if (File.Exists("config" + AppLanguage.LanguageDir() + "/strings.conf")) //{ // GameStringManager.initialize("config" + AppLanguage.LanguageDir() + "/strings.conf"); //} if (File.Exists("cdb/strings.conf")) { GameStringManager.initialize("cdb/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); var fileInfos = (new DirectoryInfo("cdb")).GetFiles(); //var fileInfos = (new DirectoryInfo("cdb" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); //YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } if (Directory.Exists("expansions")) { fileInfos = (new DirectoryInfo("expansions")).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); } } } } #if (!UNITY_ANDROID || !UNITY_IPHONE) //移动端显示问题,此功能不使用 if (Directory.Exists("pack")) { fileInfos = (new DirectoryInfo("pack")).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); } #endif initializeALLservants(); loadResources(); }); }
void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { InterString.initialize("config/translation.conf"); InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); Config.initialize("config/config.conf"); UpdateClient(); GameStringManager.initialize("config/strings.conf"); if (File.Exists("config/strings.conf")) { GameStringManager.initialize("config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); //load cards.cdb last this way for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } if (Directory.Exists("expansions")) { if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();; fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } } fileInfos = (new DirectoryInfo("pack")).GetFiles(); fileInfos = (new DirectoryInfo("pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }
void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { InterString.initialize("config/translation.conf"); GameTextureManager.initialize(); Config.initialize("config/config.conf"); GameStringManager.initialize("config/strings.conf"); if (File.Exists("cdb/strings.conf")) { GameStringManager.initialize("cdb/strings.conf"); } if (File.Exists("diy/strings.conf")) { GameStringManager.initialize("diy/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); var fileInfos = (new DirectoryInfo("cdb")).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); } } } if (Directory.Exists("diy")) { fileInfos = (new DirectoryInfo("diy")).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("diy/" + fileInfos[i].Name); } } } } if (Directory.Exists("pack")) { fileInfos = (new DirectoryInfo("pack")).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); } initializeALLservants(); loadResources(); }); }
void initialize() { #if UNITY_ANDROID //Android //保持唤醒 Screen.sleepTimeout = SleepTimeout.NeverSleep; //创建资源目录 DirectoryInfo gameDir = new DirectoryInfo(Application.persistentDataPath); string sdcardpath = gameDir.FullName.Substring(0, gameDir.FullName.LastIndexOf("Android")); if (!Directory.Exists(Path.Combine(sdcardpath, "ygocore/texture")) || !File.Exists(Path.Combine(sdcardpath, "ygocore/picture/null.png"))) { string filePath = Application.streamingAssetsPath + "/ygocore.zip"; var www = new WWW(filePath); while (!www.isDone) { } byte[] bytes = www.bytes; ExtractZipFile(bytes, sdcardpath, false); DirPaths(Path.Combine(sdcardpath, "ygocore/cdb/")); DirPaths(Path.Combine(sdcardpath, "ygocore/config/")); DirPaths(Path.Combine(sdcardpath, "ygocore/deck/")); DirPaths(Path.Combine(sdcardpath, "ygocore/pack/")); DirPaths(Path.Combine(sdcardpath, "ygocore/updates/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/card/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/closeup/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/field/")); DirPaths(Path.Combine(sdcardpath, "ygocore/replay/")); DirPaths(Path.Combine(sdcardpath, "ygocore/sound/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/common/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/face/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/duel/healthBar/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/duel/phase/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/ui/")); File.Create(Path.Combine(sdcardpath, "ygocore/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/card/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/closeup/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/field/.nomedia")); } Environment.CurrentDirectory = Path.Combine(sdcardpath, "ygocore"); System.IO.Directory.SetCurrentDirectory(Path.Combine(sdcardpath, "ygocore")); #elif UNITY_IOS //iPhone if (!Directory.Exists(Application.persistentDataPath + "/ygocore/texture") || !File.Exists(Application.persistentDataPath + "/ygocore/picture/null.png")) { string filePath = Application.streamingAssetsPath + "/ygocore.zip"; ExtractZipFile(System.IO.File.ReadAllBytes(filePath), Application.persistentDataPath + "/", false); } Environment.CurrentDirectory = Application.persistentDataPath + "/ygocore"; System.IO.Directory.SetCurrentDirectory(Application.persistentDataPath + "/ygocore"); #endif go(1, () => { initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { UpdateClient(); InterString.initialize("config/translation.conf"); InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); Config.initialize("config/config.conf"); GameStringManager.initialize("config/strings.conf"); if (File.Exists("config/strings.conf")) { GameStringManager.initialize("config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); //load cards.cdb last this way for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } if (Directory.Exists("expansions")) { if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();; fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } } fileInfos = (new DirectoryInfo("pack")).GetFiles(); fileInfos = (new DirectoryInfo("pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }
private void printSelected() { GameTextureManager.clearUnloaded(); YGOSharp.Deck deck; DeckManager.FromYDKtoCodedDeck("deck/" + deckSelected + ".ydk", out deck); int mainAll = 0; int mainMonster = 0; int mainSpell = 0; int mainTrap = 0; int sideAll = 0; int sideMonster = 0; int sideSpell = 0; int sideTrap = 0; int extraAll = 0; int extraFusion = 0; int extraLink = 0; int extraSync = 0; int extraXyz = 0; int currentIndex = 0; bool resaveDeck = false; int[] hangshu = UIHelper.get_decklieshuArray(deck.Main.Count); foreach (var item in deck.Main) { mainAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Monster) > 0) { mainMonster++; } if ((c.Type & (UInt32)CardType.Spell) > 0) { mainSpell++; } if ((c.Type & (UInt32)CardType.Trap) > 0) { mainTrap++; } if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate) { deck.Deck_O.Main[deck.Deck_O.Main.IndexOf(item)] = c.Id; resaveDeck = true; quickCards[currentIndex].reCode(c.Id); } else { quickCards[currentIndex].reCode(item); } Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu); quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x], 10) , 161.6f - v.x * 60f , 0 ); if (currentIndex <= 198) { currentIndex++; } } foreach (var item in deck.Side) { sideAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Monster) > 0) { sideMonster++; } if ((c.Type & (UInt32)CardType.Spell) > 0) { sideSpell++; } if ((c.Type & (UInt32)CardType.Trap) > 0) { sideTrap++; } if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate) { deck.Deck_O.Side[deck.Deck_O.Side.IndexOf(item)] = c.Id; resaveDeck = true; quickCards[currentIndex].reCode(c.Id); } else { quickCards[currentIndex].reCode(item); } quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count, 10) , -181.1f , 0 ); if (currentIndex <= 198) { currentIndex++; } } foreach (var item in deck.Extra) { extraAll++; YGOSharp.Card c = YGOSharp.CardsManager.Get(item); if ((c.Type & (UInt32)CardType.Fusion) > 0) { extraFusion++; } if ((c.Type & (UInt32)CardType.Synchro) > 0) { extraSync++; } if ((c.Type & (UInt32)CardType.Xyz) > 0) { extraXyz++; } if ((c.Type & (UInt32)CardType.Link) > 0) { extraLink++; } if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate) { deck.Deck_O.Extra[deck.Deck_O.Extra.IndexOf(item)] = c.Id; resaveDeck = true; quickCards[currentIndex].reCode(c.Id); } else { quickCards[currentIndex].reCode(item); } quickCards[currentIndex].transform.localPosition = new Vector3 ( -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, extraAll - 1, deck.Extra.Count, 10) , -99.199f , 0 ); if (currentIndex <= 198) { currentIndex++; } } while (true) { quickCards[currentIndex].clear(); if (currentIndex <= 198) { currentIndex++; } else { break; } } deckPanel.leftMain.text = GameStringHelper._zhukazu + mainAll; deckPanel.leftExtra.text = GameStringHelper._ewaikazu + extraAll; deckPanel.leftSide.text = GameStringHelper._fukazu + sideAll; deckPanel.rightMain.text = GameStringHelper._guaishou + mainMonster + " " + GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap; deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink; deckPanel.rightSide.text = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap; if (resaveDeck && Program.I().setting.autoDeckUpdate) { Program.I().deckManager.deck = deck; RMSshow_none("This deck has been updated becase it contained cards with beta IDs that got removed.\nPlease confirm your deck has no missing cards."); Config.Set("deckInUse", deckSelected); Program.I().deckManager.onSave(); //resaveDecklist } }