示例#1
0
    def __init__(self):
        '''
        Constructor
        '''
        style = base.getStyle()
        
        SogalForm.__init__(self, fading = True, fading_duration = 0.5, enableMask = True, backgroundColor = style['color']['bg'], sort = 103)
        
        self._style = style
        
        self._cards = {}
        self._graphics = self.ConfigCard(parent = self)
        self._cards['graphics'] = (self._graphics)   #0, graphics
        
        #TODO: 重写ConfigLabel(一个OnscreenText 和一个控件 一行 ) 实现键盘支持

        #resolution = DirectOptionMenu(text="options", scale=0.1,items=["item1","item2","item3"],initialitem=2,
        
        resolution_options = OptionMenu(items = ["Unchanged", "1280x720","1920x1080",'1024x768'],itemcontent = [None,(1280,720),(1920,1080),(1024,768)])
        self._resolution = OptionLabel(self, text = 'Resolution', controlNP = resolution_options)
        self.appendConfigLabel('graphics', self._resolution)   #sresolution
        
        
        fullscreen = CheckBox()
        self._fullscreen = OptionLabel(self, text = 'Full Screen', controlNP = fullscreen)
        self.appendConfigLabel('graphics', self._fullscreen)
        
        self.refreshSettings()
示例#2
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self, fading = True, fading_duration = 0.3, enableMask = True,backgroundColor = (0,0,0,0.6))
        self.reparentTo(aspect2d,sort = 101)
        

        self.frame = DirectScrolledFrame(parent = self, canvasSize = CANVASSIZE, 
                                         frameSize = FRAMESIZE, 
                                         autoHideScrollBars = AUTO_HIDE_SCROLLBARS,
                                         )
        
        self.reloadTheme()
        
        self.height = TOP
        self.shiftedHeight = 0
        self.shifter = NodePath('text_history_shifter')
        self.shifter.reparentTo(self.frame.getCanvas())
        
        if not prop_set_up:
            nameprops = TextProperties()  # @UndefinedVariable
            nameprops.setTextScale(0.75)
            TextPropertiesManager.getGlobalPtr().setProperties("th_name", nameprops)  # @UndefinedVariable
 
        self.labels = []
