예제 #1
0
        public void ReadSettingsFromDevice()
        {
            string[] deviceCommands = new string[] { CommandTypes.Trigger };
            string   deviceQueries  = string.Concat(deviceCommands.Select(command => command + "?").ToArray());

            string[] channelCommands = new string[] {
                CommandTypes.Frequency, CommandTypes.Amplitude, CommandTypes.PLL, CommandTypes.SweepLower,
                CommandTypes.SweepUpper, CommandTypes.SweepStepSize, CommandTypes.SweepStepTime, CommandTypes.SweepDirection
            };
            string channelQueries = string.Concat(channelCommands.Select(command => command + "?").ToArray());

            Connect(SerialTerminationMethod.TerminationCharacter);
            Write(deviceQueries + CommandTypes.Channel + "0" + channelQueries + CommandTypes.Channel + "1" + channelQueries, true);

            int numberCommands = deviceCommands.Length + 2 * channelCommands.Length;

            string[] responses = new string[numberCommands];
            for (int i = 0; i < numberCommands; i++)
            {
                string response = Read();
                responses[i] = response.Substring(0, response.Length - 1);
            }
            Disconnect();

            bool[] channels = new bool[2] {
                false, true
            };
            triggerMode = (TriggerTypes)Convert.ToInt32(responses[0]);
            ChannelA.SyncSettings(responses.Skip(1).Take(channelCommands.Length).ToArray());
            ChannelB.SyncSettings(responses.Skip(channelCommands.Length + 1).Take(channelCommands.Length).ToArray());
        }
예제 #2
0
        public static void DrawTrigger(Vector2 position, bool on, TriggerTypes type)
        {
            switch (type)
            {
            case TriggerTypes.triggerOld:
                if (on)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.triggerOnTex, position);
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.triggerOffTex, position);
                }
                break;

            case TriggerTypes.triggerBase:
                if (on)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["TriggerBase"], position, sourceRectangle: new Rectangle(0, 0, 24, 48));
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["TriggerBase"], position, sourceRectangle: new Rectangle(24, 0, 24, 48));
                }
                break;
            }
        }
예제 #3
0
        public static void FireGuardianHurtTrigger(Vector2 Position, TerraGuardian guardian, int Damage, bool Critical, bool PvP)
        {
            TriggerTypes trigger = TriggerTypes.Hurt;
            int          Value   = Damage;

            FireTrigger(Position, trigger, new TriggerTarget(guardian), Value, Critical ? 1 : 0, PvP ? 1 : 0);
        }
예제 #4
0
        public static void FirePlayerHurtTrigger(Vector2 Position, Player player, int Damage, bool Critical, bool PvP)
        {
            TriggerTypes trigger = TriggerTypes.Hurt;
            int          Value   = Damage;

            FireTrigger(Position, trigger, new TriggerTarget(player), Value, Critical ? 1 : 0, PvP ? 1 : 0);
        }
예제 #5
0
        public static void FirePlayerDeathTrigger(Vector2 Position, Player player, int Damage, bool PvP)
        {
            TriggerTypes trigger = TriggerTypes.Death;
            int          Value   = Damage;

            FireTrigger(Position, trigger, new TriggerTarget(player), Value, PvP ? 1 : 0);
        }
예제 #6
0
        public ITrigger GetTrigger(TriggerTypes triggerType)
        {
            switch (triggerType)
            {
            case TriggerTypes.Text:
                return(new TextTrigger());

                break;

            case TriggerTypes.Color:
                throw new NotImplementedException();
                break;

            case TriggerTypes.IncrementingNumber:
                throw new NotImplementedException();
                break;

            case TriggerTypes.DecrementingNumber:
                throw new NotImplementedException();
                break;

            default:
                throw new ArgumentException($"Type does not exist for passed in Trigger Type {triggerType}");
            }
        }
        private WritableTableDefinition <T> AppendTriggerData(TriggerTypes TriggerType, string TriggerBody, bool AppendTriggerBody = true)
        {
            var trigger = new DALTrigger <T>(TriggerType, TriggerBody)
            {
                DatabaseName = this.DatabaseName
            };

            Triggers = Triggers ?? new Dictionary <TriggerTypes, DALTrigger <T> >();

            if (Triggers.ContainsKey(TriggerType))
            {
                if (AppendTriggerBody)
                {
                    trigger.TriggerBody = $"{Triggers[TriggerType].TriggerBody};{Environment.NewLine}{trigger.TriggerBody}";
                }

                Triggers[TriggerType] = trigger;
            }
            else
            {
                Triggers.Add(TriggerType, trigger);
            }

            return(this);
        }
