public static ICommandAction Create(DbCommandTree commandTree)
        {
            ICommandAction action = null;

            if (commandTree is DbQueryCommandTree)
            {
                action = new QueryCommandAction(commandTree as DbQueryCommandTree);
            }
            else if (commandTree is DbInsertCommandTree)
            {
                action = new InsertCommandAction(commandTree as DbInsertCommandTree);
            }
            else if (commandTree is DbUpdateCommandTree)
            {
                action = new UpdateCommandAction(commandTree as DbUpdateCommandTree);
            }
            else if (commandTree is DbDeleteCommandTree)
            {
                action = new DeleteCommandAction(commandTree as DbDeleteCommandTree);
            }

            if (action == null)
            {
                throw new NotSupportedException("Not supported DbCommandTree type");
            }

            return(action);
        }
Beispiel #2
0
 /// <summary>
 /// 添加监视窗体
 /// </summary>
 /// <param name="MonitorCtrl">要监视的窗体</param>
 public void AddMonitorList(ICommandAction MonitorCtrl)
 {
     if (!MonitorCtrl.ReceiverList.Contains(this))
     {
         MonitorCtrl.ReceiverList.Add(this);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 删除监视窗体
 /// </summary>
 /// <param name="MonitorCtrl">要监视的窗体</param>
 public void RemoveMonitorList(ICommandAction MonitorCtrl)
 {
     if (!MonitorCtrl.ReceiverList.Contains(this))
     {
         MonitorCtrl.ReceiverList.Remove(this);
     }
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="EffortEntityCommand" /> class
        ///     based on  a provided command tree.
        /// </summary>
        /// <param name="commandtree">
        ///     The command tree that describes the operation.
        /// </param>
        public EffortEntityCommand(DbCommandTree commandtree)
        {
            this.commandAction = CommandActionFactory.Create(commandtree);

            foreach (KeyValuePair <string, TypeUsage> param in commandtree.Parameters)
            {
                this.AddParameter(param.Key);
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="EffortEntityCommand" /> class
        ///     based on a prototype instance.
        /// </summary>
        /// <param name="prototype">
        ///     The prototype <see cref="EffortEntityCommand" /> object.
        /// </param>
        private EffortEntityCommand(EffortEntityCommand prototype)
        {
            this.commandAction = prototype.commandAction;

            foreach (EffortParameter parameter in prototype.Parameters)
            {
                this.AddParameter(parameter.ParameterName);
            }
        }
Beispiel #6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="EffortEntityCommand" /> class 
        ///     based on a prototype instance.
        /// </summary>
        /// <param name="prototype">
        ///     The prototype <see cref="EffortEntityCommand" /> object.
        /// </param>
        private EffortEntityCommand(EffortEntityCommand prototype)
        {
            this.commandAction = prototype.commandAction;

            foreach (EffortParameter parameter in prototype.Parameters)
            {
                this.AddParameter(parameter.ParameterName);
            }
        }
Beispiel #7
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="EffortEntityCommand" /> class 
        ///     based on  a provided command tree.
        /// </summary>
        /// <param name="commandtree">
        ///     The command tree that describes the operation.
        /// </param>
        public EffortEntityCommand(DbCommandTree commandtree)
        {
            this.commandAction = CommandActionFactory.Create(commandtree);

            foreach (KeyValuePair<string, TypeUsage> param in commandtree.Parameters)
            {
                this.AddParameter(param.Key);
            }
        }
        public ActionContest(BattleActor initiator, BattleActor target, ICommandAction commandAction)
        {
            this.initiator = initiator;
            this.target    = target;
            action         = commandAction;

            attackResult = PerformContestCalculation();
            target.TrySetAnimationState(ActorStateMachine.Actions.ActionAnimationState.Guard);
        }
Beispiel #9
0
        private ShipModel_Battle _GetFirstActionShip(ICommandAction cmdAction)
        {
            HougekiListModel hougekiListModel = cmdAction as HougekiListModel;

            if (hougekiListModel != null && hougekiListModel.Count > 0)
            {
                return(hougekiListModel.GetData(0).Attacker);
            }
            return((cmdAction as RaigekiModel)?.GetFirstActionShip());
        }
        public bool TryParseCommand(string input, out ICommandAction action)
        {
            CommandUsageMatchData match = Commands.Parse(input);

            if (match == null)
            {
                action = null;
                return(false);
            }

            action = BuildAction(input, match);
            return(true);
        }
Beispiel #11
0
        public void BattleCommandSet(ActionType actionType, BattleActor target)
        {
            TrySetActionState(actionType);
            currentTarget = target;

            ICommandAction ca = (ICommandAction)actionFSM.currentStateImplementation;

            if (ca == null)
            {
                throw new System.Exception("Error trying to set BattleCommand");
            }
            battleManager.NewBattleAction(this, target, ca);
        }
Beispiel #12
0
 public void SendMessage <T>(T msg, ICommandAction Receive = null) where T : ViewMessageBase
 {
     if (Receive == null)
     {
         foreach (var it in ReceiverList)
         {
             it.OnRecvMessage(msg);
         }
     }
     else
     {
         Receive.OnRecvMessage(msg);
     }
 }
Beispiel #13
0
 public CmdActionPhaseModel(FromMiddleBattleDayData data, Dictionary <int, ShipModel_BattleAll> ships)
 {
     if (data.Production != null)
     {
         _eff = new __EffectModel__(data.Production);
     }
     if (data.F_BattleData != null)
     {
         if (data.F_BattleData.FmtType == 1)
         {
             HougekiDayBattleFmt hougekiDayBattleFmt = data.F_BattleData as HougekiDayBattleFmt;
             _data_f = new HougekiListModel(hougekiDayBattleFmt.AttackData, ships);
         }
         else if (data.F_BattleData.FmtType == 2)
         {
             Raigeki      data2        = data.F_BattleData as Raigeki;
             RaigekiModel raigekiModel = new RaigekiModel(data2, ships);
             if (raigekiModel.Count_f > 0 || raigekiModel.Count_e > 0)
             {
                 _data_f = raigekiModel;
             }
         }
     }
     if (data.E_BattleData == null)
     {
         return;
     }
     if (data.E_BattleData.FmtType == 1)
     {
         HougekiDayBattleFmt hougekiDayBattleFmt2 = data.E_BattleData as HougekiDayBattleFmt;
         _data_e = new HougekiListModel(hougekiDayBattleFmt2.AttackData, ships);
     }
     else if (data.E_BattleData.FmtType == 2)
     {
         Raigeki      data3         = data.E_BattleData as Raigeki;
         RaigekiModel raigekiModel2 = new RaigekiModel(data3, ships);
         if (raigekiModel2.Count_f > 0 || raigekiModel2.Count_e > 0)
         {
             _data_e = raigekiModel2;
         }
     }
 }
 public HelpCommandResult(ICommandAction command, bool isSuccessful, ICommandRoot target)
 {
     CommandAction     = command;
     IsSuccessful      = isSuccessful;
     CommandRootTarget = target;
 }
 public void NewBattleAction(
     BattleActor battleActor, BattleActor target, ICommandAction actionState)
 {
     battleActions.AddLast(new BattleAction(battleActor, target, actionState));
 }
 public BattleAction(BattleActor performer, BattleActor target, ICommandAction action)
 {
     this.performer = performer;
     this.target    = target;
     this.action    = action;
 }
Beispiel #17
0
 public Command()
 {
     action = new CommandAction();
 }
 public SystemCommandResult(ICommandAction command, bool isSuccessful, CommandKind commandKind)
 {
     CommandAction = command;
     IsSuccessful  = isSuccessful;
     CommandKind   = commandKind;
 }
Beispiel #19
0
 public CommandPipeline(ICommandAction commandAction)
 {
     _commandAction = commandAction;
 }