public static void SetTextureMonsterParts(ref PicturebookItem.TextureData textureData, string resourcePath, string assetBundlePath) { Texture2D texture2D = Resources.Load(resourcePath) as Texture2D; Texture2D texture2D2 = Resources.Load(resourcePath + "_alpha") as Texture2D; string path = assetBundlePath + "_alpha"; if (texture2D == null && texture2D2 == null) { Texture2D texture2D3 = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePath, null) as Texture2D; Texture2D monsterAlphaTexture = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(path, null) as Texture2D; if (null != texture2D3) { textureData._monsterTexture = texture2D3; textureData._isMainTexture = true; } if (null != texture2D3) { textureData._monsterAlphaTexture = monsterAlphaTexture; } } else { textureData._monsterTexture = texture2D; textureData._monsterAlphaTexture = texture2D2; textureData._isMainTexture = false; } }
public static void MakeAllMonsterTex(CMD_Picturebook cmd, int allMonsterCount) { for (int i = 0; i < allMonsterCount; i++) { PicturebookMonster monsterData = cmd.GetMonsterData(i); if (monsterData == null) { break; } string iconId = monsterData.monsterMaster.Simple.iconId; string monsterIconPathByIconId = GUIMonsterIcon.GetMonsterIconPathByIconId(iconId); string resourcePath = GUIMonsterIcon.InternalGetMonsterIconPathByIconId(iconId); PicturebookItem.TextureData textureData = new PicturebookItem.TextureData(); textureData._monsterTexture = new Texture2D(PicturebookItem.ICON_TEXTURE_CX, PicturebookItem.ICON_TEXTURE_CY); textureData._monsterAlphaTexture = new Texture2D(PicturebookItem.ICON_TEXTURE_CX, PicturebookItem.ICON_TEXTURE_CY); PicturebookMonsterIcon.SetTextureMonsterParts(ref textureData, resourcePath, monsterIconPathByIconId); PicturebookItem._monsterTextureDataList.Add(textureData); } }
public void SetMonsterIcon(PicturebookItem.TextureData textureData, string growStep, bool isUnknown) { if (null == this.txCHAR.material) { Shader iconShader = GUIMonsterIcon.GetIconShader(); this.txCHAR.material = new Material(iconShader); } if (!textureData._isMainTexture) { this.txCHAR.material.SetTexture("_MaskTex", textureData._monsterAlphaTexture); this.txCHAR.material.SetTexture("_MainTex", textureData._monsterTexture); } else { NGUIUtil.ChangeUITexture(this.txCHAR, textureData._monsterTexture, false); this.txCHAR.material.SetTexture("_MaskTex", Texture2D.whiteTexture); } int growStep2 = int.Parse(growStep); PicturebookMonsterIcon.SetThumbnailFrame(this.spBASE, this.spFRAME, growStep2); this.ngTX_IS_UNKOWN.gameObject.SetActive(isUnknown); MonsterIconGrayout.SetGrayout(base.gameObject, (!isUnknown) ? GUIMonsterIcon.DIMM_LEVEL.ACTIVE : GUIMonsterIcon.DIMM_LEVEL.DISABLE); }