def __init__(self, questID): ScriptWidget.__init__(self) ActionListener.__init__(self) self.bg = Sprite("DATA/FormPQuest2/2BG.gi") self.addChild(self.bg) self.paramWindow = NinePatch("ORC/quest_param_win.9.json") self.paramWindow.position = (643, 457) self.paramWindow.geometry = (320, 280) self.addChild(self.paramWindow) self.exitButton = Button("DATA/FormPQuest2/2CloseN.gi", "DATA/FormPQuest2/2CloseA.gi", "DATA/FormPQuest2/2CloseD.gi") self.exitButton.position = (953, 725) self.addWidget(self.exitButton) self.exitButton.addListener(self) self.image = None self.questID = questID self.questFile = resources.datRoot()['PlanetQuest']['PlanetQuest'][questID].value.replace('\\', '/') player.loadQuest(self.questFile) self.loadImages() self.style = resources.objectManager().getResourceObject('/world/skin/quest/grey') self.interact = InteractionWidget(Rect(15, 45, 15 + 539, 45 + 363), Rect(15, 482, 15 + 539, 482 + 215), self.style) self.interact.position = (35, 5) self.interact.layer = -2; self.addWidget(self.interact) self.interact.addListener(self) self.paramLabel = ColorLabel("") self.paramLabel.wordWrap = True self.paramLabel.position = (665, 480) self.paramLabel.setFixedSize(280, 280) self.paramLabel.textColor = self.style.color self.paramLabel.selectionColor = self.style.activeColor self.addChild(self.paramLabel) self.skin1Button = Button("DATA/FormPQuest2/2Skin1N.gi", "DATA/FormPQuest2/2Skin1A.gi", "DATA/FormPQuest2/2Skin1D.gi") self.skin1Button.position = (529, 742) self.addWidget(self.skin1Button) self.skin1Button.addListener(self) self.skin2Button = Button("DATA/FormPQuest2/2Skin2N.gi", "DATA/FormPQuest2/2Skin2A.gi", "DATA/FormPQuest2/2Skin2D.gi") self.skin2Button.position = (547, 742) self.addWidget(self.skin2Button) self.skin2Button.addListener(self) self.skin3Button = Button("DATA/FormPQuest2/2Skin3N.gi", "DATA/FormPQuest2/2Skin3A.gi", "DATA/FormPQuest2/2Skin3D.gi") self.skin3Button.position = (565, 742) self.addWidget(self.skin3Button) self.skin3Button.addListener(self) self.skin4Button = Button("DATA/FormPQuest2/2Skin4N.gi", "DATA/FormPQuest2/2Skin4A.gi", "DATA/FormPQuest2/2Skin4D.gi") self.skin4Button.position = (583, 742) self.addWidget(self.skin4Button) self.skin4Button.addListener(self) self.updateWidget()
def __init__(self): ScriptWidget.__init__(self) self.curve1 = BezierCurve(Vector(100, 500), Vector(0, 100), Vector(600, 200), Vector(500, 500)) self.line1 = TiledBezierCurve('ORC/UnitPath2.png') self.line1.curve = self.curve1 self.addChild(self.line1) self.curve2 = BezierCurve(Vector(250, 250), Vector(500, 100), Vector(0, 100), Vector(500, 250)) self.line2 = TiledBezierCurve('ORC/UnitPath2.png') self.line2.curve = self.curve2 self.addChild(self.line2) self.curve3 = BezierCurve(Vector(100, 500), Vector(200, 400), Vector(300, 600), Vector(400, 500)) self.line3 = TiledBezierCurve('ORC/UnitPath2.png') self.line3.curve = self.curve3 self.addChild(self.line3) self.curve3 = BezierCurve(Vector(0, 500), Vector(400, 600), Vector(600, 600), Vector(1000, 500)) self.line3 = TiledBezierCurve('ORC/UnitPath2.png') self.line3.curve = self.curve3 self.addChild(self.line3) self.p1up = True self.p2up = False self.p0s = Sprite('ORC/UnitPath12.png') self.p0s.position = self.curve3.p0 self.addChild(self.p0s) self.p1s = Sprite('ORC/UnitPath1.png') self.p1s.position = self.curve3.p1 self.addChild(self.p1s) self.p2s = Sprite('ORC/UnitPath1.png') self.p2s.position = self.curve3.p2 self.addChild(self.p2s) self.p3s = Sprite('ORC/UnitPath1.png') self.p3s.position = self.curve3.p3 self.addChild(self.p3s)
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.widget = None self.testBtnGroup = RadioButtonGroup() self.testBtns = [] self.layer = 100 self.addWidget(self.testBtnGroup) i = 0 for test in self.TESTS: b = RadioButton(engine.defaultSkin.radioButtonStyle, test) b.position = (10, 50 + i * (b.height + 5)) self.testBtnGroup.addRadioButton(b) self.testBtns.append(b) b.addListener(self) i = i + 1
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.t = 0 self.bgforward = False self.background = Sprite('DATA/FormMain3/2bg.gi') self.background.width = self.background.width / ( engine.screenHeight / self.background.height) self.background.height = engine.screenHeight self.background.layer = -3 self.addChild(self.background) self.bgPlanet = Sprite('DATA/FormMain3/2Planet.gi') self.bgPlanet.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_BOTTOM) self.bgPlanet.position = (0, engine.screenHeight) self.bgPlanet.layer = -2 self.addChild(self.bgPlanet) self.bgAnimLine = GAISprite("DATA/FormMain2/2AnimLine.gai") self.bgAnimLine.origin = (SpriteXOrigin.POSITION_X_RIGHT, SpriteYOrigin.POSITION_Y_TOP) self.bgAnimLine.position = (engine.screenWidth, 0) self.bgAnimLine.layer = 0 self.addChild(self.bgAnimLine) self.bgAnim = GAISprite("DATA/FormMain2/2AnimMain.gai") self.bgAnim.layer = -1 self.bgAnim.height = self.bgAnim.height * engine.screenWidth / self.bgAnim.width self.bgAnim.width = engine.screenWidth self.bgAnim.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_BOTTOM) self.bgAnim.position = (0, engine.screenHeight) self.addChild(self.bgAnim) self.caption = Sprite("DATA/FormMain3/2caption.gi") self.caption.origin = (SpriteXOrigin.POSITION_X_RIGHT, SpriteYOrigin.POSITION_Y_CENTER) self.caption.position = (engine.screenWidth, 110) self.caption.layer = 1 self.addChild(self.caption) self.ship = [None, None, None] self.ship[0] = GAISprite('DATA/FormMain3/2Ship1.gai') self.ship[0].position = (0, engine.screenHeight - self.ship[0].height) self.ship[0].layer = 1 self.ship[0].speed = 1.5 self.ship[0].singleShot = True self.ship[1] = GAISprite('DATA/FormMain3/2Ship2.gai') self.ship[1].position = (0, engine.screenHeight - self.ship[1].height) self.ship[1].layer = 1 self.ship[1].speed = 1.5 self.ship[1].singleShot = True self.ship[1].stop() self.ship[2] = GAISprite('DATA/FormMain3/2Ship3.gai') self.ship[2].position = (0, engine.screenHeight - self.ship[2].height) self.ship[2].layer = 1 self.ship[2].speed = 1.5 self.ship[2].singleShot = True self.ship[2].stop() self.addChild(self.ship[0]) self.currentShip = 0 self.menuNode = WidgetNode() self.menuNode.layer = 2 self.menuNode.position = (engine.screenWidth - 400, 300) self.addWidget(self.menuNode) sound.playMusic("Music/SPECIAL/SpaceIsCalling.dat", False) self.buttons = {} clickSound = "Sound/ButtonClick.wav" leaveSound = "Sound/ButtonLeave.WAV" enterSound = "Sound/ButtonEnter.wav" y = 0 for name in self.BUTTONS: button = Button( 'DATA/FormMain2/' + self.BUTTON_FILES[name] + 'N.gi', 'DATA/FormMain2/' + self.BUTTON_FILES[name] + 'A.gi', 'DATA/FormMain2/' + self.BUTTON_FILES[name] + 'D.gi') self.buttons[name] = button button.addListener(self) button.position = (0, y) button.sounds = (clickSound, enterSound, leaveSound) self.menuNode.addWidget(button) y = y + self.BUTTON_SPARSE self.questButton = Button('DATA/FormLoadRobot/2LoadQuestN.gi', 'DATA/FormLoadRobot/2LoadQuestA.gi', 'DATA/FormLoadRobot/2LoadQuestN.gi') self.questButton.addListener(self) self.questButton.position = (305, engine.screenHeight - 135) self.questButton.layer = 2 self.questButton.sounds = (clickSound, enterSound, leaveSound) self.addWidget(self.questButton) self.pause = False
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.scrollStyle = resources.objectManager().getResourceObject( '/world/skin/quest/dark').scrollStyle if not self.scrollStyle: self.scrollStyle = engine.defaultSkin.scrollStyle font = resources.objectManager().getResourceObject('/fonts/default') self.smallFont = resources.loadFont(font.path, 12, font.antialiasing) self.font = resources.loadFont(font) self.buttonFont = resources.loadFont( resources.objectManager().getResourceObject('/fonts/ranger-bold')) self.buttonSounds = (engine.defaultSkin.buttonStyle.clickSound,\ engine.defaultSkin.buttonStyle.enterSound,\ engine.defaultSkin.buttonStyle.leaveSound) self.bg = Sprite("DATA/FormLoadQuest/2BG.gi") self.bg.layer = -1 self.addChild(self.bg) self.width = int(self.bg.width) self.height = int(self.bg.height) self.bg2 = Sprite("DATA/FormLoadQuest/2ImageBG.gi") self.bg2.layer = -3 self.bg2.position = (640, 15) self.addChild(self.bg2) self.image = None self.descNode = WidgetNode() self.descScroll = ScrollArea(self.scrollStyle, self.descNode) self.descScroll.position = (631, 280) self.descScroll.geometry = (280, 243) self.addWidget(self.descScroll) self.desc = ColorLabel() self.desc.font = self.font self.desc.position = (0, 5) self.desc.wordWrap = True self.desc.setFixedWidth(280) self.desc.textColor = Color(0.0, 0.0, 0.0) self.desc.selectionColor = Color(0.0, 0.0, 1.0) self.descWidget = LabelWidget(self.desc) self.descNode.addWidget(self.descWidget) self.node = WidgetNode() self.scroll = ScrollArea(self.scrollStyle, self.node) self.scroll.position = (40, 145) self.scroll.geometry = (528, 460) self.addWidget(self.scroll) self.startButton = Button('DATA/FormSave2/2SaveN.gi', '', 'DATA/FormSave2/2SaveD.gi') self.startButton.sounds = (self.buttonSounds[0], '', '') self.startButton.text = _('Start', 'FormLoadQuest.Start', 'OpenSR-World') self.startButton.font = self.buttonFont self.startButton.color = Color.fromString('#002842') self.startButton.position = (638, 574) self.startButton.layer = 1 self.startButton.addListener(self) self.addWidget(self.startButton) self.cancelButton = Button('DATA/FormSave2/2CancelN.gi', '', 'DATA/FormSave2/2CancelD.gi') self.cancelButton.sounds = (self.buttonSounds[0], '', '') self.cancelButton.text = _('Cancel', 'FormLoadQuest.Cancel', 'OpenSR-World') self.cancelButton.font = self.buttonFont self.cancelButton.color = Color.fromString('#002842') self.cancelButton.position = (638, 626) self.cancelButton.layer = 1 self.cancelButton.addListener(self) self.addWidget(self.cancelButton) self.closeButton = Button('DATA/FormSave2/2CloseN.gi', 'DATA/FormSave2/2CloseA.gi', 'DATA/FormSave2/2CloseD.gi') self.closeButton.sounds = self.buttonSounds self.closeButton.position = (891, 601) self.closeButton.layer = 1 self.closeButton.addListener(self) self.addWidget(self.closeButton) self.buttons = {} self.loadQuests() self.selected = None first = None i = 0 for q in self.quests: b = Button("DATA/FormLoadQuest/2SlotNormal.gi", "DATA/FormLoadQuest/2SlotOnMouse.gi", "DATA/FormLoadQuest/2SlotOnPress.gi") b.position = (0, 5 + i * (b.height + 5)) self.node.addWidget(b) self.buttons[b] = i b.addListener(self) if i == 0: first = b nl = Label(q.name) nl.font = self.font nl.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) nl.position = (15, int(5 + i * (b.height + 5) + b.height / 2)) nl.layer = 1 nl.color = Color.fromString("#A5B68C") self.node.addChild(nl) if q.length < 1: diff = "DATA/FormLoadQuest/2D1.gi" elif q.length < 2: diff = "DATA/FormLoadQuest/2D2.gi" elif q.length < 3: diff = "DATA/FormLoadQuest/2D3.gi" elif q.length < 4: diff = "DATA/FormLoadQuest/2D4.gi" else: diff = "DATA/FormLoadQuest/2D5.gi" diffIcon = Sprite(diff) diffIcon.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) diffIcon.position = (int(b.width / 2.2), int(5 + i * (b.height + 5) + b.height / 2)) diffIcon.layer = 1 self.node.addChild(diffIcon) gl = Label(q.genre) gl.font = self.smallFont gl.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) gl.position = (int(b.width / 2.2) + 5 + diffIcon.width, int(5 + i * (b.height + 5) + b.height / 2)) gl.layer = 1 gl.color = Color.fromString("#A5B68C") gl.wordWrap = True gl.setFixedWidth(b.width - int(b.width / 2.2) - 5 - diffIcon.width) self.node.addChild(gl) i += 1 self.select(first)
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.scrollStyle = resources.objectManager().getResourceObject('/world/skin/quest/dark').scrollStyle if not self.scrollStyle: self.scrollStyle = engine.defaultSkin.scrollStyle font = resources.objectManager().getResourceObject('/fonts/default') self.smallFont = resources.loadFont(font.path, 12, font.antialiasing) self.font = resources.loadFont(font) self.buttonFont = resources.loadFont(resources.objectManager().getResourceObject('/fonts/ranger-bold')) self.buttonSounds = (engine.defaultSkin.buttonStyle.clickSound,\ engine.defaultSkin.buttonStyle.enterSound,\ engine.defaultSkin.buttonStyle.leaveSound) self.bg = Sprite("DATA/FormLoadQuest/2BG.gi") self.bg.layer = -1 self.addChild(self.bg) self.width = int(self.bg.width) self.height = int(self.bg.height) self.bg2 = Sprite("DATA/FormLoadQuest/2ImageBG.gi") self.bg2.layer = -3 self.bg2.position = (640, 15) self.addChild(self.bg2) self.image = None self.descNode = WidgetNode() self.descScroll = ScrollArea(self.scrollStyle, self.descNode) self.descScroll.position = (631, 280) self.descScroll.geometry = (280, 243) self.addWidget(self.descScroll) self.desc = ColorLabel() self.desc.font = self.font self.desc.position = (0, 5) self.desc.wordWrap = True self.desc.setFixedWidth(280) self.desc.textColor = Color(0.0, 0.0, 0.0) self.desc.selectionColor = Color(0.0, 0.0, 1.0) self.descWidget = LabelWidget(self.desc) self.descNode.addWidget(self.descWidget) self.node = WidgetNode() self.scroll = ScrollArea(self.scrollStyle, self.node) self.scroll.position = (40, 145) self.scroll.geometry = (528, 460) self.addWidget(self.scroll) self.startButton = Button('DATA/FormSave2/2SaveN.gi', '', 'DATA/FormSave2/2SaveD.gi') self.startButton.sounds = (self.buttonSounds[0], '', '') self.startButton.text = _('Start', 'FormLoadQuest.Start', 'OpenSR-World') self.startButton.font = self.buttonFont self.startButton.color = Color.fromString('#002842') self.startButton.position = (638, 574) self.startButton.layer = 1 self.startButton.addListener(self) self.addWidget(self.startButton) self.cancelButton = Button('DATA/FormSave2/2CancelN.gi', '', 'DATA/FormSave2/2CancelD.gi') self.cancelButton.sounds = (self.buttonSounds[0], '', '') self.cancelButton.text = _('Cancel', 'FormLoadQuest.Cancel', 'OpenSR-World') self.cancelButton.font = self.buttonFont self.cancelButton.color = Color.fromString('#002842') self.cancelButton.position = (638, 626) self.cancelButton.layer = 1 self.cancelButton.addListener(self) self.addWidget(self.cancelButton) self.closeButton = Button('DATA/FormSave2/2CloseN.gi', 'DATA/FormSave2/2CloseA.gi', 'DATA/FormSave2/2CloseD.gi') self.closeButton.sounds = self.buttonSounds self.closeButton.position = (891, 601) self.closeButton.layer = 1 self.closeButton.addListener(self) self.addWidget(self.closeButton) self.buttons = {} self.loadQuests() self.selected = None first = None i = 0 for q in self.quests: b = Button("DATA/FormLoadQuest/2SlotNormal.gi", "DATA/FormLoadQuest/2SlotOnMouse.gi", "DATA/FormLoadQuest/2SlotOnPress.gi") b.position = (0, 5 + i * (b.height + 5)) self.node.addWidget(b) self.buttons[b] = i b.addListener(self) if i == 0: first = b nl = Label(q.name) nl.font = self.font nl.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) nl.position = (15, int(5 + i * (b.height + 5) + b.height / 2)) nl.layer = 1 nl.color = Color.fromString("#A5B68C") self.node.addChild(nl) if q.length < 1: diff = "DATA/FormLoadQuest/2D1.gi" elif q.length < 2: diff = "DATA/FormLoadQuest/2D2.gi" elif q.length < 3: diff = "DATA/FormLoadQuest/2D3.gi" elif q.length < 4: diff = "DATA/FormLoadQuest/2D4.gi" else: diff = "DATA/FormLoadQuest/2D5.gi" diffIcon = Sprite(diff) diffIcon.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) diffIcon.position = (int(b.width / 2.2), int(5 + i * (b.height + 5) + b.height / 2)) diffIcon.layer = 1 self.node.addChild(diffIcon) gl = Label(q.genre) gl.font = self.smallFont gl.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_CENTER) gl.position = (int(b.width / 2.2) + 5 + diffIcon.width, int(5 + i * (b.height + 5) + b.height / 2)) gl.layer = 1 gl.color = Color.fromString("#A5B68C") gl.wordWrap = True gl.setFixedWidth(b.width - int(b.width / 2.2) - 5 - diffIcon.width) self.node.addChild(gl) i += 1 self.select(first)
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.t = 0 self.bgforward = False self.background = Sprite('DATA/FormMain3/2bg.gi') self.background.width = self.background.width / (engine.screenHeight / self.background.height) self.background.height = engine.screenHeight self.background.layer = -3 self.addChild(self.background) self.bgPlanet = Sprite('DATA/FormMain3/2Planet.gi') self.bgPlanet.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_BOTTOM) self.bgPlanet.position = (0, engine.screenHeight) self.bgPlanet.layer = -2 self.addChild(self.bgPlanet) self.bgAnimLine = GAISprite("DATA/FormMain2/2AnimLine.gai") self.bgAnimLine.origin = (SpriteXOrigin.POSITION_X_RIGHT, SpriteYOrigin.POSITION_Y_TOP) self.bgAnimLine.position = (engine.screenWidth, 0) self.bgAnimLine.layer = 0 self.addChild(self.bgAnimLine) self.bgAnim = GAISprite("DATA/FormMain2/2AnimMain.gai") self.bgAnim.layer = -1 self.bgAnim.height = self.bgAnim.height * engine.screenWidth / self.bgAnim.width self.bgAnim.width = engine.screenWidth self.bgAnim.origin = (SpriteXOrigin.POSITION_X_LEFT, SpriteYOrigin.POSITION_Y_BOTTOM) self.bgAnim.position = (0, engine.screenHeight) self.addChild(self.bgAnim) self.caption = Sprite("DATA/FormMain3/2caption.gi") self.caption.origin = (SpriteXOrigin.POSITION_X_RIGHT, SpriteYOrigin.POSITION_Y_CENTER) self.caption.position = (engine.screenWidth, 110) self.caption.layer = 1 self.addChild(self.caption) self.ship = [None, None, None] self.ship[0] = GAISprite('DATA/FormMain3/2Ship1.gai') self.ship[0].position = (0, engine.screenHeight - self.ship[0].height) self.ship[0].layer = 1 self.ship[0].speed = 1.5 self.ship[0].singleShot = True self.ship[1] = GAISprite('DATA/FormMain3/2Ship2.gai') self.ship[1].position = (0, engine.screenHeight - self.ship[1].height) self.ship[1].layer = 1 self.ship[1].speed = 1.5 self.ship[1].singleShot = True self.ship[1].stop(); self.ship[2] = GAISprite('DATA/FormMain3/2Ship3.gai') self.ship[2].position = (0, engine.screenHeight - self.ship[2].height) self.ship[2].layer = 1 self.ship[2].speed = 1.5 self.ship[2].singleShot = True self.ship[2].stop(); self.addChild(self.ship[0]) self.currentShip = 0 self.menuNode = WidgetNode() self.menuNode.layer = 2 self.menuNode.position = (engine.screenWidth - 400, 300) self.addWidget(self.menuNode) sound.playMusic("Music/SPECIAL/SpaceIsCalling.dat", False) self.buttons = {} clickSound = "Sound/ButtonClick.wav" leaveSound = "Sound/ButtonLeave.WAV" enterSound = "Sound/ButtonEnter.wav" y = 0 for name in self.BUTTONS: button = Button('DATA/FormMain2/' + self.BUTTON_FILES[name] + 'N.gi', 'DATA/FormMain2/' + self.BUTTON_FILES[name] + 'A.gi', 'DATA/FormMain2/' + self.BUTTON_FILES[name] + 'D.gi') self.buttons[name] = button button.addListener(self) button.position = (0, y) button.sounds = (clickSound, enterSound, leaveSound) self.menuNode.addWidget(button) y = y + self.BUTTON_SPARSE self.questButton = Button('DATA/FormLoadRobot/2LoadQuestN.gi', 'DATA/FormLoadRobot/2LoadQuestA.gi', 'DATA/FormLoadRobot/2LoadQuestN.gi') self.questButton.addListener(self) self.questButton.position = (305, engine.screenHeight - 135) self.questButton.layer = 2 self.questButton.sounds = (clickSound, enterSound, leaveSound) self.addWidget(self.questButton) self.pause = False
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.background = Sprite("DATA/FormOptions2/2Bg.gi") self.background.width = engine.screenWidth self.background.height = engine.screenHeight self.background.layer = -2 self.addChild(self.background) deltaY = engine.screenHeight - 768 deltaX = engine.screenWidth - 1024 self.formBg = NinePatch("ORC/settings_bg.9.json") self.formBg.geometry = (self.formBg.width + deltaX, self.formBg.height + deltaY) self.formBg.position = (math.floor((engine.screenWidth - self.formBg.width) / 2) - 10, 32) self.formBg.layer = -1 self.addChild(self.formBg) self.formTop = NinePatch("ORC/settings_top.9.json") self.formTop.width = self.formTop.width + deltaX self.formTop.position = (math.floor((engine.screenWidth - self.formTop.width) / 2), 0) self.formTop.layer = -1 self.addChild(self.formTop) self.formBottom = NinePatch("ORC/settings_bottom.9.json") self.formBottom.width = self.formBottom.width + deltaX self.formBottom.position = (math.floor((engine.screenWidth - self.formTop.width) / 2), engine.screenHeight - self.formBottom.height) self.formBottom.layer = -1 self.addChild(self.formBottom) self.buttonNode = WidgetNode() self.buttonNode.position = (self.formBg.position.x + 80, self.formBg.position.y + 120) self.addWidget(self.buttonNode) self.spaceButton = Button("DATA/FormOptions2/2SpaceN.gi", "DATA/FormOptions2/2SpaceN.gi", "DATA/FormOptions2/2SpaceD.gi") self.spaceButton.position = (self.formBg.position.x + 26, self.formBg.position.y + 10) self.addWidget(self.spaceButton) self.okButton = Button("DATA/FormOptions2/2OkN.gi", "DATA/FormOptions2/2OkA.gi", "DATA/FormOptions2/2OkD.gi") self.okButton.position = (self.formBottom.position.x + 607 + deltaX, self.formBottom.position.y + 22) self.okButton.addListener(self) self.setSoundsDefault(self.okButton) self.addWidget(self.okButton) self.cancelButton = Button("DATA/FormOptions2/2CancelN.gi", "DATA/FormOptions2/2CancelA.gi", "DATA/FormOptions2/2CancelD.gi") self.cancelButton.position = (self.formBottom.position.x + 674 + deltaX, self.formBottom.position.y + 22) self.cancelButton.addListener(self) self.setSoundsDefault(self.cancelButton) self.addWidget(self.cancelButton) self.autoButton = Button("DATA/FormOptions2/2AutoN.gi", "DATA/FormOptions2/2AutoA.gi", "DATA/FormOptions2/2AutoD.gi") self.autoButton.position = (self.formBottom.position.x + 102, self.formBottom.position.y + 22) self.setSoundsDefault(self.autoButton) self.addWidget(self.autoButton) self.highButton = Button("DATA/FormOptions2/2HighN.gi", "DATA/FormOptions2/2HighA.gi", "DATA/FormOptions2/2HighD.gi") self.highButton.position = (self.formBottom.position.x + 176, self.formBottom.position.y + 4) self.setSoundsDefault(self.highButton) self.addWidget(self.highButton) self.mediumButton = Button("DATA/FormOptions2/2MediumN.gi", "DATA/FormOptions2/2MediumA.gi", "DATA/FormOptions2/2MediumD.gi") self.mediumButton.position = (self.formBottom.position.x + 170, self.formBottom.position.y + 33) self.setSoundsDefault(self.mediumButton) self.addWidget(self.mediumButton) self.lowButton = Button("DATA/FormOptions2/2LowN.gi", "DATA/FormOptions2/2LowA.gi", "DATA/FormOptions2/2LowD.gi") self.lowButton.position = (self.formBottom.position.x + 161, self.formBottom.position.y + 58) self.setSoundsDefault(self.lowButton) self.addWidget(self.lowButton) self.graphicsButton = Button("DATA/FormOptions2/2PageN.gi", "DATA/FormOptions2/2PageA.gi", "DATA/FormOptions2/2PageD.gi") self.graphicsButton.font = engine.coreFont self.graphicsButton.text = _("Graphics", "FormCfgSettings.GGraph") self.graphicsButton.color = Color(0.75, 0.85, 1.0) self.graphicsButton.position = (0, 0) self.setSoundsDefault(self.graphicsButton) self.buttonNode.addWidget(self.graphicsButton) self.paramNode = WidgetNode() self.widthLabel = Label(_("Width:")) self.paramNode.addChild(self.widthLabel) self.widthEdit = LineEdit(engine.defaultSkin.lineEditStyle) self.paramNode.addWidget(self.widthEdit) self.heightLabel = Label(_("Height:")) self.paramNode.addChild(self.heightLabel) self.heightEdit = LineEdit(engine.defaultSkin.lineEditStyle) self.paramNode.addWidget(self.heightEdit) self.fullscreen = CheckBox(engine.defaultSkin.checkBoxStyle, _("Fullscreen mode")) self.paramNode.addWidget(self.fullscreen) self.useShaders = CheckBox(engine.defaultSkin.checkBoxStyle, _("Use shaders")) self.paramNode.addWidget(self.useShaders) self.widthEdit.width = 50 self.widthEdit.position = (100, 5) self.widthLabel.position = (5, 5 + (self.widthEdit.height - self.widthLabel.font.size)) self.heightEdit.width = 50 self.heightEdit.position = (270, 5) self.heightLabel.position = (170, 5 + (self.widthEdit.height - self.widthLabel.font.size)) self.fullscreen.position = (5, self.widthEdit.height + 15) self.useShaders.position = (5, self.fullscreen.position.y + self.fullscreen.height + 5) self.scroll = ScrollArea(engine.defaultSkin.scrollStyle, self.paramNode) self.scroll.position = (self.formBg.position.x + 257, self.formBg.position.y + 149) self.scroll.geometry = (426 + deltaX, 439 + deltaY) self.addWidget(self.scroll) # RadioButton example #self.group = OpenSR.Engine.RadioButtonGroup() #self.r1 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "Yes") #self.r2 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "No") #self.r3 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "I dunno lol") #self.r2.setPosition(0, self.r1.height + 5) #self.r3.setPosition(0, self.r2.position.y + self.r2.height + 5) #self.group.addRadioButton(self.r1) #self.group.addRadioButton(self.r2) #self.group.addRadioButton(self.r3) #self.group.setPosition(0, 300) #self.paramNode.addWidget(self.group) self.loadSettings()
def __init__(self): ScriptWidget.__init__(self) ActionListener.__init__(self) self.background = Sprite("DATA/FormOptions2/2Bg.gi") self.background.width = engine.screenWidth self.background.height = engine.screenHeight self.background.layer = -2 self.addChild(self.background) deltaY = engine.screenHeight - 768 deltaX = engine.screenWidth - 1024 self.formBg = NinePatch("ORC/settings_bg.9.json") self.formBg.geometry = (self.formBg.width + deltaX, self.formBg.height + deltaY) self.formBg.position = (math.floor( (engine.screenWidth - self.formBg.width) / 2) - 10, 32) self.formBg.layer = -1 self.addChild(self.formBg) self.formTop = NinePatch("ORC/settings_top.9.json") self.formTop.width = self.formTop.width + deltaX self.formTop.position = (math.floor( (engine.screenWidth - self.formTop.width) / 2), 0) self.formTop.layer = -1 self.addChild(self.formTop) self.formBottom = NinePatch("ORC/settings_bottom.9.json") self.formBottom.width = self.formBottom.width + deltaX self.formBottom.position = (math.floor( (engine.screenWidth - self.formTop.width) / 2), engine.screenHeight - self.formBottom.height) self.formBottom.layer = -1 self.addChild(self.formBottom) self.buttonNode = WidgetNode() self.buttonNode.position = (self.formBg.position.x + 80, self.formBg.position.y + 120) self.addWidget(self.buttonNode) self.spaceButton = Button("DATA/FormOptions2/2SpaceN.gi", "DATA/FormOptions2/2SpaceN.gi", "DATA/FormOptions2/2SpaceD.gi") self.spaceButton.position = (self.formBg.position.x + 26, self.formBg.position.y + 10) self.addWidget(self.spaceButton) self.okButton = Button("DATA/FormOptions2/2OkN.gi", "DATA/FormOptions2/2OkA.gi", "DATA/FormOptions2/2OkD.gi") self.okButton.position = (self.formBottom.position.x + 607 + deltaX, self.formBottom.position.y + 22) self.okButton.addListener(self) self.setSoundsDefault(self.okButton) self.addWidget(self.okButton) self.cancelButton = Button("DATA/FormOptions2/2CancelN.gi", "DATA/FormOptions2/2CancelA.gi", "DATA/FormOptions2/2CancelD.gi") self.cancelButton.position = (self.formBottom.position.x + 674 + deltaX, self.formBottom.position.y + 22) self.cancelButton.addListener(self) self.setSoundsDefault(self.cancelButton) self.addWidget(self.cancelButton) self.autoButton = Button("DATA/FormOptions2/2AutoN.gi", "DATA/FormOptions2/2AutoA.gi", "DATA/FormOptions2/2AutoD.gi") self.autoButton.position = (self.formBottom.position.x + 102, self.formBottom.position.y + 22) self.setSoundsDefault(self.autoButton) self.addWidget(self.autoButton) self.highButton = Button("DATA/FormOptions2/2HighN.gi", "DATA/FormOptions2/2HighA.gi", "DATA/FormOptions2/2HighD.gi") self.highButton.position = (self.formBottom.position.x + 176, self.formBottom.position.y + 4) self.setSoundsDefault(self.highButton) self.addWidget(self.highButton) self.mediumButton = Button("DATA/FormOptions2/2MediumN.gi", "DATA/FormOptions2/2MediumA.gi", "DATA/FormOptions2/2MediumD.gi") self.mediumButton.position = (self.formBottom.position.x + 170, self.formBottom.position.y + 33) self.setSoundsDefault(self.mediumButton) self.addWidget(self.mediumButton) self.lowButton = Button("DATA/FormOptions2/2LowN.gi", "DATA/FormOptions2/2LowA.gi", "DATA/FormOptions2/2LowD.gi") self.lowButton.position = (self.formBottom.position.x + 161, self.formBottom.position.y + 58) self.setSoundsDefault(self.lowButton) self.addWidget(self.lowButton) self.graphicsButton = Button("DATA/FormOptions2/2PageN.gi", "DATA/FormOptions2/2PageA.gi", "DATA/FormOptions2/2PageD.gi") self.graphicsButton.font = engine.coreFont self.graphicsButton.text = _("Graphics", "FormCfgSettings.GGraph") self.graphicsButton.color = Color(0.75, 0.85, 1.0) self.graphicsButton.position = (0, 0) self.setSoundsDefault(self.graphicsButton) self.buttonNode.addWidget(self.graphicsButton) self.paramNode = WidgetNode() self.widthLabel = Label(_("Width:")) self.paramNode.addChild(self.widthLabel) self.widthEdit = LineEdit(engine.defaultSkin.lineEditStyle) self.paramNode.addWidget(self.widthEdit) self.heightLabel = Label(_("Height:")) self.paramNode.addChild(self.heightLabel) self.heightEdit = LineEdit(engine.defaultSkin.lineEditStyle) self.paramNode.addWidget(self.heightEdit) self.fullscreen = CheckBox(engine.defaultSkin.checkBoxStyle, _("Fullscreen mode")) self.paramNode.addWidget(self.fullscreen) self.useShaders = CheckBox(engine.defaultSkin.checkBoxStyle, _("Use shaders")) self.paramNode.addWidget(self.useShaders) self.widthEdit.width = 50 self.widthEdit.position = (100, 5) self.widthLabel.position = ( 5, 5 + (self.widthEdit.height - self.widthLabel.font.size)) self.heightEdit.width = 50 self.heightEdit.position = (270, 5) self.heightLabel.position = ( 170, 5 + (self.widthEdit.height - self.widthLabel.font.size)) self.fullscreen.position = (5, self.widthEdit.height + 15) self.useShaders.position = (5, self.fullscreen.position.y + self.fullscreen.height + 5) self.scroll = ScrollArea(engine.defaultSkin.scrollStyle, self.paramNode) self.scroll.position = (self.formBg.position.x + 257, self.formBg.position.y + 149) self.scroll.geometry = (426 + deltaX, 439 + deltaY) self.addWidget(self.scroll) # RadioButton example #self.group = OpenSR.Engine.RadioButtonGroup() #self.r1 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "Yes") #self.r2 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "No") #self.r3 = OpenSR.Engine.RadioButton(engine.defaultSkin().radioButtonStyle, "I dunno lol") #self.r2.setPosition(0, self.r1.height + 5) #self.r3.setPosition(0, self.r2.position.y + self.r2.height + 5) #self.group.addRadioButton(self.r1) #self.group.addRadioButton(self.r2) #self.group.addRadioButton(self.r3) #self.group.setPosition(0, 300) #self.paramNode.addWidget(self.group) self.loadSettings()
def __init__(self, questID): ScriptWidget.__init__(self) ActionListener.__init__(self) self.bg = Sprite("DATA/FormPQuest2/2BG.gi") self.addChild(self.bg) self.paramWindow = NinePatch("ORC/quest_param_win.9.json") self.paramWindow.position = (643, 457) self.paramWindow.geometry = (320, 280) self.addChild(self.paramWindow) self.exitButton = Button("DATA/FormPQuest2/2CloseN.gi", "DATA/FormPQuest2/2CloseA.gi", "DATA/FormPQuest2/2CloseD.gi") self.exitButton.position = (953, 725) self.addWidget(self.exitButton) self.exitButton.addListener(self) self.image = None self.questID = questID self.questFile = resources.datRoot( )['PlanetQuest']['PlanetQuest'][questID].value.replace('\\', '/') player.loadQuest(self.questFile) self.loadImages() self.style = resources.objectManager().getResourceObject( '/world/skin/quest/grey') self.interact = InteractionWidget(Rect(15, 45, 15 + 539, 45 + 363), Rect(15, 482, 15 + 539, 482 + 215), self.style) self.interact.position = (35, 5) self.interact.layer = -2 self.addWidget(self.interact) self.interact.addListener(self) self.paramLabel = ColorLabel("") self.paramLabel.wordWrap = True self.paramLabel.position = (665, 480) self.paramLabel.setFixedSize(280, 280) self.paramLabel.textColor = self.style.color self.paramLabel.selectionColor = self.style.activeColor self.addChild(self.paramLabel) self.skin1Button = Button("DATA/FormPQuest2/2Skin1N.gi", "DATA/FormPQuest2/2Skin1A.gi", "DATA/FormPQuest2/2Skin1D.gi") self.skin1Button.position = (529, 742) self.addWidget(self.skin1Button) self.skin1Button.addListener(self) self.skin2Button = Button("DATA/FormPQuest2/2Skin2N.gi", "DATA/FormPQuest2/2Skin2A.gi", "DATA/FormPQuest2/2Skin2D.gi") self.skin2Button.position = (547, 742) self.addWidget(self.skin2Button) self.skin2Button.addListener(self) self.skin3Button = Button("DATA/FormPQuest2/2Skin3N.gi", "DATA/FormPQuest2/2Skin3A.gi", "DATA/FormPQuest2/2Skin3D.gi") self.skin3Button.position = (565, 742) self.addWidget(self.skin3Button) self.skin3Button.addListener(self) self.skin4Button = Button("DATA/FormPQuest2/2Skin4N.gi", "DATA/FormPQuest2/2Skin4A.gi", "DATA/FormPQuest2/2Skin4D.gi") self.skin4Button.position = (583, 742) self.addWidget(self.skin4Button) self.skin4Button.addListener(self) self.updateWidget()