HOME LINE UP

From Torrid Leopard, 1 Week ago, written in Plain Text, viewed 3 times. This paste will slip away in 2 Weeks.
URL https://paste.afonso.co/view/6c792400 Embed
Download Paste or View Raw
  1. import smartpaging
  2. import helper
  3. from System.Threading.Tasks import Task
  4. from System.IO import Path, File
  5.  
  6. highlightStart = 0.0
  7. highlightSubtract = 0.184
  8.  
  9. def __onStart(graphicOnAirItem, momentExecution, workFlowtype, graphicOnAirItems):     
  10.  
  11.         Scheduler.ClearScheduler()
  12.         extradata = graphicOnAirItem.ExtraData
  13.         graphicOnAir = IntelliflowController.GetGraphicOnAirItems(graphicOnAirItem.Graphic, OutputManager.ActiveChannelOutput)
  14.        
  15.         if not graphicOnAir:
  16.                 list = []
  17.                 for player in Game.HomeTeam.InPlayByKeeperAndShirt:
  18.                         list.append(player)
  19.                 list.append(Game.HomeTeam.Coach)
  20.                 results = list #Game.HomeTeam.InPlayByKeeperAndShirt
  21.                 counter = len(results) + 1
  22.                 if counter == 0 or counter == 1:
  23.                         momentExecution.Message = "HOME LINEUP: No players In play!"
  24.                         momentExecution.Cancel = True
  25.                         return
  26.                 extradata["index"] = 0
  27.                 extradata["pageIndex"] = 0
  28.                 extradata["pages"] = smartpaging.NonUniformPaging(counter, 1 if counter > 2 else 2)
  29.                 extradata["players"] = results
  30.                 extradata["highlightStart"] = highlightStart
  31.         else:
  32.                 if not "pageIndex" in extradata:
  33.                         momentExecution.Cancel = True
  34.                         return
  35.                
  36. def __getData(graphicOnAirItem, viewBag, momentExecution):
  37.        
  38.         extradata = graphicOnAirItem.ExtraData
  39.        
  40.         viewBag.SetString("tCaptainInfo", "C")
  41.         viewBag.SetString("tPlayerInfo", "GK")
  42.         viewBag.SetFloat("vHighlightType", 1)
  43.                        
  44.         ### TEAM INFORMATION
  45.         logosPath = Path.Combine(graphicOnAirItem.GraphicsEngine.Options.RootPath, graphicOnAirItem.Scene.Path, "Images", "Badges")
  46.         team_path = Path.Combine(logosPath, "%s.png"%(Game.HomeTeam.RefName))
  47.        
  48.         if File.Exists(team_path):
  49.                 viewBag.SetImage("lgTeamBadge", "Images\Badges\%s.png" % Game.HomeTeam.RefName)
  50.         else:
  51.                 viewBag.SetImage("lgTeamBadge", "Images\\vaz.png")
  52.        
  53.         viewBag.SetString("tTeamName", Game.HomeTeam.ShortName.upper())
  54.        
  55.         ### COACH INFORMATION
  56.         viewBag.SetTranslatedText("tCoachFunction", "{{%s}}.{{LineUp}}|filter:ToUpper " % Game.HomeTeam.Coach.Function)
  57.         viewBag.SetString("tCoachFirstName", Game.HomeTeam.Coach.FirstName)
  58.         viewBag.SetString("tCoachLastName", Game.HomeTeam.Coach.LastName)
  59.         viewBag.SetVisibility("vCoachAtRiskVisibility", Game.HomeTeam.Coach.AtRisk)
  60.  
  61.         for enum,player in enumerate(Game.HomeTeam.InPlayByKeeperAndShirt):
  62.                 viewBag.SetVisibility("vAtRiskVisibility%02d" % (enum+1), player.AtRisk)
  63.                 viewBag.SetVisibility("vPlayerInfo%02dVisibility" % (enum+1), player.IsGoalKeeper)
  64.                
  65.                 viewBag.SetString("tNumber%02d" % (enum+1), player.Number)
  66.                
  67.                 if player.IsCaptain:
  68.                         viewBag.SetFloat("vTypeCaptain", enum+1)
  69.        
  70.                 if player.OtherNames:
  71.                         viewBag.SetString("tLastName%02d" % (enum+1), player.OtherNames.upper())
  72.                 else:
  73.                         viewBag.SetString("tName%02d" % (enum+1), player.FirstName.upper())
  74.                         viewBag.SetString("tLastName%02d" % (enum+1), player.LastName.upper())
  75.  
  76.         playerPath = Path.Combine(graphicOnAirItem.GraphicsEngine.Options.RootPath, graphicOnAirItem.Scene.Path, "Images", "Photos", Game.HomeTeam.RefName.ToString(), "%s.png" % Game.HomeTeam.InPlayByKeeperAndShirt[0].RefName.ToString())
  77.         if File.Exists(playerPath):
  78.                 viewBag.SetImage("lgPhoto", "Images\Photos\%s\%s.png" % (Game.HomeTeam.RefName.ToString(), Game.HomeTeam.InPlayByKeeperAndShirt[0].RefName.ToString()))
  79.         else:
  80.                 viewBag.SetImage("lgPhoto", "Images\Photos\\vaz.png")
  81.        
  82.         viewBag.SetFloat("vHighlightStart", 0)
  83.         viewBag.SetFloat("vHighlightEnd", 0)
  84.  
  85.                
  86. def __continueGraphic(args):           
  87.         graphicOnAirItem, momentExecution, graphicOnAirItems = args
  88.         extradata = graphicOnAirItem.ExtraData
  89.         pages = extradata["pages"]
  90.         total = extradata["total"]
  91.         index = extradata["index"]
  92.         players = extradata["players"]
  93.  
  94.         viewBag = IntelliflowController.CreateViewBag()
  95.  
  96.         if int(index) == 0:
  97.                 for g in graphicOnAirItems:
  98.                         g.Scene.Show("BadgeToPhoto")
  99.                         g.Scene.Wait("BadgeToPhoto")
  100.                         g.Scene.Show("Highlight_In")
  101.                         g.Scene.Show("Highlight_Scroll")
  102.         else:
  103.                 if index == 11:
  104.                         viewBag.SetFloat("vHighlightType", 2)  
  105.                 playerPath = Path.Combine(graphicOnAirItem.GraphicsEngine.Options.RootPath, graphicOnAirItem.Scene.Path, "Images", "Photos", Game.HomeTeam.RefName.ToString(), "%s.png" % players[int(index)].RefName.ToString())
  106.                 if File.Exists(playerPath):
  107.                         viewBag.SetImage("lgPhoto", "Images\Photos\%s\%s.png" % (Game.HomeTeam.RefName.ToString(), players[int(index)].RefName.ToString()))
  108.                 else:
  109.                         viewBag.SetImage("lgPhoto", "Images\Photos\\vaz.png")
  110.  
  111.                 viewBag.SetFloat("vHighlightStart", extradata["highlightStart"] + 0.184)
  112.                 viewBag.SetFloat("vHighlightEnd", extradata["highlightStart"])
  113.  
  114.                 for render in graphicOnAirItems:
  115.                         render.Scene.FillTags(viewBag)
  116.                
  117.                 for g in graphicOnAirItems:
  118.                         g.Scene.Show("PhotoChange_In")
  119.                         g.Scene.Show("Highlight_Scroll")
  120.        
  121.                
  122.         helper.SetExtraData(extradata, "highlightStart", extradata["highlightStart"] - highlightSubtract)
  123.        
  124.         delay = int(Project.ProjectSettings["LineUpTactical Timer (ms)"]) / extradata["pages"].Count
  125.        
  126.         if index < 11:
  127.                 extradata["index"] = extradata["index"] + 1
  128.                 args = [graphicOnAirItem, momentExecution, graphicOnAirItems]
  129.                 Scheduler.Add(Script.RefName, "__continueGraphic", Project.Name, args, delay)
  130.         else:
  131.                 Scheduler.Add(Script.RefName, "__takeOut", Project.Name, graphicOnAirItem, delay)
  132.        
  133.  
  134. def __afterProgram(graphicOnAirItem, momentExecution, graphicOnAirItems):
  135.         extradata = graphicOnAirItem.ExtraData
  136.         pages = extradata["pages"]
  137.         index = extradata["index"]
  138.  
  139.         delay = int(Project.ProjectSettings["LineUpTactical Timer (ms)"]) / extradata["pages"].Count
  140.         if index < pages:
  141.                 args = [graphicOnAirItem, momentExecution, graphicOnAirItems]
  142.                 Scheduler.Add(Script.RefName, "__continueGraphic", Project.Name, args, delay)
  143.  
  144. def __takeOut(graphicOnAirItem):
  145.         IntelliflowController.TakeOut(graphicOnAirItem.Graphic, OutputManager.ActiveChannelOutput)
  146.  
  147. def __beforeProgramOut(graphicOnAirItem, momentExecution):
  148.         Scheduler.ClearScheduler()
  149.  
  150. def __afterPanic(graphicOnAirItem, momentExecution):
  151.         Scheduler.ClearScheduler()

Reply to "HOME LINE UP"

Here you can reply to the paste above