//Function called when this object is created
    private void Awake()
    {
        //Making sure the icon is off by default
        this.iconObject.SetActive(false);

        this.toggleSaveEVT = new DelegateEvent <EVTData>(this.ToggleSaveIcon);
    }
Example #2
0
    //Function called when this object is initialized
    private void Awake()
    {
        //Making sure this is the only active CharacterManager component
        if (globalReference != null)
        {
            this.enabled = false;
        }
        else
        {
            globalReference = this;
        }

        //Initializing the list of party characters with enough room for the maximum number
        this.playerParty = new List <Character>(this.maxPartySize);
        for (int i = 0; i < this.maxPartySize; ++i)
        {
            this.playerParty.Add(null);
        }

        //Initializing the list of dead characters
        this.deadCharacters = new List <DeadCharacterInfo>();
        //Initializing the list of tile encounters
        this.tileEnemyEncounters = new List <EnemyEncounter>();

        //Setting the event delegate for the time passed listener
        this.timePassedListener = new DelegateEvent <EVTData>(this.AdvanceTimeForAllCharacters);
    }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testListenerInvocationForNewlyCreatedScope()
        public virtual void testListenerInvocationForNewlyCreatedScope()
        {
            // given
            DelegateEvent.clearEvents();

            ProcessDefinition sourceProcessDefinition = migrationRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            ProcessDefinition targetProcessDefinition = migrationRule.deployAndGetDefinition(modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("subProcess").camundaExecutionListenerClass([email protected]_Fields.EVENTNAME_START, typeof(DelegateExecutionListener).FullName).done());

            MigrationPlan migrationPlan = engineRule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask", "userTask").build();

            ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            Batch batch = engineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync();

            helper.executeSeedJob(batch);

            // when
            helper.executeJobs(batch);

            // then
            IList <DelegateEvent> recordedEvents = DelegateEvent.Events;

            assertEquals(1, recordedEvents.Count);

            DelegateEvent @event = recordedEvents[0];

            assertEquals(targetProcessDefinition.Id, @event.ProcessDefinitionId);
            assertEquals("subProcess", @event.CurrentActivityId);

            DelegateEvent.clearEvents();
        }
        public virtual void testSkipListenerInvocationForRemovedScope()
        {
            // given
            DelegateEvent.ClearEvents();

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method:
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(ProcessModels.SubprocessProcess)
                                                  //.ActivityBuilder("subProcess")
                                                  //.CamundaExecutionListenerClass(ExecutionListenerFields.EventNameEnd,
                                                  //    typeof(DelegateExecutionListener).FullName)
                                                  //.Done()
                                                  );
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ProcessModels.OneTaskProcess);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("userTask", "userTask")
                .Build();

            // when
            var processInstance = rule.RuntimeService.StartProcessInstanceById(migrationPlan.SourceProcessDefinitionId);

            rule.RuntimeService.NewMigration(migrationPlan)
            .ProcessInstanceIds(processInstance.Id)
            .SkipCustomListeners()
            .Execute();

            // then
            var recordedEvents = DelegateEvent.Events;

            Assert.AreEqual(0, recordedEvents.Count);

            DelegateEvent.ClearEvents();
        }
Example #5
0
        public virtual void testListenerInvocationForNewlyCreatedScope()
        {
            // given
            DelegateEvent.ClearEvents();

            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ProcessModels.OneTaskProcess);

            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(ProcessModels.SubprocessProcess)
                                                  //.ActivityBuilder("subProcess")
                                                  //.CamundaExecutionListenerClass(ExecutionListenerFields.EventNameStart,
                                                  //    typeof(DelegateExecutionListener).FullName)
                                                  //.Done()
                                                  );

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("userTask", "userTask")
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            var recordedEvents = DelegateEvent.Events;

            Assert.AreEqual(1, recordedEvents.Count);

            var @event = recordedEvents[0];

            Assert.AreEqual(targetProcessDefinition.Id, @event.ProcessDefinitionId);
            Assert.AreEqual("subProcess", @event.CurrentActivityId);

            DelegateEvent.ClearEvents();
        }
