Ejemplo n.º 1
0
        public SettingsPage()
        {
            this.InitializeComponent();
            Callouts.SetTitle("Settings");
            switch (settings.Values["speed"]?.ToString())
            {
            case "Fast": speedFastRB.IsChecked = true; break;

            case "Slow": speedSlowRB.IsChecked = true; break;

            default: speedNormalRB.IsChecked = true; break;
            }

            switch (settings.Values["numbers"]?.ToString())
            {
            case "1-8": numbersDancersRB.IsChecked = true; break;

            case "1-4": numbersCouplesRB.IsChecked = true; break;

            default: numbersNoneRB.IsChecked = true; break;
            }
            switch (settings.Values["geometry"]?.ToString())
            {
            case "Hexagon": geometryHexagonRB.IsChecked = true; break;

            case "Bigon": geometryBigonRB.IsChecked = true; break;

            default: geometrySquareRB.IsChecked = true; break;
            }
            gridSwitch.IsOn     = settings.Values["grid"]?.ToString() == "On";
            loopSwitch.IsOn     = settings.Values["loop"]?.ToString() == "On";
            pathsSwitch.IsOn    = settings.Values["paths"]?.ToString() == "On";
            phantomsSwitch.IsOn = settings.Values["phantoms"]?.ToString() == "On";
        }
        private void setAnimation()
        {
            var tam = alltams.ElementAt(animnum);

            Callouts.SetTitle(tam.attr("title"));
            animationView.setAnimation(tam);
            sliderTicView.setTics(animationView.totalBeats, animationView.parts, isParts: animationView.hasParts);
            Callouts.progressCallback = (double beat) => {
                //  Set slider to the current beat
                userDrag     = false;
                slider.Value = beat * 100 / animationView.totalBeats;
                userDrag     = true;
                //  Fade out any Taminator text
                //  Win wants an "opacity" value from 1 to 0
                var a = Math.Max((2.0 - beat) / 2.01, 0.0);
                saysPanel.Opacity = a;
            };
            var taminator = tam.SelectSingleNode("taminator");

            if (taminator != null)
            {
                saysText.Text = taminator.FirstChild.NodeValue.ToString().Trim().ReplaceAll("\\s+", " ");
            }
            animnumText.Text = $"{animnum+1} of {animtot}";
            readSettings();
        }
        public void reset(string level)
        {
            LevelData   d       = LevelData.find(level);
            var         isIndex = d.dir == "all";
            XmlDocument calldoc = TamUtils.getXMLAsset(isIndex ? "src\\callindex.xml" : "src\\calls.xml");

            Callouts.SetTitle(d.name);
            calls = calldoc.SelectNodes(isIndex ? "/calls/call" : $"/calls/call[@{d.selector}]");
            searchCallList("");
        }
Ejemplo n.º 4
0
        public LevelPage()
        {
            this.InitializeComponent();
            var screenSize = MainPage.ScreenSize();

            if (screenSize.Length() < 6)
            {
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            }
            Callouts.SetTitle("Taminations");
        }
Ejemplo n.º 5
0
 public override void nextAnimation() {
   if (tutnum >= tutdata.Length)
     tutnum = 0;
   var tamdoc = TamUtils.getXMLAsset("src/tutorial.xml");
   var gender = settings.Values["gender"]?.ToString() == "Girl" ? Gender.GIRL : Gender.BOY;
   var offset = gender == Gender.BOY ? 0 : 1;
   var tamlist = tamdoc.SelectNodes("/tamination/tam");
   var tam = tamlist[tutnum * 2 + offset];
   Callouts.SetTitle(tam.attr("title"));
   page.Animation.setAnimation(tam,(int)gender);
   switch (settings.Values["practicespeed"]?.ToString()) {
     case "Normal": page.Animation.setSpeed("Normal"); break;
     case "Moderate": page.Animation.setSpeed("Moderate"); break;
     default: page.Animation.setSpeed("Slow"); break;
   }
   showInstructions();
 }
