private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { enabled = true; } }
private void getBin(ScriptEventData gotBin) { //Log.Write("A"); if (gotBin.Data == null) { return; } //Log.Write("B"); SendActiveBins sendBin = gotBin.Data.AsInterface <SendActiveBins>(); //Log.Write("C"); if (sendBin == null) { Log.Write(LogLevel.Error, Script.ID.ToString(), "Unable to create interface, check logs for missing member(s)"); return; } string binToReturn; binToReturn = sendBin.SendActiveBin.ElementAt(0); //Log.Write("D"); string VolumeFlag = sendBin.SendActiveBin.ElementAt(1); //Log.Write("binToReturn: " + binToReturn); //og.Write("VolumeFlag: " + VolumeFlag); // Log.Write("pos: " + pos); if (!(VolumeFlag == "volume")) { if ((binToReturn == pos) || (binToReturn == "all")) { ReturnBeatBlock(); } } }
private void LocalTeleport(int MoveNumber, ScriptEventData data) { Log.Write("MoveNumber: " + MoveNumber); LastCameraMan = CameraMan; foreach (AgentPrivate agent in ScenePrivate.GetAgents()) { Log.Write(agent.AgentInfo.Name); if (agent.AgentInfo.Name == CameraMan) { Log.Write("Camaeraman found"); ObjectPrivate objectPrivate = ScenePrivate.FindObject(agent.AgentInfo.ObjectId); if (objectPrivate != null) { AnimationComponent anim = null; if (objectPrivate.TryGetFirstComponent(out anim)) { RigidBody.SetPosition(MoveVector[MoveNumber]); Wait(TimeSpan.FromSeconds(0.05)); anim.SetPosition(MoveVector[MoveNumber]); Wait(TimeSpan.FromSeconds(0.05)); Quaternion rotation = Quaternion.FromEulerAngles(Mathf.RadiansPerDegree * RotateVector[MoveNumber]); RigidBody.SetOrientation(rotation); //PlayMovement(MoveNumber, data); } } } } }
private void LocalTeleport(ScriptEventData data) { Log.Write("A"); foreach (AgentPrivate agent in ScenePrivate.GetAgents()) { Log.Write(agent.AgentInfo.Name); if (agent.AgentInfo.Name == "GranddadGotMojo") { Log.Write("Camaeraman found"); ObjectPrivate objectPrivate = ScenePrivate.FindObject(agent.AgentInfo.ObjectId); if (objectPrivate != null) { AnimationComponent anim = null; if (objectPrivate.TryGetFirstComponent(out anim)) { if (RelativeDestination) { anim.SetPosition(Destination + ObjectPrivate.Position); } else { anim.SetPosition(Destination); } } } } } }
private void Subscribe(ScriptEventData data) { unsubscribes = SubscribeToAll(ShowPromptEvent, (ScriptEventData subdata) => { try { ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>(); if (simpledata != null) { AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId); if (agent != null && agent.IsValid) { agent.Client.UI.ModalDialog.Show(MessagePrompt, LeftButtonText, RightButtonText, (opc) => { OnDialogResponse(agent.Client.UI.ModalDialog.Response, agent.AgentInfo.SessionId); }); } } } catch (Exception) { // Agent left. } }); }
private void getBin(ScriptEventData gotBin) { if (gotBin.Data == null) { return; } SendActiveBins sendBin = gotBin.Data.AsInterface <SendActiveBins>(); if (sendBin == null) { Log.Write(LogLevel.Error, Script.ID.ToString(), "Unable to create interface, check logs for missing member(s)"); return; } string binToReturn = sendBin.ActiveBin[0]; string StopFlag = sendBin.ActiveBin[1]; //Log.Write("binToReturn: " + binToReturn); //Log.Write("StopFlag: " + StopFlag); //Log.Write("pos: " + pos); if ((StopFlag == "stop")) { if (binToReturn == pos) { ReturnBeatBlock(); } } }
private void Subscribe(ScriptEventData sed) //doesn't really pass data. Always passes null { //Look At Animation Strings and subscribe to events Log.Write("In Subscribe"); animation.JumpToFrame(36); }
private void getScreenPos(ScriptEventData gotScreenPos) { Log.Write("SCREEN EVENT RECIEVED"); Log.Write("In getScreenPos"); if (gotScreenPos.Data == null) { return; } SendScreenPos sendScreenPos = gotScreenPos.Data.AsInterface <SendScreenPos>(); if (sendScreenPos == null) { Log.Write(LogLevel.Error, Script.ID.ToString(), "Unable to create interface, check logs for missing member(s)"); return; } XScreenPos = float.Parse(sendScreenPos.SetScreenPos[0]); Log.Write("XScreenPos: " + XScreenPos); YScreenPos = float.Parse(sendScreenPos.SetScreenPos[1]); ZScreenPos = float.Parse(sendScreenPos.SetScreenPos[2]); XScreenRot = float.Parse(sendScreenPos.SetScreenPos[3]); YScreenRot = float.Parse(sendScreenPos.SetScreenPos[4]); ZScreenRot = float.Parse(sendScreenPos.SetScreenPos[5]); ScreenPos = new Vector(XScreenPos, YScreenPos, ZScreenPos); Vector ScreenRot = new Vector(XScreenRot * pi / 180, YScreenRot * pi / 180, ZScreenRot * pi / 180); ScreenQuat = Quaternion.FromEulerAngles(ScreenRot).Normalized(); CurQuat = RigidBody.GetOrientation(); CurPos = RigidBody.GetPosition(); SlideMass = RigidBody.GetMass(); }
private void Subscribe(ScriptEventData data) { unsubscribes = SubscribeToAll(EnableGrabEvent, (ScriptEventData subdata) => { rigidBody.SetCanGrab(true); }); unsubscribes += SubscribeToAll(DisableGrabEvent, (ScriptEventData subData) => { rigidBody.SetCanGrab(false); }); if (!string.IsNullOrWhiteSpace(GrabbedMessage)) { grabSubscribe = rigidBody.SubscribeToHeldObject(HeldObjectEventType.Grab, (HeldObjectData holdData) => { if (ShouldSend(holdData)) { SendToAll(GrabbedMessage, GrabReleaseData(holdData)); } }); } if (!string.IsNullOrWhiteSpace(ReleasedMessage)) { releaseSubscribe = rigidBody.SubscribeToHeldObject(HeldObjectEventType.Release, (HeldObjectData holdData) => { if (ShouldSend(holdData)) { SendToAll(ReleasedMessage, GrabReleaseData(holdData)); } }); } }
private void getInstrument(ScriptEventData gotInstrument) { if (gotInstrument.Data == null) { //Log.Write(LogLevel.Warning, Script.ID.ToString(), "Expected non-null event data"); return; } SendInstrument sendInstrument = gotInstrument.Data.AsInterface <SendInstrument>(); if (sendInstrument == null) { Log.Write(LogLevel.Error, Script.ID.ToString(), "Unable to create interface, check logs for missing member(s)"); return; } //Log.Write("######## In getInstrument ######"); if (sendInstrument.SendInstrumentArray.Count() > 0) { InstrumentArray = new List <string>(); int notecntr = 0; do { if (notecntr > 0) { InstrumentArray.Add(sendInstrument.SendInstrumentArray[notecntr]); } else { InstrumentName.Add(sendInstrument.SendInstrumentArray[0]); //first entry of SendInstrumentArray is the name of the instrument } notecntr++; } while (notecntr < sendInstrument.SendInstrumentArray.Count()); instrumentcntr++; } }
private void Unsubscribe(ScriptEventData sed) { if (unsubscribePlay != null) { unsubscribePlay(); unsubscribePlay = null; } if (unsubscribePause != null) { unsubscribePause(); unsubscribePause = null; } if (unsubscribeA != null) { unsubscribeA(); unsubscribeA = null; } if (unsubscribeB != null) { unsubscribeB(); unsubscribeB = null; } }
private void Enable(ScriptEventData data) { if (subscriptions == null) { IEventSubscription sub = ScenePrivate.User.Subscribe(User.AddUser, (UserData ud) => { SimpleData sd = new SimpleData(this); sd.SourceObjectId = ObjectPrivate.ObjectId; sd.AgentInfo = ScenePrivate.FindAgent(ud.User)?.AgentInfo; if (sd.AgentInfo != null) { sd.ObjectId = sd.AgentInfo.ObjectId; } visitors[ud.User] = sd.AgentInfo; SendToAll(OnAgentEnter, sd); }); subscriptions = sub.Unsubscribe; sub = ScenePrivate.User.Subscribe(User.RemoveUser, (UserData ud) => { SimpleData sd = new SimpleData(this); sd.SourceObjectId = ObjectPrivate.ObjectId; AgentInfo agentInfo = null; if (visitors.TryGetValue(ud.User, out agentInfo)) { sd.AgentInfo = agentInfo; visitors.Remove(ud.User); } SendToAll(OnAgentExit, sd); }); subscriptions += sub.Unsubscribe; } }
private void getVRControllerInfo(ScriptEventData gotVRControllerInfo) { //Log.Write("getVRControllerInfo"); if (gotVRControllerInfo.Data == null) { return; } VRControllerInfo sendVRControllerInfo = gotVRControllerInfo.Data.AsInterface <VRControllerInfo>(); if (sendVRControllerInfo == null) { Log.Write(LogLevel.Error, Script.ID.ToString(), "Unable to create interface, check logs for missing member(s)"); return; } AgentPrivate VRAgent = sendVRControllerInfo.VRAgent; string VRController = sendVRControllerInfo.VRController; Vector VRControllerLocalPosition = sendVRControllerInfo.VRControllerLocalPosition; Vector VRControllerWorldPosition = sendVRControllerInfo.VRControllerWorldPosition; Log.Write("Message Received VRAgent: " + VRAgent.AgentInfo.Name + " VRController: " + VRController + " LocalPos: " + VRControllerLocalPosition + " WorldPos: " + VRControllerWorldPosition); //Interact with hot spots calls go here }
private void PlayMovement(int MoveNumber, ScriptEventData data) { Log.Write("PositionOffset: " + PositionOffset); PositionOffset.X = MoveVector[MoveNumber].X; PositionOffset.Y = MoveVector[MoveNumber].Y; PositionOffset.Z = MoveVector[MoveNumber].Z; Quaternion currentRot = ObjectPrivate.Rotation; Log.Write("currentRot.Z: " + currentRot.Z); float CosAngle = (float)Math.Cos(currentRot.GetEulerAngles().Z * 57.2958 * 0.0174533); float SinAngle = (float)Math.Sin(currentRot.GetEulerAngles().Z * 57.2958 * 0.0174533); float newX = (PositionOffset.X * CosAngle) - (PositionOffset.Y * SinAngle); float newY = (PositionOffset.Y * CosAngle) + (PositionOffset.X * SinAngle); rotatedPositionOffset.X = newX; rotatedPositionOffset.Y = newY; rotatedPositionOffset.Z = PositionOffset.Z; Log.Write("rotatedPositionOffset: " + rotatedPositionOffset); Vector newVector = ObjectPrivate.Position + rotatedPositionOffset; if (ObjectPrivate.IsMovable) { WaitFor(ObjectPrivate.Mover.AddTranslate, newVector, OverTime[MoveNumber], MoveModeArray[MoveNumber]); SendToAll(DoneEvent[MoveNumber], data.Data); } }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(ResetEvent, Reset); } }
private void Subscribe(ScriptEventData sed) { if ((subscription == null) && (TheObject != null)) { subscription = SubscribeToAll(DispenseEvent, (data) => { DispenseObject(TheObject); }); subscription += SubscribeToAll(DestroyOldestEvent, (data) => { DestroyOldestObject(); }); subscription += SubscribeToAll(DestroyYoungestEvent, (data) => { DestroyYoungestObject(); }); subscription += SubscribeToAll(DestroyAllEvent, (data) => { DestroyAllObjects(); }); } }
private void CheckObjectiveState(ScriptEventData sed) { Objective objective = GetObjectiveFromScriptEventData(sed); if (objective == null) { return; } try { switch (objective.GetState()) { case ObjectiveState.Active: SendToAll(IfActive, sed.Data); break; case ObjectiveState.Completed: SendToAll(IfCompleted, sed.Data); break; case ObjectiveState.Locked: SendToAll(IfLocked, sed.Data); break; case ObjectiveState.None: SendToAll(IfNone, sed.Data); break; default: break; } } catch (Exception) { } }
private void Subscribe(ScriptEventData sed) { if ((subscription == null) && (SoundResource != null)) { subscription = SubscribeToAll(PlayEvent, (data) => { PlaySound(SoundResource); }); subscription += SubscribeToAll(AdjustEvent, (data) => { AdjustSound(AdjustedLoudness, AdjustedPitchOffset); }); subscription += SubscribeToAll(StopEvent, (data) => { StopSound(true); }); if (Looping && LoopingAutoplay && (currentPlayHandle == null)) { PlaySound(SoundResource); } } if (AdjustFadeTime > 0.0f) { StartFadeCoroutine(); } }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(LocalEvent, LocalTeleport); Unsubscribes += SubscribeToAll(RemoteEvent, RemoteTeleport); } }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(ShowEvent, Show); Unsubscribes += SubscribeToAll(HideEvent, Hide); } }
private void Unsubscribe(ScriptEventData sed) { if (subscription != null) { subscription(); subscription = null; } }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(ShowEvent, (ScriptEventData e) => SetVisible(e, true)); Unsubscribes += SubscribeToAll(HideEvent, (ScriptEventData e) => SetVisible(e, false)); } }
private void VolumeDown(ScriptEventData data) { Log.Write("In volumeDown"); curLoudness = currentPlayHandle.GetLoudness(); curLoudness = -5; currentPlayHandle.SetLoudness(curLoudness); scenePlayHandle.SetLoudness(curLoudness); }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(StartEvent, Start); Unsubscribes += SubscribeToAll(CancelEvent, Cancel); } }
private void Unsubscribe(ScriptEventData sed) { if (Unsubscribes != null) { Unsubscribes(); Unsubscribes = null; } }
private void Subscribe(ScriptEventData sed) { if (Unsubscribes == null) { Unsubscribes = SubscribeToAll(CompleteEvent, CompleteQuest); Unsubscribes += SubscribeToAll(OfferEvent, OfferQuest); } }
private void Subscribe(ScriptEventData sed) { if (subscriptions == null) { subscriptions = SubscribeToAll(ModeAEvent, SetLights); subscriptions += SubscribeToAll(ModeBEvent, ResetLights); } }
private void InitializeDirector(ScriptEventData sed) { Log.Write("In InitializeDirector"); ISimpleData DirectorData = sed.Data?.AsInterface <ISimpleData>(); AgentPrivate DirectorAgent = ScenePrivate.FindAgent(DirectorData.AgentInfo.SessionId); Director = DirectorAgent.AgentInfo.Name; }
private void Subscribe(ScriptEventData sed) { if (subscription == null) { subscription = SubscribeToAll(StartEvent, (ScriptEventData subdata) => { ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>(); if (simpledata != null && simpledata.AgentInfo != null) { AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId); if (agent != null && agent.IsValid) { broadcastAgents.Add(agent); ScenePrivate.SetMegaphone(agent, true); // User gets notified of megaphone status } } }); subscription += SubscribeToAll(StopEvent, (ScriptEventData subdata) => { ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>(); if (simpledata != null && simpledata.AgentInfo != null) { AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId); if (agent != null && agent.IsValid) { broadcastAgents.Remove(agent); ScenePrivate.SetMegaphone(agent, false); // User gets notified of megaphone status } } }); subscription += SubscribeToAll(ToggleEvent, (ScriptEventData subdata) => { ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>(); if (simpledata != null && simpledata.AgentInfo != null) { AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId); if (agent != null && agent.IsValid) { if (broadcastAgents.Contains(agent)) { broadcastAgents.Remove(agent); ScenePrivate.SetMegaphone(agent, false); // User gets notified of megaphone status } else { broadcastAgents.Add(agent); ScenePrivate.SetMegaphone(agent, true); // User gets notified of megaphone status } } } }); } }
private void getBeatBlockcfg(ScriptEventData gotBlockcfg) { SendBlockNamescfg sendBlockcfg = gotBlockcfg.Data.AsInterface <SendBlockNamescfg>(); BeatBlockName = sendBlockcfg.SendBlockArraycfg[0]; beats = sendBlockcfg.SendBlockArraycfg[1]; BlockGenre = sendBlockcfg.SendBlockArraycfg[2]; BeatBlockConfigSub.Unsubscribe(); }