예제 #8
0
        public static void FireGuardianDownedTrigger(Vector2 Position, TerraGuardian guardian, int Damage, bool PvP)
        {
            TriggerTypes trigger = TriggerTypes.Downed;
            int          Value   = Damage;

            FireTrigger(Position, trigger, new TriggerTarget(guardian), Value, PvP ? 1 : 0);
        }
예제 #9
0
        public static void FireNpcHurtTrigger(Vector2 Position, NPC npc, int Damage, bool Critical)
        {
            TriggerTypes trigger = TriggerTypes.Hurt;
            int          Value   = Damage;

            FireTrigger(Position, trigger, new TriggerTarget(npc), Value, Critical ? 1 : 0);
        }
    public void TriggerDebugger(TriggerTypes type, ref bool debug)
    {
        EnvironmentalTrigger p = SpawnTrigger();

        p.GrabPlayerWhoEarnedIt(debuggingPlayer);
        p.SetUpTrigger(type);
        debug = false;
    }
예제 #11
0
 internal PlcMemoryInfoTrigger(Object triggerValue, TriggerTypes type, string name, string description, EventMemory memoryType = EventMemory.DM,
                               UInt32 readOffset = 0, AccessSize accessSize   = AccessSize.WORD, BitPlace bitPlace = BitPlace.NOBIT,
                               bool isEnable     = true, Object constantValue = null)
     : base(name, description, memoryType, readOffset, accessSize, bitPlace, isEnable, constantValue)
 {
     TriggerValue = triggerValue;
     TriggerType  = type;
 }
예제 #12
0
 public EventSource(AssetId assetId, TextId textSource, TriggerTypes trigger, int x = 0, int y = 0)
 {
     // Trigger = TalkTo for NPC, UseItem for item, Action for event set, Default for none
     AssetId    = assetId;
     TextSource = textSource;
     Trigger    = trigger;
     X          = x;
     Y          = y;
 }
예제 #13
0
 public ZoneKey(bool global, TriggerTypes type, ushort chain) // For tests
 {
     Global      = global;
     Trigger     = type;
     Chain       = chain;
     Unk1        = 0;
     DummyNumber = 0;
     Node        = null;
 }
예제 #14
0
 void FadeEffects(TriggerTypes trigger)
 {
     for (var i = currentDisplays.Count - 1; i >= 0; --i)
     {
         if (currentDisplays[i].effect.fadeTrigger == trigger)
         {
             Debug.Log($"Effect name: { currentDisplays[i].name } faded at { trigger.ToString() }. Total effects: { currentDisplays.Count }");
             RemoveEffect(currentDisplays[i].effect.name);
         }
     }
 }
예제 #15
0
    public static void ResolveTriggers(TriggerTypes triggerType, Action callBack = null)
    {
        if (callBack != null)
        {
            Console.Write(triggerType.ToString(), LogTypes.Triggers, true, "yellow");
        }
        else
        {
            Console.Write(triggerType + " is resolved again", LogTypes.Triggers, false, "yellow");
        }

        if (triggerType == TriggerTypes.OnDamageIsDealt && callBack != null)
        {
            DamageNumbers.UpdateSavedHP();
        }

        StackLevel currentLevel = GetCurrentLevel();

        if (currentLevel == null || currentLevel.IsActive)
        {
            CreateNewLevelOfStack(triggerType, callBack);
            currentLevel = GetCurrentLevel();
        }

        if (!currentLevel.IsActive)
        {
            SetStackLevelCallBack(callBack);

            List <Trigger>   currentTriggersList = currentLevel.GetTriggersByPlayer(Phases.PlayerWithInitiative);
            Players.PlayerNo currentPlayer       = (currentTriggersList.Count > 0) ? Phases.PlayerWithInitiative : Roster.AnotherPlayer(Phases.PlayerWithInitiative);
            currentTriggersList = currentLevel.GetTriggersByPlayer(currentPlayer);

            if (currentTriggersList.Count != 0)
            {
                currentLevel.IsActive = true;
                if ((currentTriggersList.Count == 1) || (IsAllSkippable(currentTriggersList)))
                {
                    FireTrigger(currentTriggersList[0]);
                }
                else
                {
                    RunDecisionSubPhase();
                }
            }
            else
            {
                if (triggerType == TriggerTypes.OnDamageIsDealt)
                {
                    DamageNumbers.ShowChangedHP();
                }
                DoCallBack();
            }
        }
    }
