void OnLoad(DefaultEvent eventdata) { if (Game.current.CurrentTrack != "" && Game.current.CurrentTrack != "Stop_All") { Trace.Script($"Loading music {Game.current.CurrentTrack}"); AkSoundEngine.PostEvent("Stop_All", MusicPlayer.gameObject); AkSoundEngine.PostEvent(Game.current.CurrentTrack, MusicPlayer.gameObject); } else { Trace.Script("Stopping Music"); AkSoundEngine.PostEvent("Stop_All", MusicPlayer.gameObject); } if (Game.current.CurrentAmbience != "" && Game.current.CurrentAmbience != "Stop_All") { Trace.Script($"Loading ambience {Game.current.CurrentAmbience}"); AkSoundEngine.PostEvent("Stop_All", AmbiencePlayer.gameObject); AkSoundEngine.PostEvent(Game.current.CurrentAmbience, AmbiencePlayer.gameObject); } else { Trace.Script("Stopping Ambience"); AkSoundEngine.PostEvent("Stop_All", AmbiencePlayer.gameObject); } }
void OnLoad(DefaultEvent eventdata) { if (!Game.current.InCurrentStory) { LoadedToMap = true; } }
void OnLoad(DefaultEvent eventdata) { foreach (var actor in Game.current.CastCall) { Actors.Add(actor.chara, actor.Dir); } }
public void CleanUp(DefaultEvent eventdata) { if (Active) { Active = false; } }
void OnSave(DefaultEvent eventdata) { //Space.DispatchEvent(Events.DisableMove); //Instantiate(Resources.Load("Prefabs/SaveMenu")); Space.DispatchEvent(Events.Choice, new ChoiceDisplayEvent(SaveOptions)); }
public void SaveAndContinue(DefaultEvent eventdata) { SaveSystem.SaveGame(); //Space.DispatchEvent(Events.Dream); }
void OnLoad(DefaultEvent eventdata) { Load = true; foreach (var actor in Game.current.CastCall) { foreach (var person in CastList) { if (person.Character == actor.chara) { var cast = Instantiate(person.Actor); var directions = cast.GetComponent <CharacterDisplay>(); if (directions == null) { Debug.LogError("character: " + actor.chara + "is missing at rollcall. See StageDisplay"); } else { directions.OnLoad(actor); Actors.Add(directions); SpotLights[actor.Dir] += 1; break; } } } } }
void OnStatChange(DefaultEvent eventdata) { StopAllCoroutines(); int Dstat = Game.current.Self.GetWellbingStat(Personality.Wellbeing.Depression); float Dpercent = (float)Dstat / 100f; Dpercent = Mathf.Clamp01((Dpercent - DeadZone) / (1 - DeadZone)); var newSatValue = Mathf.Lerp(ZeroDepressionValue, MaxDepressionValue, Dpercent); int Sstat = Game.current.Self.GetWellbingStat(Personality.Wellbeing.Stress); float Spercent = (float)Sstat / 100f; Spercent = Mathf.Clamp01((Spercent - DeadZone) / (1 - DeadZone)); var newGrainValue = Mathf.Lerp(ZeroStressValue, MaxStressValue, Spercent); int Fstat = Game.current.Self.GetWellbingStat(Personality.Wellbeing.Fatigue); float Fpercent = (float)Fstat / 100f; Fpercent = Mathf.Clamp01((Fpercent - DeadZone) / (1 - DeadZone)); var newVinValue = Mathf.Lerp(ZeroFatigueValue, MaxFatigueValue, Fpercent); StartCoroutine(UpdatePost(newVinValue, newGrainValue, newSatValue)); }
void OnLoad(DefaultEvent eventdata) { CellCount = Game.current.CGCalls.Count; CurrentCount = CellCount - 1; NextCell(new CustomGraphicEvent("", NextCellCall)); }
public DefaultEvent AddEvent(string name) { DefaultEvent classEvent = new DefaultEvent(this, name); Events.Add(classEvent); return(classEvent); }
void UpdateTime(DefaultEvent eventdata) { var oldHour = currentHour; currentHour = Game.current.Hour; var oldday = currentDay; currentDay = Game.current.Day; float multiplier = 1; if (oldHour == currentHour && currentDay == oldday) { Space.DispatchEvent(Events.ClockFinished); return; } if (currentDay - oldday != 0) { multiplier = Mathf.Abs(currentDay - oldday) * MultiDayChangeMultiplier; if (multiplier < 1) { multiplier = 1; } } StartCoroutine(Swing(AnimationTime * multiplier)); }
private void MarkAsNotCompleted(DefaultTransaction transaction) { IEvent notCompleteEvent = new DefaultEvent("CAT", "BadInstrument") { Status = "TransactionNotCompleted" }; notCompleteEvent.Complete(); transaction.AddChild(notCompleteEvent); transaction.Complete(); }
void OnClose(DefaultEvent eventdata) { foreach (var command in Commands) { ClearGrouping(command); } }
void OnLoad(DefaultEvent eventdata) { foreach (var set in Game.current.CGCalls) { NextCommand(new CustomGraphicEvent("", set)); } }
private void RaiseAction(DefaultEvent handler) { if (handler != null) { handler(); } }
//验证Transaction internal void ValidateTransaction(ITransaction transaction) { IList<IMessage> children = transaction.Children; int len = children.Count; for (int i = 0; i < len; i++) { IMessage message = children[i]; var transaction1 = message as ITransaction; if (transaction1 != null) { ValidateTransaction(transaction1); } } if (!transaction.IsCompleted()) { // missing transaction end, log a BadInstrument event so that // developer can fix the code IMessage notCompleteEvent = new DefaultEvent("CAT", "BadInstrument") {Status = "TransactionNotCompleted"}; notCompleteEvent.Complete(); transaction.AddChild(notCompleteEvent); transaction.Complete(); } }
void OnClose(DefaultEvent eventdata) { var Awhite = Color.white; Awhite.a = 0; FrontCurtain.gameObject.DispatchEvent(Events.Fade, new FadeEvent(Awhite, TransitionSpeed)); }
void OnPause(DefaultEvent eventdata) { this.Paused = true; this.MenuObject.gameObject.SetActive(true); MenuObject.Back(); // test audio thing }
public static async Task SagaEventProcessor( [EventHubTrigger(@"%ReplyEventHubName%", Connection = @"EventHubsNamespaceConnection")] EventData[] eventsData, [CosmosDB( databaseName: @"%CosmosDbDatabaseName%", collectionName: @"%CosmosDbSagaCollectionName%", ConnectionStringSetting = @"CosmosDbConnectionString")] IAsyncCollector <SagaItem> documentCollector, [DurableClient] IDurableOrchestrationClient client, ILogger log) { foreach (EventData eventData in eventsData) { var jsonBody = Encoding.UTF8.GetString(eventData.Body); DefaultEvent @event = JsonConvert.DeserializeObject <DefaultEvent>(jsonBody); if (@event.Header == null) { log.LogError("Invalid event header"); continue; } var item = new SagaItem { TransactionId = @event.Header.TransactionId, MessageType = @event.Header.MessageType, Source = @event.Header.Source, CreationDate = @event.Header.CreationDate }; await documentCollector.AddAsync(item); await client.RaiseEventAsync(@event.Header.TransactionId, @event.Header.Source, @event.Header.MessageType); } }
void OnMap(DefaultEvent eventdata) { /* * var see = Game.current.FlagMap(Location); * * switch(see) * { * case SceneSeen.Unseen: * var co = manga.color; * co.a = 0; * manga.color = co; * break; * case SceneSeen.Seen: * manga.sprite = SeenIcon; * var col = manga.color; * col.a = 1; * manga.color = col; * break; * case SceneSeen.Completed: * manga.sprite = CompleteIcon; * var coll = manga.color; * coll.a = 1; * manga.color = coll; * break; * default: * break; * } */ }
void OnPause(DefaultEvent eventdata) { Paused = true; if (typing != null) { StopCoroutine(typing); } }
void UpdateStats(DefaultEvent eventdata) { int stat = Game.current.Self.GetWellbingStat(WellnessStat); float percent = (float)stat / 100f; //Bar.transform.localScale = new Vector3(percent, 1, 1); StartCoroutine(ChangeSize(percent, ChangeTime)); }
void OnUnPause(DefaultEvent eventdata) { Paused = false; if (Text.IsActive()) { typing = StartCoroutine(TypeText(Text.maxVisibleCharacters)); } }
public override void OnEvent(AST.Event node) { DomRegion region = GetRegion(node); DefaultEvent e = new DefaultEvent(node.Name, CreateReturnType(node.Type), GetModifier(node), region, region, OuterClass); ConvertAttributes(node, e); OuterClass.Events.Add(e); }
void OnFinishedTyping(DefaultEvent eventdata) { isFinished = true; if (!Auto) { NextLine.SetBool("Play", true); } }
void OnClose(DefaultEvent eventdata) { if (!Active) { return; } CloseCG(); }
public void ProcessBoardingShipMission(DefaultEvent e) { // the tactical crew used to complete the boarding ship mission goes to infirmary var tactical = Crew.First(c => c.Type == CrewType.Tactical && c.MissionName == e.Message); tactical.State = CrewState.Infirmary; tactical.MissionName = string.Empty; }
public void markAsNotCompleted(DefaultTransaction transaction) { DefaultEvent evt = new DefaultEvent("cat", "BadInstrument"); evt.Status = "TransactionNotCompleted"; evt.SetCompleted(true); transaction.AddChild(evt); transaction.SetCompleted(true); }
void CloseDisplay(DefaultEvent eventdata) { print("off"); //Space.DispatchEvent(Events.CloseUI, new UIEvent(this)); anime.SetBool("IsUp", false); Active = false; Description.Clear(); StartCoroutine(WaitTilClosed()); }
void SpawnChoice(DefaultEvent eventdata) { foreach (var choice in choices) { choice.OwnerRef = gameObject; } Space.DispatchEvent(Events.Choice, new ChoiceDisplayEvent(choices)); }
public void Bind(string tag, string childMessageId, string title) { try { DefaultEvent evt = new DefaultEvent("RemoteCall", "Tagged"); if (String.IsNullOrEmpty(title)) { title = Type + ":" + Name; } evt.AddData(childMessageId, title); evt.Timestamp = Timestamp; evt.Status = CatConstants.SUCCESS; evt.SetCompleted(true); AddChild(evt); } catch (Exception ex) { Cat.lastException = ex; } }
public virtual IEvent NewEvent(String type, String name, String nameValuePairs) { if (!_mManager.HasContext()) { _mManager.Setup(); } if (_mManager.CatEnabled) { IEvent evt0 = new DefaultEvent(type, name); // Need add data before event is added into context, so that estimated bytes is correct. if (!string.IsNullOrEmpty(nameValuePairs)) { evt0.AddData(nameValuePairs); } _mManager.Add(evt0); return evt0; } return new NullEvent(); }
protected internal IMessage DecodeLine(ChannelBuffer buf, ITransaction parent, Stack<ITransaction> stack, IMessageTree tree) { BufferHelper helper = _mBufferHelper; byte identifier = buf.ReadByte(); String timestamp = helper.Read(buf, TAB); String type = helper.Read(buf, TAB); String name = helper.Read(buf, TAB); if (identifier == 'E') { IMessage evt = new DefaultEvent(type, name); String status = helper.Read(buf, TAB); String data = helper.ReadRaw(buf, TAB); helper.Read(buf, LF); // get rid of line feed evt.Timestamp = _mDateHelper.Parse(timestamp); evt.Status = status; evt.AddData(data); if (parent != null) { parent.AddChild(evt); tree.EstimatedByteSize += evt.EstimateByteSize(); return parent; } return evt; } if (identifier == 'M') { DefaultMetric metric = new DefaultMetric(type, name); String status = helper.Read(buf, TAB); String data = helper.ReadRaw(buf, TAB); helper.Read(buf, LF); // get rid of line feed metric.Timestamp = _mDateHelper.Parse(timestamp); metric.Status = status; metric.AddData(data); if (parent != null) { parent.AddChild(metric); tree.EstimatedByteSize += metric.EstimateByteSize(); return parent; } return metric; } if (identifier == 'H') { IMessage heartbeat = new DefaultHeartbeat(type, name); String status0 = helper.Read(buf, TAB); String data1 = helper.ReadRaw(buf, TAB); helper.Read(buf, LF); // get rid of line feed heartbeat.Timestamp = _mDateHelper.Parse(timestamp); heartbeat.Status = status0; heartbeat.AddData(data1); if (parent != null) { parent.AddChild(heartbeat); tree.EstimatedByteSize += heartbeat.EstimateByteSize(); return parent; } return heartbeat; } if (identifier == 't') { IMessage transaction = new DefaultTransaction(type, name, null); helper.Read(buf, LF); // get rid of line feed transaction.Timestamp = _mDateHelper.Parse(timestamp); if (parent != null) { parent.AddChild(transaction); } stack.Push(parent); return transaction; } if (identifier == 'A') { ITransaction transaction2 = new DefaultTransaction(type, name, null); String status3 = helper.Read(buf, TAB); String duration = helper.Read(buf, TAB); String data4 = helper.ReadRaw(buf, TAB); helper.Read(buf, LF); // get rid of line feed transaction2.Timestamp = _mDateHelper.Parse(timestamp); transaction2.Status = status3; transaction2.AddData(data4); long d = Int64.Parse(duration.Substring(0, duration.Length - 2), NumberStyles.Integer); transaction2.DurationInMicros = d; if (parent != null) { parent.AddChild(transaction2); tree.EstimatedByteSize += transaction2.EstimateByteSize(); return parent; } return transaction2; } if (identifier == 'T') { String status5 = helper.Read(buf, TAB); String duration6 = helper.Read(buf, TAB); String data7 = helper.ReadRaw(buf, TAB); helper.Read(buf, LF); // get rid of line feed parent.Status = status5; parent.AddData(data7); long d8 = Int64.Parse( duration6.Substring(0, duration6.Length - 2), NumberStyles.Integer); parent.DurationInMicros = d8; tree.EstimatedByteSize += parent.EstimateByteSize(); return stack.Pop(); } Logger.Error("Unknown identifier(" + identifier + ") of message: " + buf); // unknown message, ignore it return parent; }
private void AdjustForTruncatedTransaction(ITransaction root) { DefaultEvent next = new DefaultEvent("TruncatedTransaction", "TotalDuration"); long actualDurationInMicros = _mTotalDurationInMicros + root.DurationInMicros; next.AddData(Convert.ToString(actualDurationInMicros)); next.Status = CatConstants.SUCCESS; root.AddChild(next); _mTotalDurationInMicros = 0; }
public override object VisitEventDeclaration(AST.EventDeclaration eventDeclaration, object data) { DomRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation); DomRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd); DefaultClass c = GetCurrentClass(); IReturnType type; if (eventDeclaration.TypeReference.IsNull) { DefaultClass del = new DefaultClass(cu, ClassType.Delegate, ConvertModifier(eventDeclaration.Modifier), region, c); del.Modifiers |= ModifierEnum.Synthetic; CreateDelegate(del, eventDeclaration.Name + "EventHandler", new AST.TypeReference("System.Void"), new AST.TemplateDefinition[0], eventDeclaration.Parameters); type = del.DefaultReturnType; } else { type = CreateReturnType(eventDeclaration.TypeReference); } DefaultEvent e = new DefaultEvent(eventDeclaration.Name, type, ConvertModifier(eventDeclaration.Modifier), region, bodyRegion, c); ConvertAttributes(eventDeclaration, e); c.Events.Add(e); if (e != null) { e.Documentation = GetDocumentation(region.BeginLine, eventDeclaration.Attributes); } else { LoggingService.Warn("NRefactoryASTConvertVisitor: " + eventDeclaration + " has no events!"); } return null; }
public void LinkAsRunAway(DefaultForkedTransaction transaction) { DefaultEvent evt = new DefaultEvent("RemoteCall", "RunAway"); evt.AddData(transaction.ForkedMessageId, transaction.Type + ":" + transaction.Name); evt.Timestamp = transaction.Timestamp; evt.Status = CatConstants.SUCCESS; evt.SetCompleted(true); transaction.Standalone = true; _mManager.Add(evt); }
public override void Complete() { try { if (IsCompleted()) { // complete() was called more than once IMessage evt0 = new DefaultEvent("cat", "BadInstrument") { Status = "TransactionAlreadyCompleted" }; evt0.Complete(); AddChild(evt0); } else { _mDurationInMicro = MilliSecondTimer.UnixNowMicroSeconds() - TimestampInMicros; SetCompleted(true); if (_mManager != null) { _mManager.End(this); } } } catch (Exception ex) { Cat.lastException = ex; } }
public override object VisitEventDeclaration(AST.EventDeclaration eventDeclaration, object data) { DomRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation); DomRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd); DefaultClass c = GetCurrentClass(); IReturnType type; if (eventDeclaration.TypeReference.IsNull) { DefaultClass del = new DefaultClass(cu, ClassType.Delegate, ConvertModifier(eventDeclaration.Modifier), region, c); del.Modifiers |= ModifierEnum.Synthetic; CreateDelegate(del, eventDeclaration.Name + "EventHandler", new AST.TypeReference("System.Void", true), new AST.TemplateDefinition[0], eventDeclaration.Parameters); type = del.DefaultReturnType; } else { type = CreateReturnType(eventDeclaration.TypeReference); } DefaultEvent e = new DefaultEvent(eventDeclaration.Name, type, ConvertModifier(eventDeclaration.Modifier), region, bodyRegion, c); ConvertAttributes(eventDeclaration, e); AddInterfaceImplementations(e, eventDeclaration); c.Events.Add(e); e.Documentation = GetDocumentation(region.BeginLine, eventDeclaration.Attributes); if (eventDeclaration.HasAddRegion) { e.AddMethod = new DefaultMethod(e.DeclaringType, "add_" + e.Name) { Parameters = { new DefaultParameter("value", e.ReturnType, DomRegion.Empty) }, Region = GetRegion(eventDeclaration.AddRegion.StartLocation, eventDeclaration.AddRegion.EndLocation), BodyRegion = GetRegion(eventDeclaration.AddRegion.Block.StartLocation, eventDeclaration.AddRegion.Block.EndLocation) }; } if (eventDeclaration.HasRemoveRegion) { e.RemoveMethod = new DefaultMethod(e.DeclaringType, "remove_" + e.Name) { Parameters = { new DefaultParameter("value", e.ReturnType, DomRegion.Empty) }, Region = GetRegion(eventDeclaration.RemoveRegion.StartLocation, eventDeclaration.RemoveRegion.EndLocation), BodyRegion = GetRegion(eventDeclaration.RemoveRegion.Block.StartLocation, eventDeclaration.RemoveRegion.Block.EndLocation) }; } return null; }
public void TruncateAndFlush(Context ctx, long timestamp) { IMessageTree tree = ctx.Tree; Stack<ITransaction> stack = ctx.Stack; IMessage message = tree.Message; if (message is DefaultTransaction) { string id = tree.MessageId; string rootId = tree.RootMessageId; string childId = _mManager.NextMessageId(); DefaultTransaction source = (DefaultTransaction)message; DefaultTransaction target = new DefaultTransaction(source.Type, source.Name, _mManager); target.Timestamp = source.Timestamp; target.DurationInMicros = source.DurationInMicros; target.AddData(source.Data); target.Status = CatConstants.SUCCESS; MigrateMessage(stack, source, target, 1); int reducedByteSize = 0; foreach (ITransaction transaction in stack) { DefaultTransaction tran = (DefaultTransaction)transaction; tran.Timestamp = timestamp; reducedByteSize += transaction.EstimateByteSize(); } DefaultEvent next = new DefaultEvent("RemoteCall", "Next"); next.AddData(childId); next.Status = CatConstants.SUCCESS; target.AddChild(next); IMessageTree t = tree.Copy(); t.Message = target; ctx.Tree.MessageId = childId; ctx.Tree.ParentMessageId = id; ctx.Tree.RootMessageId = (rootId != null ? rootId : id); ctx._mLength = stack.Count; // Update estimated byte size of the truncated tree to be the total size of all on-stack transactions. ctx.Tree.EstimatedByteSize = reducedByteSize; ctx._mTotalDurationInMicros = ctx._mTotalDurationInMicros + target.DurationInMicros; _mManager.Flush(t); } }