def __init__(self): ShowBase.__init__(self) self.base = ShowBase DirectGuiGlobals.setDefaultFont( loader.loadFont(GameGlobals.InterfaceFont)) base.enableParticles() self.NEWintroButtons() #self.config = self.loadConfig() #self.debug = self.config["settings"]['want-debug-mode'] #print(self.debug) base.disableMouse() self.debug = True if self.debug: print("Debug mode enabled!") self.accept('f4', base.oobe) if __debug__: try: from src.debug.OTPInjectorDev import Injector self.injector = Injector() except ImportError: print("You don't have wxPython or psutil installed.") print("You need them to use the injector!") except: import traceback traceback.print_exc()
def __init__(self): ShowBase.__init__(self) # Increase the texture resolution on DirectGui default_font = DirectGuiGlobals.getDefaultFont() default_font.clear() default_font.setPixelsPerUnit(64) DirectGuiGlobals.setDefaultFont(default_font) self.accept("f1", sys.exit) self.win.setCloseRequestEvent("f1") self.background = OnscreenImage(parent=self.render2dp, image="art/menu_background.png") self.cam2dp.node().getDisplayRegion(0).setSort(-20) # Setup camera self.disableMouse() self.camera.setPos(0, -5, 2.25) self.camera.setHpr(0, -10, 0) self.camLens.setFov(65) # Setup saves self.save_dir = os.path.join(appdirs.user_data_dir('ThorGame', roaming=True), 'saves') if not os.path.exists(self.save_dir): os.makedirs(self.save_dir) self.saved_trainer_ids = [i.split('.')[0] for i in os.listdir(self.save_dir)] # Setup UI self.ui = CEFPanda() src_dir = _file_dir template_folder = os.path.join(src_dir, 'ui') self.ui_env = Environment(loader=FileSystemLoader(template_folder), trim_blocks=True) # HACK - CEFPython requires a regular LoadURL before LoadString works, # so we just give it something to work on. This doesn't render nicely, # but we replace it immediately with the UI for the first GameState. # CEFPython issue: https://code.google.com/p/chromiumembedded/issues/detail?id=763 self.ui.load('ui/base.html') # Load monster data data_folder = os.path.join(src_dir, 'data') self.monster_data = [] for i in os.listdir(data_folder): if i.startswith('race'): with open(os.path.join(data_folder, i)) as f: self.monster_data.append(json.load(f)) # Setup the default player and monster self.player = Trainer(dont_save=True) self.player.monster = Monster.new_from_race("ogre") # Setup game states self.game_state = TitleState(self) self.taskMgr.add(self.main_loop, "MainLoop")
def draw_set_font(font_name=None, font_size=None): if font_name is not None: fonts = DRAW_DATA.get("fonts") fonts.update({"_active": font_name}) if font_size is not None: fonts.update({"_size": font_size}) font = draw_get_font() DGG.setDefaultFont(font[0]) return font
def __init__(self): ShowBase.__init__(self) DirectGuiGlobals.setDefaultFont( loader.loadFont(GameGlobals.InterfaceFont)) self.accept('f4', base.oobe) if __debug__: try: from src.debug.OTPInjectorDev import Injector self.injector = Injector() except ImportError: print("You don't have wxPython or psutil installed.") print("You need them to use the injector!") except: import traceback traceback.print_exc() self.dia = Dialogue.Dialogue(ShowBase) self.dia.load()
from src.coginvasion.globals import CIGlobals CIGlobals.SettingsMgr = sm sm.loadFile(jsonFile) sm.doSunriseFor(sunrise=SHOWBASE_PREINIT) from src.mod.ModBase import ModBase base = ModBase() sm.doSunriseFor(sunrise=SHOWBASE_POSTINIT) ConfigVariableDouble('decompressor-step-time').setValue(0.01) ConfigVariableDouble('extractor-step-time').setValue(0.01) from direct.gui import DirectGuiGlobals DirectGuiGlobals.setDefaultFontFunc(CIGlobals.getToonFont) DirectGuiGlobals.setDefaultFont(CIGlobals.getToonFont()) DirectGuiGlobals.setDefaultRolloverSound( loader.loadSfx("phase_3/audio/sfx/GUI_rollover.ogg")) DirectGuiGlobals.setDefaultClickSound( loader.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.ogg")) DirectGuiGlobals.setDefaultDialogGeom( loader.loadModel("phase_3/models/gui/dialog_box_gui.bam")) from src.coginvasion.nametag import NametagGlobals NametagGlobals.setMe(base.cam) NametagGlobals.setCardModel('phase_3/models/props/panel.bam') NametagGlobals.setArrowModel('phase_3/models/props/arrow.bam') NametagGlobals.setChatBalloon3dModel('phase_3/models/props/chatbox.bam') NametagGlobals.setChatBalloon2dModel( 'phase_3/models/props/chatbox_noarrow.bam') NametagGlobals.setThoughtBalloonModel(
base.transitions.FadeModelName = "phase_3/models/misc/fade.bam" base.setFrameRateMeter(False) base.accept("f9", base.screenshot, ["screenshots/screenshot"]) from direct.filter.CommonFilters import CommonFilters print "CIStart: Setting display preferences..." sm.applySettings(jsonfile) if base.win == None: print "CIStart: Unable to open window; aborting." sys.exit() else: print "CIStart: Successfully opened window." ConfigVariableDouble("decompressor-step-time").setValue(0.01) ConfigVariableDouble("extractor-step-time").setValue(0.01) DirectGuiGlobals.setDefaultFontFunc(CIGlobals.getToonFont) DirectGuiGlobals.setDefaultFont(CIGlobals.getToonFont()) DirectGuiGlobals.setDefaultRolloverSound(loader.loadSfx("phase_3/audio/sfx/GUI_rollover.mp3")) DirectGuiGlobals.setDefaultClickSound(loader.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.mp3")) DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel("phase_3/models/gui/dialog_box_gui.bam")) def maybeDoSomethingWithMusic(condition): width, height, fs, music, sfx, tex_detail, model_detail, aa, af = sm.getSettings(jsonfile) if condition == 0: if music == True: base.enableMusic(False) elif condition == 1: if music == True: base.enableMusic(True)