public async Task <string> React(PublicId userId, PublicId toId, ReactionType type) { var reaction = (ActivityObject)Activator.CreateInstance(CustomJsonSerializer.TypeOf(type.ToString())); reaction.actor = new List <BaseObject> { new Common.Person { PublicId = userId, } }.ToCollection(); var target = await _activityContent.Get(toId, userId); if (target != null) { reaction.target = new List <BaseObject> { target }.ToCollection(); var res = await _activityStream.Post("outbox", reaction); return(reaction.id); } else { return(null); } }
public AddReactionCommand(string userId, ReactionType type, string activityId, string comment) { UserId = userId ?? throw new ArgumentNullException(nameof(userId)); ActivityId = activityId ?? throw new ArgumentNullException(nameof(activityId)); Type = type; Comment = comment; }
public ReactionAddedMessage(string activityId, ReactionType type, string userId, string comment) { this.ActivityId = activityId; this.ReactionType = type; this.UserId = userId; this.Comment = comment; }
void ChooseAReaction(ReactionType rt, ReactionCategory rc) { VoiceLine tempReaction = reactions[Random.Range(0, reactions.Length)]; if (tempReaction == currentReaction) { ChooseAReaction(rt, rc); } else { currentReaction = tempReaction; } boredumLevelTimer = (rt == ReactionType.Event) ? timeUntilNextBoredumLevel : boredumLevelTimer; currentReaction.spriteSheet.animationFinished = false; currentReaction.spriteSheet.index = 0; currentReaction.audio.audioStarted = false; currentReaction.audio.audioFinished = false; currentReaction.text.subtitlesFinished = false; currentReaction.text.subtitleTimer = 0; speakingState = (rt == ReactionType.Event) ? SpeakingState.Speaking : SpeakingState.IdleSpeaking; /*foreach (VoiceLine vl in reactions) * { * vl.tried = false; * }*/ }
public async Task <ReactionsCountServiceModel> ReactAsync(ReactionType reactionType, int replyId, string authorId) { var replyReaction = await this.db.ReplyReactions .FirstOrDefaultAsync(rr => rr.ReplyId == replyId && rr.AuthorId == authorId); if (replyReaction == null) { replyReaction = new ReplyReaction { ReactionType = reactionType, ReplyId = replyId, AuthorId = authorId, CreatedOn = this.dateTimeProvider.Now() }; await this.db.ReplyReactions.AddAsync(replyReaction); } else { replyReaction.ModifiedOn = this.dateTimeProvider.Now(); replyReaction.ReactionType = replyReaction.ReactionType == reactionType ? ReactionType.Neutral : reactionType; } await this.db.SaveChangesAsync(); return(await this.GetCountByReplyIdAsync(replyId)); }
void ChooseAReaction(ReactionType rt, ReactionCatagory rc) { currentReaction = reactions[Random.Range(0, reactions.Length)]; if ((currentReaction.reactionType != rt || currentReaction.reactionCatagory != rc) && attempts >= 0) { if (!currentReaction.tried) { currentReaction.tried = true; attempts--; } ChooseAReaction(rt, rc); return; } else if (attempts <= 0) { if (reactions.Length > 0) { currentReaction = reactions[0]; } } attempts = reactions.Length; foreach (VoiceLine vl in reactions) { vl.tried = false; } boredumLevelTimer = (rt == ReactionType.Event) ? timeUntilNextBoredumLevel: boredumLevelTimer; currentReaction.spriteSheet.animationFinished = false; currentReaction.spriteSheet.index = 0; currentReaction.audio.audioStarted = false; currentReaction.audio.audioFinished = false; currentReaction.text.subtitlesFinished = false; currentReaction.text.subtitleTimer = 0; speakingState = (rt == ReactionType.Event) ? SpeakingState.Speaking : SpeakingState.IdolSpeaking; }
public async Task ReactAsync(ReactionType reactionType, int postId, string authorId) { var postReaction = await this.db.PostReactions .FirstOrDefaultAsync(pr => pr.PostId == postId && pr.AuthorId == authorId); if (postReaction == null) { postReaction = new PostReaction { ReactionType = reactionType, PostId = postId, AuthorId = authorId, CreatedOn = this.dateTimeProvider.Now() }; await this.db.PostReactions.AddAsync(postReaction); } else { postReaction.ModifiedOn = this.dateTimeProvider.Now(); postReaction.ReactionType = postReaction.ReactionType == reactionType ? ReactionType.Neutral : reactionType; } await this.db.SaveChangesAsync(); }
public Reaction(int id, string nodeId, User user, ReactionType content) { Id = id; NodeId = nodeId; User = user; Content = content; }
private static GameObject CreateGameObject(uint currentObjBaseAddress) { ulong guid = Memory.Read <ulong>(currentObjBaseAddress + (int)ObjectOffsets.Guid); GOType type = (GOType)Memory.Read <short>(currentObjBaseAddress + (uint)ObjectOffsets.Type); GameObject go = null; switch (type) { case GOType.None: break; case GOType.Item: //do this later go = new GameObject(currentObjBaseAddress, guid, type); break; case GOType.Container: //do this later go = new GameObject(currentObjBaseAddress, guid, type); break; case GOType.Unit: string name = GetName(currentObjBaseAddress); if (false == reactionCache.ContainsKey(guid)) { reactionCache.Add(guid, LuaHelper.GetReactionType(guid)); } ReactionType reaction = reactionCache[guid]; go = new Unit(currentObjBaseAddress, guid, type, name, reaction); break; case GOType.Player: //do this later go = new GameObject(currentObjBaseAddress, guid, type); break; case GOType.GameObject: go = new GameObject(currentObjBaseAddress, guid, type); break; case GOType.DynamicObject: //do this later go = new GameObject(currentObjBaseAddress, guid, type); break; case GOType.Corpse: //do this later go = new GameObject(currentObjBaseAddress, guid, type); break; default: break; } return(go); }
public ReactionType Update(ReactionType entity) { _context.Entry(entity).State = EntityState.Modified; _context.SaveChanges(); return(entity); }
public ReactionType Create(ReactionType entity) { _context.ReactionTypes.Add(entity); _context.SaveChanges(); return(entity); }
public ActionResult <ReactionTypeReadDto> Create([FromBody] ReactionTypeCreateDto request) { ReactionType newEntity = _mapper.Map <ReactionType>(request); newEntity = _repository.Create(newEntity); return(StatusCode(StatusCodes.Status201Created, _mapper.Map <ReactionTypeReadDto>(newEntity))); }
public async Task <ReactionShort> AddOrUpdateAsync(string publicationId, ReactionType reactionType, string userId) { var result = await reactionsApi.UpsertAsync( KeysBuilder.PublicationReactionsKey(publicationId), reactionType.ToString(), userId); return(ToReactionShort(result, new UserReaction(reactionType))); }
/// <summary> /// An interface to pass the chosen question to the DialogSystem. /// It will react by telling the GUI to display the answer. /// </summary> /// <param name="questionIndex"> /// The index of the chosen question. /// </param> public void NextAnswer(int questionIndex) { //The question chosen by the player Question chosen = QuestionSets.Dequeue().Questions[questionIndex]; Debug.Log(chosen.Text); Debug.Log(chosen.GetAnswer(ReactionType.Annoying).Text); Debug.Log(chosen.GetAnswer(ReactionType.Okay).Text); Debug.Log(chosen.GetAnswer(ReactionType.Comforting).Text); //The reaction the question would provoke ReactionType reaction = chosen.GetReactionFor(NPC.Character); Debug.Log(reaction); //The answer that our npc would give to the chosen question. Snippet answer = chosen.GetAnswer(reaction); Debug.Log(answer.Text); //If the answer contains a special need, add it to the NPC. if (answer.Need != Need.None) { NPC.AddSpecialNeed(answer.Need); if (answer.Need == Need.Tired) { NPC.StayDuration = Random.Range(0, GameClock.MaxStayDuration); } } //Make the NPC react to the question: switch (reaction) { case ReactionType.Annoying: NPC.ComfortLevel -= 1f; break; case ReactionType.Okay: NPC.ComfortLevel -= 0.5f; break; case ReactionType.Comforting: NPC.ComfortLevel += 0.5f; break; } if (NPC.ComfortLevel <= 0 || QuestionSets.Count == 0) { //Only show the answer. The dialog will end when "..." is pressed and Next ist executed. DialogDisplayer.DisplaySnippet(answer.Text); } else { //Take the matching reponse to the chosen question and discard the question. Also display the next questions. DialogDisplayer.DisplayAnswer(answer.Text, QuestionSets.Peek().ToStringList()); } }
/// <summary> /// Create reaction /// </summary> /// <param name="noteId">target note ID</param> /// <param name="reaction">reaction type</param> public async Task CreateAsync(string noteId, ReactionType reaction) { var q = new Dictionary <string, object>() { { "noteId", noteId }, { "reaction", reaction.ToString().ToLower() }, }; await RequestAsync("/api/notes/reactions/create", q); }
/// <summary> /// Convert enum to string. /// </summary> /// <param name="reactionType">Reaction type (enum).</param> /// <returns>String value.</returns> public static string ToLocal(this ReactionType reactionType) { return(reactionType switch { ReactionType.NoReaction => "No reaction", ReactionType.Low => "Low", ReactionType.Medium => "Medium", ReactionType.High => "High", _ => "Unknown", });
public ActionResult <ReactionTypeReadDto> Update(int id, [FromBody] ReactionTypeUpdateDto request) { ReactionType found = _repository.Get(id); found = _mapper.Map(request, found); _repository.Update(found); return(StatusCode(StatusCodes.Status200OK, _mapper.Map <ReactionTypeReadDto>(found))); }
private Question GetRandomQuestion(ReactionType type) { int index = Random.Range(0, TAR.TextAssets.Questions.Count); while (TAR.TextAssets.Questions[index].GetReactionFor(NPC.Character) != type) { index = (index + 1) % TAR.TextAssets.Questions.Count; } return(TAR.TextAssets.Questions[index]); }
public static void ExecuteAction(Player player, Tile tile, ReactionType action) { Element tileType = tile.ElementType; if (Controller.Reactions.ContainsKey(tileType)) { if (Controller.Reactions[tileType].Types.Contains(action)) { // Execute Action switch (action) { case ReactionType.Platform: break; case ReactionType.HorizontalPlatform: break; case ReactionType.VerticalPlatform: break; case ReactionType.ComplexPlatform: break; case ReactionType.Hurt: player.Hurt(-player.Direction); break; case ReactionType.HurtFromFront: player.Hurt(-player.Direction); break; case ReactionType.HurtFromBack: player.Hurt(-player.Direction); break; case ReactionType.HurtFromAbove: player.Hurt(-player.Direction); break; case ReactionType.HurtFromBelow: player.Hurt(-player.Direction); break; case ReactionType.Bounce: player.Jump(1.0f); break; case ReactionType.Jump: player.Jump(1.0f); break; case ReactionType.HighJump: player.Jump(2.0f); break; case ReactionType.Collect: break; case ReactionType.Push: break; case ReactionType.Destroy: break; default: break; } } } }
public override bool IsEnemy(Mobile m) { Faction ourFaction = m_Faction; Faction theirFaction = Faction.Find(m); if (theirFaction == null && m is BaseFactionGuard) { theirFaction = ((BaseFactionGuard)m).Faction; } if (m is BaseCreature) { if (((BaseCreature)m).FactionAllegiance != null && FactionAllegiance != null && ((BaseCreature)m).FactionAllegiance != FactionAllegiance) { return(true); } } if (ourFaction != null && theirFaction != null && ourFaction != theirFaction) { ReactionType reactionType = Orders.GetReaction(theirFaction).Type; if (reactionType == ReactionType.Attack) { return(true); } if (m is BaseFactionGuard) { return(true); } if (theirFaction != null) { List <AggressorInfo> list = m.Aggressed; for (int i = 0; i < list.Count; ++i) { AggressorInfo ai = list[i]; if (ai.Defender is BaseFactionGuard) { BaseFactionGuard bf = (BaseFactionGuard)ai.Defender; if (bf.Faction == ourFaction) { return(true); } } } } } return(false); }
public static string ReactionTypeToString(ReactionType actString) { switch (actString) { case ReactionType.BlockMove: return("block_move"); case ReactionType.BlockHeal: return("block_heal"); case ReactionType.BlockBuff: return("block_buff"); case ReactionType.BlockItem: return("block_item"); case ReactionType.BlockRetreat: return("block_combat_retreat"); case ReactionType.CommentSelfHit: return("comment_self_hit"); case ReactionType.CommentSelfMissed: return("comment_self_missed"); case ReactionType.CommentAllyHit: return("comment_ally_hit"); case ReactionType.CommentAllyMissed: return("comment_ally_missed"); case ReactionType.CommentAllyAttackHit: return("comment_ally_attack_hit"); case ReactionType.CommentAllyAttackMiss: return("comment_ally_attack_missed"); case ReactionType.CommentMove: return("comment_move"); case ReactionType.CommentCurioInteraction: return("comment_curio_interaction"); case ReactionType.CommentTrapTriggered: return("comment_trap_triggered"); case ReactionType.BlockEffect: return("block_effect"); default: return("block_move"); } }
public ReactionType Delete(int id) { ReactionType entity = _context.ReactionTypes.FirstOrDefault(e => e.Id == id); if (entity != null) { _context.ReactionTypes.Remove(entity); _context.SaveChanges(); } return(entity); }
/*halmeida - carefull when using this method. If any memory is currently allocated, it will not be freed.*/ protected virtual void ResetAllClassFields() { if (cleared) { symbolDatabase = null; maxBoxWidth = DEFAULT_MAX_BOX_WIDTH; maxBoxHeight = DEFAULT_MAX_BOX_HEIGHT; minBoxHeight = 0f; maxTextWidth = 0f; maxTextHeight = 0f; boxSprite = null; boxObject = null; boxRenderer = null; boxArea = new Rect(0f, 0f, 0f, 0f); textArea = new Rect(0f, 0f, 0f, 0f); margin = 0f; marginDouble = 0f; lineHeight = 0f; maxLineWidth = 0f; maxLinesPerPage = 0; pageFirstLineIndex = -1; pageLastLineIndex = -1; built = false; open = false; opening = false; written = false; closing = false; closed = false; cleared = false; instantCreation = false; reactionType = ReactionType.ReactAnywhere; boxToTextDepth = -DisplayDepthManager.ELEMENT_TO_ELEMENT_OFFSET / 100f; textAlignment = TextAlignment.AlignLeft; text = null; textLines = null; textLineObjects = null; textLineComponents = null; textLinesReady = false; textSpeed = DEFAULT_TEXT_SPEED; currentLine = null; currentLineIndex = -1; currentSymbolIndex = -1; currentLineLength = 0; symbolDuration = 0f; symbolElapsed = 0f; writeImmediately = false; autoClose = false; autoCloseDuration = 0f; autoCloseElapsed = 0f; openingSpeed = 1f; } }
/// <summary> /// Adds a reaction type to COPASI /// </summary> /// <returns>COPASI reaction.</returns> /// <param name="reactionType">Reaction type.</param> public CReaction AddReaction(ReactionType reactionType) { string name = reactionType.GetAutoName(); // now we create a reaction CReaction reaction = model.createReaction(name); UpdateReaction(reaction, reactionType.Reagents, reactionType.Products, reactionType.Rate); copasiReactionByReactionType.Add(reactionType, reaction); return(reaction); }
public ReactionContext ( Cacheable <IUserMessage, ulong> cachedUserMessage, ISocketMessageChannel messageChannel, SocketReaction reaction, ReactionType reactionType ) { ReactionType = reactionType; _cachedUserMessage = cachedUserMessage; _messageChannel = messageChannel; _reaction = reaction; }
public ReactionNotification( string userId, ReactionType reactionType, string reactingUserName, string originUserName, bool isPersonal, string url) : base(userId, url) { this.ReactionType = reactionType; this.ReactingUserName = reactingUserName ?? throw new ArgumentNullException(nameof(reactingUserName)); this.OriginUserName = originUserName ?? throw new ArgumentNullException(nameof(originUserName)); this.IsPersonal = isPersonal; }
private async Task ReactionAction ( Cacheable <IUserMessage, ulong> userMessage, ISocketMessageChannel messageChannel, SocketReaction reaction, ReactionType reactionType ) { using (var scope = _services.CreateScope()) { var registry = scope.ServiceProvider.GetService <ReactionModuleRegistry>(); if (registry == null) { _logger.LogWarning($"{nameof(ReactionModuleRegistry)} ist nicht konfiguriert"); return; } var types = registry.GetRegisteredTypes(reaction.Emote.Name); if (!types.Any()) { return; } var context = new ReactionContext(userMessage, messageChannel, reaction, reactionType); foreach (var type in types) { if (!(scope.ServiceProvider.GetService(type) is ReactionModuleBase module)) { _logger.LogWarning($"Ungültiger Typ in {nameof(ReactionModuleRegistry)} gefunden: '{type.FullName}'."); continue; } module.Context = context; try { if (await module.ExecuteAsync()) { return; } } catch (Exception e) { _logger.LogCritical(e, $"ReactionHandler '{module.GetType().FullName}' hat eine Exception zurückgegeben."); throw; } } } }
private void ChangeReaction(Faction faction, ReactionType type) { if (faction == null) { switch (type) { case ReactionType.Ignore: this.Say(1005179); break; // Civilians will now be ignored. case ReactionType.Warn: this.Say(1005180); break; // Civilians will now be warned of their impending deaths. case ReactionType.Attack: return; } } else { TextDefinition def = null; switch (type) { case ReactionType.Ignore: def = faction.Definition.GuardIgnore; break; case ReactionType.Warn: def = faction.Definition.GuardWarn; break; case ReactionType.Attack: def = faction.Definition.GuardAttack; break; } if (def != null && def.Number > 0) { this.Say(def.Number); } else if (def != null && def.String != null) { this.Say(def.String); } } this.m_Orders.SetReaction(faction, type); }
/// <summary> /// Removes a reaction. /// </summary> /// <param name="reaction">Reaction.</param> public void RemoveReaction(ReactionType reaction) { CReaction copasiReaction = GetReaction(reaction); model.removeReaction(copasiReaction); copasiReactionByReactionType.Remove(reaction); CModelValue fluxValue; if (copasiReactionFluxValueByReaction.TryGetValue(copasiReaction, out fluxValue)) { model.removeModelValue(fluxValue); copasiReactionFluxValueByReaction.Remove(copasiReaction); } }
public Reaction(GenericReader reader) { int version = reader.ReadEncodedInt(); switch (version) { case 0: { m_Faction = Faction.ReadReference(reader); m_Type = (ReactionType)reader.ReadEncodedInt(); break; } } }
public Reaction( GenericReader reader ) { int version = reader.ReadEncodedInt(); switch ( version ) { case 0: { m_Faction = Faction.ReadReference( reader ); m_Type = (ReactionType) reader.ReadEncodedInt(); break; } } }
private static string GetPath(ReactionType type) { string path = ""; switch (type) { case ReactionType.Owo: path = "https://orig00.deviantart.net/bc18/f/2018/140/2/1/orikivo_iii____animated_emoticons_owo_by_abnersquared-dbtju89.gif"; break; default: throw new Exception("Invalid reaction type."); } return(path); }
public void insert_reactions_types() { var alergicaLeveModeradaGrave = new ReactionType() { Id = 1, Description = "Aloimunização Eritrocitária" }; var aloimunizacaoEritrocitaria = new ReactionType() { Id = 2, Description = "Aloimunização HLA" }; var aloimunizacaoHla = new ReactionType() { Id = 3, Description = "Imunomodulação" }; var enxertoXHospedeiro = new ReactionType() { Id = 4, Description = "Lesão pulmonar relacionada a transfusão" }; var febrilNaoHemolitica = new ReactionType() { Id = 5, Description = "Púrpura pós transfusional" }; var hemoliticaImune = new ReactionType() { Id = 6, Description = "Alérgica: leve; moderada; grave" }; var imunomodulacao = new ReactionType() { Id = 7, Description = "Enxerto x Hospedeiro" }; var lesaoPulmonarRelacionadaATransfusao = new ReactionType() { Id = 8, Description = "Febril não hemolítica" }; var purpuraPosTransfusional = new ReactionType() { Id = 9, Description = "Hemolítica Imune" }; var types = new List<ReactionType> { alergicaLeveModeradaGrave, aloimunizacaoEritrocitaria, aloimunizacaoHla, enxertoXHospedeiro, febrilNaoHemolitica, hemoliticaImune, imunomodulacao, lesaoPulmonarRelacionadaATransfusao, purpuraPosTransfusional }; var reactionTypes = new Types<ReactionType>(); reactionTypes.SaveList(types); }
public Reaction(int id, User user, ReactionType content) { Id = id; User = user; Content = content; }
public void SetReaction( Faction faction, ReactionType type ) { Reaction reaction = GetReaction( faction ); reaction.Type = type; }
public Reaction( Faction faction, ReactionType type ) { m_Faction = faction; m_Type = type; }
/// <summary> /// Initializes a new instance of the <see cref="NewReaction"/> class. /// </summary> /// <param name="content">The reaction type.</param> public NewReaction(ReactionType content) { Content = content; }
private void ChangeReaction( Faction faction, ReactionType type ) { if ( faction == null ) { switch ( type ) { case ReactionType.Ignore: Say( 1005179 ); break; // Civilians will now be ignored. case ReactionType.Warn: Say( 1005180 ); break; // Civilians will now be warned of their impending deaths. case ReactionType.Attack: return; } } else { TextDefinition def = null; switch ( type ) { case ReactionType.Ignore: def = faction.Definition.GuardIgnore; break; case ReactionType.Warn: def = faction.Definition.GuardWarn; break; case ReactionType.Attack: def = faction.Definition.GuardAttack; break; } if ( def != null && def.Number > 0 ) Say( def.Number ); else if ( def != null && def.String != null ) Say( def.String ); } m_Orders.SetReaction( faction, type ); }
public void Remove(ReactionType type) { if (Types.Contains(type)) Types.Remove(type); }
public Reaction(Faction faction, ReactionType type) { this.m_Faction = faction; this.m_Type = type; }
public void Add(ReactionType type) { Types.Add(type); }