-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of lupa.github.com:LupaDevStudio/Linconym
- Loading branch information
Showing
11 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#:kivy 2.2.1 | ||
|
||
|
||
|
||
<DailyWheelPopup>: | ||
|
||
RelativeLayout: | ||
id: popup_layout | ||
|
||
RelativeLayout: | ||
size_hint: (0.8, 0.8) | ||
pos_hint: {"center_x":0.5, "center_y": 0.625} | ||
|
||
canvas.before: | ||
PushMatrix | ||
Rotate: | ||
angle: root.angle | ||
axis: 0, 0, 1 | ||
origin: self.width/2, self.height/2 | ||
canvas.after: | ||
PopMatrix | ||
|
||
Image: | ||
id: my_image | ||
source: "resources/images/front_daily_wheel.png" | ||
size_hint: (1, 1) | ||
pos_hint: {'center_x': 0.5, "center_y": 0.5} | ||
|
||
Image: | ||
id: image | ||
source: "resources/images/back_daily_wheel.png" | ||
size_hint: (0.8, 0.8) | ||
pos_hint: {'center_x': 0.5, "center_y": 0.625} | ||
|
||
# # Reward frame for Lincoins | ||
# RewardFrame: | ||
# pos_hint: {"center_x": 0.25, "top": 0.45} if root.win_linclues else {"center_x": 0.5, "top": 0.45} | ||
# size_hint: (0.375, 0.15) | ||
# reward: root.number_lincoins_won | ||
# font_ratio: root.font_ratio | ||
# plus_mode: True | ||
# opacity: 1 if root.number_lincoins_won > 0 else 0 | ||
|
||
# # Reward frame for Linclues | ||
# RewardFrame: | ||
# pos_hint: {"center_x": 0.75, "top": 0.45} | ||
# size_hint: (0.375, 0.15) | ||
# reward: root.number_linclues_won | ||
# font_ratio: root.font_ratio | ||
# unit: "linclue" | ||
# opacity: 1 if root.win_linclues else 0 | ||
# plus_mode: True | ||
|
||
ColoredRoundedButton: | ||
id: button | ||
size_hint: (0.4, 0.15) | ||
pos_hint: {"center_x":0.5, "center_y":0.12} | ||
font_ratio: root.font_ratio | ||
font_size: SMALL_BUTTON_FONT_SIZE | ||
text: root.button_label | ||
text_font_name: PATH_TEXT_FONT | ||
background_color: root.secondary_color | ||
touch_color: root.primary_color | ||
color_label: root.color_label_button | ||
release_function: root.release_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
""" | ||
Module to create a popup to allow the user to regenerate lives. | ||
""" | ||
|
||
############### | ||
### Imports ### | ||
############### | ||
|
||
### Python imports ### | ||
|
||
import random as rd | ||
|
||
### Kivy imports ### | ||
|
||
from kivy.properties import ( | ||
StringProperty, | ||
NumericProperty, | ||
ColorProperty, | ||
ObjectProperty | ||
) | ||
from kivy.animation import Animation, AnimationTransition | ||
|
||
### Local imports ### | ||
|
||
from screens.custom_widgets.popup.custom_popup import CustomPopup | ||
|
||
|
||
############# | ||
### Class ### | ||
############# | ||
|
||
|
||
class DailyWheelPopup(CustomPopup): | ||
|
||
title = StringProperty() | ||
angle = NumericProperty(0) | ||
primary_color = ColorProperty() | ||
secondary_color = ColorProperty() | ||
color_label_button = ColorProperty((1, 1, 1, 1)) | ||
release_function = ObjectProperty(lambda: 1 + 1) | ||
button_label = StringProperty() | ||
|
||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self.title = "Daily Wheel" | ||
|
||
def on_open(self): | ||
self.release_function = self.start_animation | ||
self.button_label = "Spin" | ||
return super().on_open() | ||
|
||
def on_angle(self, item, angle): | ||
if angle == 360: | ||
item.angle = 0 | ||
|
||
def start_animation(self): | ||
number_of_turns = rd.randint(4, 8) | ||
last_angle = rd.randint(0, 360) + 360 * number_of_turns | ||
anim = Animation(angle=last_angle, duration=number_of_turns, | ||
t=AnimationTransition.out_quad) | ||
anim.start(self) | ||
self.ids.button.disabled = True | ||
anim.on_complete = self.finish_animation | ||
|
||
def finish_animation(self, *args): | ||
self.button_label = "Close" | ||
self.ids.button.disabled = False | ||
self.release_function = self.dismiss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters