コード例 #1
0
        public Spell addPosition(WiimoteInfo.Point pointF, DateTime dateTime)
        {
            if ((spellNames == null || spellNames.Count == 0))
            {
                //cloudBitWarningShown = true;
                MessageBox.Show(
                    "You need to choose the spells and set the cloudBit or IFTTT configurations before casting spells",
                    "Configuration required",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return(null);
            }


            if (spell == null)
            {
                addPosition(new Position(pointF, dateTime));

                if (positions.Count > 10)
                {
                    if (wandIsPaused(positions))
                    {
                        Spell chosen = brain.chooseSpell(positions);
                        if (chosen != null && authorization != null && device != null && spellNames != null)
                        {
                            for (int i = 0; i < spellNames.Count; i++)
                            {
                                if (spellNames[i].Equals(chosen.GetType().Name))
                                {
                                    spell = chosen;
                                    ((CloudBitSpell)spell).setConfigurations(device, authorization, iftttUserKey, spellIftttEvents[i]);
                                    spell.castSpell();
                                    startSpell = DateTime.Now;
                                }
                            }
                        }
                    }
                }
            }
            else if (!spell.casting())
            {
                spell = null;
                positions.Clear();
                if (strokes != null)
                {
                    strokes.Clear();
                }
            }

            return(spell);
        }
コード例 #2
0
 public Position(WiimoteInfo.Point point, DateTime time)
 {
     this.point = point;
     this.time  = time;
 }