Code: Select all
init python:
class ClothingItem:
def __init__(self, name, tag, image, girly = 0,):
self.name = name
self.girly = girly
self.image = image
self.tag = tag
def check_valid_position(self, layer, position):
if self.layer == layer and self.position == position:
return True
else:
return False
class Wardrobe:
def __init__(self):
self.girly_index = 0
self.wearing = []
self.wardrobe = []
def add_clothes(self, clothes):
if clothes not in self.wardrobe:
self.wardrobe.append(clothes)
return
def remove_clothes(self, clothes):
if clothes in self.wardrobe:
self.wardrobe.remove(clothes)
return
def undress(self, clothes):
if clothes in self.wearing:
self.wearing.remove(clothes)
self.girly_index -= clothes.girly
return
def wear(self, clothes):
temp = self.wearing[:] # make copy of wearing list
for item in temp: # iterate over copy of wearing list
if item.tag == clothes.tag:
self.undress(item) # if same slot, then properly remove from wearing list
self.wearing.append(clothes)
self.girly_index += clothes.girly
return
def get_image_wearing(self, tag):
for item in self.wearing:
if item.tag == tag:
return item.image
def get_image_all(self, tag):
for item in self.wardrobe:
if item.tag == tag:
return item.image
def check_tag(wardrobe, tag):
# get all clothing items with a certain tag
clothes_with_tag = []
for item in wardrobe.wardrobe:
if item.tag == tag:
clothes_with_tag.append(item)
return clothes_with_tag
Code: Select all
screen underwear:
modal True
imagebutton:
xpos 10
ypos 0
auto "gui/relationship/game_button_variate_%s.png"
action ToggleScreen ("showstats")
vbox:
xalign 0.5
ypos 0.08
spacing 10
frame:
xsize 1000
ysize 720
$ x = 10 # coordinates of the top left item position
$ y = 10
for i, name in enumerate(wardrobe.check_tag("under bottom")):
$ x += 320
$ pic = "clothes/" + wardrobe.get_image_all("under bottom")
frame:
xalign 1.2
xpos x
ypos y
imagebutton:
idle pic
hover pic
action [
Show("wardrobe_button"),
SetVariable("wardrobe.wear", name),
Hide("underwear"),
Show("wardrobe")
]
$ i += 1
Code: Select all
$ pic = "clothes/" + wardrobe.get_image_all("under bottom")