コード例 #1
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
        internal void SelectConversation(Mode c)
        {
            if (c == null)
            {
                Talker.Say("Trying to start non-existant conversation", Talk.BeepType.Bad );
                return;
            }
            // Avoid multiple starts.
            if (currentMode == c) return;

            // Let the old conversation deactivate any event hooks, grammars, etc.
            if (currentMode != null)
                currentMode.Stop();

            currentMode = c;
            currentMode.Start();
        }
コード例 #2
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
        /// <summary>
        /// Start an interrupting conversation.
        /// </summary>
        void StartInterruption()
        {
            // Remember what we were talking about.
            if (interrupted == null)
                interrupted = currentMode;

            // Visually they stack up, so we take the last one first.
            currentMode = interruptions.Last();
            currentMode.Start();
        }
コード例 #3
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
        /// <summary>
        /// Finish an interruption and resume normal conversation
        /// </summary>
        internal void FinishInterruption( Mode m )
        {
            lock (interruptions)
            {
                // Remove the terminating interruption from the list.
                interruptions.Remove(m);

                // Let it remove any event hooks, etc
                m.Stop();

                // If there are any other interruptions pending, start one.
                // Otherwise resume the interrupted conversation.
                if (interruptions.Count > 0)
                    StartInterruption();
                else
                {
                    currentMode = interrupted;
                    interrupted = null;
                    currentMode.Start();
                }
            }
        }
コード例 #4
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
        /// <summary>
        /// Remove the context for a conversation that is no longer visible.
        /// </summary>
        /// <param name="name"></param>
        internal void RemoveConversation(string name)
        {
            bool change = false;

            lock (conversations)
            {
                if (conversations.ContainsKey(name))
                {
                    Mode doomed = conversations[name];
                    if (currentMode == doomed)
                    {
                        change = true;
                        currentMode = chat;
                    }
                    if (interrupted == doomed)
                        interrupted = chat;

                    conversations.Remove(name);
                    if (change)
                        SelectConversation(currentMode);
                }
            }
        }
コード例 #5
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
 internal void ChangeFocus(Mode toThis)
 {
     currentMode = toThis;
      if (currentMode != null)
         currentMode.Start();
 }
コード例 #6
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
 internal bool amCurrent(Mode m)
 {
     return (currentMode == m);
 }
コード例 #7
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
        /// <summary>
        /// Take note of a new interruption.
        /// </summary>
        /// <param name="m"></param>
        internal void AddInterruption(Mode m)
        {
            lock (interruptions)
            {
                // Add to the end of the list.
                interruptions.AddLast(m);

                // If the list WAS empty, start this.
                if (interruptions.Count == 1)
                    StartInterruption();
            }
        }
コード例 #8
0
ファイル: Control.cs プロジェクト: Nuriat/radegast
 /// <summary>
 /// Add a conversation context to those we are tracking.
 /// </summary>
 /// <param name="m"></param>
 internal void AddConversation(Mode m)
 {
     if (!conversations.ContainsKey(m.Title))
         conversations[m.Title] = m;
 }
コード例 #9
0
ファイル: Control.cs プロジェクト: Booser/radegast
        internal void SelectConversation(Mode c)
        {
            if (c == null)
            {
                Logger.Log("Trying to start non-existant conversation", Helpers.LogLevel.Warning);
                return;
            }
            // Avoid multiple starts.
            if (currentMode == c) return;

            // Let the old conversation deactivate any event hooks, grammars, etc.
            if (currentMode != null)
                currentMode.Stop();

            currentMode = c;
            currentMode.Start();
        }