public void CalculatingTextureByTasks(string folderPath, float fx) { string[] imgall = Directory.GetFiles(folderPath + "\\Brightnes" + fx.ToString()); string folder = folderPath.Split('\\').Last(); TextureRes texture = new TextureRes(); ImageProcessing imgproc = new ImageProcessing(); int i = 0; List <double[]> resultCalculation = new List <double[]>(); foreach (string img in imgall) { double[] rec = new double[11]; Bitmap gray = imgproc.MakeGrayscale3(new Bitmap(img)); int[,] colorGray = imgproc.GetCountorPoints(gray); var qvant = imgproc.GetHistogramm(gray, colorGray); int[,] graycl = texture.GrayClasses(colorGray, qvant); double[,] resMat = texture.MatrixCalculation(graycl, 32); rec[0] = texture.MatrixPower(resMat); rec[1] = texture.Correl(resMat); rec[2] = texture.Disper(resMat); rec[3] = texture.SumSr(resMat); rec[4] = texture.SumDisp(resMat); rec[5] = texture.SumEntr(resMat); rec[6] = texture.Entrop(resMat); rec[7] = texture.Contrast(resMat); rec[8] = texture.Odnorod(resMat); rec[9] = texture.diffDisp(resMat); rec[10] = texture.diffEntr(resMat); resultCalculation.Add(rec); i++; } WriteToFile(resultCalculation, folder, fx); }
// 显示[对方回合] public void enemyTurn() { if (m_enemyTex == null) { m_enemyTex = Ctx.m_instance.m_texMgr.getAndSyncLoad <TextureRes>("Image/Scene/duishou_zhanchang.tga"); } m_mat.mainTexture = m_enemyTex.getTexture(); }
/// <summary> /// name不带后缀,不带前缀 /// </summary> /// <param name="name">name为图片名称</param> /// <returns></returns> public static Texture Load(string name) { Texture tex = null; AssetBundle ab = LoadAB(name); tex = ab.LoadAsset(name) as Texture; ab.Unload(false); TextureRes res = new TextureRes(name, tex); EventDispatcher.Instance.DispatchEvent(EventID.OnABResLoaded, res); return(tex); }
override public void dispose() { base.dispose(); if (m_selfTex != null) { Ctx.m_instance.m_texMgr.unload(m_selfTex.GetPath(), null); m_selfTex = null; } if (m_enemyTex != null) { Ctx.m_instance.m_texMgr.unload(m_enemyTex.GetPath(), null); m_enemyTex = null; } if (m_effect != null) { m_effect.dispose(); m_effect = null; } }
/// <summary>加载完成</summary> /// <param name="res"></param> private void OnLoader_Complete(NormalRes res) { TextureRes imgRes = res as TextureRes; SkinManagerLoaderItem loaderItem = m_currentLoaders[0]; Transform target = loaderItem.target; E_SkinPart part = loaderItem.part; //GoalKeeper keeper = target.GetComponent<GoalKeeper>(); //if(null != keeper && ) m_currentLoaders.RemoveAt(0); if (m_currentLoaders.Count > 0) { ResourceManager.Instance.LoadTexture(m_currentLoaders[0].skinId, OnLoader_Complete, OnLoader_Error); } else { if (null != LoaderCompleteCallBack) { LoaderCompleteCallBack(); } inLoading = false; Clear(); } if (null != target) { SkinnedMeshRenderer render = target.GetComponent <SkinnedMeshRenderer>(); Material mat = render.material; mat.mainTexture = imgRes.m_texture; render.material = mat; } res = null; }
private void onABResLoaded(string evtId, object[] paras) { Res res = paras[0] as Res; if (res is WindowRes) { WindowRes wRes = res as WindowRes; ResCacheDic[ABType.Window][wRes.resName] = wRes; //----->可视化显示 //var older = windowResList.Find(a => a.resName == wRes.resName); //if (older != null) //{ // older = wRes; //} //else //{ // windowResList.Add(wRes); //} //TODO:用上述方法,不知道是什么原因导致的inspector面板上ResObj没有显示出来 var older = ABManagerMono.Instance.windowResList.Find(a => a.resName == wRes.resName); if (older != null) { ABManagerMono.Instance.windowResList.Remove(older); } ABManagerMono.Instance.windowResList.Add(wRes); GameObject obj = wRes.resObj as GameObject; fillMatTexHolder(obj); this.addDestroyNotice(obj); } else if (res is EffectRes) { EffectRes effRes = res as EffectRes; ResCacheDic[ABType.Effect][effRes.resName] = effRes; //可视化处理 var older = ABManagerMono.Instance.effectResList.Find(a => a.resName == effRes.resName); if (older != null) { ABManagerMono.Instance.effectResList.Remove(older); } ABManagerMono.Instance.effectResList.Add(effRes); GameObject obj = effRes.resObj as GameObject; fillMatTexHolder(obj); this.addDestroyNotice(obj); } else if (res is OtherPrefabRes) { OtherPrefabRes opRes = res as OtherPrefabRes; ResCacheDic[ABType.OtherPrefab][opRes.resName] = opRes; //可视化处理 var older = ABManagerMono.Instance.opResList.Find(a => a.resName == opRes.resName); if (older != null) { ABManagerMono.Instance.opResList.Remove(older); } ABManagerMono.Instance.opResList.Add(opRes); GameObject obj = opRes.resObj as GameObject; fillMatTexHolder(obj); this.addDestroyNotice(obj); } else if (res is SpriteRes) { SpriteRes sRes = res as SpriteRes; ABManagerMono.Instance.spriteResList.Add(sRes); ResCacheDic[ABType.Sprite][sRes.resName] = sRes; } else if (res is TextureRes) { TextureRes tRes = res as TextureRes; ABManagerMono.Instance.texResList.Add(tRes); ResCacheDic[ABType.Texture][tRes.resName] = tRes; } else if (res is AudioRes) { AudioRes aRes = res as AudioRes; ABManagerMono.Instance.audioResList.Add(aRes); ResCacheDic[ABType.Audio][aRes.resName] = aRes; } }