예제 #16
0
        // REGISTER TRIGGER

        protected void RegisterAbilityTrigger(TriggerTypes triggerType, EventHandler eventHandler, System.EventArgs e = null)
        {
            Triggers.RegisterTrigger(new Trigger()
            {
                Name         = Name,
                TriggerType  = triggerType,
                TriggerOwner = HostShip.Owner.PlayerNo,
                EventHandler = eventHandler,
                Sender       = hostReal,
                EventArgs    = e
            });
        }
예제 #17
0
 void ActivateEffects(TriggerTypes trigger)
 {
     for (var i = 0; i < currentDisplays.Count; i++)
     {
         if (currentDisplays[i].effect.activationTrigger == trigger && currentDisplays[i].effect.actionToTrigger != null)
         {
             currentDisplays[i].effect.readyToFade = true;
             StartCoroutine(BattleManager.instance.DoHeroAction(currentDisplays[i].effect.actionToTrigger, parentPanel, null, false));
             Debug.Log($"Effect name: { currentDisplays[i].name } activated at { trigger.ToString() }.");
         }
     }
 }
예제 #18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="triggerElement"></param>
 /// <param name="triggerType"></param>
 /// <param name="targetMenu"></param>
 /// <returns>Если менюшка создана заново, то возвращает true, если обновлена существующая, то false</returns>
 public static void RegisterMenu(FrameworkElement triggerElement, TriggerTypes triggerType, PopupMenu targetMenu) {
   UnregisterMenu(triggerElement);
   var menuTriggerElement = new MenuTriggerElement {
     PopupMenu = targetMenu,
     TriggerType = triggerType,
     TriggerElement = triggerElement
   };
   if (targetMenu.AccessKeyElement == null)
     ApplicationMenus.Add(menuTriggerElement);
   else
     ApplicationMenus.Insert(0, menuTriggerElement);
 }
예제 #19
0
        internal DALTrigger(TriggerTypes TriggerType, string TriggerBody = null)
        {
            TableName = typeof(T)
                        .GetCustomAttribute <DALTable>()?.TableName?.MySqlObjectQuote()
                        ??
                        throw new CustomAttributeFormatException(DatabaseCoreUtilities.NoDalTableAttributeError);

            this.TriggerType        = TriggerType;
            this.TriggerBody        = TriggerBody;
            this.DefinerUser        = "******";
            this.StatementDelimiter = "$$";
        }
예제 #20
0
        protected void RegisterTriggerSingleFriendlyCheckCommon(string text, TriggerTypes eventType)
        {
            var areThereAnyOtherEnemyShipsThanTheCapturedTie = CheckAnyOtherFriendlyShipsPresent();

            if (!areThereAnyOtherEnemyShipsThanTheCapturedTie)
            {
                RegisterAbilityTrigger(eventType, (s, e) =>
                {
                    Messages.ShowInfoToHuman(text);
                    HostUpgrade.TryDiscard(Triggers.FinishTrigger);
                });
            }
        }
예제 #21
0
    public static void ResolveTriggers(TriggerTypes triggerType, Action callBack = null)
    {
        if (DebugManager.DebugTriggers)
        {
            Debug.Log("Triggers are resolved: " + triggerType);
        }

        if (triggerType == TriggerTypes.OnDamageIsDealt && callBack != null)
        {
            DamageNumbers.UpdateSavedHP();
        }

        StackLevel currentLevel = GetCurrentLevel();

        if (currentLevel == null || currentLevel.IsActive)
        {
            CreateNewLevelOfStack(callBack);
            currentLevel = GetCurrentLevel();
        }

        if (!currentLevel.IsActive)
        {
            SetStackLevelCallBack(callBack);

            List <Trigger>   currentTriggersList = currentLevel.GetTriggersByPlayer(Phases.PlayerWithInitiative);
            Players.PlayerNo currentPlayer       = (currentTriggersList.Count > 0) ? Phases.PlayerWithInitiative : Roster.AnotherPlayer(Phases.PlayerWithInitiative);
            currentTriggersList = currentLevel.GetTriggersByPlayer(currentPlayer);

            if (currentTriggersList.Count != 0)
            {
                currentLevel.IsActive = true;
                if ((currentTriggersList.Count == 1) || (IsAllSkippable(currentTriggersList)))
                {
                    FireTrigger(currentTriggersList[0]);
                }
                else
                {
                    RunDecisionSubPhase();
                }
            }
            else
            {
                if (triggerType == TriggerTypes.OnDamageIsDealt)
                {
                    DamageNumbers.ShowChangedHP();
                }
                DoCallBack();
            }
        }
    }
