Cggallery rpy

Coding and VN Engine > cggallery_rpy

CG Gallery init python: ##Variables cgpage = 1 lastcg = 0 cgthumb = [None]*16 ##array of pictures divided into tabs store.cggeneral = [ ("img/Day 1 The Beginning.png", "Day 1 The Beginning", 1), ("img/Day 2 The Beginning.png", "Day 2 The Beginning", 1) ]   store.cgcharacter = [ ("img/Momiji.png", "momiji normal", 1), ("img/Mokou.png", "mokou normal", 1), ("img/Letty.png", "letty normal", 1), ("img/Alice.png", "alice normal", 1) ]   store.cgbackground = [ ( "img/lake.png", "bg lake", 1) ]   cgcurrenttab = cggeneral ##array of tabs store.cgtabs = [ (cggeneral), (cgcharacter), (cgbackground) ]

## Subtracts from page count def add_cgpage: if store.cgpage < 10: store.cgpage = store.cgpage + 1 return ## Subtracts from page count def sub_cgpage: cgpage = store.cgpage if cgpage > 1: store.cgpage = cgpage - 1 return ##Image checker/locked unlocked def init_cgslots: store.lastcg = 0 store.cgthumb = [None] * 16 for i in range (0, len(store.cgcurrenttab)): if renpy.seen_image(store.cgcurrenttab[i][1]): if cgpage == store.cgcurrenttab[i][2]: store.cgthumb[store.lastcg] = store.cgcurrenttab[i][0] store.lastcg += 1 else: if cgpage == store.cgcurrenttab[i][2]: store.cgthumb[store.lastcg] ="img/lock.png" store.lastcg += 1 return ##Creates Cgslots def create_cgslots(a): if cgthumb[a] != None: ui.imagebutton(im.Grayscale(im.Scale(cgthumb[a], 80, 60)),                               im.Scale(cgthumb[a], 80, 60),                                clicked= lambda: cgclicked(a)                                ) else: ui.imagebutton(im.Grayscale(im.Scale("img/back1.png", 80, 60)),                               im.Scale("img/back1.png", 80, 60),                                clicked=None                                ) ##Image View def cgclicked(a): if cgthumb[a] != "img/lock.png": ui.imagebutton(Solid((0, 0, 0, 100)), Solid((0, 0, 0, 100)), clicked=ui.jumps('cggallery'), xfill=True, yfill=True) ui.frame(background=Solid((0, 0, 0, 255)),xpos=0.5,ypos=0.5,xanchor='center',yanchor='center') ui.image(cgthumb[a]) ui.interact(suppress_overlay=True, suppress_underlay=True, mouse='gamemenu') return ##Change Gallery def changetab(a): store.cgcurrenttab = cgtabs[a] store.cgpage = 1 return label cggallery: $ init_cgslots $ ui.image(ui_background) $ ui.image(ui_topborder,                 xpos=0,                  ypos=0                  ) $ ui.image(ui_botborder,                 xpos=0,                  ypos=500                  )
 * 1) Main body

##Main Window $ ui.frame(background=None, ypos=0.5, xpos=0.5, yanchor='center',xanchor='center') $ ui.hbox ##Grid Window $ ui.frame(background=Solid((0, 0, 50, 115))) $ ui.grid(4, 4, padding=12, transpose=False) $ for i in range(0, 16): create_cgslots(i) $ ui.close ##Spacer $ ui.null(width=10) ##Tabs $ ui.frame(background=Solid((0, 0, 50, 115)), yminimum= 286) $ ui.vbox(ypos=1.0, yanchor=1.0) $ ui.textbutton("General", clicked= lambda: (changetab(0), renpy.jump('cggallery')), xminimum=150) $ ui.textbutton("Characters", clicked= lambda: (changetab(1), renpy.jump('cggallery')), xminimum=150) $ ui.textbutton("Backgrounds", clicked= lambda: (changetab(2), renpy.jump('cggallery')), xminimum=150) ##Spacer $ ui.null(height=10) ##Navigation $ ui.hbox(xpos=0.5,xanchor='center') $ ui.imagebutton(ui_arrowleft1,                        ui_arrowleft2,                         clicked= lambda: (sub_cgpage, renpy.jump('cggallery'))                         ) $ ui.imagebutton(ui_arrowright1,                        ui_arrowright2,                                         clicked= lambda: (add_cgpage, renpy.jump('cggallery'))                         ) $ ui.close $ ui.close $ ui.close ##Return $ ui.imagebutton(ui_return1,                        ui_return2,                         clicked=ui.jumps("_return"),                         xanchor=0.5,                         xpos=0.5,                         ypos=0.78                         ) $ ui.interact(suppress_overlay=True, suppress_underlay=True, mouse='mainmenu')