Skip to content

Commit

Permalink
videos and images back
Browse files Browse the repository at this point in the history
  • Loading branch information
johnchoi313 committed Oct 9, 2023
1 parent 62952d9 commit acd2d4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
26 changes: 11 additions & 15 deletions examples/NPCs/ArenaDialogueBubbleGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import string
import random


# ------------------------------------------ #
# -----------ARENA BUBBLE GROUP------------- #
# ------------------------------------------ #
Expand Down Expand Up @@ -67,14 +66,11 @@ def start(self):

#self.PlayLastTransform()


#creates new bubbles
def initializeBubbles(self, line = None):
if(line == None):
self.dialogue.currentNode.currentLine = self.dialogue.currentNode.lines[0]
line = self.dialogue.currentNode.currentLine
#self.speechBubble = self.createSpeechBubble(line)
#self.buttons = self.createButtons(line)

# ------------------------------------------ #
# ------------RUNNING COMMANDS-------------- #
Expand Down Expand Up @@ -244,10 +240,10 @@ def PlayVideo(self, video):
self.scene.update_object(self.video)

def HideVideo(self):
#self.ScaleAnimation(self.video, self.lastVideoSize, Scale(0,0,random.uniform(0, 0.01)))
self.lastVideoSize = (0,0,0)
self.ScaleAnimation(self.video, self.lastVideoSize, Scale(0,0,random.uniform(0, 0.01)))
self.lastVideoSize = Scale(0,0,0)
def ShowVideo(self, scale):
#self.ScaleAnimation(self.video, Scale(0,0,random.uniform(0, 0.01)), scale)
self.ScaleAnimation(self.video, Scale(0,0,random.uniform(0, 0.01)), scale)
self.lastVideoSize = scale

#Images
Expand All @@ -272,20 +268,20 @@ def PlayImage(self, img):
self.ShowImage(self.getNewScale(img.w, img.h, img.size))
self.scene.update_object(self.image, url = img.url)
def HideImage(self):
#self.ScaleAnimation(self.image, self.lastImageSize, Scale(0,0,random.uniform(0, 0.01)))
self.lastImageSize = (0,0,0)
self.ScaleAnimation(self.image, self.lastImageSize, Scale(0,0,random.uniform(0, 0.01)))
self.lastImageSize = Scale(0,0,0)
def ShowImage(self, scale):
#self.ScaleAnimation(self.image, Scale(0,0,random.uniform(0, 0.01)), scale)
self.ScaleAnimation(self.image, Scale(0,0,random.uniform(0, 0.01)), scale)
self.lastImageSize = scale

if(USE_DEFAULT_SOUNDS and not self.soundUsedThisLine):
self.PlaySound(SOUND_IMAGE)

#Scaling helper functions.
def ScaleAnimation(self, plane, startScale, endScale):
#animation = Animation(property="scale", start=startScale, end=endScale, easing="easeInOutQuad", dur=PLANE_SCALE_DURATION)
#plane.dispatch_animation(animation)
#self.scene.run_animations(plane)
animation = Animation(property="scale", start=startScale, end=endScale, easing="easeInOutQuad", dur=PLANE_SCALE_DURATION)
plane.dispatch_animation(animation)
self.scene.run_animations(plane)
plane.update_attributes(scale = endScale)

def getNewScale(self, w, h, size):
Expand All @@ -300,7 +296,7 @@ def getNewScale(self, w, h, size):
nw = aspect * scale * size * PLANE_SCALE
nh = 1.0 * scale * size * PLANE_SCALE

return (nw, nh, 1)
return Scale(nw, nh, 1)

#Visibility
def SetVisible(self, key, visible):
Expand All @@ -317,7 +313,7 @@ def SetVisible(self, key, visible):
def ClearCommandProperties(self):
#scale the link button out because delete won't work
if(self.linkButton != None and self.checkIfArenaObjectExists(self.linkButton.box)):
#self.ScaleAnimation(self.linkButton.box, LINK_BUBBLE_SCALE, Scale(0,0,random.uniform(0, 0.01)))
self.ScaleAnimation(self.linkButton.box, LINK_BUBBLE_SCALE, Scale(0,0,random.uniform(0, 0.01)))
self.scene.delete_object(self.linkButton.text)
self.scene.delete_object(self.linkButton.box)

Expand Down
10 changes: 2 additions & 8 deletions examples/NPCs/NPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def __init__(self, scene):
width=ROOT_SIZE,
height=ROOT_SIZE,
position=ROOT_POSITION,
#position=(0,0,0),
#rotation=ROOT_ROTATION,
material = Material(opacity=ROOT_OPACITY, transparent=True, visible=True),
material = Material(opacity=ROOT_OPACITY, transparent=True, visible=False),
sound = None,
persist=True
)
Expand All @@ -69,9 +68,6 @@ def __init__(self, scene):
scene.add_object(self.gltf)





'''
#NPC ROOT OBJECT (with debug box)
self.collider = Box(
Expand Down Expand Up @@ -166,7 +162,6 @@ def user_join_callback(scene, obj, msg):
#npc.bubbles.PlayLastTransform()
npc.bubbles.reloadCurrentLine()
npc.bubbles.PlayAnimation(ANIM_IDLE)

scene.user_join_callback = user_join_callback

#def user_left_callback(scene, obj, msg):
Expand All @@ -179,7 +174,6 @@ def user_join_callback(scene, obj, msg):
# etc.
#scene.user_left_callback = user_left_callback


@scene.run_forever(interval_ms=ENTER_INTERVAL)
def EnterExit_Handler(): #checks whether or not a user is in range of NPC
users = scene.get_user_list()
Expand Down Expand Up @@ -294,5 +288,5 @@ def Speech_Handler(): #iteratively adds characters to speech bubble
#if(npc.bubbles.speechBubble.data.text != npc.bubbles.speech):
scene.update_object(npc.bubbles.speechBubble)


scene.run_tasks()

0 comments on commit acd2d4b

Please sign in to comment.