예제 #22
0
 public static void RegisterBombDropTriggerIfAvailable(GenericShip ship, TriggerTypes triggerType, UpgradeSubType subType = UpgradeSubType.None, Type type = null, bool onlyDrop = false, bool isRealDrop = true)
 {
     if ((!isRealDrop || !ship.IsBombAlreadyDropped) && HasBombsToDrop(ship, subType, type))
     {
         Triggers.RegisterTrigger(new Trigger()
         {
             Name         = "Ask which bomb to drop",
             TriggerType  = TriggerTypes.OnMovementActivationStart,
             TriggerOwner = ship.Owner.PlayerNo,
             EventHandler = (object sender, EventArgs e) => CreateAskBombDropSubPhase((sender as GenericShip), subType, type, onlyDrop),
             Sender       = ship
         });
     }
 }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);
        property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label);
        if (property.isExpanded)
        {
            EditorGUIUtility.labelWidth = 70;
            label.text = "Title: ";
            EditorGUI.PropertyField(new Rect(position.x, position.y + 20, position.width, position.height), property.FindPropertyRelative("title"), label, true);
            label.text = "Type: ";
            EditorGUI.PropertyField(new Rect(position.x, position.y + 40, position.width, position.height), property.FindPropertyRelative("type"), label, true);

            TriggerTypes type = (TriggerTypes)property.FindPropertyRelative("type").enumValueIndex;

            switch (type)
            {
            case TriggerTypes.Bool:
                label.text = "Default: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 60, position.width, position.height), property.FindPropertyRelative("defaultBool"), label, true); EditorGUI.LabelField(new Rect(position.x + 100, position.y + 60, position.width / 2, position.height), "(" + property.FindPropertyRelative("defaultBool").boolValue.ToString() + ")");
                label.text = "Current: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 80, position.width, position.height), property.FindPropertyRelative("triggerBool"), label, true); EditorGUI.LabelField(new Rect(position.x + 100, position.y + 80, position.width / 2, position.height), "(" + property.FindPropertyRelative("triggerBool").boolValue.ToString() + ")");
                break;

            case TriggerTypes.Int:
                label.text = "Default: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 60, position.width, position.height), property.FindPropertyRelative("defaultInt"), label, true);
                label.text = "Current: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 80, position.width, position.height), property.FindPropertyRelative("triggerInt"), label, true);
                break;

            case TriggerTypes.Float:
                label.text = "Default: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 60, position.width, position.height), property.FindPropertyRelative("defaultFloat"), label, true);
                label.text = "Current: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 80, position.width, position.height), property.FindPropertyRelative("triggerFloat"), label, true);
                break;

            case TriggerTypes.Double:
                label.text = "Default: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 60, position.width, position.height), property.FindPropertyRelative("defaultDouble"), label, true);
                label.text = "Current: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 80, position.width, position.height), property.FindPropertyRelative("triggerDouble"), label, true);
                break;

            case TriggerTypes.String:
                label.text = "Default: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 60, position.width, position.height), property.FindPropertyRelative("defaultString"), label, true);
                label.text = "Current: "; EditorGUI.PropertyField(new Rect(position.x, position.y + 80, position.width, position.height), property.FindPropertyRelative("triggerString"), label, true);
                break;
            }
            EditorGUI.LabelField(new Rect(position.x, position.y + 110, position.width, position.height), "Notes");
            EditorGUI.PropertyField(new Rect(position.x, position.y + 110, position.width, position.height * 5), property.FindPropertyRelative("notes"), GUIContent.none);
            EditorGUIUtility.labelWidth = 0;
        }

        EditorGUI.EndProperty();
        EditorUtility.SetDirty(property.serializedObject.targetObject);
    }
