예제 #1
0
 public void Setup()
 {
     MockCommand    = new Mock <GameCommand>();
     CommandStorage = new CommandStorageImpl(
         new[] { MockCommand.Object }
         );
 }
예제 #2
0
        /// <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);
        }
예제 #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);
        }
예제 #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();
        }
예제 #5
0
 public CommandExecutorImpl(UIInput input, CommandStorage commandStorage, Logger logger)
 {
     Input          = input;
     CommandStorage = commandStorage;
     Logger         = logger;
 }
예제 #6
0
 /// <summary>
 /// Sets the command storage instance.
 /// </summary>
 public void SetCommandStorage(CommandStorage CommandStorage)
 {
     this.Commands = CommandStorage;
 }
예제 #7
0
 /// <summary>
 /// Sets the command queue instance.
 /// </summary>
 public void SetCommandQueue(CommandStorage CommandStorage)
 {
     this.Queue = CommandStorage;
 }
예제 #8
0
 public TeamPainterNetClient()
 {
     _commands = new CommandStorage();
     _isActive = false;
 }