コード例 #1
0
        public void InsertNewCmd_Before(int Index, EnumCmd CmdToAdd, int NewCmdID)
        {
            int FreeActionID = -1;

            if (Index <= 0)
            {
                throw (new Exception("Invalid Param"));
            }

            if (_Strategy == null)
            {
                throw (new Exception("Invalid Param"));
            }

            if (Index > _Strategy.Count)
            {
                throw (new Exception("Invalid Param"));
            }

            Command NewCommand = new Command(CmdToAdd);

            if (NewCmdID > 1)
            {
                FreeActionID = GetPrevFreeActionID(NewCmdID + 1);
            }
            else
            {
                FreeActionID = GetPrevFreeActionID(_Strategy[Index - 1].ActionID);
            }

            StrategyItem NewStrategyItem = new StrategyItem(NewCommand, FreeActionID, -1, -1);

            _Strategy.Insert(Index - 1, NewStrategyItem);
        }
コード例 #2
0
        public void InsertNewCmd_After(int Index, EnumCmd CmdToAdd, int NewCmdID)
        {
            int FreeActionID = -1;

            if (Index < 0)
            {
                throw (new Exception("Invalid Param"));
            }

            if (_Strategy == null)
            {
                _Strategy = new List <StrategyItem>();
            }

            if (Index > _Strategy.Count)
            {
                throw (new Exception("Invalid Param"));
            }

            Command NewCommand = new Command(CmdToAdd);

            if (_Strategy.Count == 0)
            {
                FreeActionID = 1;
            }
            else
            {
                if (NewCmdID > 1)
                {
                    FreeActionID = GetNextFreeActionID(NewCmdID - 1);
                }
                else
                {
                    FreeActionID = GetNextFreeActionID(_Strategy[Index - 1].ActionID);
                }
            }

            StrategyItem NewStrategyItem = new StrategyItem(NewCommand, FreeActionID, -1, -1);

            _Strategy.Insert(Index, NewStrategyItem);
        }
コード例 #3
0
ファイル: FullStrategy.cs プロジェクト: Vanganesha/oufffteam
        public void InsertNewCmd_Before(int Index, EnumCmd CmdToAdd, int NewCmdID)
        {
            int FreeActionID = -1;
            if (Index <= 0)
                throw (new Exception("Invalid Param"));

            if (_Strategy == null)
                throw (new Exception("Invalid Param"));

            if (Index > _Strategy.Count)
                throw (new Exception("Invalid Param"));

            Command NewCommand = new Command(CmdToAdd);

            if (NewCmdID > 1)
                FreeActionID = GetPrevFreeActionID(NewCmdID + 1);
            else
                FreeActionID = GetPrevFreeActionID(_Strategy[Index - 1].ActionID);

             StrategyItem NewStrategyItem = new StrategyItem(NewCommand, FreeActionID, -1, -1);
            _Strategy.Insert(Index - 1, NewStrategyItem);
        }
コード例 #4
0
ファイル: FullStrategy.cs プロジェクト: Vanganesha/oufffteam
        public void InsertNewCmd_After(int Index, EnumCmd CmdToAdd, int NewCmdID)
        {
            int FreeActionID = -1;
            if (Index < 0)
                throw (new Exception("Invalid Param"));

            if (_Strategy == null)
            {
                _Strategy = new List<StrategyItem>();
            }

            if (Index > _Strategy.Count)
                throw (new Exception("Invalid Param"));

            Command NewCommand = new Command(CmdToAdd);

            if (_Strategy.Count == 0)
                FreeActionID = 1;
            else
            {
                if (NewCmdID > 1)
                    FreeActionID = GetNextFreeActionID(NewCmdID - 1);
                else
                    FreeActionID = GetNextFreeActionID(_Strategy[Index - 1].ActionID);
            }

            StrategyItem NewStrategyItem = new StrategyItem(NewCommand, FreeActionID, -1, -1);
            _Strategy.Insert(Index, NewStrategyItem);
        }