示例#1
0
        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;
        }
示例#2
0
//		public void SetTexture2D* texture(T inThing) {Texture2D_Ross texture = inThing;}/@property(readwrite,assign) Texture2D*	texture;


        public void initAtlasWithString(World inWorld, bool canScale, int inGridSizeX, int inGridSizeY, List <int> inGridArray, string inName, Texture2D_RossPixelFormat forceType
                                        )
        {
            this.initAtlasWithString_IsDropbox(inWorld, canScale, inGridSizeX, inGridSizeY, inGridArray, inName, forceType, false, -1);
        }