public Verb(VerbType _type, int _valency, SentenceConstruction _constructions, float _factor) { type = _type; valency = _valency; constructions = _constructions; factor = _factor; }
public RequestServerVerbsEvent(EntityUid entityUid, VerbType type, EntityUid?slotOwner = null, bool adminRequest = false) { EntityUid = entityUid; Type = type; SlotOwner = slotOwner; AdminRequest = adminRequest; }
public void SaveOrLoad(Serializer serializer) { var verbEntries = new[] { LoadAndSaveEntry.Create(reader => CurRect.Left = reader.ReadInt16(), writer => writer.WriteInt16(CurRect.Left), 8), LoadAndSaveEntry.Create(reader => CurRect.Top = reader.ReadInt16(), writer => writer.WriteInt16(CurRect.Top), 8), LoadAndSaveEntry.Create(reader => CurRect.Right = reader.ReadInt16(), writer => writer.WriteInt16(CurRect.Right), 8), LoadAndSaveEntry.Create(reader => CurRect.Bottom = reader.ReadInt16(), writer => writer.WriteInt16(CurRect.Bottom), 8), LoadAndSaveEntry.Create(reader => OldRect.Left = reader.ReadInt16(), writer => writer.WriteInt16(OldRect.Left), 8), LoadAndSaveEntry.Create(reader => OldRect.Top = reader.ReadInt16(), writer => writer.WriteInt16(OldRect.Top), 8), LoadAndSaveEntry.Create(reader => OldRect.Right = reader.ReadInt16(), writer => writer.WriteInt16(OldRect.Right), 8), LoadAndSaveEntry.Create(reader => OldRect.Bottom = reader.ReadInt16(), writer => writer.WriteInt16(OldRect.Bottom), 8), LoadAndSaveEntry.Create(reader => VerbId = reader.ReadByte(), writer => writer.WriteByte(VerbId), 8, 11), LoadAndSaveEntry.Create(reader => VerbId = reader.ReadUInt16(), writer => writer.WriteUInt16(VerbId), 12), LoadAndSaveEntry.Create(reader => Color = reader.ReadByte(), writer => writer.WriteByte(Color), 8), LoadAndSaveEntry.Create(reader => HiColor = reader.ReadByte(), writer => writer.WriteByte(HiColor), 8), LoadAndSaveEntry.Create(reader => DimColor = reader.ReadByte(), writer => writer.WriteByte(DimColor), 8), LoadAndSaveEntry.Create(reader => BkColor = reader.ReadByte(), writer => writer.WriteByte(BkColor), 8), LoadAndSaveEntry.Create(reader => Type = (VerbType)reader.ReadByte(), writer => writer.WriteByte((byte)Type), 8), LoadAndSaveEntry.Create(reader => CharsetNr = reader.ReadByte(), writer => writer.WriteByte(CharsetNr), 8), LoadAndSaveEntry.Create(reader => CurMode = reader.ReadByte(), writer => writer.WriteByte(CurMode), 8), LoadAndSaveEntry.Create(reader => SaveId = reader.ReadByte(), writer => writer.WriteByte(SaveId), 8), LoadAndSaveEntry.Create(reader => Key = reader.ReadByte(), writer => writer.WriteByte(Key), 8), LoadAndSaveEntry.Create(reader => Center = reader.ReadBoolean(), writer => writer.WriteByte(Center), 8), LoadAndSaveEntry.Create(reader => Prep = reader.ReadByte(), writer => writer.WriteByte(Prep), 8), LoadAndSaveEntry.Create(reader => ImgIndex = reader.ReadUInt16(), writer => writer.WriteUInt16(ImgIndex), 8), }; verbEntries.ForEach(e => e.Execute(serializer)); }
/// <summary> /// Execute actions associated with the given verb. /// </summary> /// <remarks> /// Unless this is a client-exclusive verb, this will also tell the server to run the same verb. However, if the verb /// is disabled and has a tooltip, this function will only generate a pop-up-message instead of executing anything. /// </remarks> public void ExecuteVerb(EntityUid target, Verb verb, VerbType verbType) { if (verb.Disabled) { if (verb.Message != null) { _popupSystem.PopupCursor(verb.Message); } return; } var user = _playerManager.LocalPlayer?.ControlledEntity; if (user == null) { return; } ExecuteVerb(verb, user.Value, target); if (!verb.ClientExclusive) { RaiseNetworkEvent(new ExecuteVerbEvent(target, verb, verbType)); } }
/// <summary> /// Execute actions associated with the given verb. /// </summary> /// <remarks> /// Unless this is a client-exclusive verb, this will also tell the server to run the same verb. /// </remarks> public void ExecuteVerb(EntityUid target, Verb verb, VerbType verbType) { var user = _playerManager.LocalPlayer?.ControlledEntity; if (user == null) { return; } // is this verb actually valid? if (verb.Disabled) { // maybe send an informative pop-up message. if (!string.IsNullOrWhiteSpace(verb.Message)) { _popupSystem.PopupEntity(verb.Message, user.Value); } return; } if (verb.ClientExclusive) { // is this a client exclusive (gui) verb? ExecuteVerb(verb, user.Value, target); } else { EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(target, verb, verbType)); } }
public string[] GetForms(VerbType verbType) { List <string> formsList; switch (verbType) { case VerbType.Infinitive: formsList = _formInfinitiveList; break; case VerbType.Past: formsList = _formPastList; break; case VerbType.PresentParticiple: formsList = _formPresentParticipleList; break; case VerbType.PastParticiple: formsList = _formPastParticipleList; break; default: throw new Exception(verbType + " is not supported"); } return(formsList.ToArray()); }
public Verb(IDictionary <string, object> dynamicRaml, VerbType type, string defaultMediaType, bool isOptional = false) { this.dynamicRaml = dynamicRaml; this.type = type; this.defaultMediaType = defaultMediaType; this.isOptional = isOptional; }
public VerbCategoryPopup(VerbSystem system, IEnumerable <Verb> verbs, VerbType type, EntityUid target, bool drawOnlyIcons) : base() { // Do any verbs have icons? If not, don't bother leaving space for icons in the pop-up. var drawVerbIcons = false; foreach (var verb in verbs) { if (verb.Icon != null) { drawVerbIcons = true; break; } } // If no verbs have icons. we cannot draw only icons if (drawVerbIcons == false) { drawOnlyIcons = false; } // If we are drawing only icons, show them side by side if (drawOnlyIcons) { List.Orientation = LayoutOrientation.Horizontal; } foreach (var verb in verbs) { AddToMenu(new VerbButton(system, verb, type, target, drawVerbIcons)); } }
public ConfirmationMenuElement(Verb verb, string?text, VerbType type) : base(text) { Verb = verb; Type = type; Icon.Visible = false; SetOnlyStyleClass(StyleClassConfirmationContextMenuButton); }
public static void Show(VerbType type) { var verbUi = FindObjectOfType <VerbUI>(); verbUi.types.Add(type); verbUi.header.text = verbUi.GetTextFromType(verbUi.GetFirstOfTheList()); verbUi.Show(); }
public SentenceImperative() { this.actionType = VerbType.Say; this.directObject = "mmm"; this.isAPerson = false; this.preposition = ""; this.indirectObject = ""; this.complements = ""; }
private Verb GetVerb(IDictionary<string, object> dynamicRaml, string key, VerbType typeOfVerb, string defaultMediaType) { var secondKey = String.Format("{0}?",key); return dynamicRaml.ContainsKey(key) ? builder.Build((IDictionary<string, object>)dynamicRaml[key], typeOfVerb, defaultMediaType) : (dynamicRaml.ContainsKey(secondKey) ? builder.Build((IDictionary<string, object>)dynamicRaml[secondKey], typeOfVerb, defaultMediaType, true) : null); }
private Verb GetVerb(IDictionary <string, object> dynamicRaml, string key, VerbType typeOfVerb, string defaultMediaType) { var secondKey = String.Format("{0}?", key); return(dynamicRaml.ContainsKey(key) ? new Verb((IDictionary <string, object>)dynamicRaml[key], typeOfVerb, defaultMediaType) : (dynamicRaml.ContainsKey(secondKey) ? new Verb((IDictionary <string, object>)dynamicRaml[secondKey], typeOfVerb, defaultMediaType, true) : null)); }
private Verb getVerb(IDictionary<string,object> dynamicRaml, string key, VerbType typeOfVerb) { var secondKey = String.Format("{0}?",key); return dynamicRaml.ContainsKey(key) ? new Verb((IDictionary<string, object>)dynamicRaml[key], typeOfVerb) : (dynamicRaml.ContainsKey(secondKey) ? new Verb((IDictionary<string, object>)dynamicRaml[secondKey], typeOfVerb, true) : null); }
/// <summary> /// Gets an integer value representing a weighted score for strength of match. The higher the score, the more characters of the /// path that match. /// </summary> /// <param name="path">The service path.</param> /// <param name="verb">The verb.</param> /// <returns>An integer value representing a weighted score for strength of match.</returns> public int GetMatchRate(string path, string verb) { VerbType vt = StringToVerb(verb); if ((vt & Verb) == vt) { return(GetPathMatchRate(path)); } return(-1); }
/// <summary> /// Verb Constructor /// </summary> /// <param name="hz">Preposition of the verb</param> /// <param name="bonmazi">Past tense root</param> /// <param name="bonmozareh">Present tense root</param> /// <param name="psh">Prefix</param> /// <param name="flyar">Non-verbal element</param> /// <param name="trnst">Transitivity</param> /// <param name="type">Verb type</param> /// <param name="amrshdn">CanBeImperative</param> /// <param name="vowelEnd">PresentRootConsonantVowelEndStem</param> /// <param name="maziVowelStart">PastRootVowelStart</param> /// <param name="mozarehVowelStart">PresentRootVowelStart</param> public Verb(string hz, string bonmazi, string bonmozareh, string psh, string flyar, VerbTransitivity trnst, VerbType type, bool amrshdn, string vowelEnd, string maziVowelStart, string mozarehVowelStart) { PrepositionOfVerb = hz; NonVerbalElement = flyar; Prefix = psh; PastTenseRoot = bonmazi; PresentTenseRoot = bonmozareh; Transitivity = trnst; Type = type; CanBeImperative = amrshdn; PresentRootConsonantVowelEndStem = vowelEnd; PastRootVowelStart = maziVowelStart; PresentRootVowelStart = mozarehVowelStart; }
public Verb(string hz, string bonmazi, string bonmozareh, string psh, string flyar, VerbTransitivity trnst, VerbType type, bool amrshdn, string vowelEnd, string maziVowelStart, string mozarehVowelStart) { HarfeEzafeh = hz; Felyar = flyar; Pishvand = psh; HastehMazi = bonmazi; HastehMozareh = bonmozareh; Transitivity = trnst; Type = type; AmrShodani = amrshdn; HastehMozarehConsonantVowelEndStem = vowelEnd; HastehMaziVowelStart = maziVowelStart; HastehMozarehVowelStart = mozarehVowelStart; }
public void AddForms(IEnumerable <string> forms, VerbType verbType) { switch (verbType) { case VerbType.Infinitive: _formInfinitiveList.AddRange(forms); break; case VerbType.Past: _formPastList.AddRange(forms); break; case VerbType.PastParticiple: _formPastParticipleList.AddRange(forms); break; case VerbType.PresentParticiple: _formPresentParticipleList.AddRange(forms); break; } Forms.AddRange(forms.Where(x => Forms.All(y => !y.Equals(x, StringComparison.InvariantCultureIgnoreCase)))); }
public static void Hide(VerbType type) { var verbUi = FindObjectOfType <VerbUI>(); verbUi.types.Remove(type); if (verbUi.types.Count == 0) { verbUi.Hide(); } else { verbUi.header.text = verbUi.GetTextFromType(verbUi.GetFirstOfTheList()); } }
public AnGame() { save = true; if (null != ConfigurationManager.AppSettings["Save"]) { save = Convert.ToBoolean(ConfigurationManager.AppSettings["Save"]); } actorType = (ActorType)Enum.Parse(typeof(ActorType), ConfigurationManager.AppSettings["ActorType"], true); verbType = (VerbType)Enum.Parse(typeof(VerbType), ConfigurationManager.AppSettings["VerbType"], true); faceType = (FaceType)Enum.Parse(typeof(FaceType), ConfigurationManager.AppSettings["FaceType"], true); graphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = wide, PreferredBackBufferHeight = high, IsFullScreen = false }; Content.RootDirectory = "Content"; }
public Verb Build(IDictionary<string, object> dynamicRaml, VerbType type, string defaultMediaType, bool isOptional = false) { if (dynamicRaml == null) return null; this.dynamicRaml = dynamicRaml; this.defaultMediaType = defaultMediaType; var verb = new Verb { Type = type, IsOptional = isOptional, Headers = GetHeaders(), Responses = GetResponses(), Body = GetBody(), Description = GetDescription(), QueryParameters = GetQueryParameters() }; return verb; }
public VerbButton(VerbSystem system, Verb verb, VerbType type, EntityUid target, bool drawIcons = true, bool categoryPrefix = false) : base() { Disabled = verb.Disabled; ToolTip = verb.Tooltip; TooltipDelay = 0.5f; var buttonContents = new BoxContainer { Orientation = LayoutOrientation.Horizontal }; // maybe draw verb icons if (drawIcons) { TextureRect icon = new() { MinSize = (ContextMenuPopup.ButtonHeight, ContextMenuPopup.ButtonHeight), Stretch = TextureRect.StretchMode.KeepCentered, TextureScale = (0.5f, 0.5f) }; // Even though we are drawing icons, the icon for this specific verb may be null. if (verb.Icon != null) { icon.Texture = verb.Icon.Frame0(); } else if (categoryPrefix && verb.Category?.Icon != null) { // we will use the category icon instead icon.Texture = verb.Category.Icon.Frame0(); } buttonContents.AddChild(icon); } // maybe add a label if (verb.Text != string.Empty || categoryPrefix) { // First add a small bit of padding buttonContents.AddChild(new Control { MinSize = (4, ContextMenuPopup.ButtonHeight) });
private string GetTextFromType(VerbType type) { switch (type) { case VerbType.INVESTIGATE: return("[X] Investigar"); case VerbType.OPEN: return("[X] Entrar"); case VerbType.LOOK: return("[X] Olhar"); case VerbType.CLIMB: return("[X] Subir"); case VerbType.ASK: return("[X] Questionar"); default: return("Error"); } }
public Verb Build(IDictionary <string, object> dynamicRaml, VerbType type, string defaultMediaType, bool isOptional = false) { if (dynamicRaml == null) { return(null); } this.dynamicRaml = dynamicRaml; this.defaultMediaType = defaultMediaType; var verb = new Verb { Type = type, IsOptional = isOptional, Headers = GetHeaders(), Responses = GetResponses(), Body = GetBody(), Description = GetDescription(), QueryParameters = GetQueryParameters() }; return(verb); }
public PathAction(Point pathPoint, VerbType verb) { PathPoint = pathPoint; Verb = verb; }
public ExecuteVerbEvent(EntityUid target, Verb requestedVerb, VerbType type) { Target = target; RequestedVerb = requestedVerb; Type = type; }
public RequestServerVerbsEvent(EntityUid entityUid, VerbType type, EntityUid?slotOwner = null) { EntityUid = entityUid; Type = type; SlotOwner = slotOwner; }
/// <summary> /// Initializes a new instance of the <see cref="ServicePointAttribute"/> class. /// </summary> /// <param name="path">The service path.</param> /// <param name="verb">The verb.</param> public ServicePointAttribute(string path, VerbType verb) { Path = path; Verb = verb; }
public Verb(IDictionary<string, object> dynamicRaml, VerbType type, bool isOptional = false) { this.dynamicRaml = dynamicRaml; this.type = type; this.isOptional = isOptional; }
public RequestServerVerbsEvent(EntityUid entityUid, VerbType type) { EntityUid = entityUid; Type = type; }
/// <summary> /// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This /// does not request verbs from the server. /// </summary> public virtual Dictionary <VerbType, SortedSet <Verb> > GetLocalVerbs(EntityUid target, EntityUid user, VerbType verbTypes, bool force = false) { Dictionary <VerbType, SortedSet <Verb> > verbs = new(); // accessibility checks bool canAccess = false; if (force || target == user) { canAccess = true; } else if (_interactionSystem.InRangeUnobstructed(user, target, ignoreInsideBlocker: true)) { if (user.IsInSameOrParentContainer(target)) { canAccess = true; } else { // the item might be in a backpack that the user has open canAccess = _interactionSystem.CanAccessViaStorage(user, target); } } // A large number of verbs need to check action blockers. Instead of repeatedly having each system individually // call ActionBlocker checks, just cache it for the verb request. var canInteract = force || _actionBlockerSystem.CanInteract(user); EntityUid @using = default; if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user))) { hands.TryGetActiveHeldEntity(out @using); // Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used". // This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging // their sprite. if (@using != default && EntityManager.TryGetComponent <HandVirtualItemComponent?>(@using, out var pull)) { @using = pull.BlockingEntity; } } if ((verbTypes & VerbType.Interaction) == VerbType.Interaction) { GetInteractionVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Interaction, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Activation) == VerbType.Activation) { GetActivationVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Activation, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Alternative) == VerbType.Alternative) { GetAlternativeVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Alternative, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Other) == VerbType.Other) { GetOtherVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Other, getVerbEvent.Verbs); } return(verbs); }
/// <summary> /// Verb Constructor /// </summary> /// <param name="hz">Preposition of the verb</param> /// <param name="bonmazi">Past tense root</param> /// <param name="bonmozareh">Present tense root</param> /// <param name="psh">Prefix</param> /// <param name="flyar">Non-verbal element</param> /// <param name="trnst">Transitivity</param> /// <param name="type">Verb type</param> /// <param name="amrshdn">CanBeImperative</param> /// <param name="vowelEnd">PresentRootConsonantVowelEndStem</param> /// <param name="maziVowelStart">PastRootVowelStart</param> /// <param name="mozarehVowelStart">PresentRootVowelStart</param> public Verb(string hz, string bonmazi, string bonmozareh, string psh, string flyar, VerbTransitivity trnst, VerbType type, bool amrshdn, string vowelEnd,string maziVowelStart,string mozarehVowelStart) { PrepositionOfVerb = hz; NonVerbalElement = flyar; Prefix = psh; PastTenseRoot = bonmazi; PresentTenseRoot = bonmozareh; Transitivity = trnst; Type = type; CanBeImperative = amrshdn; PresentRootConsonantVowelEndStem = vowelEnd; PastRootVowelStart = maziVowelStart; PresentRootVowelStart = mozarehVowelStart; }
/// <summary> /// Ask the server to send back a list of server-side verbs, and for now return an incomplete list of verbs /// (only those defined locally). /// </summary> public Dictionary <VerbType, SortedSet <Verb> > GetVerbs(EntityUid target, EntityUid user, VerbType verbTypes) { if (!target.IsClientSide()) { RaiseNetworkEvent(new RequestServerVerbsEvent(target, verbTypes)); } return(GetLocalVerbs(target, user, verbTypes)); }
public Verb(VerbType Type, object Action) { VerbType = Type; VerbAction = Action; }
public VerbCategoryButton(VerbSystem system, VerbCategory category, IEnumerable <Verb> verbs, VerbType type, EntityUid target, bool?drawOnlyIcons = null) : base() { _system = system; _drawOnlyIcons = drawOnlyIcons ?? category.IconsOnly; MouseFilter = MouseFilterMode.Stop; // Contents of the button stored in this box container var box = new BoxContainer() { Orientation = LayoutOrientation.Horizontal }; // First we add the icon for the verb group var icon = new TextureRect { MinSize = (ContextMenuPopup.ButtonHeight, ContextMenuPopup.ButtonHeight), TextureScale = (0.5f, 0.5f), Stretch = TextureRect.StretchMode.KeepCentered, }; if (category.Icon != null) { icon.Texture = category.Icon.Frame0(); } box.AddChild(icon); // Some padding before the text box.AddChild(new Control { MinSize = (4, ContextMenuPopup.ButtonHeight) });
/// <summary> /// Raises a number of events in order to get all verbs of the given type(s) /// </summary> public Dictionary <VerbType, SortedSet <Verb> > GetVerbs(IEntity target, IEntity user, VerbType verbTypes) { Dictionary <VerbType, SortedSet <Verb> > verbs = new(); if ((verbTypes & VerbType.Interaction) == VerbType.Interaction) { GetInteractionVerbsEvent getVerbEvent = new(user, target); RaiseLocalEvent(target.Uid, getVerbEvent); verbs.Add(VerbType.Interaction, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Activation) == VerbType.Activation) { GetActivationVerbsEvent getVerbEvent = new(user, target); RaiseLocalEvent(target.Uid, getVerbEvent); verbs.Add(VerbType.Activation, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Alternative) == VerbType.Alternative) { GetAlternativeVerbsEvent getVerbEvent = new(user, target); RaiseLocalEvent(target.Uid, getVerbEvent); verbs.Add(VerbType.Alternative, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Other) == VerbType.Other) { GetOtherVerbsEvent getVerbEvent = new(user, target); RaiseLocalEvent(target.Uid, getVerbEvent); verbs.Add(VerbType.Other, getVerbEvent.Verbs); } return(verbs); }