예제 #1
0
    private void initialize()
    {
        buildingGroup = new List <GameObject>();

        for (int i = 0; i < ParentTransform.childCount; i++)
        {
            buildingGroup.Add(ParentTransform.GetChild(i).gameObject);
        }

        // Load Color Data
        currentMaterialColorSerializer = loadColorData();

        // Load Prefab Data
        currentPrefabInterchangable = loadPrefabInterchangableData();
    }
예제 #2
0
    // Update is called once per frame
    void OnGUI()
    {
        tempMaterial = (Material)EditorGUILayout.ObjectField(tempMaterial, typeof(Material), true);
        gameObject   = (GameObject)EditorGUILayout.ObjectField(gameObject, typeof(GameObject), true);


        if (GUILayout.Button("Get All Materials From GameObject"))
        {
            if (gameObject != null)
            {
                foreach (Material material in getMaterialsGameObject(gameObject))
                {
                    currentMaterialColorSerializer.materialColorList.Add(
                        new MaterialColor(material));
                }
            }
        }

        if (GUILayout.Button("Add New Material Color Set"))
        {
            currentMaterialColorSerializer.materialColorList.Add(
                new MaterialColor(tempMaterial));
        }

        if (GUILayout.Button("Create A New Material Color Set"))
        {
            tempMaterialColor = new MaterialColor();
            currentMaterialColorSerializer.materialColorList.Add(
                tempMaterialColor);
        }

        if (GUILayout.Button("Save All"))
        {
            Save(Path.Combine(Application.dataPath, "MaterialColorInfo.xml"));
        }

        if (GUILayout.Button("Clear"))
        {
            // Save(defaultPath);
            tempMaterial = null;
        }

        if (GUILayout.Button("Load All"))
        {
            currentMaterialColorSerializer = Load(Path.Combine(Application.dataPath, "MaterialColorInfo.xml"));
        }

        if (currentMaterialColorSerializer.materialColorList != null)
        {
            foreach (MaterialColor mc in currentMaterialColorSerializer.materialColorList)
            {
                EditorGUILayout.BeginHorizontal();
                mc.materialName = EditorGUILayout.TextField(mc.materialName);
                // EditorGUILayout.TextField(mc.property_1_Name + " " + mc.property_1_Value);
                mc.property_2_Value = EditorGUILayout.ColorField(mc.property_2_Name, mc.property_2_Value);
                mc.property_3_Value = EditorGUILayout.ColorField(mc.property_3_Name, mc.property_3_Value);
                // EditorGUILayout.ColorField(mc.property_4_Name, mc.property_4_Value);
                EditorGUILayout.EndHorizontal();
            }
        }
    }
예제 #3
0
 void Awake()
 {
     currentMaterialColorSerializer = new MaterialColorContainer();
 }