Ejemplo n.º 1
0
 public void changeFaction()
 {
     GameDelegates.VoidFunction function = null;
     this.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Faction, FrameFunction.Browse, true, true, true, true, base.Scenario.Factions, base.Scenario.PlayerFactions, "变更控制", "");
     if (function == null)
     {
         function = delegate
         {
             FacilityList list = new FacilityList();
             foreach (Faction faction in base.Scenario.PlayerFactions)
             {
                 list.Add(faction);
             }
             base.Scenario.SetPlayerFactionList(this.Plugins.TabListPlugin.SelectedItemList as GameObjectList);
             foreach (Faction faction in list)
             {
                 if (!base.Scenario.IsPlayer(faction))
                 {
                     faction.EndControl();
                 }
             }
             foreach (Faction faction in base.Scenario.PlayerFactions)
             {
                 if (!list.HasGameObject(faction))
                 {
                     foreach (Routeway routeway in faction.Routeways.GetList())
                     {
                         if (!routeway.IsInUsing)
                         {
                             base.Scenario.RemoveRouteway(routeway);
                         }
                     }
                 }
             }
             if (!base.Scenario.IsPlayer(base.Scenario.CurrentPlayer))
             {
                 if (base.Scenario.CurrentPlayer != null)
                 {
                     base.Scenario.CurrentPlayer.Passed = true;
                     base.Scenario.CurrentPlayer.Controlling = false;
                 }
                 if (!base.Scenario.Factions.HasFactionInQueue(base.Scenario.PlayerFactions))
                 {
                     this.Plugins.DateRunnerPlugin.Reset();
                     this.Plugins.DateRunnerPlugin.RunDays(1);
                 }
             }
             if (this.Scenario.PlayerFactions.Count == 0)
             {
                 this.StartAutoplayMode();
             }
             else
             {
                 this.StopAutoplayMode();
             }
         };
     }
     this.Plugins.GameFramePlugin.SetOKFunction(function);
 }
Ejemplo n.º 2
0
 private void HandleKey(GameTime gameTime)
 {
     GameDelegates.VoidFunction function = null;
     if (this.currentKey != Keys.None)
     {
         if (!base.KeyState.IsKeyUp(this.currentKey))
         {
             return;
         }
         this.currentKey = Keys.None;
     }
     if ((base.Scenario.CurrentPlayer != null) && base.Scenario.CurrentPlayer.Controlling)
     {
         if (this.keyState.IsKeyDown(Keys.D1))
         {
             this.currentKey = Keys.D1;
             this.DateGo(1);
         }
         else if (this.keyState.IsKeyDown(Keys.D2))
         {
             this.currentKey = Keys.D2;
             this.DateGo(2);
         }
         else if (this.keyState.IsKeyDown(Keys.D3))
         {
             this.currentKey = Keys.D3;
             this.DateGo(3);
         }
         else if (this.keyState.IsKeyDown(Keys.D4))
         {
             this.currentKey = Keys.D4;
             this.DateGo(4);
         }
         else if (this.keyState.IsKeyDown(Keys.D5))
         {
             this.currentKey = Keys.D5;
             this.DateGo(5);
         }
         else if (this.keyState.IsKeyDown(Keys.D6))
         {
             this.currentKey = Keys.D6;
             this.DateGo(6);
         }
         else if (this.keyState.IsKeyDown(Keys.D7))
         {
             this.currentKey = Keys.D7;
             this.DateGo(7);
         }
         else if (this.keyState.IsKeyDown(Keys.D8))
         {
             this.currentKey = Keys.D8;
             this.DateGo(8);
         }
         else if (this.keyState.IsKeyDown(Keys.D9))
         {
             this.currentKey = Keys.D9;
             this.DateGo(9);
         }
         else if (this.keyState.IsKeyDown(Keys.D0))
         {
             this.currentKey = Keys.D0;
             this.DateGo(10);
         }
         else if (this.keyState.IsKeyDown(Keys.F1))
         {
             this.currentKey = Keys.F1;
             this.DateGo(30);
         }
         else if (this.keyState.IsKeyDown(Keys.F2))
         {
             this.currentKey = Keys.F2;
             this.DateGo(60);
         }
         else if (this.keyState.IsKeyDown(Keys.F3))
         {
             this.currentKey = Keys.F3;
             this.DateGo(90);
         }
     }
     if (this.keyState.IsKeyDown(Keys.Space))
     {
         this.currentKey = Keys.Space;
         this.Plugins.DateRunnerPlugin.Run();
     }
     if (this.keyState.IsKeyDown(Keys.LeftAlt) && this.keyState.IsKeyDown(Keys.C))
     {
         this.currentKey = Keys.C;
         this.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Faction, FrameFunction.Browse, true, true, true, true, base.Scenario.Factions, base.Scenario.PlayerFactions, "变更控制", "");
         if (function == null)
         {
             function = delegate
             {
                 FacilityList list = new FacilityList();
                 foreach (Faction faction in base.Scenario.PlayerFactions)
                 {
                     list.Add(faction);
                 }
                 base.Scenario.SetPlayerFactionList(this.Plugins.TabListPlugin.SelectedItemList as GameObjectList);
                 foreach (Faction faction in list)
                 {
                     if (!base.Scenario.IsPlayer(faction))
                     {
                         faction.EndControl();
                     }
                 }
                 foreach (Faction faction in base.Scenario.PlayerFactions)
                 {
                     if (!list.HasGameObject(faction))
                     {
                         foreach (Routeway routeway in faction.Routeways.GetList())
                         {
                             if (!routeway.IsInUsing)
                             {
                                 base.Scenario.RemoveRouteway(routeway);
                             }
                         }
                     }
                 }
                 if (!base.Scenario.IsPlayer(base.Scenario.CurrentPlayer))
                 {
                     base.Scenario.CurrentPlayer.Passed = true;
                     base.Scenario.CurrentPlayer.Controlling = false;
                     if (!base.Scenario.Factions.HasFactionInQueue(base.Scenario.PlayerFactions))
                     {
                         this.Plugins.DateRunnerPlugin.Reset();
                         this.Plugins.DateRunnerPlugin.RunDays(1);
                     }
                 }
             };
         }
         this.Plugins.GameFramePlugin.SetOKFunction(function);
     }
 }