def handleInput (self, inputClass): if(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED): data1 = inputClass.getData1() data2 = inputClass.getData2() if(data1 == self.TYPE_BUTTON): screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) xPosition = self.X_SCREEN + self.componentPanelXOffset yPosition = self.Y_SCREEN + self.componentPanelYOffset + data2 * self.componentPanelHeight index = self.componentProjects[data2] screen.spaceShipChangeType(index) activeTeam = gc.getGame().getActiveTeam() modelType = gc.getTeam(activeTeam).getProjectDefaultArtType(index) screen.addSpaceShipWidgetGFC("ComponentModel" + str(data2), xPosition + self.componentModelXOffset, yPosition + self.componentModelYOffset, self.componentModelWidth, self.componentModelHeight, index, modelType, WidgetTypes.WIDGET_GENERAL, -1, -1) elif(data1 == self.ZOOM_BUTTON): screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) screen.spaceShipZoom(self.componentProjects[data2]) elif(data1 == self.ADD_BUTTON): screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) screen.spaceShipFinalize() #adjust interface screen.deleteWidget("ComponentAddButton") self.activeProject = -1 self.rebuildComponentPanel() elif(data1 == self.LAUNCH_BUTTON): screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) screen.spaceShipLaunch() self.removeComponentsPanel() return 0
def removeComponentsPanel(self): screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) screen.deleteWidget("SpaceShipMainPanel") screen.deleteWidget("ComponentAddButton") screen.deleteWidget("LaunchLabel") screen.deleteWidget("LaunchButton") screen.deleteWidget("ExitButton") for i in xrange(self.numComponents): screen.deleteWidget("ComponentPanel" + str(i)) screen.deleteWidget("ComponentLabel" + str(i)) screen.deleteWidget("ComponentCompletedLabel" + str(i)) screen.deleteWidget("ComponentRequiredLabel" + str(i)) screen.deleteWidget("ComponentInProductionLabel" + str(i)) screen.deleteWidget("ComponentTypeButton" + str(i)) screen.deleteWidget("ComponentZoomButton" + str(i)) screen.deleteWidget("ComponentModel" + str(i))