Example #6
0
        private void OnSelectResolution(object sender, EventArgs e)
        {
            if (toupcam_ != null)
            {
                uint eSize = 0;
                if (toupcam_.get_eSize(out eSize))
                {
                    if (eSize != comboBox1.SelectedIndex)
                    {
                        button2.ContextMenuStrip = null;

                        toupcam_.Stop();
                        toupcam_.put_eSize((uint)comboBox1.SelectedIndex);

                        InitSnapContextMenuAndExpoTimeRange();
                        OnEventTempTint();

                        int width = 0, height = 0;
                        if (toupcam_.get_Size(out width, out height))
                        {
                            bmp_ = new Bitmap(width, height, PixelFormat.Format24bppRgb);
                            ev_  = new DelegateEvent(DelegateOnEvent);
                            toupcam_.StartPullModeWithCallback(new ToupTek.ToupCam.DelegateEventCallback(DelegateOnEventCallback));
                        }
                    }
                }
            }
        }
Example #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEndListenerInvocationForRemovedScope()
        public virtual void testEndListenerInvocationForRemovedScope()
        {
            // given
            DelegateEvent.clearEvents();

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("subProcess").camundaExecutionListenerClass([email protected]_Fields.EVENTNAME_END, typeof(DelegateExecutionListener).FullName).done());
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask", "userTask").build();

            // when
            testHelper.createProcessInstanceAndMigrate(migrationPlan);

            // then
            IList <DelegateEvent> recordedEvents = DelegateEvent.Events;

            assertEquals(1, recordedEvents.Count);

            DelegateEvent @event = recordedEvents[0];

            assertEquals(sourceProcessDefinition.Id, @event.ProcessDefinitionId);
            assertEquals("subProcess", @event.CurrentActivityId);
            assertEquals(testHelper.getSingleActivityInstanceBeforeMigration("subProcess").Id, @event.ActivityInstanceId);

            DelegateEvent.clearEvents();
        }
        public virtual void testSkipListenerInvocationF()
        {
            // given
            DelegateEvent.ClearEvents();
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method:
            var processDefinition = testRule.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(instance)
                                                                    //.ActivityBuilder("user2")
                                                                    //.CamundaExecutionListenerClass(ExecutionListenerFields.EventNameStart,
                                                                    //    typeof(DelegateExecutionListener).FullName)
                                                                    //.Done()
                                                                    );

            var processInstance = runtimeService.StartProcessInstanceById(processDefinition.Id);

            var batch = runtimeService.CreateModification(processDefinition.Id)
                        .CancelAllForActivity("user2")
                        .SetProcessInstanceIds(processInstance.Id)
                        .SetSkipCustomListeners()
                        .ExecuteAsync();

            helper.ExecuteSeedJob(batch);

            // when
            helper.ExecuteJobs(batch);

            // then
            Assert.AreEqual(0, DelegateEvent.Events.Count);
        }
Example #9
0
    static void Main(string[] args)
    {
        AttendanceLogger logger = new AttendanceLogger();
        DelegateEvent    dEvent = new DelegateEvent();

        dEvent.EventLog += new DelegateEvent.AttendanceLogHandler(logger.LogMessage);
        dEvent.LogProcess();
    }
 //Function called when this object is created to assign our delegate event
 private void Awake()
 {
     this.generalMessages     = new List <string>();
     this.combatMessages      = new List <string>();
     this.generalLogText.text = "";
     this.combatLogText.text  = "";
     this.newMessageListener  = new DelegateEvent <EVTData>(this.AddMessageToLog);
 }
Example #11
0
    /*Function called on Initialization
     * Inherits from Ship.cs to connect base delegate events */
    protected override void Awake()
    {
        base.Awake();

        //Initializes new delegate events for the Event Manager
        this.action1EVT = new DelegateEvent <EVTData>(this.AttackTest);
        this.action2EVT = new DelegateEvent <EVTData>(this.MoveTest);
    }
Example #12
0
    //Function called on Initialization
    private void Awake()
    {
        objectSelected = new List <GameObject>();

        //Initializes new DelegateEvents for the Event Manager
        this.trackObjectEVT   = new DelegateEvent <EVTData>(this.TrackSelectedObj);
        this.multiTrackEVT    = new DelegateEvent <EVTData>(this.TrackMultipleObj);
        this.clearSelectedEVT = new DelegateEvent <EVTData>(this.ClearSelected);
    }
Example #13
0
 // Use this for initialization
 private void Awake()
 {
     //Initializes a new DelegateEvent for the Event Manager
     this.setActionEVT = new DelegateEvent <EVTData>(this.SetAction);
     //Sets a quick reference to this game object's button component
     this.thisButton = GetComponent <Button>();
     //Disables the icon game object by default
     this.buttonIcon.enabled = false;
 }
