public static triggercondition TriggerAddCondition(trigger whichTrigger, boolexpr condition)
        {
            triggercondition addCondition = new triggercondition();

            whichTrigger.conditions.Add(addCondition);
            return(addCondition);
        }
 public static void TriggerExecute(trigger whichTrigger)
 {
     for (int i = 0; i < whichTrigger.actions.Count; i++)
     {
         whichTrigger.actions[i].Invoke();
     }
 }
        /// <summary>
        /// 创建触发器
        /// </summary>
        /// <returns>创建的触发器</returns>
        public static trigger CreateTrigger()
        {
            trigger nt = new trigger();

            RuntimeRecorder.Recorder.Triggers.Add(nt);
            return(nt);
        }
        public static @event TriggerRegisterPlayerChatEvent(trigger whichTrigger, player whichPlayer, @string chatMessageToDetect, boolean exactMatchOnly)
        {
            @event triEvent = new @event()
            {
                sourcePlayer = whichPlayer, chatMatchMessage = chatMessageToDetect, playerEvent = EVENT_PLAYER_CHAT
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterPlayerStateEvent(trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval)
        {
            @event triEvent = new @event()
            {
                sourcePlayer = whichPlayer, playerStateEvent = whichState
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterPlayerUnitEvent(trigger whichTrigger, player whichPlayer, playerunitevent whichPlayerUnitEvent, boolexpr filter)
        {
            @event triEvent = new @event()
            {
                sourcePlayer = whichPlayer, playerUnitEvent = whichPlayerUnitEvent
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterPlayerEvent(trigger whichTrigger, player whichPlayer, playerevent whichPlayerEvent)
        {
            @event triEvent = new @event()
            {
                sourcePlayer = whichPlayer, playerEvent = whichPlayerEvent
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterTrackableTrackEvent(trigger whichTrigger, trackable t)
        {
            @event triEvent = new @event()
            {
                sourceTrackable = t
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterDialogButtonEvent(trigger whichTrigger, button whichButton)
        {
            @event triEvent = new @event()
            {
                sourceDialogButton = whichButton
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterDialogEvent(trigger whichTrigger, dialog whichDialog)
        {
            @event triEvent = new @event()
            {
                sourceDialog = whichDialog
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterGameStateEvent(trigger whichTrigger, gamestate whichState, limitop opcode, real limitval)
        {
            @event triEvent = new @event()
            {
                gamestateEvent = whichState
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterTimerExpireEvent(trigger whichTrigger, timer t)
        {
            @event triEvent = new @event()
            {
                sourceTimer = t
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterUnitStateEvent(trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval)
        {
            @event triEvent = new @event()
            {
                sourceUnit = whichUnit, unitStateEvent = opcode
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static triggeraction TriggerAddAction(trigger whichTrigger, Action actionFunc)
        {
            triggeraction addAction = new triggeraction()
            {
                action = actionFunc
            };

            whichTrigger.actions.Add(addAction);
            return(addAction);
        }
        public static @event TriggerRegisterDeathEvent(trigger whichTrigger, widget whichWidget)
        {
            @event triEvent = new @event()
            {
                unitevent = EVENT_UNIT_DEATH
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterUnitEvent(trigger whichTrigger, unit whichUnit, unitevent whichEvent)
        {
            @event triEvent = new @event()
            {
                unitevent = whichEvent, sourceUnit = whichUnit
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
        public static @event TriggerRegisterTimerEvent(trigger whichTrigger, real timeout, boolean periodic)
        {
            @event triEvent = new @event()
            {
                timerEventTime = timeout, timerEventPeriodic = periodic
            };

            whichTrigger.events.Add(triEvent);
            return(triEvent);
        }
 public static boolean TriggerEvaluate(trigger whichTrigger)
 {
     if (whichTrigger != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// 关闭触发器
 /// </summary>
 /// <param name="whichTrigger"></param>
 public static void DisableTrigger(trigger whichTrigger)
 {
     whichTrigger.isEnabled = false;
 }
 public static void TriggerClearActions(trigger whichTrigger)
 {
     whichTrigger.actions.Clear();
 }
 public static void TriggerRemoveAction(trigger whichTrigger, triggeraction whichAction)
 {
     whichTrigger.actions.Remove(whichAction);
 }
 public static boolean IsTriggerWaitOnSleeps(trigger whichTrigger)
 {
     throw new NotImplementedException();
 }
 public static void TriggerRemoveCondition(trigger whichTrigger, triggercondition whichCondition)
 {
     whichTrigger.conditions.Remove(whichCondition);
 }
 public static @event TriggerRegisterUnitInRange(trigger whichTrigger, unit whichUnit, real range, boolexpr filter)
 {
     throw new NotImplementedException();
 }
 public static @event TriggerRegisterPlayerAllianceChange(trigger whichTrigger, player whichPlayer, alliancetype whichAlliance)
 {
     throw new NotImplementedException();
 }
 public static boolean IsTriggerEnabled(trigger whichTrigger)
 {
     return(whichTrigger.isEnabled);
 }
 public static void TriggerExecuteWait(trigger whichTrigger)
 {
 }
 public static void TriggerClearConditions(trigger whichTrigger)
 {
     whichTrigger.conditions.Clear();
 }
Example #29
0
 public static boolean SaveTriggerHandle(hashtable table, integer parentKey, integer childKey, trigger whichTrigger)
 {
     table.Add(parentKey.ToString("x8") + childKey.ToString("x8"), whichTrigger);
     return(true);
 }
 public static @event TriggerRegisterFilterUnitEvent(trigger whichTrigger, unit whichUnit, unitevent whichEvent, boolexpr filter)
 {
     throw new NotImplementedException();
 }