Пример #1
0
func MakeWallPanel(room *roomDef, viewer *RoomViewer) *WallPanel {
	var wp WallPanel
	wp.room = room
	wp.viewer = viewer
	wp.VerticalTable = gui.MakeVerticalTable()
	wp.selected_walls = make(map[int]bool)

	tex_table := gui.MakeVerticalTable()
	fnames := GetAllWallTextureNames()
	for i := range fnames {
		name := fnames[i]
		tex_table.AddChild(gui.MakeButton("standard", name, 300, 1, 1, 1, 1, func(t int64) {
			wt := MakeWallTexture(name)
			if wt == nil {
				return
			}
			wp.wall_texture = wt
			wp.wall_texture.temporary = true
			wp.room.WallTextures = append(wp.room.WallTextures, wp.wall_texture)
			wp.drag_anchor.X = 0
			wp.drag_anchor.Y = 0
		}))
	}
	wp.VerticalTable.AddChild(gui.MakeScrollFrame(tex_table, 300, 700))

	return &wp
}
Пример #2
0
func makeFurniturePanel(room *roomDef, viewer *RoomViewer) *FurniturePanel {
	var fp FurniturePanel
	fp.Room = room
	fp.RoomViewer = viewer
	fp.key_map = base.GetDefaultKeyMap()
	if room.Name == "" {
		room.Name = "name"
	}
	fp.name = gui.MakeTextEditLine("standard", room.Name, 300, 1, 1, 1, 1)

	if room.Floor.Path == "" {
		room.Floor.Path = base.Path(datadir)
	}
	fp.floor_path = gui.MakeFileWidget(room.Floor.Path.String(), imagePathFilter)

	if room.Wall.Path == "" {
		room.Wall.Path = base.Path(datadir)
	}
	fp.wall_path = gui.MakeFileWidget(room.Wall.Path.String(), imagePathFilter)

	var args []string
	algorithm.Map2(tags.RoomSizes, &args, func(a RoomSize) string { return a.String() })
	fp.room_size = gui.MakeComboTextBox(args, 300)
	for i := range tags.RoomSizes {
		if tags.RoomSizes[i].String() == room.Size.String() {
			fp.room_size.SetSelectedIndex(i)
			break
		}
	}
	fp.VerticalTable = gui.MakeVerticalTable()
	fp.VerticalTable.Params().Spacing = 3
	fp.VerticalTable.Params().Background.R = 0.3
	fp.VerticalTable.Params().Background.B = 1
	fp.VerticalTable.AddChild(fp.name)
	fp.VerticalTable.AddChild(fp.floor_path)
	fp.VerticalTable.AddChild(fp.wall_path)
	fp.VerticalTable.AddChild(fp.room_size)

	furn_table := gui.MakeVerticalTable()
	fnames := GetAllFurnitureNames()
	for i := range fnames {
		name := fnames[i]
		furn_table.AddChild(gui.MakeButton("standard", name, 300, 1, 1, 1, 1, func(t int64) {
			f := MakeFurniture(name)
			if f == nil {
				return
			}
			fp.furniture = f
			fp.furniture.temporary = true
			fp.Room.Furniture = append(fp.Room.Furniture, fp.furniture)
			dx, dy := fp.furniture.Dims()
			fp.drag_anchor.x = float32(dx) / 2
			fp.drag_anchor.y = float32(dy) / 2
		}))
	}
	fp.VerticalTable.AddChild(gui.MakeScrollFrame(furn_table, 300, 600))

	return &fp
}
Пример #3
0
func makeHouseRelicsTab(house *HouseDef, viewer *HouseViewer) *houseRelicsTab {
	var hdt houseRelicsTab
	hdt.VerticalTable = gui.MakeVerticalTable()
	hdt.house = house
	hdt.viewer = viewer

	hdt.VerticalTable.AddChild(gui.MakeTextLine("standard", "Spawns", 300, 1, 1, 1, 1))
	hdt.spawn_name = gui.MakeTextEditLine("standard", "", 300, 1, 1, 1, 1)
	hdt.VerticalTable.AddChild(hdt.spawn_name)

	hdt.make_spawn = gui.MakeButton("standard", "New Spawn Point", 300, 1, 1, 1, 1, func(int64) {
		hdt.newSpawn()
	})
	hdt.VerticalTable.AddChild(hdt.make_spawn)

	return &hdt
}
Пример #4
0
func makeHouseDataTab(house *HouseDef, viewer *HouseViewer) *houseDataTab {
	var hdt houseDataTab
	hdt.VerticalTable = gui.MakeVerticalTable()
	hdt.house = house
	hdt.viewer = viewer

	hdt.name = gui.MakeTextEditLine("standard", "name", 300, 1, 1, 1, 1)
	num_floors_options := []string{"1 Floor", "2 Floors", "3 Floors", "4 Floors"}
	hdt.num_floors = gui.MakeComboTextBox(num_floors_options, 300)
	if hdt.house.Icon.Path == "" {
		hdt.house.Icon.Path = base.Path(filepath.Join(datadir, "houses", "icons"))
	}
	hdt.icon = gui.MakeFileWidget(string(hdt.house.Icon.Path), imagePathFilter)

	hdt.VerticalTable.AddChild(hdt.name)
	hdt.VerticalTable.AddChild(hdt.num_floors)
	hdt.VerticalTable.AddChild(hdt.icon)

	names := GetAllRoomNames()
	room_buttons := gui.MakeVerticalTable()
	for _, name := range names {
		n := name
		room_buttons.AddChild(gui.MakeButton("standard", name, 300, 1, 1, 1, 1, func(int64) {
			if hdt.temp_room != nil {
				return
			}
			hdt.temp_room = &Room{Defname: n}
			base.GetObject("rooms", hdt.temp_room)
			hdt.temp_room.temporary = true
			hdt.temp_room.invalid = true
			hdt.house.Floors[0].Rooms = append(hdt.house.Floors[0].Rooms, hdt.temp_room)
			hdt.drag_anchor.x = float32(hdt.temp_room.Size.Dx / 2)
			hdt.drag_anchor.y = float32(hdt.temp_room.Size.Dy / 2)
		}))
	}
	scroller := gui.MakeScrollFrame(room_buttons, 300, 700)
	hdt.VerticalTable.AddChild(scroller)
	return &hdt
}
Пример #5
0
func makeHouseDoorTab(house *HouseDef, viewer *HouseViewer) *houseDoorTab {
	var hdt houseDoorTab
	hdt.VerticalTable = gui.MakeVerticalTable()
	hdt.house = house
	hdt.viewer = viewer

	names := GetAllDoorNames()
	door_buttons := gui.MakeVerticalTable()
	for _, name := range names {
		n := name
		door_buttons.AddChild(gui.MakeButton("standard", name, 300, 1, 1, 1, 1, func(int64) {
			if len(hdt.house.Floors[0].Rooms) < 2 || hdt.temp_door != nil {
				return
			}
			hdt.temp_door = MakeDoor(n)
			hdt.temp_door.temporary = true
			hdt.temp_door.invalid = true
			hdt.temp_room = hdt.house.Floors[0].Rooms[0]
		}))
	}
	scroller := gui.MakeScrollFrame(door_buttons, 300, 700)
	hdt.VerticalTable.AddChild(scroller)
	return &hdt
}