Beispiel #1
0
 public void Setup()
 {
     MockCommand    = new Mock <GameCommand>();
     CommandStorage = new CommandStorageImpl(
         new[] { MockCommand.Object }
         );
 }
        /// <summary>
        /// Bind to a command when the TargetProperty is known
        /// </summary>
        /// <param name="control"></param>
        /// <param name="bindingOptions"></param>
        /// <param name="targetPropertyName"></param>
        public void ExecuteCommandBind(IBindingTarget control, Options bindingOptions, string targetPropertyName)
        {
            BindingDef binding = new BindingDef(control, targetPropertyName, bindingOptions, controlService);

            CommandStorage.Add(binding);
            ExecuteCommandBind(control, binding);
        }
Beispiel #3
0
        public string GetCommandText(string commandID)
        {
            string cmdText = CommandStorage.GetCommandText(commandID);

            if (string.IsNullOrEmpty(cmdText))
            {
                throw new Exception(string.Format("命令{0}不存在", commandID));//未找到指定命令抛出异常
            }
            return(cmdText);
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new battle.
        /// </summary>
        public static void InitBattle(Player[] Players, GameModeData GameMode)
        {
            if (Players.Length <= 0)
            {
                return;
            }

            ArenaData ArenaData = null;

            CommandStorage Storage = new CommandStorage();
            CommandStorage Queue   = new CommandStorage();

            object Locker = new object();

            for (int I = 0; I < Players.Length; I++)
            {
                if (ArenaData == null || Players[I].Arena.DemoteTrophyLimit > ArenaData.DemoteTrophyLimit)
                {
                    ArenaData = Players[I].Arena;
                }
            }

            for (int I = 0; I < Players.Length; I++)
            {
                Player Player = Players[I];

                Player.GameMode.LoadBattleState();

                for (int J = 0; J < Players.Length; J++)
                {
                    Player.GameMode.AddPlayer(Players[J], J);
                }

                Player.GameMode.Battle.SetArena(ArenaData);
                Player.GameMode.Battle.SetLocation(ArenaData.PvPLocationData);
                Player.GameMode.Battle.SetGameMode(GameMode);

                Player.GameMode.SectorManager.SetCommandStorage(Storage);
                Player.GameMode.SectorManager.SetCommandQueue(Queue);
                Player.GameMode.SectorManager.SetLocker(Locker);
            }

            BattleManager.InitBattleTimer(Players, Locker).Start();
        }
Beispiel #5
0
 public CommandExecutorImpl(UIInput input, CommandStorage commandStorage, Logger logger)
 {
     Input          = input;
     CommandStorage = commandStorage;
     Logger         = logger;
 }
Beispiel #6
0
 /// <summary>
 /// Sets the command storage instance.
 /// </summary>
 public void SetCommandStorage(CommandStorage CommandStorage)
 {
     this.Commands = CommandStorage;
 }
Beispiel #7
0
 /// <summary>
 /// Sets the command queue instance.
 /// </summary>
 public void SetCommandQueue(CommandStorage CommandStorage)
 {
     this.Queue = CommandStorage;
 }
Beispiel #8
0
 public TeamPainterNetClient()
 {
     _commands = new CommandStorage();
     _isActive = false;
 }