예제 #24
0
        // REGISTER TRIGGER

        protected Trigger RegisterAbilityTrigger(TriggerTypes triggerType, EventHandler eventHandler, System.EventArgs e = null)
        {
            var trigger = new Trigger()
            {
                Name         = Name,
                TriggerType  = triggerType,
                TriggerOwner = HostShip.Owner.PlayerNo,
                EventHandler = eventHandler,
                Sender       = hostReal,
                EventArgs    = e
            };

            Triggers.RegisterTrigger(trigger);
            return(trigger);
        }
예제 #25
0
        public HSPI()
        {
            //Initialize the plugin

            //Enable internal debug logging to console
            LogDebug = true;
            //Setup anything that needs to be configured before a connection to HomeSeer is established
            // like initializing the starting state of anything needed for the operation of the plugin

            //Such as initializing the settings pages presented to the user (currently saved state is loaded later)
            InitializeSettingsPages();

            //Or adding an event action or trigger type definition to the list of types supported by your plugin
            ActionTypes.AddActionType(typeof(WriteLogSampleActionType));
            TriggerTypes.AddTriggerType(typeof(SampleTriggerType));
        }
예제 #26
0
        // REGISTER TRIGGER

        /// <summary>
        /// Register trigger of ability
        /// </summary>
        public Trigger RegisterAbilityTrigger(TriggerTypes triggerType, EventHandler eventHandler, System.EventArgs e = null, bool isSkippable = false)
        {
            var trigger = new Trigger()
            {
                Name         = Name,
                TriggerType  = triggerType,
                TriggerOwner = HostShip.Owner.PlayerNo,
                EventHandler = eventHandler,
                Sender       = hostReal,
                EventArgs    = e,
                Skippable    = isSkippable
            };

            Triggers.RegisterTrigger(trigger);
            return(trigger);
        }
예제 #27
0
        private void RegisterAskUndock(GenericShip ship, TriggerTypes timing)
        {
            if (BoardTools.Board.IsOffTheBoard(ship)) return;

            bool canUndock = ship.CheckCanReleaseDockedShipRegular();
            if (canUndock)
            {
                Triggers.RegisterTrigger(new Trigger()
                {
                    Name = "Undocking decision",
                    TriggerType = timing,
                    TriggerOwner = ship.Owner.PlayerNo,
                    EventHandler = AskUndock
                });
            }
        }
예제 #28
0
 /// <summary>
 /// Try to trigger an object
 /// </summary>
 /// <param name="triggerObj"></param>
 /// <param name="triggerType"></param>
 /// <returns></returns>
 bool TryTriggerInteraction(ObjectTrigger triggerObj, TriggerTypes triggerType)
 {
     Debug.Log(triggerObj + "TriggerType: " + triggerType);
     if (triggerObj != null)
     {
         if (triggerObj.actionTrigger != null && triggerObj.actionTrigger.ActionType == triggerType.ToString())
         {
             StartCoroutine(triggerObj.TriggerAction(CompleteAction));
         }
         else if (attemptTime <= 0)
         {
             TriggerFailAttempt();
         }
         return(true);
     }
     return(false);
 }
예제 #29
0
 public void Trigger(TriggerTypes type, Radio rad)
 {
     if (type == TriggerTypes.SHOW)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neue Show", rad.show + " von " + rad.moderator + " (" + rad.style + ")", ToolTipIcon.Info);
     }
     else if (type == TriggerTypes.SONG)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neuer Track", rad.song + " || " + rad.artist, ToolTipIcon.Info);
         wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist));
         wplayerSongCalls.controls.play();
     }
     else if (type == TriggerTypes.PICTURE)
     {
         wao.RequestPicture(rad);
     }
 }
예제 #30
0
        public static TriggerBase FromType(TriggerTypes trigger)
        {
            switch (trigger)
            {
            default:
                return(null);

            case TriggerTypes.Failing:
                return(new FailingTrigger());

            case TriggerTypes.Passing:
                return(new PassingTrigger());

            case TriggerTypes.HitSound:
                return(new HitSoundTrigger());
            }
        }
