Example #1
0
    public void Process(QuestionnaireTrial trial)
    {
        EventData e = new EventData();

        e.Add(Information.time);
        e.Add("Index", trial.Index + "");
        e.Add("Question", trial.Prompt);
        e.Add("Response", "" + trial.AnswerString);
        Analytics.LogEvent(e);
        Analytics.LogCritical(QuestionnaireTitle + "_" + trial.Index, trial.AnswerString);
    }
    public void QuestionAnswered(LikertTrial trial, int response)
    {
        if (timeFirstAnswered < 0f)
        {
            timeFirstAnswered = Time.time;
        }

        Trials.Remove(trial);

        if (DoneTrials.Contains(trial) == false)
        {
            DoneTrials.Add(trial);
        }

        if (Trials.Count == 0)
        {
            foreach (LikertTrial t in DoneTrials)
            {
                Process(t);
            }


            float score = (float)TotalScore / (float)NumberOfAnswers;

            EventData e = new EventData();

            float calc = Time.time - timeFirstAnswered;

            e.Add("Timestamp", "" + Time.time);
            e.Add("Likert Task Ended", this.LikertTitle);
            e.Add("Score", "" + score);
            e.Add("Time taken", "" + calc);


            Analytics.LogEvent(e);


            UISequencer.current.Next();
        }
        else
        {
            if (trial.Index < MainPanel.transform.childCount - 1)
            {
                trialTarget     = MainPanel.transform.GetChild(trial.Index + 1);
                centringOnTrial = true;
            }
            else if (trial.Index == MainPanel.transform.childCount - 1)
            {
                trialTarget     = MainPanel.transform.GetChild(trial.Index - 1);
                centringOnTrial = true;
            }
        }
    }
Example #3
0
        private void SuscribeToCoreEvents()
        {
            GameEvents.onVesselLoaded.Add(OnVesselLoad);
            onModMessageReceivedEvent = GameEvents.FindEvent <EventData <string, byte[]> >("onModMessageReceived");
            if (onModMessageReceivedEvent != null)
            {
                BDArmorySettings.MULTIPLAYER_ACTIVE = true;
                Debug.Log("[BDArmory]: LMP Multiplayer enabled");
                onModMessageReceivedEvent.Add(OnModMessageReceived);

                Dependencies.Get <DamageEventService>().OnActionExecuted       += OnActionExecuted;
                Dependencies.Get <ExplosionEventService>().OnActionExecuted    += OnActionExecuted;
                Dependencies.Get <ArmorEventService>().OnActionExecuted        += OnActionExecuted;
                Dependencies.Get <VesselTeamChangeService>().OnActionExecuted  += OnActionExecuted;
                Dependencies.Get <ForceEventService>().OnActionExecuted        += OnActionExecuted;
                Dependencies.Get <TurretAimEventService>().OnActionExecuted    += OnActionExecuted;
                Dependencies.Get <FireEventService>().OnActionExecuted         += OnActionExecuted;
                Dependencies.Get <MissileFiredEventService>().OnActionExecuted += OnActionExecuted;
                Dependencies.Get <RequestTeamEventService>().OnActionExecuted  += OnActionExecuted;
            }
            else
            {
                Debug.Log("[BDArmory]: LMP Multiplayer disabled");
                BDArmorySettings.MULTIPLAYER_ACTIVE = false;
            }
        }
        private void Start()
        {
            if (onContractChange == null)
            {
                onContractChange = new EventData <float[], contractTypeContainer>("onContractChange");
            }
            if (onParamChange == null)
            {
                onParamChange = new EventData <float[], paramTypeContainer>("onParamChange");
            }
            onContractChange.Add(contractChanged);
            onParamChange.Add(paramChanged);
            GameEvents.Contract.onOffered.Add(contractOffered);

            if (stockToolbar || !ToolbarManager.ToolbarAvailable)
            {
                appLauncherButton = gameObject.AddComponent <contractStockToolbar>();
                if (blizzyToolbarButton != null)
                {
                    Destroy(blizzyToolbarButton);
                }
            }
            else if (ToolbarManager.ToolbarAvailable && !stockToolbar)
            {
                blizzyToolbarButton = gameObject.AddComponent <contractToolbar>();
                if (appLauncherButton != null)
                {
                    Destroy(appLauncherButton);
                }
            }
        }
Example #5
0
        private void Start()
        {
            var rp0Settings = HighLogic.CurrentGame.Parameters.CustomParams <RP0Settings>();

            // Nothing gets saved in simulations. Use static fields to pass the information over to the editor scene where it gets correctly persisted.
            if (_isInterplanetaryWarningShown)
            {
                rp0Settings.Avionics_InterplanetaryWarningShown = true;
            }
            _isInterplanetaryWarningShown |= rp0Settings.Avionics_InterplanetaryWarningShown;

            if (_airlaunchTipShown)
            {
                rp0Settings.AirlaunchTipShown = true;
            }
            _airlaunchTipShown |= rp0Settings.AirlaunchTipShown;

            _onKctVesselAddedToBuildQueueEvent = GameEvents.FindEvent <EventData <BuildListVessel> >("OnKctVesselAddedToBuildQueue");
            if (_onKctVesselAddedToBuildQueueEvent != null)
            {
                _onKctVesselAddedToBuildQueueEvent.Add(OnKctVesselAddedToBuildQueue);
            }

            var vessel = FlightGlobals.ActiveVessel;

            if (!_airlaunchTipShown && vessel &&
                KerbalConstructionTime.Utilities.IsSimulationActive &&
                vessel.GetVesselBuiltAt() == EditorFacility.SPH &&
                vessel.FindPartModuleImplementing <ModuleEngineConfigs>() != null)    // Does the vessel have a rocket engine?
            {
                ShowAirlaunchTip();
            }
        }
Example #6
0
        public void Start()
        {
            onKctTechQueuedEvent = GameEvents.FindEvent <EventData <RDTech> >("OnKctTechQueued");
            if (onKctTechQueuedEvent != null)
            {
                onKctTechQueuedEvent.Add(OnKctTechQueued);
                Debug.Log($"[LRTR] Bound to OnKctTechQueued");
            }

            onKctTechCompletedEvent = GameEvents.FindEvent <EventData <ProtoTechNode> >("OnKctTechCompleted");
            if (onKctTechCompletedEvent != null)
            {
                onKctTechCompletedEvent.Add(OnKctTechCompleted);
                Debug.Log($"[LRTR] Bound to OnKctTechCompleted");
            }

            onKctFacilityUpgradeQueuedEvent = GameEvents.FindEvent <EventData <KCT_UpgradingBuilding> >("OnKctFacilityUpgradeQueued");
            if (onKctFacilityUpgradeQueuedEvent != null)
            {
                onKctFacilityUpgradeQueuedEvent.Add(OnKctFacilityUpgdQueued);
                Debug.Log($"[LRTR] Bound to OnKctFacilityUpgradeQueued");
            }

            onKctFacilityUpgradeCompletedEvent = GameEvents.FindEvent <EventData <KCT_UpgradingBuilding> >("OnKctFacilityUpgradeComplete");
            if (onKctFacilityUpgradeCompletedEvent != null)
            {
                onKctFacilityUpgradeCompletedEvent.Add(OnKctFacilityUpgdComplete);
                Debug.Log($"[LRTR] Bound to OnKctFacilityUpgradeComplete");
            }

            StartCoroutine(CreateCoursesRoutine());
        }
Example #7
0
        public IActionResult NewEvent(Event newEvent)
        {
            EventData.Add(newEvent);


            return(Redirect("/Events"));
        }
Example #8
0
        public void Start()
        {
            RotationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived16");
            if (RotationChannel != null)
            {
                RotationChannel.Add(vesselRotationCallback);
            }
            TranslationChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived17");
            if (TranslationChannel != null)
            {
                TranslationChannel.Add(vesselTranslationCallback);
            }
            WheelChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived18");
            if (WheelChannel != null)
            {
                WheelChannel.Add(wheelCallback);
            }
            ThrottleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived19");
            if (ThrottleChannel != null)
            {
                ThrottleChannel.Add(throttleCallback);
            }
            AutopilotChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived28");
            if (AutopilotChannel != null)
            {
                AutopilotChannel.Add(autopilotModeCallback);
            }

            FlightGlobals.ActiveVessel.OnPostAutopilotUpdate += AutopilotUpdater;
        }
Example #9
0
        public void Start()
        {
            activateBuffer     = 0;
            deactivateBuffer   = 0;
            toggleBuffer       = 0;
            currentStateBuffer = 0;

            AGActivateChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.ActionGroupActivate);
            if (AGActivateChannel != null)
            {
                AGActivateChannel.Add(actionActivateCallback);
            }
            AGDeactivateChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.ActionGroupDeactivate);
            if (AGDeactivateChannel != null)
            {
                AGDeactivateChannel.Add(actionDeactivateCallback);
            }
            AGToggleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + +InboundPackets.ActionGroupToggle);
            if (AGToggleChannel != null)
            {
                AGToggleChannel.Add(actionToggleCallback);
            }

            AGStateChannel = GameEvents.FindEvent <EventData <byte, object> >("toSerial" + OutboundPackets.ActionGroups);
            GameEvents.FindEvent <EventData <byte, object> >("onSerialChannelSubscribed" + OutboundPackets.ActionGroups).Add(resendActionGroup);
        }
Example #10
0
 private void Start()
 {
     Debug.Log("[Bureaucracy]: Registering Events");
     GameEvents.OnVesselRollout.Add(AddLaunch);
     GameEvents.Contract.onOffered.Add(OnContractOffered);
     GameEvents.onFacilityContextMenuSpawn.Add(OnFacilityContextMenuSpawn);
     GameEvents.OnScienceRecieved.Add(OnScienceReceived);
     GameEvents.OnCrewmemberHired.Add(OnCrewMemberHired);
     GameEvents.onKerbalStatusChanged.Add(PotentialKerbalDeath);
     GameEvents.onGUIAstronautComplexSpawn.Add(AstronautComplexSpawned);
     GameEvents.onGUIAstronautComplexDespawn.Add(AstronautComplexDespawned);
     Debug.Log("[Bureaucracy]: Stock Events Registered");
     FlightTrackerApi.OnFlightTrackerUpdated.Add(HandleRecovery);
     Debug.Log("[Bureaucracy]: FlightTracker Events Registered");
     kerbalism = new KerbalismApi();
     if (SettingsClass.Instance.HandleScience && kerbalism.ActivateKerbalismInterface())
     {
         onKerbalismScience = GameEvents.FindEvent <EventData <List <ScienceSubject>, List <double> > >("onSubjectsReceived");
         if (onKerbalismScience == null)
         {
             return;
         }
         onKerbalismScience.Add(OnKerbalismScienceReceived);
         Debug.Log("[Bureaucracy]: Kerbalism Event Registered");
     }
     Debug.Log("[Bureaucracy]: All Events Successfully Registered");
 }
Example #11
0
        public void Start()
        {
            activateBuffer     = 0;
            deactivateBuffer   = 0;
            toggleBuffer       = 0;
            currentStateBuffer = 0;

            AGActivateChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived13");
            if (AGActivateChannel != null)
            {
                AGActivateChannel.Add(actionActivateCallback);
            }
            AGDeactivateChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived14");
            if (AGDeactivateChannel != null)
            {
                AGDeactivateChannel.Add(actionDeactivateCallback);
            }
            AGToggleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived15");
            if (AGToggleChannel != null)
            {
                AGToggleChannel.Add(actionToggleCallback);
            }

            AGStateChannel = GameEvents.FindEvent <EventData <byte, object> >("toSerial23");
        }
