Пример #1
0
        /// <summary>
        /// Create a new dialog sequence.
        /// </summary>
        /// <param name="sequenceName">The name of the new sequence.</param>
        /// <param name="list">An arbitrary collection of dialogs that will be made part of this sequence.</param>
        /// <returns>The constructed dialog sequence</returns>
        public HybrasylDialogSequence NewDialogSequence(string sequenceName, params object[] list)
        {
            if (string.IsNullOrEmpty(sequenceName))
            {
                GameLog.ScriptingError($"NewDialogSequence: Sequence name (first argument) was null / empty");
                return(null);
            }

            var dialogSequence = new HybrasylDialogSequence(sequenceName);

            foreach (var entry in list)
            {
                if (entry is HybrasylDialog)
                {
                    var newdialog = entry as HybrasylDialog;
                    dialogSequence.AddDialog(newdialog);
                    newdialog.Sequence = dialogSequence.Sequence;
                }
                else
                {
                    GameLog.ScriptingError($"NewDialogSequence: Unknown argument of type {entry.GetType()} was passed for a dialog - ignored");
                }
            }
            return(dialogSequence);
        }
Пример #2
0
 /// <summary>
 /// Add a main menu item (pursuit) to this object's menu list.
 /// </summary>
 /// <param name="hybrasylSequence"></param>
 public void AddPursuit(HybrasylDialogSequence hybrasylSequence)
 {
     if (Obj is VisibleObject && !(Obj is User))
     {
         var vobj = Obj as VisibleObject;
         vobj.AddPursuit(hybrasylSequence.Sequence);
     }
 }
Пример #3
0
 /// <summary>
 /// Register a dialog sequence as a "global" sequence, meaning any object in the game can reference and use it.
 /// </summary>
 /// <param name="globalSequence">The dialog sequence to be registered as a global seqeunce.</param>
 public void RegisterGlobalSequence(HybrasylDialogSequence globalSequence)
 {
     if (globalSequence is null || globalSequence.Sequence.Dialogs.Count == 0)
     {
         GameLog.ScriptingError("RegisterGlobalSequence: sequence (first argument) was null, or the sequence contained no dialogs");
     }
     Game.World.RegisterGlobalSequence(globalSequence.Sequence);
 }
Пример #4
0
 public void RegisterSequence(HybrasylDialogSequence hybrasylSequence)
 {
     if (Obj is VisibleObject && !(Obj is User))
     {
         var vobj = Obj as VisibleObject;
         vobj.RegisterDialogSequence(hybrasylSequence.Sequence);
     }
 }
Пример #5
0
 /// <summary>
 /// Add a main menu item (pursuit) to this object's menu list.
 /// </summary>
 /// <param name="hybrasylSequence"></param>
 public void AddPursuit(HybrasylDialogSequence hybrasylSequence)
 {
     if (hybrasylSequence is null || hybrasylSequence.Sequence.Dialogs.Count == 0)
     {
         GameLog.ScriptingError("AddPursuit: Dialog sequence (first argument) was null or sequence was empty (no dialogs)");
     }
     if (Obj is VisibleObject && !(Obj is User))
     {
         var vobj = Obj as VisibleObject;
         vobj.AddPursuit(hybrasylSequence.Sequence);
     }
 }
Пример #6
0
 /// <summary>
 /// Register a constructed dialog sequence with the current world object, which makes it available for use by that object.
 /// Dialogs must be registered before they can be used.
 /// </summary>
 /// <param name="hybrasylSequence"></param>
 public void RegisterSequence(HybrasylDialogSequence hybrasylSequence)
 {
     if (hybrasylSequence is null)
     {
         GameLog.Error("RegisterSequence called with null/nil value. Check Lua");
         return;
     }
     if (Obj is VisibleObject && !(Obj is User))
     {
         var vobj = Obj as VisibleObject;
         vobj.RegisterDialogSequence(hybrasylSequence.Sequence);
     }
 }
Пример #7
0
 /// <summary>
 /// Register a constructed dialog sequence with the current world object, which makes it available for use by that object.
 /// Dialogs must be registered before they can be used.
 /// </summary>
 /// <param name="hybrasylSequence"></param>
 public void RegisterSequence(HybrasylDialogSequence hybrasylSequence)
 {
     if (hybrasylSequence is null || hybrasylSequence.Sequence.Dialogs.Count == 0)
     {
         GameLog.Error("RegisterSequence: sequence (first argument) was null or contained no dialogs, ignoring");
         return;
     }
     if (Obj is VisibleObject && !(Obj is User))
     {
         var vobj = Obj as VisibleObject;
         vobj.RegisterDialogSequence(hybrasylSequence.Sequence);
     }
 }
Пример #8
0
        public HybrasylDialogSequence NewDialogSequence(string sequenceName, params object[] list)
        {
            var dialogSequence = new HybrasylDialogSequence(sequenceName);

            foreach (var entry in list)
            {
                Logger.InfoFormat("Type is {0}", entry.GetType().ToString());
                if (entry is HybrasylDialog)
                {
                    var newdialog = entry as HybrasylDialog;
                    dialogSequence.AddDialog(newdialog);
                }
                else if (entry is PythonFunction)
                {
                    var action = entry as PythonFunction;
                }
            }
            return(dialogSequence);
        }
Пример #9
0
        /// <summary>
        /// Create a new dialog sequence.
        /// </summary>
        /// <param name="sequenceName">The name of the new sequence.</param>
        /// <param name="list">An arbitrary collection of dialogs that will be made part of this sequence.</param>
        /// <returns>The constructed dialog sequence</returns>
        public HybrasylDialogSequence NewDialogSequence(string sequenceName, params object[] list)
        {
            var dialogSequence = new HybrasylDialogSequence(sequenceName);

            foreach (var entry in list)
            {
                if (entry is HybrasylDialog)
                {
                    var newdialog = entry as HybrasylDialog;
                    dialogSequence.AddDialog(newdialog);
                    newdialog.Sequence = dialogSequence.Sequence;
                }
                else
                {
                    GameLog.Error($"Unknown parameter type {entry.GetType()} passed to NewDialogSequence, ignored");
                }
            }
            return(dialogSequence);
        }
Пример #10
0
        public HybrasylDialogSequence NewDialogSequence(string sequenceName, params object[] list)
        {
            var dialogSequence = new HybrasylDialogSequence(sequenceName);

            foreach (var entry in list)
            {
                Logger.InfoFormat("Type is {0}", entry.GetType().ToString());
                if (entry is HybrasylDialog)
                {
                    var newdialog = entry as HybrasylDialog;
                    dialogSequence.AddDialog(newdialog);
                }
                else
                {
                    ScriptingLogger.Error($"Unknown parameter type {entry.GetType()} passed to NewDialogSequence, ignored");
                }
            }
            return(dialogSequence);
        }
Пример #11
0
 /// <summary>
 /// Add a dialog option that will start a new sequence when selected by a player.
 /// </summary>
 /// <param name="option">The option text</param>
 /// <param name="sequence">The DialogSequence that wil be started when the option is selected by a player</param>
 public void AddOption(string option, HybrasylDialogSequence sequence) => Options.Add(option, sequence);
Пример #12
0
 /// <summary>
 /// Register a dialog sequence as a "global" sequence, meaning any object in the game can reference and use it.
 /// </summary>
 /// <param name="globalSequence">The dialog sequence to be registered as a global seqeunce.</param>
 public void RegisterGlobalSequence(HybrasylDialogSequence globalSequence)
 {
     Game.World.RegisterGlobalSequence(globalSequence.Sequence);
 }