예제 #1
0
    void BillboardCreator()
    {
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("BillBoard Prefab Name", EditorStyles.boldLabel);
        T4MCache.PrefabName = GUILayout.TextField(T4MCache.PrefabName, 25, GUILayout.Width(155));
        GUILayout.EndHorizontal();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        CreationBB = (CreaType)EditorGUILayout.EnumPopup("New Billboard Type", CreationBB, GUILayout.Width(340));

        if (CreationBB == CreaType.Custom)
        {
            GUILayout.Label("Billboard Meshes", EditorStyles.boldLabel);
            BillMesh = (Mesh)EditorGUILayout.ObjectField("Mesh", BillMesh, typeof(Mesh), false);
        }
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        GUILayout.BeginHorizontal();

        GUILayout.Label("BillBoard Setup", EditorStyles.boldLabel, GUILayout.Width(223));
        GUILayout.Label("MainTex", EditorStyles.boldLabel, GUILayout.Width(68));
        GUILayout.Label("Bump", EditorStyles.boldLabel, GUILayout.Width(60));
        GUILayout.EndHorizontal();
        EditorGUILayout.Space();
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();
        GUILayout.BeginHorizontal();
        GUILayout.Label("BillBoard Shader", GUILayout.Width(103));
        T4MCache.ShaderLOD1S = (LODShaderStatus)EditorGUILayout.EnumPopup(T4MCache.ShaderLOD1S, GUILayout.Width(95));
        GUILayout.EndHorizontal();
        EditorGUILayout.Space();
        if (T4MCache.ShaderLOD1S == LODShaderStatus.New)
        {
            T4MCache.LOD1S = (Shader)EditorGUILayout.ObjectField(T4MCache.LOD1S, typeof(Shader), true, GUILayout.MaxWidth(220));
        }
        else
        {
            T4MCache.LOD1Material = (Material)EditorGUILayout.ObjectField(T4MCache.LOD1Material, typeof(Material), false, GUILayout.MaxWidth(220));
        }
        GUILayout.EndVertical();
        if (T4MCache.LOD1S)
        {
            T4MCache.LOD1Material = new Material(Shader.Find(T4MCache.LOD1S.name));
        }

        if (T4MCache.LOD1Material && T4MCache.LOD1Material.HasProperty("_MainTex"))
        {
            if (T4MCache.LOD1Material.GetTexture("_MainTex"))
            {
                T4MCache.LOD1T = T4MCache.LOD1Material.GetTexture("_MainTex");
            }
            T4MCache.LOD1T = EditorGUILayout.ObjectField(T4MCache.LOD1T, typeof(Texture), false, GUILayout.Width(60), GUILayout.Height(60)) as Texture;
            if (T4MCache.LOD1Material && T4MCache.LOD1Material.HasProperty("_BumpMap"))
            {
                if (T4MCache.LOD1Material.GetTexture("_BumpMap"))
                {
                    T4MCache.LOD1B = T4MCache.LOD1Material.GetTexture("_BumpMap");
                }
                T4MCache.LOD1B = EditorGUILayout.ObjectField(T4MCache.LOD1B, typeof(Texture), false, GUILayout.Width(60), GUILayout.Height(60)) as Texture;
            }
        }

        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("CONSTRUCT", GUILayout.Width(100), GUILayout.Height(30)))
        {
            if (T4MCache.PrefabName != "" && T4MCache.LOD1Material)
            {
                CreatePrefabBB();
            }
            else
            {
                EditorUtility.DisplayDialog("T4M Message", "You must complete the formulary before make the construct", "OK");
            }
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
    }
	void BillboardCreator(){
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		
		GUILayout.BeginHorizontal("box");
			GUILayout.Label("BillBoard Prefab Name", EditorStyles.boldLabel);
				PrefabName=GUILayout.TextField (PrefabName, 25, GUILayout.Width(155));
		GUILayout.EndHorizontal();
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		CreationBB =(CreaType) EditorGUILayout.EnumPopup ("New Billboard Type", CreationBB, GUILayout.Width(340));
		
		if (CreationBB == CreaType.Custom){
			GUILayout.Label("Billboard Meshes", EditorStyles.boldLabel);
			BillMesh= (Mesh)EditorGUILayout.ObjectField("Mesh",  BillMesh, typeof(Mesh),false);
		}
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		GUILayout.BeginHorizontal();
		
			GUILayout.Label("BillBoard Setup", EditorStyles.boldLabel, GUILayout.Width(223));
			GUILayout.Label("MainTex", EditorStyles.boldLabel, GUILayout.Width(68));
			GUILayout.Label("Bump", EditorStyles.boldLabel, GUILayout.Width(60));
		GUILayout.EndHorizontal();
		EditorGUILayout.Space();
		GUILayout.BeginHorizontal();
			GUILayout.BeginVertical();
			GUILayout.BeginHorizontal();
				GUILayout.Label("BillBoard Shader", GUILayout.Width(103));
				ShaderLOD1S =(LODShaderStatus) EditorGUILayout.EnumPopup (ShaderLOD1S, GUILayout.Width(95));
			GUILayout.EndHorizontal();
		EditorGUILayout.Space();
				if (ShaderLOD1S == LODShaderStatus.New)
					LOD1S= (Shader)EditorGUILayout.ObjectField(LOD1S, typeof(Shader),true, GUILayout.MaxWidth(220));
				else LOD1Material= (Material)EditorGUILayout.ObjectField(LOD1Material, typeof(Material),false, GUILayout.MaxWidth(220));
			GUILayout.EndVertical();
				if (LOD1S)
					LOD1Material =  new Material (Shader.Find (LOD1S.name));
				
					if (LOD1Material && LOD1Material.HasProperty("_MainTex")){
						if (LOD1Material.GetTexture("_MainTex"))
							LOD1T = LOD1Material.GetTexture("_MainTex");
						LOD1T=EditorGUILayout.ObjectField(LOD1T, typeof(Texture),false, GUILayout.Width(60), GUILayout.Height(60)) as Texture;
						if (LOD1Material && LOD1Material.HasProperty("_BumpMap")){
							if (LOD1Material.GetTexture("_BumpMap"))
								LOD1B = LOD1Material.GetTexture("_BumpMap");
							LOD1B=EditorGUILayout.ObjectField(LOD1B, typeof(Texture),false, GUILayout.Width(60), GUILayout.Height(60)) as Texture;
						}
					} 
				
				GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
		GUILayout.FlexibleSpace();
			GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
					if (GUILayout.Button("CONSTRUCT", GUILayout.Width(100), GUILayout.Height(30))) {
						if (PrefabName != "" &&  LOD1Material)
							CreatePrefabBB();
						else  EditorUtility.DisplayDialog("T4M Message", "You must complete the formulary before make the construct", "OK");
					}
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
				GUILayout.FlexibleSpace();
		
	}