Example #12
0
        public void Start()
        {
            // Debug.Log("CLSAddon:Start");
            _settingsPath = $"{KSPUtil.ApplicationRootPath}GameData/ConnectedLivingSpace/Plugins/PluginData";
            _settingsFile = $"{_settingsPath}/cls_settings.dat";

            _windowStyle = new GUIStyle(HighLogic.Skin.window);

            // load toolbar selection setting
            ApplySettings();

            if (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight)
            {
                // TODO check events
                GameEvents.onFlightReady.Add(OnFlightReady);
                GameEvents.onVesselChange.Add(OnVesselChange);
                GameEvents.onVesselWasModified.Add(onVesselWasModified);
                onCLSVesselChange.Add(onCLSVesselChangeHandler);
                GameEvents.onEditorShipModified.Add(OnEditorShipModified);
                GameEvents.onGameSceneSwitchRequested.Add(OnGameSceneSwitchRequested);

                GameEvents.onItemTransferStarted.Add(OnItemTransferStarted);
                GameEvents.onCrewTransferPartListCreated.Add(OnCrewTransferPartListCreated);
                GameEvents.onCrewTransferSelected.Add(OnCrewTransferSelected);
            }

            // Add the CLSModule to all parts that can house crew (and do not already have it).
            if (HighLogic.LoadedScene == GameScenes.LOADING)
            {
                AddModuleToParts();

                // Add hatches to all the docking ports (prefabs)
                //AddHatchModuleToPartPrefabs();
            }
        }
