コード例 #1
0

# =============================================================================
# >> EVENT CLASSES
# =============================================================================
class GG_Team_Win(ESEvent):
    '''Fires when a team wins the game'''

    winner = ShortField(
        min_value=2, max_value=3, comment='Team that won the match')

    loser = ShortField(
        min_value=2, max_value=3, comment='Team that lost the match')

# Get the ResourceFile instance to create the .res file
gg_teamwork_resource = ResourceFile(
    path(__file__).parent.joinpath('gg_teamwork.res'))

# Write the .res file
gg_teamwork_resource.write([GG_Team_Win], overwrite=True)


# =============================================================================
# >> TEAM CLASSES
# =============================================================================
class GGTeams(dict):
    '''Class to store the 2 teams'''

    def __new__(cls):
        '''Creates the new object and adds the teams to the dictionary'''

        # Make sure there is only one instance of the class
コード例 #2
0
        min_value=2, max_value=3, comment='Team that lost the match')


class GG_Team_LevelUp(ESEvent):
    '''Fires when a team levels up'''

    team = ShortField(min_value=2, max_value=3, comment='Team that leveled up')

    old_level = ByteField(
        min_value=1, comment='The old level of the team that leveled up')

    new_level = ByteField(
        min_value=1, comment='The new level of the team that leveled up')

# Get the ResourceFile instance to create the .res file
gg_teamplay_resource = ResourceFile(
    path(__file__).parent.joinpath('gg_teamplay.res'))

# Write the .res file
gg_teamplay_resource.write([GG_Team_Win, GG_Team_LevelUp], overwrite=True)


# =============================================================================
# >> TEAM CLASSES
# =============================================================================
class GGTeams(dict):
    '''Class to store the 2 teams'''

    def __new__(cls):
        '''Creates the new object and adds the teams to the dictionary'''

        # Make sure there is only one instance of the class
コード例 #3
0
ファイル: gg_teamplay.py プロジェクト: robtomlinson/GunGame

class GG_Team_LevelUp(ESEvent):
    '''Fires when a team levels up'''

    team = ShortField(min_value=2, max_value=3, comment='Team that leveled up')

    old_level = ByteField(min_value=1,
                          comment='The old level of the team that leveled up')

    new_level = ByteField(min_value=1,
                          comment='The new level of the team that leveled up')


# Get the ResourceFile instance to create the .res file
gg_teamplay_resource = ResourceFile(
    path(__file__).parent.joinpath('gg_teamplay.res'))

# Write the .res file
gg_teamplay_resource.write([GG_Team_Win, GG_Team_LevelUp], overwrite=True)


# =============================================================================
# >> TEAM CLASSES
# =============================================================================
class GGTeams(dict):
    '''Class to store the 2 teams'''
    def __new__(cls):
        '''Creates the new object and adds the teams to the dictionary'''

        # Make sure there is only one instance of the class
        if not '_the_instance' in cls.__dict__: