void LoadResources(XmlNode resNode) { if (resNode == null) { fileManager.skipDownloadResources(); return; } int resVer = GetIntFromAttribute(resNode, "rev", 0); int oldResVer = PlayerPrefs.GetInt("ResVer", 0); for (int childInd = 0; childInd < resNode.ChildNodes.Count; childInd++) { XmlNode childNode = resNode.ChildNodes[childInd]; switch (childNode.Name) { case "menuicon": { AppRes fn = new AppRes("icons", GetTextFromAttribute(childNode, "filename")); if (fn.FileName != "") { downloadedResList.Add(fn); } } break; } } StartCoroutine(fileManager.downloadResources(downloadedResList, oldResVer >= resVer)); PlayerPrefs.SetInt("ResVer", resVer); }
public Sprite LoadSpriteFromRes(AppRes appRes) { string resFileName = savePath + appRes.Dir + "/" + appRes.FileName; if (!File.Exists(resFileName)) { return(null); } Texture2D tex = new Texture2D(2, 2, TextureFormat.RGBA32, true); tex.filterMode = FilterMode.Trilinear; tex.anisoLevel = 16; tex.Apply(); tex.LoadImage(File.ReadAllBytes(resFileName)); return(Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(tex.width / 2, tex.height / 2))); }
public Main_Form() { InitializeComponent(); AppRes.InitDirs(); test(); }