/// <summary> /// Gets an array of <see cref="NPCChatResponseActionBase"/> from the <paramref name="names"/>. /// </summary> /// <param name="names">The array of names of the <see cref="NPCChatResponseActionBase"/>s to get.</param> /// <returns>An array of <see cref="NPCChatResponseActionBase"/> from the <paramref name="names"/>.</returns> NPCChatResponseActionBase[] GetActionsFromNames(IList <string> names) { if (!LoadActions) { return(NPCChatResponseActionBase.EmptyActions); } if (names == null || names.Count == 0) { return(NPCChatResponseActionBase.EmptyActions); } var ret = new NPCChatResponseActionBase[names.Count]; for (var i = 0; i < names.Count; i++) { ret[i] = NPCChatResponseActionBase.GetResponseAction(names[i]); } return(ret); }
/// <summary> /// When overridden in the derived class, sets the values read from the Read method. /// </summary> /// <param name="value">The value.</param> /// <param name="page">The page.</param> /// <param name="text">The text.</param> /// <param name="conditionals">The conditionals.</param> /// <param name="actions">The actions.</param> protected abstract void SetReadValues(byte value, NPCChatDialogItemID page, string text, NPCChatConditionalCollectionBase conditionals, NPCChatResponseActionBase[] actions);
/// <summary> /// Gets an array of <see cref="NPCChatResponseActionBase"/> from the <paramref name="names"/>. /// </summary> /// <param name="names">The array of names of the <see cref="NPCChatResponseActionBase"/>s to get.</param> /// <returns>An array of <see cref="NPCChatResponseActionBase"/> from the <paramref name="names"/>.</returns> NPCChatResponseActionBase[] GetActionsFromNames(IList<string> names) { if (!LoadActions) return NPCChatResponseActionBase.EmptyActions; if (names == null || names.Count == 0) return NPCChatResponseActionBase.EmptyActions; var ret = new NPCChatResponseActionBase[names.Count]; for (var i = 0; i < names.Count; i++) { ret[i] = NPCChatResponseActionBase.GetResponseAction(names[i]); } return ret; }
/// <summary> /// When overridden in the derived class, sets the values read from the Read method. /// </summary> /// <param name="value">The value.</param> /// <param name="page">The page.</param> /// <param name="text">The text.</param> /// <param name="conditionals">The conditionals.</param> /// <param name="actions">The actions.</param> protected override void SetReadValues(byte value, NPCChatDialogItemID page, string text, NPCChatConditionalCollectionBase conditionals, NPCChatResponseActionBase[] actions) { Debug.Assert(_value == default(byte) && _page == default(ushort) && _text == default(string), "Values were already set?"); _value = value; _page = page; _text = text; }
/// <summary> /// Tries to get the <see cref="NPCChatResponseActionBase"/> with the given <paramref name="name"/>. /// </summary> /// <param name="name">The name of the <see cref="NPCChatResponseActionBase"/> to get.</param> /// <param name="value">If the method returns true, contains the <see cref="NPCChatResponseActionBase"/> /// with the given <paramref name="name"/>.</param> /// <returns>True if the <paramref name="value"/> was successfully acquired; otherwise false.</returns> public static bool TryGetResponseAction(string name, out NPCChatResponseActionBase value) { return _instances.TryGetValue(name, out value); }
/// <summary> /// When overridden in the derived class, sets the values read from the Read method. /// </summary> /// <param name="value">The value.</param> /// <param name="page">The page.</param> /// <param name="text">The text.</param> /// <param name="conditionals">The conditionals.</param> /// <param name="actions">The actions.</param> protected override void SetReadValues(byte value, NPCChatDialogItemID page, string text, NPCChatConditionalCollectionBase conditionals, NPCChatResponseActionBase[] actions) { _value = value; _page = page; SetText(text); _actions.Clear(); _actions.AddRange(actions); var c = conditionals as EditorNPCChatConditionalCollection; _conditionals = c ?? new EditorNPCChatConditionalCollection(); }
/// <summary> /// Tries to get the <see cref="NPCChatResponseActionBase"/> with the given <paramref name="name"/>. /// </summary> /// <param name="name">The name of the <see cref="NPCChatResponseActionBase"/> to get.</param> /// <param name="value">If the method returns true, contains the <see cref="NPCChatResponseActionBase"/> /// with the given <paramref name="name"/>.</param> /// <returns>True if the <paramref name="value"/> was successfully acquired; otherwise false.</returns> public static bool TryGetResponseAction(string name, out NPCChatResponseActionBase value) { return(_instances.TryGetValue(name, out value)); }