/// <summary>Deserialize into new object instance</summary> public Cue(CueDeserializeContext context) { friendlyName = context.br.ReadNullableString(); type = (CueType)context.br.ReadByte(); radius = context.br.ReadInt32(); pitch = context.br.ReadSingle(); pan = context.br.ReadSingle(); volume = context.br.ReadSingle(); var soundsCount = context.br.ReadInt32(); for (var i = 0; i < soundsCount; i++) { sounds.Add(context.ReadSound()); } if (context.Version >= 2) { minPitch = context.br.ReadNullableSingle(); maxPitch = context.br.ReadNullableSingle(); } if (context.Version >= 3) { if (radius == 0) { radius = 100; // new default } } }
public Cue(ulong fire_at, ulong remove_at, CueType type, int draw_order) { this.fire_at = fire_at; this.remove_at = remove_at; this.type = type; this.draw_order = draw_order; }
public GameVariableInfo gameVariableInfo; /**< ゲーム変数 */ public CueInfo(byte[] data, int startIndex) { if (IntPtr.Size == 4) { this.id = BitConverter.ToInt32(data, startIndex + 0); this.type = (CueType)BitConverter.ToInt32(data, startIndex + 4); this.name = Marshal.PtrToStringAnsi(new IntPtr(BitConverter.ToInt32(data, startIndex + 8))); this.userData = Marshal.PtrToStringAnsi(new IntPtr(BitConverter.ToInt32(data, startIndex + 12))); this.length = BitConverter.ToInt64(data, startIndex + 16); this.categories = new ushort[16]; for (int i = 0; i < 16; ++i) { categories[i] = BitConverter.ToUInt16(data, startIndex + 24 + (2 * i)); } this.numLimits = BitConverter.ToInt16(data, startIndex + 56); this.numBlocks = BitConverter.ToUInt16(data, startIndex + 58); this.priority = data[startIndex + 60]; this.headerVisibility = data[startIndex + 61]; this.reserved = new byte[2]; for (int i = 0; i < 2; ++i) { reserved[i] = data[startIndex + 62 + (1 * i)]; } this.pos3dInfo = new CuePos3dInfo(data, startIndex + 64); this.gameVariableInfo = new GameVariableInfo(data, startIndex + 92); } else { this.id = BitConverter.ToInt32(data, startIndex + 0); this.type = (CueType)BitConverter.ToInt32(data, startIndex + 4); this.name = Marshal.PtrToStringAnsi(new IntPtr(BitConverter.ToInt64(data, startIndex + 8))); this.userData = Marshal.PtrToStringAnsi(new IntPtr(BitConverter.ToInt64(data, startIndex + 16))); this.length = BitConverter.ToInt64(data, startIndex + 24); this.categories = new ushort[16]; for (int i = 0; i < 16; ++i) { categories[i] = BitConverter.ToUInt16(data, startIndex + 32 + (2 * i)); } this.numLimits = BitConverter.ToInt16(data, startIndex + 64); this.numBlocks = BitConverter.ToUInt16(data, startIndex + 66); this.priority = data[startIndex + 68]; this.headerVisibility = data[startIndex + 69]; this.reserved = new byte[2]; for (int i = 0; i < 2; ++i) { reserved[i] = data[startIndex + 70 + (1 * i)]; } this.pos3dInfo = new CuePos3dInfo(data, startIndex + 72); this.gameVariableInfo = new GameVariableInfo(data, startIndex + 104); } }
IEnumerable <Cue> CuesFind(CueType cueType, string linkName = null, bool reverse = false, bool allowCoroutines = true) { // Get main passage's cues List <Cue> mainCues = CuesGet(this.CurrentPassage.Name, cueType, linkName, allowCoroutines); // Return them here only if not reversing if (!reverse && mainCues != null) { for (int h = 0; h < mainCues.Count; h++) { yield return(mainCues[h]); } } // Note: Since 2.0, the Output list can be rearranged by changing the InsertStack. // Consequently, later embedded passages' cues can be triggered before earlier embedded // passages' cues if they were inserted higher up in the list. int c = 0; for ( int i = reverse ? this.Output.Count - 1 : 0; reverse?i >= 0 : i < this.Output.Count; c++, i = i + (reverse ? -1 : 1) ) { EmbedPassage passageEmbed = this.Output[i] as EmbedPassage; if (passageEmbed == null) { continue; } List <Cue> cues = CuesGet(passageEmbed.Name, cueType, linkName, allowCoroutines); if (cues != null) { for (int h = 0; h < cues.Count; h++) { yield return(cues[h]); } } } // Reversing, so return the main cues now if (reverse && mainCues != null) { for (int h = 0; h < mainCues.Count; h++) { yield return(mainCues[h]); } } }
public StoryCueAttribute(string passageName, string linkName, CueType cue) { this.PassageName = passageName; this.LinkName = linkName; this.Cue = cue; }
public StoryCueAttribute(string passageName, CueType cue) : this(passageName, null, cue) { }
// IMPORTANT: Any changes made in this function should be cross-checked with both the corresponding JSON // and the UXF data-points collection public void LoadFromUxfJson() { var sessionSettingsDict = Session.instance.settings.GetDict("SessionSettings"); sessionType = ParseSessionType((string)Session.instance.participantDetails["SessionType"]); cueType = ParseCueType((string)sessionSettingsDict["AttentionCueType"]); feedbackType = ParseFeedbackType((string)Session.instance.participantDetails["FeedbackType"]); numTrials = Convert.ToInt32(sessionSettingsDict["NumTrials"]); fixationTime = Convert.ToSingle(sessionSettingsDict["FixationTimeSeconds"]); fixationDotRadius = Convert.ToSingle(sessionSettingsDict["FixationDotRadiusDegrees"]); skyColor = ParseColor((List <object>)sessionSettingsDict["SkyColor"]); stimulusDensity = Convert.ToSingle(sessionSettingsDict["StimulusDensity"]); minDotLifetime = Convert.ToSingle(sessionSettingsDict["MinDotLifetimeSeconds"]); maxDotLifetime = Convert.ToSingle(sessionSettingsDict["MaxDotLifetimeSeconds"]); dotSize = Convert.ToSingle(sessionSettingsDict["StimulusDotSizeArcMinutes"]); outerStimulusRadius = Convert.ToSingle(sessionSettingsDict["OuterStimulusRadiusDegrees"]); outerStimulusNoisePercentage = Convert.ToSingle(sessionSettingsDict["OuterStimulusNoisePercentage"]); innerStimulusNoisePercentage = Convert.ToSingle(sessionSettingsDict["InnerStimulusNoisePercentage"]); innerStimulusRadius = Convert.ToSingle(sessionSettingsDict["InnerStimulusRadiusDegrees"]); innerStimulusSpawnRadius = Convert.ToSingle(sessionSettingsDict["InnerStimulusSpawnRadius"]); outerStimulusStart = Convert.ToSingle(sessionSettingsDict["OuterStimulusStartMs"]); outerStimulusDuration = Convert.ToSingle(sessionSettingsDict["OuterStimulusDurationMs"]); innerStimulusStart = Convert.ToSingle(sessionSettingsDict["InnerStimulusStartMs"]); innerStimulusDuration = Convert.ToSingle(sessionSettingsDict["InnerStimulusDurationMs"]); stimulusDepth = Convert.ToSingle(sessionSettingsDict["StimulusDepthMeters"]); interTrialDelay = Convert.ToSingle(sessionSettingsDict["InterTrialDelaySeconds"]); regionSlices = Convert.ToInt32(sessionSettingsDict["TotalRegionSlices"]); flipRegions = Convert.ToBoolean(sessionSettingsDict["FlipRegions"]); coherenceStaircase = ParseFloatList((List <object>)sessionSettingsDict["CoherenceStaircase"]); staircaseIncreaseThreshold = Convert.ToInt32(sessionSettingsDict["StaircaseIncreaseThreshold"]); staircaseDecreaseThreshold = Convert.ToInt32(sessionSettingsDict["StaircaseDecreaseThreshold"]); interTrialDelay = Convert.ToSingle(sessionSettingsDict["InterTrialDelaySeconds"]); stimulusSpacing = Convert.ToSingle(sessionSettingsDict["StimulusSpacingMeters"]); coarseAdjustEnabled = Convert.ToBoolean(sessionSettingsDict["CoarseAdjustment"]); choosableAngles = ParseFloatList((List <object>)sessionSettingsDict["ChoosableAngles"]); attentionCueStart = Convert.ToSingle(sessionSettingsDict["AttentionCueStartMs"]); attentionCueDuration = Convert.ToSingle(sessionSettingsDict["AttentionCueDurationMs"]); attentionCueDepth = Convert.ToSingle(sessionSettingsDict["AttentionCueDepth"]); attentionCueDistance = Convert.ToSingle(sessionSettingsDict["AttentionCueLengthDegrees"]); pulseFrequency = Convert.ToSingle(sessionSettingsDict["PulseFrequency"]); sampleRate = Convert.ToSingle(sessionSettingsDict["SampleRate"]); angleErrorTolerance = Convert.ToSingle(sessionSettingsDict["AngleErrorToleranceDegrees"]); positionErrorTolerance = Convert.ToSingle(sessionSettingsDict["PositionErrorToleranceDegrees"]); positionStaircaseEnabled = Convert.ToBoolean(sessionSettingsDict["EnableLocationalStaircase"]); directionStaircaseEnabled = Convert.ToBoolean(sessionSettingsDict["EnableDirectionalStaircase"]); fixationErrorTolerance = Convert.ToSingle(sessionSettingsDict["FixationErrorToleranceRadiusDegrees"]); buddyDotsEnabled = Convert.ToBoolean(sessionSettingsDict["EnableBuddyDots"]); inputStart = Convert.ToSingle(sessionSettingsDict["InputStartMs"]); inputDuration = Convert.ToSingle(sessionSettingsDict["InputDurationMs"]); fixationBreakCheckStart = Convert.ToSingle(sessionSettingsDict["FixationBreakCheckStartMs"]); fixationBreakCheckDuration = Convert.ToSingle(sessionSettingsDict["FixationBreakCheckDurationMs"]); headFixationDistanceErrorTolerance = Convert.ToSingle(sessionSettingsDict["HeadStabilityDistanceErrorToleranceM"]); headFixationAngleErrorTolerance = Convert.ToSingle(sessionSettingsDict["HeadStabilityAngleErrorToleranceDegrees"]); headFixationStart = Convert.ToSingle(sessionSettingsDict["HeadStabilityCheckStartMs"]); headFixationDuration = Convert.ToSingle(sessionSettingsDict["HeadStabilityCheckDurationMs"]); timeoutIsFailure = Convert.ToBoolean(sessionSettingsDict["FailOnTimeout"]); }
public async Task <QLabResponse <string> > CreateWorkSpaceCue(string workspaceGuid, CueType type, int timeout = 500) { string path = string.Format(WorkspaceConstants.WORKSPACE, workspaceGuid) + WorkspaceConstants.CREATE_CUE; object cueTypeName = Enum.GetName(typeof(CueType), type).ToLower(); return(await base.Send <QLabResponse <string> >(path, timeout : timeout, cueTypeName)); }