예제 #1
0
    public static void DrawBlockEditor(Block block, BlockSet blockSet)
    {
        GUILayout.BeginVertical(GUI.skin.box);
        {
            string name = EditorGUILayout.TextField("Name", block.GetName());
            block.SetName(FixNameString(name));

            int atlas = EditorGUIUtils.Popup("Atlas", block.GetAtlasID(), blockSet.GetAtlases());
            block.SetAtlasID(atlas);

            int light = EditorGUILayout.IntField("Light", block.GetLight());
            block.SetLight(light);
        }
        GUILayout.EndVertical();

        Texture texture = block.GetTexture();

        if (texture != null)
        {
            FieldInfo field = DrawFacesList(block, texture);
            int       face  = (int)field.GetValue(block);
            DrawFaceEditor(ref face, block.GetAtlas(), ref atlasMatrix);
            field.SetValue(block, face);
        }
    }
예제 #2
0
    public static void DrawBlockEditor(OCBlock block, OCBlockSet blockSet)
    {
        GUILayout.BeginVertical(GUI.skin.box);
        {
            string name = EditorGUILayout.TextField("Name", block.GetName());
            block.SetName(FixNameString(name));

            if (block is OCGlassBlock)
            {
                OCGlassBlock glass    = (OCGlassBlock)block;
                GameObject   interior = (GameObject)EditorGUILayout.ObjectField("Interior", glass.GetInterior(), typeof(GameObject), true, null);
                glass.SetInterior(interior);
            }

            int atlas = EditorGUIUtils.Popup("Atlas", block.AtlasID, blockSet.Atlases);
            block.AtlasID = atlas;

            int light = EditorGUILayout.IntField("Light", block.GetLight());
            block.SetLight(light);
        }
        GUILayout.EndVertical();

        Texture texture = block.GetTexture();

        if (texture != null)
        {
            FieldInfo field = DrawFacesList(block, texture);
            int       face  = (int)field.GetValue(block);
            DrawFaceEditor(ref face, block.Atlas, ref atlasMatrix);
            field.SetValue(block, face);
        }
    }