示例#3
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self, fading = True, fading_duration = 0.5, enableMask = True,backgroundColor= color_themes.ilia_bgColor)
        self.reparentTo(aspect2d,sort = 102)
        self.frame = DirectScrolledFrame(parent = self, canvasSize = SAVE_CANVAS_SIZE, 
                                         frameSize = FRAMESIZE, 
                                         autoHideScrollBars = AUTO_HIDE_SCROLLBARS,
                                         **color_themes.ilia_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent = self.frame.getCanvas(), margin = vspacing)
        hbox = None
        self.__dumped = None
        for i in range(1,MAX_SAVE + 1):
            fname = 'save' + str(i)
            head = str(i)
            label = SaveLoadLabel(command = self.save, always_enable = True, fileName = fname, head = head,extraArgs = [fname],style = color_themes.ilia_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin = hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
示例#4
0
 def open(self):
     '''Called by SogalBase. Do something and show, you will need it if you want a more complex main menu'''
     self.fadinglock.acquire()
     
     if not self.closed:
         return
     SogalForm.show(self)
     self.addButtons()
     self.closed = False
示例#5
0
    def open(self):
        '''Called by SogalBase. Do something and show, you will need it if you want a more complex main menu'''
        self.fadinglock.acquire()

        if not self.closed:
            return
        SogalForm.show(self)
        self.addButtons()
        self.closed = False
示例#6
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=0.5,
                           enableMask=True,
                           backgroundColor=color_themes.sirius_bgColor)
        self.reparentTo(aspect2d, sort=102)

        self.frame = DirectScrolledFrame(
            parent=self,
            canvasSize=LOAD_CANVAS_SIZE,
            frameSize=FRAMESIZE,
            autoHideScrollBars=AUTO_HIDE_SCROLLBARS,
            **color_themes.sirius_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent=self.frame.getCanvas(), margin=vspacing)

        hbox = None
        self.__dumped = None

        pos2 = MAX_SAVE + runtime_data.MAX_QUICKSAVE
        pos3 = MAX_SAVE + runtime_data.MAX_QUICKSAVE + runtime_data.MAX_AUTOSAVE
        for i in range(1, pos3 + 1):
            if i <= MAX_SAVE:
                fname = 'save' + str(i)
                head = str(i)
            elif MAX_SAVE < i <= pos2:
                index = i - MAX_SAVE
                fname = 'quick_save' + str(index)
                head = 'Quick Save ' + str(index)
            elif pos2 < i <= pos3:
                index = i - pos2
                fname = 'auto_save' + str(index)
                head = 'Auto Save ' + str(index)

            label = SaveLoadLabel(command=self.load,
                                  always_enable=False,
                                  fileName=fname,
                                  head=head,
                                  extraArgs=[fname],
                                  style=color_themes.sirius_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin=hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
示例#7
0
 def focused(self):
     if not self.__focused:
         self.accept('mouse1', self.input, [1])
         self.accept('enter', self.input, [1])
         self.accept('mouse3', self.input, [3])
         self.accept('wheel_up', self.showTextHistory)
         self.accept('escape', self.showMenu)
         self.accept('control',self.setForceJump, [True])
         self.accept('control-up',self.setForceJump, [False])
         SogalForm.focused(self)
         self.__focused = True
示例#8
0
 def close(self):
     '''Called by SogalBase. Do something and hide, you will need it if you want a more complex main menu'''
     self.fadinglock.acquire()
     
     if self.closed:
         return
     SogalForm.hide(self)
     self.closed = True
     if self.bar:
         for btn in self.bar:
             btn['state'] = DGG.DISABLED
示例#9
0
    def close(self):
        '''Called by SogalBase. Do something and hide, you will need it if you want a more complex main menu'''
        self.fadinglock.acquire()

        if self.closed:
            return
        SogalForm.hide(self)
        self.closed = True
        if self.bar:
            for btn in self.bar:
                btn['state'] = DGG.DISABLED
示例#10
0
 def defocused(self):
     if self.__focused:
         self.ignore('mouse1')
         self.ignore('enter')
         self.ignore('mouse3')
         self.ignore('wheel_up')
         self.ignore('escape')
         self.ignore('control')
         self.ignore('control-up')
         self.setForceJump(False)
         SogalForm.defocused(self)
         self.__arrow_shown = False
         self.gameTextBox.hideArrow()
         self.__focused = False
示例#11
0
 def destroy(self):
     self.__destroyed = True
     taskMgr.remove('story_manager_loop')  # @UndefinedVariable
     taskMgr.remove('story_jump_check')  # @UndefinedVariable
     if self._frame:
         self._frame.destroy()
         self._frame = None
     
     if self.__currentSelection:
         self.__currentSelection.destroy()
     self.gameTextBox.destroy()
     self.storyView.destroy()
     self.menu.destroy()
     self.textHistory.destroy()
     SogalForm.destroy(self)
示例#12
0
    def __init__(self, entry = 'ifselectionjumptest'):
        '''
        Constructor
        '''
        self.entry = entry
        self.closed = True
        
        SogalForm.__init__(self, fading = True, fading_duration = 1.0, backgroundImage = None, backgroundColor = (0,0,0,1), 
                           enableMask = True,
                           hiddenFunc = self.closedFunc, shownFunc = self.openedFunc)
        

        self.addButtonBar()
        
        self.fadinglock = Lock()        #This lock is to prevent open or close failure when the main menu is on fading
示例#13
0
 def defocused(self):
     self.ignore('mouse1')
     self.ignore('mouse2')
     self.ignore('mouse3')
     self.ignore('escape')
     self.ignore('wheel_up')
     self.ignore('wheel_down')
     self.ignore('arrow_up-repeat')
     self.ignore('arrow_down-repeat')
     self.ignore('arrow_up')
     self.ignore('arrow_down')
     self.ignore('w-repeat')
     self.ignore('s-repeat')
     self.ignore('w')
     self.ignore('s')
     SogalForm.defocused(self)
示例#14
0
 def focused(self):
     self.accept('mouse1', self.hide)
     self.accept('mouse2', self.hide)
     self.accept('mouse3', self.hide)
     self.accept('escape', self.hide)
     self.accept('wheel_up', self.roll, [-1.0])
     #self.accept('wheel_down', self.wheeldown)
     self.accept('wheel_down', self.roll, [1.0])
     self.accept('arrow_up-repeat', self.roll, [-1.0])
     self.accept('arrow_down-repeat', self.roll, [1.0])
     self.accept('arrow_up', self.roll, [-1.0])
     self.accept('arrow_down', self.roll, [1.0])
     self.accept('w-repeat', self.roll, [-1.0])
     self.accept('s-repeat', self.roll, [1.0])
     self.accept('w', self.roll, [-1.0])
     self.accept('s', self.roll, [1.0])
     SogalForm.focused(self)
示例#15
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self, fading = True, fading_duration = 0.5, enableMask = True,backgroundColor=color_themes.sirius_bgColor)
        self.reparentTo(aspect2d,sort = 102)

        self.frame = DirectScrolledFrame(parent = self, canvasSize = LOAD_CANVAS_SIZE, 
                                         frameSize = FRAMESIZE, 
                                         autoHideScrollBars = AUTO_HIDE_SCROLLBARS,
                                         **color_themes.sirius_frame)
 
        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent = self.frame.getCanvas(), margin = vspacing)
        
        hbox = None
        self.__dumped = None
        
        pos2 = MAX_SAVE + runtime_data.MAX_QUICKSAVE
        pos3 = MAX_SAVE + runtime_data.MAX_QUICKSAVE + runtime_data.MAX_AUTOSAVE
        for i in range(1,  pos3 + 1):
            if i <= MAX_SAVE:
                fname = 'save' + str(i)
                head = str(i)
            elif MAX_SAVE < i <= pos2:
                index = i - MAX_SAVE
                fname = 'quick_save' + str(index)
                head = 'Quick Save ' + str(index)
            elif pos2 < i <= pos3:
                index = i - pos2
                fname = 'auto_save' + str(index)
                head = 'Auto Save ' + str(index)
                
            label = SaveLoadLabel(command = self.load, always_enable = False,
                                  fileName = fname, head = head, extraArgs = [fname],style = color_themes.sirius_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin = hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
示例#16
0
    def __init__(self, entry='ifselectionjumptest'):
        '''
        Constructor
        '''
        self.entry = entry
        self.closed = True

        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=1.0,
                           backgroundImage=None,
                           backgroundColor=(0, 0, 0, 1),
                           enableMask=True,
                           hiddenFunc=self.closedFunc,
                           shownFunc=self.openedFunc)

        self.addButtonBar()

        self.fadinglock = Lock(
        )  #This lock is to prevent open or close failure when the main menu is on fading
