def SetViewscreenCamera(pAction, sSetName, sCameraName = None): pBridge = App.BridgeSet_Cast(App.g_kSetManager.GetSet("bridge")) pSet = App.g_kSetManager.GetSet(sSetName) if (pBridge == None) or (pSet == None): return 0 pViewscreen = pBridge.GetViewScreen() if (sCameraName != None): pCamera = App.CameraObjectClass_GetObject(pSet, sCameraName) else: pCamera = pSet.GetActiveCamera() if (pCamera == None): # Try getting the player's camera from the game. pCamera = App.Game_GetPlayerCamera() if (pCamera == None): # Try getting "MainPlayerCamera". pCamera = App.CameraObjectClass_GetObject(pSet, "MainPlayerCamera") if (pViewscreen == None) or (pCamera == None): return 0 pViewscreen.SetRemoteCam(pCamera) pViewscreen.SetIsOn(1) return 0
def Terminate(): # Stop the beeping! RemoveBeepTimer() # Remove all of our generic bridge sounds we loaded App.g_kSoundManager.DeleteAllSoundsInGroup("BridgeGeneric") # Unload all common animations UnloadCommonAnimations() # Unload all prefetched animations and sounds pBridgeSet = App.BridgeSet_Cast(App.g_kSetManager.GetSet("bridge")) if (pBridgeSet): # Unload animations of the previous bridge pcOldBridgeConfigScript = pBridgeSet.GetConfig() pOldMod = __import__("Bridge." + pcOldBridgeConfigScript) pOldMod.UnloadAnimations() pOldMod.UnloadSounds()
def Load(sBridgeConfigScript): # kDebugObj.Print("Loading the " + sBridgeConfigScript + " bridge") # # Check to see if there is a Set called "bridge" already. If not, create # it for the first time. # pBridgeSet = App.BridgeSet_Cast(App.g_kSetManager.GetSet("bridge")) if (pBridgeSet == None): # kDebugObj.Print("No previous bridge") pBridgeSet = CreateAndPopulateBridgeSet() else: # Reset all the extras.. ResetExtraLocations() # # If it already existed, check to see if the bridge set is configured # for what we are requesting. If so, we're done. Otherwise, unload # the previous config and load up with the new one # if (pBridgeSet.IsSameConfig(sBridgeConfigScript)): # kDebugObj.Print(sBridgeConfigScript + " is already loaded") return else: # Unload animations and sounds of the previous bridge pcOldBridgeConfigScript = pBridgeSet.GetConfig() pOldMod = __import__("Bridge." + pcOldBridgeConfigScript) pOldMod.UnloadAnimations() pOldMod.UnloadSounds() # Save away the camera our viewscreen was displaying pCamera = None pViewScreen = pBridgeSet.GetViewScreen() if (pViewScreen != None): pCamera = pViewScreen.GetRemoteCam() # # Remove the old bridge model and viewscreen, if they existed # pBridgeSet.DeleteObjectFromSet("bridge") # Remove the bridge, if it exists pBridgeSet.DeleteObjectFromSet( "viewscreen") # Remove viewscreen, if it exists pBridgeSet.DeleteCameraFromSet( "maincamera") # Remove maincamera, if it exists # # Now call the config script to create our bridge model, viewscreen # and to configure our characters to that bridge # pMod = __import__("Bridge." + sBridgeConfigScript) pMod.CreateBridgeModel(pBridgeSet) pMod.ConfigureCharacters(pBridgeSet) pMod.PreloadAnimations() if (pCamera != None): # reset our viewscreen to its pViewScreen = pBridgeSet.GetViewScreen() pViewScreen.SetRemoteCam(pCamera) # previous state, if it had one pViewScreen.SetIsOn(1) pBridgeSet.SetConfig(sBridgeConfigScript) # store our config import Bridge.Characters.CommonAnimations Bridge.Characters.CommonAnimations.PutGuestChairOut()