Skip to content

Commit

Permalink
started NPC astronaut branch
Browse files Browse the repository at this point in the history
  • Loading branch information
johnchoi313 committed Nov 30, 2023
1 parent 32941f3 commit f8868ab
Show file tree
Hide file tree
Showing 16 changed files with 4,942 additions and 0 deletions.
645 changes: 645 additions & 0 deletions examples/NPC_Astronaut/ArenaDialogueBubbleGroup.py

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions examples/NPC_Astronaut/Button.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from config import *
from mappings import *
from YarnParser import *
from ColorPrinter import *

import sys
if(USE_DEV_ARENAPY):
sys.path.append(ARENAPY_DEV_PATH)

from arena import *

from asyncio import create_subprocess_exec

class NPCButton():
def __init__(self, scene, npc, name, text, eventHandler, position, rotation, buttonScale, textScale, color, textColor, persist):
self.scene = scene
self.npc = npc

self.box = self.makeButtonBox(name, text, eventHandler, color, position, rotation, buttonTextColor=textColor, buttonScale = buttonScale, persist=persist)
self.text = self.makeButtonText(self.box, name, text, buttonColor=textColor, buttonScale = textScale, persist=persist)

def makeButtonText(self, button, buttonID, buttonText,
buttonColor = Color(255,255,255),
buttonPos = Position(0, 0, 0.6),
buttonRot = Rotation(0,0,0),
buttonScale = Scale(0.5, 2, 1),
persist=False):
#Create Button Text Object
buttonText = Text(
object_id=buttonID+"_text",
text=buttonText,
align="center",

position=buttonPos,
rotation=buttonRot,
scale=buttonScale,

material = Material(color = buttonColor, transparent = False, opacity=1),

parent = button,
persist=persist
)
self.scene.add_object(buttonText)
#Return created object
return buttonText

def makeButtonBox(self, buttonID, buttonText, buttonHandler,
buttonColor = Color(128,128,128),
buttonPos = Position(0,0,0),
buttonRot = Rotation(0,0,0),
buttonScale = Scale(0.4, 0.08, 0.04),
buttonTextColor = Color(255,255,255),
persist=False):
#Create Button Object
button = Box(
object_id=buttonID,

position=buttonPos,
rotation=buttonRot,
#scale=Scale(0,0,0),
scale=buttonScale,

material = Material(color = buttonColor, transparent = True, opacity=CHOICE_BUBBLE_OPACITY),

evt_handler=buttonHandler,
parent = self.npc,
clickable=True,
persist=persist
)
self.scene.add_object(button)
#Button Appearance Animation
animation = Animation(property="scale", start=Scale(0,0,0), end=buttonScale, easing="easeInOutQuad", dur=CHOICE_SCALE_DURATION)
button.dispatch_animation(animation)
self.scene.run_animations(button)
#Return created object
return button
84 changes: 84 additions & 0 deletions examples/NPC_Astronaut/ColorPrinter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import colorama
from colorama import Fore, Back, Style
colorama.init(strip=False)

def printWarning(text):
print(Back.YELLOW + Fore.WHITE + text + Fore.RESET + Back.RESET)
def printError(text):
print(Back.RED + Fore.WHITE + text + Fore.RESET + Back.RESET)

#---PRINT COLOR---#

def printBlack(text):
print(Back.RESET + Fore.BLACK + text + Fore.RESET)
def printBlue(text):
print(Back.RESET + Fore.BLUE + text + Fore.RESET)
def printCyan(text):
print(Back.RESET + Fore.CYAN + text + Fore.RESET)
def printGreen(text):
print(Back.RESET + Fore.GREEN + text + Fore.RESET)
def printMagenta(text):
print(Back.RESET + Fore.MAGENTA + text + Fore.RESET)
def printRed(text):
print(Back.RESET + Fore.RED + text + Fore.RESET)
def printReset(text):
print(Back.RESET + Fore.RESET + text + Fore.RESET)
def printWhite(text):
print(Back.RESET + Fore.WHITE + text + Fore.RESET)
def printYellow(text):
print(Back.RESET + Fore.YELLOW + text + Fore.RESET)

def printLightBlack(text):
print(Back.RESET + Fore.LIGHTBLACK_EX + text + Fore.RESET)
def printLightBlue(text):
print(Back.RESET + Fore.LIGHTBLUE_EX + text + Fore.RESET)
def printLightCyan(text):
print(Back.RESET + Fore.LIGHTCYAN_EX + text + Fore.RESET)
def printLightGreen(text):
print(Back.RESET + Fore.LIGHTGREEN_EX + text + Fore.RESET)
def printLightMagenta(text):
print(Back.RESET + Fore.LIGHTMAGENTA_EX + text + Fore.RESET)
def printLightRed(text):
print(Back.RESET + Fore.LIGHTRED_EX + text + Fore.RESET)
def printLightWhite(text):
print(Back.RESET + Fore.LIGHTWHITE_EX + text + Fore.RESET)
def printLightYellow(text):
print(Back.RESET + Fore.LIGHTYELLOW_EX + text + Fore.RESET)

#---PRINT WITH BACKGROUND---#

def printBlackB(text):
print(Fore.WHITE + Back.BLACK + text + Fore.RESET + Back.RESET)
def printBlueB(text):
print(Fore.WHITE + Back.BLUE + text + Fore.RESET + Back.RESET)
def printCyanB(text):
print(Fore.WHITE + Back.CYAN + text + Fore.RESET + Back.RESET)
def printGreenB(text):
print(Fore.BLACK + Back.GREEN + text + Fore.RESET + Back.RESET)
def printMagentaB(text):
print(Fore.WHITE + Back.MAGENTA + text + Fore.RESET + Back.RESET)
def printRedB(text):
print(Fore.WHITE + Back.RED + text + Fore.RESET + Back.RESET)
def printResetB(text):
print(Fore.WHITE + Back.RESET + text + Fore.RESET + Back.RESET)
def printWhiteB(text):
print(Fore.BLACK + Back.WHITE + text + Fore.RESET + Back.RESET)
def printYellowB(text):
print(Fore.BLACK + Back.YELLOW + text + Fore.RESET + Back.RESET)

def printLightBlackB(text):
print(Fore.WHITE + Back.LIGHTBLACK_EX + text + Fore.RESET + Back.RESET)
def printLightBlueB(text):
print(Fore.WHITE + Back.LIGHTBLUE_EX + text + Fore.RESET + Back.RESET)
def printLightCyanB(text):
print(Fore.WHITE + Back.LIGHTCYAN_EX + text + Fore.RESET + Back.RESET)
def printLightGreenB(text):
print(Fore.WHITE + Back.LIGHTGREEN_EX + text + Fore.RESET + Back.RESET)
def printLightMagentaB(text):
print(Fore.WHITE + Back.LIGHTMAGENTA_EX + text + Fore.RESET + Back.RESET)
def printLightRedB(text):
print(Fore.WHITE + Back.LIGHTRED_EX + text + Fore.RESET + Back.RESET)
def printLightWhiteB(text):
print(Fore.BLACK + Back.LIGHTWHITE_EX + text + Fore.RESET + Back.RESET)
def printLightYellowB(text):
print(Fore.BLACK + Back.LIGHTYELLOW_EX + text + Fore.RESET + Back.RESET)
Loading

0 comments on commit f8868ab

Please sign in to comment.