예제 #31
0
 public Trigger(Vector2 position, string target, bool startOn, TriggerTypes type, bool lockAfterUse = false)
 {
     Position = position;
     Target   = target;
     On       = startOn;
     if (type == TriggerTypes.triggerOld)
     {
         Boundary = new RectangleF(64, 64, position.X, position.Y);
     }
     if (type == TriggerTypes.triggerBase)
     {
         Boundary = new RectangleF(48, 48, position.X, position.Y);
     }
     _texOnLight   = Game1.triggerOnLight;
     _texOffLight  = Game1.triggerOffLight;
     _type         = type;
     _lockAfterUse = lockAfterUse;
     _locked       = false;
 }
예제 #32
0
    public void AddTrigger(TriggerTypes triggerType, params UIElement[] triggerElements) {
      foreach (FrameworkElement triggerElement in triggerElements.Where(elem => elem != null)) {
        PopupMenuManager.RegisterMenu(triggerElement, triggerType, this); 

        if (triggerElement.Parent == null)
          triggerElement.LayoutUpdated += triggerElement_LayoutUpdated;
        else
          triggerElement_LayoutUpdated(triggerElement, null);
      }
    }
예제 #33
0
 internal static void RunTriggers(Connection conn, Type tableType, Dictionary<string, object> updateFields, SelectParameter[] parameters, TriggerTypes type, out bool abort)
 {
     abort = false;
     ITrigger[] tmp = new ITrigger[0];
     Monitor.Enter(_triggers);
     if (_triggers.ContainsKey(tableType))
     {
         tmp = new ITrigger[_triggers[tableType].Count];
         _triggers[tableType].CopyTo(tmp);
     }
     Monitor.Exit(_triggers);
     foreach (ITrigger tr in tmp)
     {
         switch (type)
         {
             case TriggerTypes.PRE_UPDATE:
                 tr.PreUpdate(conn,tableType, updateFields, parameters,out abort);
                 break;
             case TriggerTypes.POST_UPDATE:
                 tr.PostUpdate(conn,tableType, updateFields, parameters);
                 break;
         }
     }
 }
예제 #34
0
파일: Trigger.cs 프로젝트: weawesomeyo/GEJ
    public void setTrigger(string type, string name, List<string> parameterList)
    {
        this.name = name;
         // converts firstl etter to Upper character ( because the classes are named with Upper at start )
        // check if its input or timer, those are protected calsses so our classes are different than the users classes conversion takes place
         type = char.ToUpper(type[0]) + type.Substring(1);
         if( type == "Input")
        {
            type = "GameInput";
        }
         else if ( type == "Timer")
        {
            type = "GameTimer";
        }
         // check if type of trigger exists
         if (Enum.IsDefined(typeof(TriggerTypes), type))
        {
            // adds the current type of the trigger to the wanted type ( for easy acces )
            triggerType = (TriggerTypes)Enum.Parse(typeof(TriggerTypes), type);

           switch(triggerType)
            {
                case TriggerTypes.GameInput:

                    // checks if key is valid, if not return null and if count is 2.
                    if (parameterList.Count == 2 )
                    {

                        GameInput gameInput = new GameInput(parameterList[1]);
                        gameInput.name = name;

                  	 	trigger = (object)gameInput;
                    }
                else {
                        CodeInputHandler.abortPlay("type failed ! check your gameinput keyname -49 trigger.cs");
                    }
                    break;
                case TriggerTypes.Loop:

                    if (parameterList.Count == 2)
                    {

                        Loop loop = new Loop(parameterList[1]);
                        loop.name = name;

                        trigger = (object)loop;

                    }
                    else
                    {
                        CodeInputHandler.abortPlay("type failed ! check your gameinput keyname -49 trigger.cs");
                    }

                    break;

            case TriggerTypes.Collision:
                Debug.Log ("does get called 77 @ trigger ");
                    Collision collision = new Collision();
                    collision.name  = name;

                    // set the variables from parameters

                    trigger = (object)collision;

                    break;
                case TriggerTypes.Timer:
                    GameTimer timer = new GameTimer();
                    // set the variables from parameters

                    trigger = (object)timer;
                    break;
                default :
                    CodeInputHandler.abortPlay("type failed !check your enum cases - 70 trigger.cs");
                    return;
            }

            TriggerHandler.triggerDictionary.Add(name,trigger);

        }

         else
        {
            // type is not one we know.
            CodeInputHandler.abortPlay("type failed ! check your trigger type  - 82 trigger.cs ");
        }
    }
