Ejemplo n.º 1
0
    public void DropAcceptedHandler(string oldContainerId, string newContainerId, ICheckerData data)
    {
      if (!(data is SimpleTextData))
      {
        throw new ArgumentException("SimpleTextChecker expects data of type SimpleTextData");
      }

      var d = data as SimpleTextData;

      if (!dict.ContainsKey(newContainerId))
      {
        dict.Add(newContainerId, new List<string>());
      }
      dict[newContainerId].Add(d.Text);

      if (oldContainerId == "default")
      {
        ++nrAcceptedDrops;
      }
      else
      {
        dict[oldContainerId].Remove(d.Text);
      }

      if (nrAcceptedDrops == NrAccepts)
      {
        // Check the result
        var r = CheckResults();

        // Inform the game all drop are done
        OnTaskFinished(r);
      }
    }
Ejemplo n.º 2
0
        public void DropAcceptedHandler(string oldContainerId, string newContainerId, ICheckerData data)
        {
            if (!(data is SimpleTextData))
            {
                throw new ArgumentException("SimpleTextChecker expects data of type SimpleTextData");
            }

            var d = data as SimpleTextData;

            if (!dict.ContainsKey(newContainerId))
            {
                dict.Add(newContainerId, new List <string>());
            }
            dict[newContainerId].Add(d.Text);

            if (oldContainerId == "default")
            {
                ++nrAcceptedDrops;
            }
            else
            {
                dict[oldContainerId].Remove(d.Text);
            }

            if (nrAcceptedDrops == NrAccepts)
            {
                // Check the result
                var r = CheckResults();

                // Inform the game all drop are done
                OnTaskFinished(r);
            }
        }