示例#17
0
    def __init__(self):
        self.topdistance = 0.3
        self.rightdistance = 0.3
        #self.rightdistance = 2
        
        SogalForm.__init__(self,
                           fading = True, 
                           fading_position_offset = (0.5,0,0),
                           fading_duration = 0.3,
                           enableMask = True,
                           backgroundColor = (0,0,0,0.25))
        self.reparentTo(aspect2d,sort = 99)
        self._buttonbox = VLayout(parent = self,margin = 0.05)
        self._currentInterval = None
        
        self.resetPos() 
        
        self.bar = NodePath('menubar')
        self.bar.reparentTo(self)
        self.setTransparency(TransparencyAttrib.MAlpha)
示例#18
0
    def __init__(self):
        self.topdistance = 0.3
        self.rightdistance = 0.3
        #self.rightdistance = 2

        SogalForm.__init__(self,
                           fading=True,
                           fading_position_offset=(0.5, 0, 0),
                           fading_duration=0.3,
                           enableMask=True,
                           backgroundColor=(0, 0, 0, 0.25))
        self.reparentTo(aspect2d, sort=99)
        self._buttonbox = VLayout(parent=self, margin=0.05)
        self._currentInterval = None

        self.resetPos()

        self.bar = NodePath('menubar')
        self.bar.reparentTo(self)
        self.setTransparency(TransparencyAttrib.MAlpha)
        self.accept('window-event', self.resetPos)
示例#19
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=0.5,
                           enableMask=True,
                           backgroundColor=color_themes.ilia_bgColor)
        self.reparentTo(aspect2d, sort=102)
        self.frame = DirectScrolledFrame(
            parent=self,
            canvasSize=SAVE_CANVAS_SIZE,
            frameSize=FRAMESIZE,
            autoHideScrollBars=AUTO_HIDE_SCROLLBARS,
            **color_themes.ilia_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent=self.frame.getCanvas(), margin=vspacing)
        hbox = None
        self.__dumped = None
        for i in range(1, MAX_SAVE + 1):
            fname = 'save' + str(i)
            head = str(i)
            label = SaveLoadLabel(command=self.save,
                                  always_enable=True,
                                  fileName=fname,
                                  head=head,
                                  extraArgs=[fname],
                                  style=color_themes.ilia_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin=hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
示例#20
0
    def __init__(self):
        '''
        Constructor
        '''
        style = base.getStyle()

        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=0.5,
                           enableMask=True,
                           backgroundColor=style['color']['bg'],
                           sort=103)

        self._style = style

        self._cards = {}
        self._graphics = self.ConfigCard(parent=self)
        self._cards['graphics'] = (self._graphics)  #0, graphics

        #TODO: 重写ConfigLabel(一个OnscreenText 和一个控件 一行 ) 实现键盘支持

        #resolution = DirectOptionMenu(text="options", scale=0.1,items=["item1","item2","item3"],initialitem=2,

        resolution_options = OptionMenu(
            items=["Unchanged", "1280x720", "1920x1080", '1024x768'],
            itemcontent=[None, (1280, 720), (1920, 1080), (1024, 768)])
        self._resolution = OptionLabel(self,
                                       text='Resolution',
                                       controlNP=resolution_options)
        self.appendConfigLabel('graphics', self._resolution)  #sresolution

        fullscreen = CheckBox()
        self._fullscreen = OptionLabel(self,
                                       text='Full Screen',
                                       controlNP=fullscreen)
        self.appendConfigLabel('graphics', self._fullscreen)

        self.refreshSettings()