예제 #35
0
 internal static void RunTriggers(Connection conn, Table original, Table tbl, TriggerTypes type, out bool abort)
 {
     abort = false;
     ITrigger[] tmp = new ITrigger[0];
     Monitor.Enter(_triggers);
     if (_triggers.ContainsKey(tbl.GetType())){
         tmp = new ITrigger[_triggers[tbl.GetType()].Count];
         _triggers[tbl.GetType()].CopyTo(tmp);
     }
     Monitor.Exit(_triggers);
     foreach (ITrigger tr in tmp)
     {
         switch (type)
         {
             case TriggerTypes.PRE_DELETE:
                 tr.PreDelete(conn,tbl,out abort);
                 break;
             case TriggerTypes.POST_DELETE:
                 tr.PostDelete(conn, tbl);
                 break;
             case TriggerTypes.PRE_INSERT:
                 tr.PreInsert(conn, tbl, out abort);
                 break;
             case TriggerTypes.POST_INSERT:
                 tr.PostInsert(conn, tbl);
                 break;
             case TriggerTypes.PRE_UPDATE:
                 tr.PreUpdate(conn, original, tbl, tbl.ChangedFields, out abort);
                 break;
             case TriggerTypes.POST_UPDATE:
                 tr.PostUpdate(conn, original, tbl, tbl.ChangedFields);
                 break;
             case TriggerTypes.PRE_DELETE_ALL:
                 tr.PreDeleteAll(conn, out abort);
                 break;
             case TriggerTypes.POST_DELETE_ALL:
                 tr.PostDeleteAll(conn);
                 break;
         }
     }
 }
        public void Receive(GameObject prev = null, TriggerTypes triggerType = TriggerTypes.ActionObject)
        {
            if (!gameObject.activeSelf || !this.enabled)
                return;

            if (IsPlaying())
                return;

            //assume actions triggered by other action objects are always valid,
            //otherwise make sure trigger type is valid for this action
            if(triggerType != TriggerTypes.ActionObject)
            {
                switch (TriggerFlag)
                {
                    case DFBlock.RdbTriggerFlags.None:
                        {
                            if (triggerType != TriggerTypes.ActionObject)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Collision01:
                        {
                            if (triggerType != TriggerTypes.WalkOn)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Direct:
                        {
                            if (triggerType != TriggerTypes.Direct)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Collision03:
                        {
                            if (triggerType != TriggerTypes.WalkInto)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Attack:
                        {
                            if (triggerType != TriggerTypes.Attack)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Direct6:
                        {
                            if (triggerType != TriggerTypes.Direct)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.MultiTrigger:
                        {
                            if (triggerType != TriggerTypes.Direct && triggerType != TriggerTypes.Attack && triggerType != TriggerTypes.WalkInto)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Collision09:
                        {
                            if (triggerType != TriggerTypes.Direct && triggerType != TriggerTypes.WalkInto)
                                return;
                        }
                        break;
                    case DFBlock.RdbTriggerFlags.Door:
                        {
                            if (triggerType != TriggerTypes.Door)
                                return;
                        }
                        break;
                    default:
                        return;
                }
            }

            //increment activation counter
            activationCount++;
            Play(prev);
            return;
        }
예제 #37
0
    public void TriggerElement_LeftClick(object triggerElement, MouseButtonEventArgs e) {
      ActualTriggerType = TriggerTypes.LeftClick;

      if (_clickAlreadyHandledInMouseDownEvent) {
        _clickAlreadyHandledInMouseDownEvent = false;
      } else {
        if (OverlayPopup.IsOpen) {
          this.Close();
        } else {
          var element = GetItemUnderMouse(triggerElement as FrameworkElement, e, AutoMapTriggerElementToSelectableItem, AutoSelectItem);
          if (element != null) {
            Point mousePos = PopupMenuUtils.GetAbsoluteElementPos(PopupMenuManager.ApplicationMenus.Count == 0, element);
            Open(mousePos, Orientation, 0, element, FocusOnShow, e);
          } else {
            ActualTriggerElement = triggerElement as FrameworkElement; // This would normally be set when calling the Open method
          }
        }
      }
    }
예제 #38
0
 /// <summary>
 /// This method is called by the database engine once when initializing the trigger.
 /// </summary>
 /// <param name="connection">a connection to the database</param>
 /// <param name="schemaName">the name of the schema</param>
 /// <param name="triggerName">the name of the trigger used in the CREATE TRIGGER statement</param>
 /// <param name="tableName">the name of the table</param>
 /// <param name="before">whether the fire method is called before or after the operation is performed</param>
 /// <param name="type">the operation type: INSERT, UPDATE, or DELETE</param>
 protected abstract void OnInit(H2Connection connection, String schemaName, String triggerName, String tableName, bool before, TriggerTypes type);
예제 #39
0
    public void TriggerElement_Hover(object triggerElement, MouseEventArgs e) {
      ActualTriggerType = TriggerTypes.Hover;

      var element = GetItemUnderMouse(triggerElement as FrameworkElement, e, AutoMapTriggerElementToSelectableItem, AutoSelectItem);
      if (element != null) {
        Point mousePos = PopupMenuUtils.GetAbsoluteElementPos(PopupMenuManager.ApplicationMenus.Count == 0, element);
        Open(mousePos, Orientation, OpenDelay, element, FocusOnShow, e);
      }
    }
예제 #40
0
 internal static void RunTriggers(Connection conn, Type tblType, TriggerTypes type, out bool abort)
 {
     abort = false;
     ITrigger[] tmp = new ITrigger[0];
     Monitor.Enter(_triggers);
     if (_triggers.ContainsKey(tblType))
     {
         tmp = new ITrigger[_triggers[tblType].Count];
         _triggers[tblType].CopyTo(tmp);
     }
     Monitor.Exit(_triggers);
     foreach (ITrigger tr in tmp)
     {
         switch (type)
         {
             case TriggerTypes.PRE_DELETE_ALL:
                 tr.PreDeleteAll(conn,out abort);
                 break;
             case TriggerTypes.POST_DELETE_ALL:
                 tr.PostDeleteAll(conn);
                 break;
         }
     }
 }
예제 #41
0
    public void TriggerElement_RightClick(object triggerElement, MouseButtonEventArgs e) {
      ActualTriggerType = TriggerTypes.RightClick;

      var element = GetItemUnderMouse(triggerElement as FrameworkElement, e, AutoMapTriggerElementToSelectableItem, AutoSelectItem)
        ?? triggerElement as FrameworkElement;
      Point mousePos = e.GetSafePosition(null);
      Open(mousePos, MenuOrientationTypes.Mouse, 0, element, FocusOnShow, e);
    }
예제 #42
0
    public void TriggerButton_Click(object triggerElement, RoutedEventArgs e) {
      ActualTriggerType = TriggerTypes.LeftClick;

      Point mousePos = PopupMenuUtils.GetAbsoluteElementPos(PopupMenuManager.ApplicationMenus.Count == 0, triggerElement as FrameworkElement);
      Open(mousePos, Orientation, 0, triggerElement as FrameworkElement, FocusOnShow, e as MouseButtonEventArgs);
    }
 public TriggerInfo(TriggerTypes type)
 {
     Type = type;
 }
예제 #44
0
    public void AddTrigger(TriggerTypes triggerType, string triggerElementNames) {
      foreach (string elementName in triggerElementNames.Split(',')) {
        var elem = elementName == "{Parent}"
          ? PopupMenuUtils.GetContainer<UIElement>(this)
          : PopupMenuUtils.FindApplicationElementByName(elementName, "trigger type " + triggerType);

        if (elem != null)
          elem.Dispatcher.BeginInvoke(delegate {
            AddTrigger(triggerType, elem as UIElement);
          });
      }
    }
예제 #45
0
 public void Trigger(TriggerTypes type,Radio rad)
 {
     if(type == TriggerTypes.SHOW)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neue Show", rad.show + " von " + rad.moderator + " (" + rad.style + ")", ToolTipIcon.Info);
     }
     else if(type == TriggerTypes.SONG)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neuer Track",rad.song + " || " + rad.artist, ToolTipIcon.Info);
         wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist));
         wplayerSongCalls.controls.play();
     }
     else if(type == TriggerTypes.PICTURE)
     {
         wao.RequestPicture(rad);
     }
 }