예제 #1
0
 public WaitState(DwarfGame game, string name, GameStateManager stateManager, WaitThreadRoutine routine)
     : base(game, name, stateManager)
 {
     WaitThread = new Thread(() =>
     {
         System.Threading.Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
         System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
         runRoutine(routine);
     })
     {
         IsBackground = true
     };
     OnFinished = (Boolean, Exception) => { };
     Done       = false;
     GuiRoot    = new Gui.Root(DwarfGame.GuiSkin)
     {
         MousePointer = new MousePointer("mouse", 15.0f, 16, 17, 18, 19, 20, 21, 22, 23)
     };
     GuiRoot.RootItem.AddChild(new Widget()
     {
         Text                = name,
         Font                = "font18-outline",
         AutoLayout          = AutoLayout.DockFill,
         TextColor           = Color.White.ToVector4(),
         TextHorizontalAlign = HorizontalAlign.Center,
         TextVerticalAlign   = VerticalAlign.Center,
         Rect                = GuiRoot.RenderData.VirtualScreen
     });
 }
예제 #2
0
 public WaitState(DwarfGame game, string name, GameStateManager stateManager, WaitThreadRoutine routine, DwarfGUI gui)
     : base(game, name, stateManager)
 {
     WaitThread = new Thread(() => runRoutine(routine));
     GUI        = gui;
     OnFinished = (Boolean, Exception) => { };
     Done       = false;
 }
예제 #3
0
 protected void runRoutine(WaitThreadRoutine routine)
 {
     try
     {
         success = routine();
     } catch (WaitStateException e)  // allows any exceptions we didn't throw on purpose to be thrown properly
     {
         this.exception = e;
     }
 }