Example #13
0
        public void Start()
        {
            onKctTechCompletedEvent = GameEvents.FindEvent <EventData <TechItem> >("OnKctTechCompleted");
            if (onKctTechCompletedEvent != null)
            {
                onKctTechCompletedEvent.Add(OnKctTechCompleted);
            }

            onKctFacilityUpgradeQueuedEvent = GameEvents.FindEvent <EventData <FacilityUpgrade> >("OnKctFacilityUpgradeQueued");
            if (onKctFacilityUpgradeQueuedEvent != null)
            {
                onKctFacilityUpgradeQueuedEvent.Add(OnKctFacilityUpgdQueued);
            }

            onKctFacilityUpgradeCompletedEvent = GameEvents.FindEvent <EventData <FacilityUpgrade> >("OnKctFacilityUpgradeComplete");
            if (onKctFacilityUpgradeCompletedEvent != null)
            {
                onKctFacilityUpgradeCompletedEvent.Add(OnKctFacilityUpgdComplete);
            }

            onKctPadConstructionQueuedEvent = GameEvents.FindEvent <EventData <PadConstruction, KCT_LaunchPad> > ("OnKctPadConstructionQueued");
            if (onKctPadConstructionQueuedEvent != null)
            {
                onKctPadConstructionQueuedEvent.Add(OnKctPadConstructionQueued);
            }

            onKctPadConstructionCompletedEvent = GameEvents.FindEvent <EventData <PadConstruction, KCT_LaunchPad> >("OnKctPadConstructionComplete");
            if (onKctPadConstructionCompletedEvent != null)
            {
                onKctPadConstructionCompletedEvent.Add(OnKctPadConstructionComplete);
            }
        }
        public void Start()
        {
            AGXPresent = AGXInstalled();
            if (KSPit.Config.Verbose)
            {
                Debug.Log(String.Format("KerbalSimpit: ActionGroupsExtended installed: {0}", AGXPresent));
            }

            enableChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.CAGEnable);
            if (enableChannel != null)
            {
                enableChannel.Add(enableCAGCallback);
            }
            disableChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.CAGDisable);
            if (disableChannel != null)
            {
                disableChannel.Add(disableCAGCallback);
            }
            toggleChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.CAGToggle);
            if (toggleChannel != null)
            {
                toggleChannel.Add(toggleCAGCallback);
            }

            CAGStateChannel = GameEvents.FindEvent <EventData <byte, object> >("toSerial" + OutboundPackets.CustomActionGroups);
            GameEvents.FindEvent <EventData <byte, object> >("onSerialChannelSubscribed" + OutboundPackets.CustomActionGroups).Add(resendActionGroup);

            lastCAGStatus = new CAGStatusStruct();
        }
        public void Start()
        {
            GameEvents.onVesselCreate.Add(OnVesselCreate);
            GameEvents.onVesselWasModified.Add(OnVesselWasModified);
            GameEvents.onVesselDestroy.Add(OnVesselDestroy);             // FEHLER, evtl. onAboutToDestroy nutzen??

            GameEvents.onVesselGoOffRails.Add(OnVesselOffRails);
            GameEvents.onVesselGoOnRails.Add(OnVesselOnRails);

            GameEvents.onPartDestroyed.Add(RemovePartJoints);
            GameEvents.onPartDie.Add(RemovePartJoints);
            GameEvents.onPartDeCouple.Add(RemovePartJoints);

            GameEvents.onPhysicsEaseStart.Add(OnEaseStart);
            GameEvents.onPhysicsEaseStop.Add(OnEaseStop);

#if Compatible
            // >= 1.7.2
            if (onRoboticPartLockChangingField != null)
            {
                EventData <Part, bool> onRoboticPartLockChanging = (EventData <Part, bool>)onRoboticPartLockChangingField.GetValue(null);
                onRoboticPartLockChanging.Add(OnRoboticPartLockChanging);
            }
#endif

#if !Compatible
            GameEvents.onRoboticPartLockChanging.Add(OnRoboticPartLockChanging);
#endif

// FHELER, der decoupler hat noch das Pack behandelt... müsste man das auch noch? ist das nicht immer dann, wenn man onrails geht??? -> doch, wird genau nur dann gesendet
        }
 public void Start()
 {
     WarpChannel = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.WarpChange);
     if (WarpChannel != null)
     {
         WarpChannel.Add(WarpCommandCallback);
     }
 }
 protected override void OnAwake()
 {
     onEngineHoverChangeEvent = GameEvents.FindEvent <EventData <ModuleKerbetrotterEngine, bool> >("onEngineHover");
     if (onEngineHoverChangeEvent != null)
     {
         onEngineHoverChangeEvent.Add(onEngineHoverChange);
     }
 }
Example #18
0
 public ISPADEventArgs WithData(Dictionary <string, string> eventData)
 {
     foreach (var item in eventData)
     {
         EventData.Add(item.Key, item.Value);
     }
     return(this);
 }
        void Start()
        {
            DontDestroyOnLoad(this);
            Instance = this;

            OnParameterChange.Add(new EventData <Contract, ContractParameter> .OnEvent(ParameterChange));
            GameEvents.OnTechnologyResearched.Add(new EventData <GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> > .OnEvent(OnTechResearched));
        }
Example #20
0
        public void EventData_Add_Variable()
        {
            var variable = "value";
            var data     = new EventData();

            data.Add(() => variable);

            Assert.IsTrue(data.Contains("variable"));
        }
Example #21
0
 internal void AddEventChart()
 {
     EventData.Add(new ChartEvent
     {
         EventStart       = Data[Data.Count - 1].ProcesTime,
         EventEnd         = Data[Data.Count - 1].ProcesTime,
         EventDescription = string.Format("Prvi korak", Environment.NewLine),
         Value            = 44d
     });
 }
Example #22
0
        public void Start()
        {
            onKctTechQueuedEvent = GameEvents.FindEvent <EventData <RDTech> >("OnKctTechQueued");
            if (onKctTechQueuedEvent != null)
            {
                onKctTechQueuedEvent.Add(OnKctTechQueued);
            }

            StartCoroutine(CreateCoursesRoutine());
        }