Example #14
0
    public static void TriggerEvent <T>(T evt)
    {
        Delegate tempDelegate;

        if (delegates.TryGetValue(typeof(T), out tempDelegate))
        {
            DelegateEvent <T> del = tempDelegate as DelegateEvent <T>;
            del(evt);
        }
    }
Example #15
0
    public void On(string eventName, DelegateEvent.EventHandler callback)
    {
        if (!actionMap.ContainsKey(eventName))
        {
            DelegateEvent delegateEvent = new DelegateEvent();
            actionMap.Add(eventName, delegateEvent);
        }

        actionMap[eventName].addListener(callback);
    }
Example #16
0
 public void DeleteOnceEventListener(string MethodName, DelegateEvent Callback)
 {
     if (Dict_Once.ContainsKey(MethodName))
     {
         Dict_Once[MethodName] -= Callback;
         if (Dict_Once[MethodName] == null)
         {
             Dict_Once.Remove(MethodName);
         }
     }
 }
    //Function called when this object is created
    private void Awake()
    {
        //Getting the reference to our image component
        this.ourImage = this.GetComponent <Image>();

        //Making sure our image alpha is 0
        this.ourImage.color = new Color(0, 0, 0, 0);

        //Initializes new DelegateEvent for the Event Manager
        this.fadeEVT = new DelegateEvent <EVTData>(this.BeginFade);
    }
Example #18
0
 public void AddOnceEventListener(string MethodName, DelegateEvent Callback)
 {
     if (Dict_Once.ContainsKey(MethodName))
     {
         Dict_Once[MethodName] += Callback;
     }
     else
     {
         Dict_Once[MethodName] = Callback;
     }
 }
Example #19
0
    // Use this for initialization
    private void Awake()
    {
        //Setting our origin to this object's local position so we can offset from the parent
        this.origin = this.transform.localPosition;

        //Initializing our interpolator
        this.ourInterp = new Interpolator();

        //Initializing the DelegateEvents for the Event Manager
        this.startShakeEVT = new DelegateEvent <EVTData>(this.StartScreenShake);
    }
Example #20
0
    /// <summary>
    /// 发送消息并监听服务端的返回值
    /// </summary>
    /// <param name="protocol">发送的协议</param>
    /// <param name="callbackName">返回的协议名callbackName时即调用委托事件</param>
    /// <param name="delegateEvent">返回后调用的事件</param>
    /// <returns></returns>
    public bool Send(BaseProtocol protocol, string callbackName, DelegateEvent delegateEvent)
    {
        if (connectionStatus != ConnectionStatus.Connected)
        {
            Debug.LogError("发送消息失败,并未连接到服务器");
            return(false);
        }

        msgDistribution.AddOnceEventListener(callbackName, delegateEvent);

        return(Send(protocol));
    }
Example #21
0
    //Function called on initialization
    virtual protected void Awake()
    {
        //Initializes new DelegateEvents for the Event Manager
        this.selectedEVT        = new DelegateEvent <EVTData>(this.SetIcons);
        this.attackTargetEVT    = new DelegateEvent <EVTData>(this.AttackTarget);
        this.moveToTargetEVT    = new DelegateEvent <EVTData>(this.MoveToTarget);
        this.stopActionsEVT     = new DelegateEvent <EVTData>(this.ClearTarget);
        this.objectDestroyedEVT = new DelegateEvent <EVTData>(this.Destroyed);
        this.mapClickEVT        = new DelegateEvent <EVTData>(this.MoveToTarget);

        GlobalData.GlobalDataRef.GetComponent <BoxSelection>().AddUnitForSelection(this.transform);
    }
    /// <summary>
    /// 删除事件
    /// </summary>
    /// <param name="type">事件类型</param>
    /// <param name="listenerFunc">监听函数</param>
    public static void removeEventListener(EventType type, DelegateEvent.EventHandler listenerFunc)
    {
        if (listenerFunc == null)
        {
            return;
        }
        if (!eventTypeListeners.ContainsKey(type))
        {
            return;
        }
        DelegateEvent delegateEvent = eventTypeListeners[type];

        delegateEvent.removeListener(listenerFunc);
    }
