Пример #1
0
from OpenSR.World import WorldManager, DefaultWorldGen, SystemWidget
from OpenSR.Engine import Engine, ResourceManager, SoundManager, ScriptWidget, ActionListener, \
                          Sprite, GAISprite, SpriteXOrigin, SpriteYOrigin, WidgetNode, Button, \
                          Action, Label, LabelWidget, ColorLabel

from OpenSR.ORC.QuestWidget import QuestWidget
from OpenSR.ORC.QuestSelectionWidget import QuestSelectionWidget

import OpenSR.ORC.Settings
from OpenSR.ORC.WorldGen import WorldGen
import sys
import math

engine = Engine.instance()
resources = ResourceManager.instance()
sound = SoundManager.instance()
world = WorldManager.instance()


class StartMenuWidget(ScriptWidget, ActionListener):
    BG_SPEED = 20.0 / 1000.0
    BUTTON_FILES = {
        'newGame': '2ButNew',
        'loadGame': '2ButLoad',
        'settings': '2ButSettings',
        'records': '2ButRecords',
        'about': '2ButAbout',
        'exit': '2ButExit'
    }
    BUTTONS = ['newGame', 'loadGame', 'settings', 'records', 'about', 'exit']
    BUTTON_SPARSE = 60
Пример #2
0
from OpenSR.Engine import ScriptWidget, ActionListener, Engine, ResourceManager, \
                          SoundManager, RadioButton, RadioButtonGroup, Action
from OpenSR.World import WorldManager

from OpenSR.test.Poly import PolyTestWidget

engine = Engine.instance()
resources = ResourceManager.instance()
sound = SoundManager.instance()
world = WorldManager.instance()

class TestingWidget(ScriptWidget, ActionListener):  
    TESTS = ['None', 'Polyline']
    
    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)
Пример #3
0
from OpenSR.Engine import ResourceManager
from OpenSR.World import WorldManager, WorldGenHook, Point
from OpenSR.ORC.Utils import loadStylesFromDAT
import math
import OpenSR.World.WorldGen as wg

world = WorldManager.instance()
dat = ResourceManager.instance().datRoot()

DAT_SOLAR_STAR_STYLE = '04'
DAT_SOLAR_BG = 'bg70'
DAT_SOLAR_NAME = '02'
SOLAR_SIZE = 7500

# Mercur, Venus, Earth, Mars, Jupiter, Saturn, Neptune
SOLAR_PLANET_STYLES = ['203', '206', '200', '202', '201', '205', '204']
SOLAR_PLANET_NAMES = [
    'Solar.0', 'Solar.1', 'Solar.2', 'Solar.3', 'Solar.4', 'Solar.5', 'Solar.6'
]
SOLAR_PLANET_ORBITS = [500, 800, 1200, 1600, 2000, 2400, 3000]
SOLAR_PLANET_PERIODS = [40.0, 64.0, 96.0, 128.0, 160.0, 192.0, 240.0]
SOLAR_PLANET_HABITABLE = [False, True, True, True, False, False, False]
SOLAR_PLANET_RACE = [None, 'People', 'People', 'People', None, None, None]
SOLAR_PLANET_POPULATION = [None, 10000, 10000, 10000, None, None, None]


class WorldGen(WorldGenHook):
    def generateSolar(self, position):
        races = world.raceManager()

        system = wg.genPlanetarySystem(DAT_SOLAR_NAME, SOLAR_SIZE,