Exemple #1
0
            public void ShowTo(User invoker, VisibleObject target = null, bool runCheck = true)
            {
                // Either we must have an associate already known to us, one must be passed, or we must have a script defined
                if (Associate == null && target == null && Script == null)
                {
                    Logger.ErrorFormat("DialogSequence {0} has no known associate or script...?", Name);
                    // Need better error handling here
                    return;
                }
                if (PreDisplayCallback != null && runCheck)
                {
                    var invocation = new ScriptInvocation();
                    invocation.Function  = PreDisplayCallback;
                    invocation.Invoker   = invoker;
                    invocation.Associate = target == null ? Associate : target;
                    if (Script != null)
                    {
                        invocation.Script = Script;
                    }

                    if (invocation.Execute())
                    {
                        Dialogs.First().ShowTo(invoker, target);
                    }
                }
                else
                {
                    Dialogs.First().ShowTo(invoker, target);
                }
            }
Exemple #2
0
            public void HandleResponse(WorldObject invoker, int optionSelected, WorldObject associateOverride = null)
            {
                var invocation = new ScriptInvocation();

                invocation.Invoker = invoker;

                if (Sequence.Associate != null)
                {
                    invocation.Associate = Sequence.Associate;
                }
                else
                {
                    invocation.Associate = associateOverride;
                }

                // If the individual options don't have callbacks, use the dialog callback instead.
                if (Handler != null && Options[optionSelected - 1].CallbackFunction == null)
                {
                    invocation.Function = Handler;
                }
                else if (Options[optionSelected - 1].CallbackFunction != null)
                {
                    invocation.Function = Options[optionSelected - 1].CallbackFunction;
                }
                invocation.Execute(optionSelected);
            }
Exemple #3
0
            public void ShowTo(User invoker, VisibleObject target = null, bool runCheck = true)
            {
                // Either we must have an associate already known to us, one must be passed, or we must have a script defined
                if (Associate == null && target == null && Script == null)
                {
                    Logger.ErrorFormat("DialogSequence {0} has no known associate or script...?", Name);
                    // Need better error handling here
                    return;
                }
                if (PreDisplayCallback != null && runCheck)
                {
                    var invocation = new ScriptInvocation();
                    invocation.Function = PreDisplayCallback;
                    invocation.Invoker = invoker;
                    invocation.Associate = target == null ? Associate : target;
                    if (Script != null)
                        invocation.Script = Script;

                    if (invocation.Execute())
                        Dialogs.First().ShowTo(invoker, target);
                }
                else
                {
                    Dialogs.First().ShowTo(invoker, target);
                }
            }
Exemple #4
0
 public void HandleResponse(WorldObject invoker, String response, WorldObject associateOverride = null)
 {
     Logger.DebugFormat("Response {0} from player {1}", response, invoker.Name);
     if (Handler != null)
     {
         // Either we must have an associate already known to us, one must be passed, or we must have a script defined
         if (Sequence.Associate == null && associateOverride == null && Sequence.Script == null)
         {
             Logger.ErrorFormat("InputDialog has no known associate or script...?");
             // Need better error handling here
             return;
         }
         var invocation = new ScriptInvocation();
         invocation.Function  = Handler;
         invocation.Associate = associateOverride == null ? Sequence.Associate : associateOverride;
         invocation.Invoker   = invoker;
         invocation.Execute(response);
     }
 }
Exemple #5
0
 public void HandleResponse(WorldObject invoker, String response, WorldObject associateOverride = null)
 {
     Logger.DebugFormat("Response {0} from player {1}", response, invoker.Name);
     if (Handler != null)
     {
         // Either we must have an associate already known to us, one must be passed, or we must have a script defined
         if (Sequence.Associate == null && associateOverride == null && Sequence.Script == null)
         {
             Logger.ErrorFormat("InputDialog has no known associate or script...?");
             // Need better error handling here
             return;
         }
         var invocation = new ScriptInvocation();
         invocation.Function = Handler;
         invocation.Associate = associateOverride == null ? Sequence.Associate : associateOverride;
         invocation.Invoker = invoker;
         invocation.Execute(response);
     }
 }
Exemple #6
0
            public void HandleResponse(WorldObject invoker, int optionSelected, WorldObject associateOverride = null)
            {
                var invocation = new ScriptInvocation();
                invocation.Invoker = invoker;

                if (Sequence.Associate != null)
                    invocation.Associate = Sequence.Associate;
                else
                    invocation.Associate = associateOverride;

                // If the individual options don't have callbacks, use the dialog callback instead.
                if (Handler != null && Options[optionSelected - 1].CallbackFunction == null)
                {
                    invocation.Function = Handler;
                }
                else if (Options[optionSelected - 1].CallbackFunction != null)
                {
                    invocation.Function = Options[optionSelected - 1].CallbackFunction;
                }
                invocation.Execute(optionSelected);
            }