Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python:
- def add_remove_objects(self, chunk, object_type, remove, chunk_coords):
- update_list = chunk.tiles
- ref_dict = self.reference_dicts["tiles"]
- field_to_update = ui.ids.tile_play_field
- if object_type == "ground_object":
- update_list = chunk.ground_objects
- ref_dict = self.reference_dicts["ground_objects"]
- field_to_update = ui.ids.ground_object_play_field
- #Once ground objects have been added delete the line below.
- return
- if object_type == "decorations":
- update_list = chunk.decorations
- ref_dict = self.reference_dicts["decorations"]
- field_to_update = ui.ids.ground_object_play_field
- #Once room decorations have been added delete the line below.
- return
- tile_size = (field_to_update.size[0] / 21,
- field_to_update.size[1] / 21)
- for thing_x in range(len(update_list)):
- for thing_y in range(len(update_list[thing_x])):
- if update_list[thing_x][thing_y] is not None:
- thing = GameImage(source=ref_dict
- [str(update_list[thing_x]
- [thing_y])].source)
- if chunk_coords:
- thing.x = NumericProperty(thing_x +
- (chunk_coords[0] * 3))
- thing.y = NumericProperty(thing_y +
- (chunk_coords[1] * 3))
- thing.pos = ((thing.x - camera.map_x) * tile_size,
- (thing.y - camera.map_y) * tile_size)
- thing.height, thing.width = tile_size
- if remove is True:
- field_to_update.remove_widget(thing)
- else:
- field_to_update.add_widget(thing)
- KV:
- #:import camera main.Camera
- #:set view_port 21
- <CategoryButton@Button>:
- size_hint_x: .5
- width: self.height
- <GameImage@Image>:
- source: self.source
- allow_stretch: False
- texture_size: self.size[0], self.size[1]
- size_hint_x: None, None
- size_hint_y: None, None
- <Root>:
- UI:
- id: ui
- orientation: 'horizontal'
- LeftPanel:
- id: left_panel
- orientation: 'vertical'
- size_hint: .5, 1
- MessageBox:
- canvas.before:
- Color:
- rgba: 0, 1, 0, 1
- Rectangle:
- pos: self.pos
- size: self.size
- id: message_box
- orientation: 'vertical'
- size_hint: 1, .25
- MessageLabel:
- HudPanel:
- id: hud_panel
- orientation: 'horizontal'
- height: left_panel.height-message_box.height
- HealthColumn:
- canvas.before:
- Color:
- rgba: 1, 0, 0, 1
- Rectangle:
- pos: self.pos
- size: self.size
- orientation: 'vertical'
- size_hint: .25, 1
- HealthBar:
- HealthLabel:
- ExpColumn:
- canvas.before:
- Color:
- rgba: 0, 0, 1, 1
- Rectangle:
- pos: self.pos
- size: self.size
- orientation: 'vertical'
- size_hint: .25, 1
- ExpBar:
- height: hud_panel.height
- ExpLabel:
- SkillColumn:
- id: skill_column
- orientation: 'vertical'
- size_hint: .5, 1
- padding: 0, self.height*.058
- spacing: self.height*.058
- CategoryButton:
- id: corporeal_button
- height: skill_column.height/5
- pos_hint: {'x':.5-(self.size_hint_x/2), 'y':.2}
- CategoryButton:
- id: alchemical_button
- height: skill_column.height/5
- pos_hint: {'x':.5-(self.size_hint_x/2), 'y':.4}
- CategoryButton:
- id: relational_button
- height: skill_column.height/5
- pos_hint: {'x':.5-(self.size_hint_x/2), 'y':.6}
- CategoryButton:
- id: spatial_button
- height: skill_column.height/5
- pos_hint: {'x':.5-(self.size_hint_x/2), 'y':.8}
- CategoryButton:
- id: metaphysical_button
- height: skill_column.height/5
- pos_hint: {'x':.5-(self.size_hint_x/2), 'y':1}
- PlayField:
- canvas.before:
- Color:
- rgba: 1, 1, 0, 1
- Rectangle:
- id: top_border
- pos: self.pos
- size: (self.width, (self.height % view_port)/2)
- Rectangle:
- id: left_border
- pos: self.pos
- size: ((self.width % view_port)/2, self.height)
- Rectangle:
- id: right_border
- pos: (self.x, self.height-((self.height % view_port)/2))
- size: (self.width, (self.height % view_port)/2)
- Rectangle:
- id: bottom_border
- pos: (self.x+self.width-((self.height % view_port)/2), self.y)
- size: ((self.width % view_port)/2, self.height)
- id: play_field
- pos: (ui.width-(self.width/2), ui.y)
- size: (ui.height, ui.height)
- size_hint: (None, None)
- border_thickness: (self.width % view_port)/2
- child_size: (self.size[0]-(self.border_thickness * 2), self.size[1]-(self.border_thickness * 2))
- child_pos: (self.pos[0] + self.border_thickness, self.pos[1] + self.border_thickness)
- TilePlayField:
- id: tile_play_field
- pos: (play_field.child_pos[0], play_field.child_pos[1])
- size: (play_field.child_size[0], play_field.child_size[1])
- size_hint_x: None, None
- size_hint_y: None, None
- GroundObjectPlayField:
- id: ground_object_play_field
- pos: (play_field.child_pos[0], play_field.child_pos[1])
- size: (play_field.child_size[0], play_field.child_size[1])
- size_hint_x: None, None
- size_hint_y: None, None
- ObjectPlayField:
- id: object_play_field
- pos: (play_field.child_pos[0], play_field.child_pos[1])
- size: (play_field.child_size[0], play_field.child_size[1])
- size_hint_x: None, None
- size_hint_y: None, None
- RightPanel:
- canvas.before:
- Color:
- rgba: 0, 1, 0, 1
- Rectangle:
- pos: self.pos
- size: self.size
- id: right_Panel
- orientation: 'vertical'
- size_hint: .5, 1
- StatusPanel:
- canvas.before:
- Color:
- rgba: 1, 0, 0, 1
- Rectangle:
- pos: self.pos
- size: self.size
- id: status_panel
- orientation: 'vertical'
- size_hint: 1, .75
- PledgePanel:
- id: pledge_panel
- size_hint: 1, .2
- PledgeLabel:
- id: pledge_label
- height: 1
- PledgeButton:
- StatusBox:
- size_hint: 1, .55
- id: status_box
- orientation: 'horizontal'
- BuffColumn:
- canvas.before:
- Color:
- rgba: 0, 0, 1, 1
- Rectangle:
- pos: self.pos
- size: self.size
- orientation: 'vertical'
- size_hint: .5, 1
- BuffLabel:
- DebuffColumn:
- canvas.before:
- Color:
- rgba: 1, 1, 0, 1
- Rectangle:
- pos: self.pos
- size: self.size
- orientation:'vertical'
- size_hint: .5, 1
- DebuffLabel:
- MiniMap:
- size_hint: 1, .25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement