public void initAtlasWithString_IsDropbox(World inWorld, bool canScale, int inGridSizeX, int inGridSizeY, List <int> inGridArray, string inName, Texture2D_RossPixelFormat forceType , bool isDropbox, int tempFileId) { //if (!base.init()) return null; myWorld = inWorld; gridSize = (short)inGridSizeX; halfGridSize = (float)inGridSizeX / 2.0f; //Globals.Assert (myMaterial == null); lastUsedSubTexture = -1; // if (inWorld == null) { // myMaterial = new UnityEngine.Material(Shader.Find( "Transparent/Diffuse" )); if (forceType == Texture2D_RossPixelFormat.t_RGB565) { // myMaterial = new UnityEngine.Material(Shader.Find( "Diffuse" )); // myMaterial = new UnityEngine.Material(Shader.Find( "Mobile/Unlit (Supports Lightmap)" )); //myMaterial = new UnityEngine.Material(Shader.Find( "Custom/SimpleOpaque" )); myMaterial = new UnityEngine.Material(Shader.Find("Pi/OpaqueOverlay")); // myMaterial = new UnityEngine.Material(Shader.Find( "Pi/TransparentOverlay" )); //beacuse of bridge sprite and render order } else { // myMaterial = new UnityEngine.Material(Shader.Find( "Unlit/Transparent" )); // myMaterial = new UnityEngine.Material(Shader.Find( "Transparent/VertexLit" )); // myMaterial = new UnityEngine.Material(Shader.Find( "Custom/SimpleAlpha" )); myMaterial = new UnityEngine.Material(Shader.Find("Pi/TransparentOverlay")); // myMaterial = new UnityEngine.Material(Shader.Find( "Pi/TransparentNoAlpha" )); } myMaterialAdditive = new UnityEngine.Material(Shader.Find("Pi/Additive")); myMaterialTransparent = new UnityEngine.Material(Shader.Find("Pi/TransparentOverlay")); string tempString; tempString = Default.Namespace.Globals.g_main.GetFolderPrefixForTextureResolution() + System.IO.Path.GetFileNameWithoutExtension(inName) + Default.Namespace.Globals.g_main.GetSuffixForTextureResolution(); Debug.Log("InitAtlas with : " + tempString); // texture = Resources.Load(tempString, typeof(Texture2D)) as Texture2D; UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a = 1.0f; tempC.r = 1.0f; tempC.g = 1.0f; tempC.b = 1.0f; myMaterial.color = tempC; // Texture tempTexture = Resources.Load(tempString, typeof(Texture2D)) as Texture; bool doingADCThing = false; if (false) //(Constants.ANDROID_25) && (Globals.g_main.loadADCQueue.state == LoadADCQueue.State.kStateBuildingUpAssetList)) { doingADCThing = true; LoadADCQueue.AssetInfo assetInfo = new LoadADCQueue.AssetInfo(); assetInfo.assetType = LoadADCQueue.AssetType.kAtlas; assetInfo.assetId = myId; assetInfo.name = inName; // Default.Namespace.Globals.g_main.loadADCQueue.AddAssetToList(assetInfo); } else { if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { if (Constants.ANDROID_25) { //loading something not using the list thing... // Globals.Assert(false); } } myMaterial.mainTexture = Resources.Load(tempString, typeof(Texture2D)) as Texture; } if (!doingADCThing) { myMaterialAdditive.mainTexture = myMaterial.mainTexture; myMaterialTransparent.mainTexture = myMaterial.mainTexture; Globals.Assert(myMaterial.mainTexture != null); } //myMaterial.shader = Shader.Find( "Transparent/Diffuse" ); // texture // Globals.Assert(texture != null); // texture = new Texture2D_Ross(true, inName, false);/ // } // else { // if (isDropbox) { // } // else { // texture = myWorld.LoadTextureP1P2(canScale, inName, forceType); // } //} if (inGridArray == null) { this.SetupAtlasP1(inGridSizeX, inGridSizeY, doingADCThing); } else { this.SetupAtlasWithGridArray(inGridArray); } //return this; }
public Texture2D_Ross(bool canScale, string nameString, bool withTransparency, int assetId, LoadADCQueue.AssetType inType) { if (!withTransparency) { myMaterial = new UnityEngine.Material(Shader.Find("Pi/OpaqueOverlay")); } else { myMaterial = new UnityEngine.Material(Shader.Find("Pi/TransparentOverlay")); } string tempString; tempString = Default.Namespace.Globals.g_main.GetFolderPrefixForTextureResolution() + System.IO.Path.GetFileNameWithoutExtension(nameString) + Default.Namespace.Globals.g_main.GetSuffixForTextureResolution(); Debug.Log("InitTexture2D with : " + tempString); UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a = 1.0f; tempC.r = 1.0f; tempC.g = 1.0f; tempC.b = 1.0f; myMaterial.color = tempC; // Texture tempTexture = Resources.Load(tempString, typeof(Texture2D)) as Texture; if (false) //(Constants.ANDROID_25) && (Globals.g_main.loadADCQueue.state == LoadADCQueue.State.kStateBuildingUpAssetList)) { LoadADCQueue.AssetInfo assetInfo = new LoadADCQueue.AssetInfo(); assetInfo.assetType = inType; assetInfo.assetId = assetId; assetInfo.name = nameString; // Default.Namespace.Globals.g_main.loadADCQueue.AddAssetToList(assetInfo); } else { if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { if (Constants.ANDROID_25) { //loading something not using the list thing... // Globals.Assert(false); } } myMaterial.mainTexture = Resources.Load(tempString, typeof(Texture2D)) as Texture; Globals.Assert(myMaterial.mainTexture != null); pixelsWide = (int)myMaterial.mainTexture.width; pixelsHigh = (int)myMaterial.mainTexture.height; Debug.Log("Texture loaded " + myMaterial.mainTexture.ToString() + " w:" + pixelsWide.ToString() + " h:" + pixelsHigh.ToString()); } /* myBillboard = new Billboard("texture_" + nameString); * myBillboard.LoadAndSetMaterial(nameString,withTransparency); * myBillboard.rotationScale = 0.5f * Utilities.GetDistanceP1(Utilities.CGPointMake(0, 0), Utilities.CGPointMake(myBillboard.height,myBillboard.width)); * * float thing = myBillboard.height / myBillboard.width; * myBillboard.rotationAngle1 = Constants.HALF_PI - (float)Math.Atan(thing); * myBillboard.rotationAngle2 = Constants.PI_ - (myBillboard.rotationAngle1 * 2.0f); */ }