Ejemplo n.º 6
0
        public virtual void nextAnimation()
        {
            var      calldoc  = TamUtils.getXMLAsset("src/calls.xml");
            var      selector = LevelData.find(page.Intent()["level"]).selector;
            var      calls    = calldoc.SelectNodes($"/calls/call[@{selector}]");
            IXmlNode tam      = null;
            var      rand     = new Random();

            while (tam == null)
            {
                var e = calls[rand.Next((int)calls.Length)];
                //  Remember link for definition
                link = e.attr("link");
                var tamdoc = TamUtils.getXMLAsset(link);
                var tams   = tamdoc.SelectNodes("/tamination/tam")
                             //  For now, skip any "difficult" animations
                             .Where((IXmlNode x) => { return(x.attr("difficulty") != "3"); })
                             //  Skip any call with parens in the title - it could be a cross-reference
                             //  to a concept call from a higher level
                             .Where((IXmlNode x) => { return(!x.attr("title").Contains("(")); });
                if (tams.Count() > 0)
                {
                    tam = tams.ElementAt(rand.Next(tams.Count()));
                    var gender = settings.Values["practicegender"]?.ToString() == "Boy"
            ? (int)Gender.BOY : (int)Gender.GIRL;
                    page.Animation.setAnimation(tam, gender);
                    switch (settings.Values["practicespeed"]?.ToString())
                    {
                    case "Normal": page.Animation.setSpeed("Normal"); break;

                    case "Moderate": page.Animation.setSpeed("Moderate"); break;

                    default: page.Animation.setSpeed("Slow"); break;
                    }
                    Callouts.SetTitle(tam.attr("title"));
                }
            }
        }
Ejemplo n.º 7
0
        public void reset()
        {
            // Fetch the list of animations and build the table
            var prevtitle = "";
            var prevgroup = "";

            link = this.Intent()["link"];
            Callouts.SetLevel(link);
            XmlDocument tamdoc = TamUtils.getXMLAsset(link);
            var         title  = tamdoc.SelectSingleNode("/tamination").attr("title");

            Callouts.SetTitle(title);
            var tams      = TamUtils.tamList(tamdoc);
            var diffsum   = 0;
            var firstanim = -1;
            var i         = 0;

            foreach (IXmlNode tam in tams)
            {
                if (tam.attr("display") == "none")
                {
                    continue;
                }
                var tamtitle = tam.attr("title");
                var from     = TamUtils.tamXref(tam).attr("from");
                var group    = tam.attr("group");
                var diffstr  = TamUtils.tamXref(tam).attr("difficulty");
                var diff     = diffstr.Length > 0 ? int.Parse(diffstr) : 0;
                diffsum += diff;
                if (group.Length > 0)
                {
                    // Add header for new group as needed
                    if (group != prevgroup)
                    {
                        if (Regex.Match(group, @"^\s+$").Success)
                        {
                            // Blank group, for calls with no common starting phrase
                            // Add a green separator unless it's the first group
                            if (anims.Count > 0)
                            {
                                anims.Add(new AnimListItem()
                                {
                                    celltype = CellType.Separator
                                });
                            }
                        }
                        else
                        {
                            // Named group e.g. "As Couples.."
                            // Add a header with the group name, which starts
                            // each call in the group
                            anims.Add(new AnimListItem()
                            {
                                celltype = CellType.Header,
                                name     = group
                            });
                        }
                    }
                    from = tamtitle.Replace(group, " ").Trim();
                }
                else if (tamtitle != prevtitle)
                {
                    // Not a group but a different call
                    // Put out a header with this call
                    anims.Add(new AnimListItem()
                    {
                        celltype = CellType.Header,
                        name     = tamtitle + " from"
                    });
                }
                //  Build list item for this animation
                prevtitle = tamtitle;
                prevgroup = group;
                //  TODO posanim(av.getCount) = i
                //  Remember where the first real animation is in the list
                if (firstanim < 0)
                {
                    firstanim = anims.Count;
                }
                //  TODO selectanim and weblink
                //  ...
                // Put out a selectable item
                anims.Add(new AnimListItem()
                {
                    celltype   = Regex.Match(group, @"^\s+$").Success ? CellType.Plain : CellType.Indented,
                    title      = tamtitle,
                    name       = from,
                    group      = group.Length > 0 ? group : tamtitle + " from",
                    animnumber = i,
                    difficulty = diff
                });
                i = i + 1;
            }
            if (diffsum <= 0)
            {
                DifficultyLegend.Visibility = Visibility.Collapsed;
            }
            AnimList.ItemsSource = anims;
            if (firstanim >= 0)
            {
                Callouts.FirstAnimationReady(anims[firstanim]);
            }
        }
Ejemplo n.º 8
0
 public AboutPage()
 {
     this.InitializeComponent();
     Callouts.SetTitle("About Taminations");
 }