示例#1
0
        public Interaction Remembrance(string textTemplate, bool longTerm = true, int millisecondTimeout = 5000, params string[] memoryKeys)
        {
            List<object> rememberedValues = new List<object>();
            foreach (string s in memoryKeys)
            {
                Interaction i = Memory.GetInstance().Remember(s, longTerm);
                if(null != i)
                    rememberedValues.Add(i.resultValue);
            }

            Interaction result = new Interaction();
            result.displayText = string.Format(textTemplate, rememberedValues.ToArray());
            _renderer.Clear();
            _renderer.Write(result.displayText);
            Thread.Sleep(millisecondTimeout);
            return result;
        }
示例#2
0
        public Interaction GetSingleValue(string text, int millisecondTimeout = 5000)
        {
            Interaction result = new Interaction();
            _renderer.Clear();
            _renderer.Write(text);
            result.displayText = text;
            Task task = Task.Run(() =>
            {
                int intResult;
                if (_input.TryGetInteger(out intResult))
                {
                    result.resultValue = intResult;
                }
            });
            task.Wait(millisecondTimeout);

            return result;
        }
示例#3
0
        public Interaction RememberSingleValue(string text, bool longTerm = false, int millisecondTimeout = 5000)
        {
            Interaction result = new Interaction();
            _renderer.Clear();
            _renderer.Write(text);
            result.displayText = text;
            Task task = Task.Run(() =>
            {
                int intResult;
                if (_input.TryGetInteger(out intResult))
                {
                    result.resultValue = intResult;
                }
            });
            task.Wait(millisecondTimeout);

            if(result.resultValue != -1)
                Memory.GetInstance().AddToMemory(result, longTerm);

            return result;
        }
示例#4
0
 public void AddToMemory(Interaction interaction, bool longTerm = false)
 {
     interaction.timestamp = DateTime.Now;
     _shortTerm.Add(interaction);
     if(longTerm) _longTerm.Add(interaction);
     _textMemory[interaction.displayText] = interaction;
 }
示例#5
0
 public Interaction Talk(string text, int millisecondTimeout = 5000)
 {
     Interaction result = new Interaction();
     _renderer.Clear();
     _renderer.Write(text);
     result.displayText = text;
     Thread.Sleep(millisecondTimeout);
     return result;
 }
示例#6
0
 public Interaction TalkInCircles(int millisecondTimeout = 5000, params string[] textLines)
 {
     if (null == _incrementer) _incrementer = new IndexIncrement(textLines.Length, true);
     string text = textLines[_incrementer.Next];
     Interaction result = new Interaction();
     _renderer.Clear();
     _renderer.Write(text);
     result.displayText = text;
     Thread.Sleep(millisecondTimeout);
     return result; ;
 }