Example #23
0
    public static void AddListener <T>(DelegateEvent <T> del) where T : GameEvent
    {
        Delegate tempDelegate;

        if (delegates.TryGetValue(typeof(T), out tempDelegate))
        {
            DelegateEvent <T> method = tempDelegate as DelegateEvent <T>;
            delegates[typeof(T)] = method += del;
        }
        else
        {
            delegates[typeof(T)] = del;
        }
    }
Example #24
0
    //Function called when this object is created to assign our delegate event
    private void Awake()
    {
        //Making sure all of the UI screens are closed by default when the game starts
        this.uiBlocker.SetActive(false);
        this.cityUI.cityPanelObject.SetActive(false);
        this.dungeonUI.dungeonPanelObject.SetActive(false);
        this.holyShrineUI.holyShrinePanelObject.SetActive(false);
        this.cursedShrineUI.cursedShrinePanelObject.SetActive(false);
        this.ambushUI.ambushPanelObject.SetActive(false);
        this.lootUI.lootPanelObject.SetActive(false);
        this.questUI.questPanelObject.SetActive(false);

        this.openLocationListener = new DelegateEvent <EVTData>(this.ActivateLocationScreen);
    }
Example #25
0
    //Function called when this object is created
    private void Awake()
    {
        //Resetting the loading bar value
        this.loadingBar.maxValue = 1;
        this.loadingBar.value    = 0;

        //Resetting the background slider
        this.backgroundSlider.maxValue = 1;
        this.backgroundSlider.value    = 0;

        //Making sure the UI is off by default
        this.loadingUIObject.SetActive(false);

        this.toggleLoadEVT = new DelegateEvent <EVTData>(this.ToggleLoad);
    }
    /// <summary>
    /// 添加事件
    /// </summary>
    /// <param name="type">事件类型</param>
    /// <param name="listenerFunc">监听函数</param>
    public static void addEventListener(EventType type, DelegateEvent.EventHandler listenerFunc)
    {
        DelegateEvent delegateEvent;

        if (eventTypeListeners.ContainsKey(type))
        {
            delegateEvent = eventTypeListeners[type];
        }
        else
        {
            delegateEvent            = new DelegateEvent();
            eventTypeListeners[type] = delegateEvent;
        }
        delegateEvent.addListener(listenerFunc);
    }
    /// <summary>
    /// 触发某一类型的事件  并传递数据
    /// </summary>
    /// <param name="type">事件类型</param>
    /// <param name="data">事件的数据(可为null)</param>
    public static void dispatchEvent(EventType type, object data)
    {
        if (!eventTypeListeners.ContainsKey(type))
        {
            return;
        }
        //创建事件数据
        EventData eventData = new EventData();

        eventData.type = type;
        eventData.data = data;

        DelegateEvent delegateEvent = eventTypeListeners[type];

        delegateEvent.Handle(eventData);
    }
    //Function called when this object is created
    private void Awake()
    {
        //Setting the static reference
        if (globalReference == null)
        {
            globalReference = this;
        }
        //If a static reference already exists, this component is destroyed
        else
        {
            Destroy(this);
        }

        //Initializes the Delegate Event for the Event Manager
        this.trackTimePassageEVT = new DelegateEvent <EVTData>(this.TrackTimePassage);
    }
Example #29
0
    //Function called when this object is created
    private void Awake()
    {
        //Initializing our lists
        this.majorActions     = new List <Action>();
        this.minorActions     = new List <Action>();
        this.fastActions      = new List <Action>();
        this.massiveActions   = new List <Action>();
        this.allSpellActions  = new List <SpellAction>();
        this.rechargingSpells = new List <SpellRecharge>();

        //Initializes the Delegate Event for the Event manager
        this.rechargeSpellsEVT = new DelegateEvent <EVTData>(this.RechargeSpells);

        //Initializing the empty list of action cooldowns
        this.actionCooldowns = new List <ActionCooldown>();
    }
Example #30
0
    //Removes the given UnityAction from the dictionary of events with the given event number
    public static void StopListening(byte evtNum_, DelegateEvent <EVTData> evtListener_)
    {
        if (EVTManager == null)
        {
            return;
        }

        List <DelegateEvent <EVTData> > stopListeningDelegate = null;

        //Checks to see if our entry for the event dictionary is found. If so, removes the listener from the event
        if (EVTManager.EventDictionary.TryGetValue(evtNum_, out stopListeningDelegate))
        {
            stopListeningDelegate.Remove(evtListener_);
        }
        //If an existing entry isn't found, nothing happens
    }