示例#21
0
 def hide(self):
     self._applyResolution()
     SogalForm.hide(self)
示例#22
0
 def destroy(self):
     self.labels = []
     self.shifter.removeNode()
     SogalForm.destroy(self)
示例#23
0
 def defocused(self):
     self.ignore('mouse3')
     self.ignore('escape')
     SogalForm.defocused(self)
示例#24
0
 def hide(self):
     self.removeFocus()
     SogalForm.hide(self)
示例#25
0
 def show(self):
     SogalForm.show(self)
示例#26
0
 def destroy(self):
     SogalForm.destroy(self)
示例#27
0
    def destroy(self):
示例#28
0
         
 def show(self):
示例#29
0
 def focused(self):
     self.accept('mouse3', self.hide)
     self.accept('escape', self.hide)
     SogalForm.focused(self)
示例#30
0
    def __init__(self):
        self.step = 0    #shows how many commands line it had run
        self.scrStack = []
        self.commandList = []
        
        self.__currentPtr = None
        if not runtime_data.RuntimeData.command_ptr:
            self.nextPtr = 0
        else: self.nextPtr = runtime_data.RuntimeData.command_ptr
        
        if not runtime_data.RuntimeData.command_stack:
            runtime_data.RuntimeData.command_stack = self.scrStack
        else: self.scrStack = runtime_data.RuntimeData.command_stack
        
        if not runtime_data.RuntimeData.command_list:
            runtime_data.RuntimeData.command_list = self.commandList
        else: self.commandList = runtime_data.RuntimeData.command_list
                
        
        self._frame = DirectFrame(parent = aspect2d)  # @UndefinedVariable pydev在傲娇而已不用管
        self._frame.setTransparency(TransparencyAttrib.MAlpha)

        

        
        self.storyView = StoryView()
        self.audioPlayer = base.audioPlayer  # @UndefinedVariable pydev在傲娇而已不用管
        self.menu = StoryMenuBar()
        self.gameTextBox = GameTextBox()
        self.textHistory = TextHistory()
        
        self.button_auto = self.menu.addButton(text = 'Auto',state = DGG.NORMAL,command = self.autoPlayButton)
        self.button_history = self.menu.addButton(text = 'History',state = DGG.NORMAL,command = self.showTextHistoryButton)
        self.button_skip = self.menu.addButton(text = 'Skip',state = DGG.DISABLED,command = self.startSkippingButton)
        self.button_lastchoice = self.menu.addButton(text = 'Last Choice',state = DGG.DISABLED,command = self.lastChoice)
        self.button_save = self.menu.addButton(text = 'Save',state = DGG.DISABLED, command = self.saveButton)
        self.button_load = self.menu.addButton(text = 'Load',state = DGG.NORMAL,command = self.loadButton)
        self.button_quicksave = self.menu.addButton(text = 'Quick Save',state = DGG.DISABLED,command = self.quickSaveButton)
        self.button_quickload = self.menu.addButton(text = 'Quick Load',state = DGG.DISABLED,command = self.quickLoadButton)
        self.button_config = self.menu.addButton(text = 'Options', state = DGG.NORMAL, command = self._configButton)
        self.button_title = self.menu.addButton(text = 'Title',state = DGG.NORMAL,command = self.returnToTitle)
        
        self._inputReady = True
        self.__arrow_shown = False
        self._choiceReady = True
        self._currentMessage = ''
        self.__currentSelection = None
        self.__finishing = False
        self.__lock = Lock()
        self.forcejump = False
        self.__autoInput = False
        self.__focused = False
        self.intervals = []
        self.__skipping = False
        self.__autoplaying = False
        self.__autoInterval = None
        self.__autoplaystep = None
        
        self.mapScriptSpace()
        SogalForm.__init__(self)
        self.show()
        taskMgr.add(self.loopTask,'story_manager_loop',sort = 2,priority = 1)  # @UndefinedVariable 傲娇的pydev……因为panda3D的"黑魔法"……
      
        taskMgr.doMethodLater(runtime_data.game_settings['jump_span'],self.__jumpCheck,'story_jump_check', sort = 5, priority = 1)  # @UndefinedVariable
示例#31
0
 
 def focused(self):
     self.accept('mouse3', self.hide)
     self.accept('escape', self.hide)
示例#32
0
 def hide(self):
     self._applyResolution()
     SogalForm.hide(self)
示例#33
0
 
 def defocused(self):
     self.ignore('mouse3')
     self.ignore('escape')