Example #23
0
        public void Start()
        {
            keyboardEmulatorEvent = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived" + InboundPackets.KeyboardEmulator);
            if (keyboardEmulatorEvent != null)
            {
                keyboardEmulatorEvent.Add(KeyboardEmulatorCallback);
            }

            input = new InputSimulator();
        }
        void Start()
        {
            DontDestroyOnLoad(this);
            Instance = this;

            PSystemManager.Instance.OnPSystemReady.Add(PSystemReady);

            OnParameterChange.Add(new EventData <Contract, ContractParameter> .OnEvent(ParameterChange));
            GameEvents.OnTechnologyResearched.Add(new EventData <GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> > .OnEvent(OnTechResearched));
            GameEvents.Contract.onParameterChange.Add(new EventData <Contract, ContractParameter> .OnEvent(StockOnParameterChange));
        }
Example #25
0
        public void EventData_Add_Property()
        {
            var model = new EventDataTestModel
            {
                Id = "testmodel"
            };
            var data = new EventData();

            data.Add(() => model.Id);

            Assert.IsTrue(data.Contains("Id"));
        }
Example #26
0
    public void EndQuestionnaire()
    {
        foreach (QuestionnaireTrial t in DoneTrials)
        {
            Process(t);
        }

        EventData e = new EventData();

        float calc = Time.time - timeFirstAnswered;

        e.Add("Time", "" + Time.time);
        e.Add("Questionnaire Ended", this.name);
        e.Add("Time taken", "" + calc);


        Analytics.LogEvent(e);


        UISequencer.current.Next();
    }
Example #27
0
        /// <summary>
        /// Handles OnAwake event
        /// </summary>
        public override void OnAwake()
        {
            setupVariants();
            GameEvents.onVariantApplied.Add(onVariantApplied);
            if (HighLogic.LoadedSceneIsEditor)
            {
                GameEvents.onEditorVariantApplied.Add(onEditorVariantApplied);
            }

            onApplyVariantExtraInfo.Add(onApplyVariantExtraInfoHandler);
            Fields["variantIndex"].guiActive = allowFieldUpdate;
        }
    public void Process(WordTaskTrial trial)
    {
        totalTrials += 1;

        EventData e = new EventData();

        e.Add("Index", trial.Index + "");
        e.Add("Fragment", trial.Fragment);
        e.Add("Response", trial.Response.text);


        if (TargetResponses.Contains(trial.Response.text.ToLower()))
        {
            targetTrials += 1;
            e.Add("Result", "target");
        }
        else if (OffTargetResponses.Contains(trial.Response.text.ToLower()))
        {
            offTargetTrials += 1;
            e.Add("Result", "off-target");
        }
        else
        {
            e.Add("Result", "nothing");
        }

        Analytics.AddEvent(e);
    }
Example #29
0
 public void Start()
 {
     echoRequestEvent = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived1");
     if (echoRequestEvent != null)
     {
         echoRequestEvent.Add(EchoRequestCallback);
     }
     echoReplyEvent = GameEvents.FindEvent <EventData <byte, object> >("onSerialReceived2");
     if (echoReplyEvent != null)
     {
         echoReplyEvent.Add(EchoReplyCallback);
     }
 }
Example #30
0
        public void Start()
        {
            onKctTechQueuedEvent = GameEvents.FindEvent <EventData <RDTech> >("OnKctTechQueued");
            if (onKctTechQueuedEvent != null)
            {
                onKctTechQueuedEvent.Add(AddCoursesForQueuedTechNode);
            }

            if (CurrentSceneAllowsCrewManagement)
            {
                StartCoroutine(CreateUnderResearchCoursesRoutine());
            }
            StartCoroutine(EnsureActiveCrewInSimulationRoutine());
        }