Guest User

Untitled

a guest
Jul 24th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. namespace WorldScript
  2. {
  3.     [WorldScript color="#8fbc8f" icon="system/icons.png;64;384;32;32"]
  4.     class ChangeScore : IWidgetHoster
  5.     {
  6.         TextWidget@ m_faggyWidget;
  7.         TextWidget@ m_scoobyWidget;
  8.        
  9.         [Editable max=1 validation=IsVariable]
  10.         UnitFeed Variable;
  11.        
  12.         bool IsVariable(UnitPtr unit)
  13.         {
  14.             return cast<Variable>(unit.GetScriptBehavior()) !is null;
  15.         }
  16.        
  17.         bool IsExecutable(UnitPtr unit)
  18.         {
  19.             WorldScript@ script = WorldScript::GetWorldScript(unit);
  20.             if (script is null)
  21.                 return false;
  22.        
  23.             return script.IsExecutable();
  24.         }
  25.         SValue@ ServerExecute()
  26.         {
  27.             auto variable = Variable.FetchFirst();
  28.        
  29.             if (!variable.IsValid())
  30.                 return null;
  31.            
  32.             Variable@ var = cast<Variable>(variable.GetScriptBehavior());
  33.            
  34.             bool result = false;
  35.             m_scoobyWidget.SetText(var.Value);
  36.             return null;
  37.         }
  38.  
  39.         ChangeScore(GUIBuilder@ b)
  40.         {
  41.             GUIDef@ def = LoadWidget(b, "gui/hud/survival.gui");
  42.             @m_faggyWidget = cast<TextWidget>(m_widget.GetWidgetById("faggy"));
  43.             @m_scoobyWidget = cast<TextWidget>(m_widget.GetWidgetById("scooby"));
  44.         }
  45.  
  46.         void Update(int dt) override
  47.         {
  48.             IWidgetHoster::Update(dt);
  49.            
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment