Untitled

From Crimson Madrill, 3 Weeks ago, written in Plain Text, viewed 2 times. This paste will cross the great divide in 6 Days.
URL https://paste.afonso.co/view/0424f5ca Embed
Download Paste or View Raw
  1. # -*- encoding: utf-8 -*-
  2. clr.AddReference("Wtvision.Sports.Models.Football")
  3. from Wtvision.Sports.Models.Football import FootballEvents
  4. clr.AddReference("Wtvision.Link.R3SpaceEngine")
  5. from Wtvision.Link import R3SpaceEngine
  6. from System.IO import Path, Directory
  7.  
  8. from System.Threading.Tasks import Task
  9.  
  10. from Wtvision.Link import R3SpaceEngine
  11. from Wtvision.Tools.Graphics import Tools
  12. from itertools import islice
  13.  
  14. global team
  15. global playersNumbersIn
  16. global playersNumbersOut
  17.  
  18.  
  19. def externalTake(gameTeam, substitutionsList):
  20.         global team
  21.         global playersNumbersIn
  22.         global playersNumbersOut
  23.        
  24.         playersIn = []
  25.         playersOut = []
  26.         for sub in substitutionsList:
  27.                 playersIn.append(sub["PlayerIn"])
  28.                 playersOut.append(sub["PlayerOut"])
  29.                
  30.        
  31.         team = Game.HomeTeam if gameTeam == "Home" else Game.AwayTeam
  32.        
  33.         playersNumbersIn = playersIn
  34.         playersNumbersOut = playersOut
  35.        
  36.         graph = GraphicTemplatesManager.GetGraphicByName(Script.Name)
  37.         graphicsOnAir = IntelliflowController.GetGraphicOnAirItems(graph.Name, OutputManager.ActiveChannelOutput)
  38.  
  39.         IntelliflowController.TakeIn(graph, OutputManager.ActiveChannelOutput, workflowType = IntelliflowController.EWorkflowType.Preview)
  40.  
  41.  
  42. def __onStart(graphicOnAirItem, momentExecution, workFlowtype):
  43.         global team
  44.         global playersNumbersIn
  45.         global playersNumbersOut
  46.        
  47.         if GameOnline.Clock.ActivePart.Name.ToString() == "First Half" or GameOnline.Clock.ActivePart.Name.ToString() == "First Extra Time":
  48.                 momentExecution.Message = "CANNOT TAKE THIS GRAPHIC IN FIRST HALF OR FIRST EXTRA TIME"
  49.                 momentExecution.Cancel = True
  50.                 return
  51.        
  52.         if workFlowtype.ToString() != "PreviewToProgram":
  53.                 delCount = len(playersNumbersOut)
  54.                 for sub in islice(playersNumbersOut, delCount):
  55.                         if __validationPlayers(team.InGame, sub.ToString(), "Out") == False:
  56.                                 momentExecution.Message = "The following OUT number is invalid: %s" %sub.ToString()
  57.                                 momentExecution.Cancel = True
  58.                                 return
  59.                        
  60.                 delCount = len(playersNumbersIn)
  61.                 for sub in islice(playersNumbersIn, delCount):
  62.                         if __validationPlayers(team.InGame, sub.ToString(), "In") == False:
  63.                                 momentExecution.Message = "The following IN number is invalid: %s" %sub.ToString()
  64.                                 momentExecution.Cancel = True
  65.                                 return
  66.                        
  67.                
  68.                 playersNumbersIn = playersNumbersIn[-delCount:]
  69.                 playersNumbersOut = playersNumbersOut[-delCount:]
  70.                
  71.  
  72. def __validationPlayers(team, playerNumber, typePlayer = None):
  73.         global playersNumbersIn
  74.         global playersNumbersOut
  75.         outMatchNumber = 0
  76.         inMatchNumber = 0
  77.         for enum, player in enumerate(team):
  78.                 if player.Number.ToString() == playerNumber.ToString():
  79.                         if typePlayer == "Out":
  80.                                 playersNumbersOut.append(player)
  81.                                 outMatchNumber += 1
  82.                         elif typePlayer == "In":
  83.                                 playersNumbersIn.append(player)
  84.                                 inMatchNumber += 1
  85.                         return True
  86.        
  87.         if outMatchNumber == 0:
  88.                 return False
  89.         if inMatchNumber == 0:
  90.                 return False
  91.         return False
  92.  
  93.  
  94. def __getData(graphicOnAirItem, viewBag, momentExecution):
  95.         viewBag.Clear()
  96.  
  97.         size = len(playersNumbersOut)
  98.         viewBag.SetString("vLines", size)
  99.         viewBag.SetFloat("vArrowType", 2)
  100.         viewBag.SetVisibility("vTitleVisibility", True)
  101.         viewBag.SetTranslatedText("tTitle", "{{Half-Time Substitution}}.{{Substitution Plural}}|filter:ToUpper ")
  102.         if GameOnline.Clock.ActivePart.Name.ToString() == "After 90 Minutes":
  103.                 viewBag.SetTranslatedText("tTitle", "{{Substitution}}.{{Substitution Plural}}|filter:ToUpper ")
  104.         if GameOnline.Clock.ActivePart.Name.ToString() == "Extra-Time Break" or GameOnline.Clock.ActivePart.Name.ToString() == "Second Extra Time":
  105.                 viewBag.SetTranslatedText("tTitle", "{{Extra-Time Break Substitution}}.{{Substitution Plural}}|filter:ToUpper ")
  106.        
  107.         viewBag.SetTranslatedText("tInformation", "{{PLAYERS OUT}}.{{Substitution}}")
  108.        
  109.  
  110.         viewBag.SetImage("lgTeamBadge", "Images/Badges/%s.png" % team.RefName)
  111.        
  112.         for enum, playerOut in enumerate(playersNumbersOut, 1):
  113.                 viewBag.SetString("tPlayerNumber%02d" % enum, playerOut.Number)
  114.                 viewBag.SetString("tPlayerFirstName%02d" % enum, "")
  115.                
  116.                 viewBag.SetString("tPlayerLastName%02d" % enum, playerOut.LastName)
  117.                 if playerOut.LastName == "":
  118.                         viewBag.SetString("tPlayerLastName%02d" % enum, playerOut.NickName)
  119.                        
  120.         graphicOnAirItem.ExtraData["Team"] = team
  121.         graphicOnAirItem.ExtraData["PlayersIn"] = playersNumbersIn
  122.         graphicOnAirItem.ExtraData["PlayersOut"] = playersNumbersOut   
  123.        
  124.  
  125.  
  126. def __afterProgram(graphicOnAirItem, momentExecution):
  127.         global playersNumbersIn
  128.         global playersNumbersOut
  129.  
  130.         graphic = GraphicTemplatesManager.GetGraphicByName("SUBSTITUTION MULTI OUT + IN HALFTIME CONTINUE")
  131.         graphicsOnAirItem = IntelliflowController.GetGraphicOnAirItems(graphic, OutputManager.ActiveChannelOutput)
  132.        
  133.         IntelliflowController.TakeIn(graphic, OutputManager.ActiveChannelOutput, workflowType = IntelliflowController.EWorkflowType.Preview, extraData = graphicOnAirItem.ExtraData)

Reply to "Untitled"

Here you can reply to the paste above