public void BuildBox(SearchResultModel model)
        {
            foreach (var item in model.Items)
            {
                ProcessItem(item);
            }
            var box = new StatBox()
            {
                Title = BoxTitle
            };

            model.StatBoxs.Add(box);
            foreach (var engine in Engines.OrderByDescending(o => o.Counter).Take(10))
            {
                var red = new StatItem()
                {
                    Title = engine.Name, Value = engine.Counter, Link = "#"
                };
                box.StatItems.Add(red);
                if (model.Items.Count > 0)
                {
                    red.ValueText    = ((decimal)engine.Counter / model.Items.Count * 100).ToString("f") + "%";
                    red.ValuePercent = ((decimal)engine.Counter / model.Items.Count * 100);
                }
                else
                {
                    red.ValueText    = "0%";
                    red.ValuePercent = 0;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Changes the displayed values on the screen to reflect their values in memory.
        /// </summary>
        private void UpdateScreenValues()
        {
            //Set the values in the Results box to their values in memory.
            WinCount.Text    = WinRatio[0].ToString();
            LossCount.Text   = WinRatio[1].ToString();
            PlayedCount.Text = (WinRatio[0] + WinRatio[1]).ToString();
            //Reset the StatBox's Text.
            StatBox.Text = "";
            //Populate the Labels giving them a black color.
            string StatString = "FACE\tFREQUENCY\tPERCENT\tTIMES GUESSED\n";

            StatBox.SelectionColor = Color.Black;
            StatBox.AppendText(StatString);
            //Change the text to dark gray.
            StatBox.SelectionColor = Color.DarkGray;
            //Loop through each face calculating the data and appending it to the StatBox
            for (int i = 0; i < 6; i++)
            {
                StatBox.AppendText("  " + (i + 1) + "\t          ");
                StatBox.AppendText(RollCounter[i].ToString() + "\t   ");
                StatBox.AppendText((WinRatio[0] + WinRatio[1] == 0 ?
                                    "0.00" : Math.Round(((double)RollCounter[i] / (WinRatio[0] + WinRatio[1])), 2).ToString("0.00")) + "%\t\t  ");
                StatBox.AppendText(Guesses[i].ToString() + "\n");
            }
        }
        public void BuildSentimentBox(SearchResultModel model, SentimentValuator sentimentValuator)
        {
            var sentimentBox = new StatBox()
            {
                Title = "Sentimiento"
            };

            model.StatBoxs.Add(sentimentBox);
            sentimentBox.StatItems.Add(new StatItem()
            {
                Title = "Positivas",
                Link  = "#",
                Value = sentimentValuator.PositiveCount
            });
            sentimentBox.StatItems.Add(new StatItem()
            {
                Title = "Negativas",
                Link  = "#",
                Value = sentimentValuator.NegativeCount
            });
            sentimentBox.StatItems.Add(new StatItem()
            {
                Title = "Neutras",
                Link  = "#",
                Value = sentimentValuator.NeutralCount
            });
            if (model.Items.Count > 0)
            {
                sentimentBox.StatItems[0].ValueText =
                    ((decimal)sentimentValuator.PositiveCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[1].ValueText =
                    ((decimal)sentimentValuator.NegativeCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[2].ValueText =
                    ((decimal)sentimentValuator.NeutralCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[0].ValuePercent =
                    ((decimal)sentimentValuator.PositiveCount / model.Items.Count * 100);
                sentimentBox.StatItems[1].ValuePercent =
                    ((decimal)sentimentValuator.NegativeCount / model.Items.Count * 100);
                sentimentBox.StatItems[2].ValuePercent =
                    ((decimal)sentimentValuator.NeutralCount / model.Items.Count * 100);
            }
            else
            {
                sentimentBox.StatItems[0].ValueText    = "0%";
                sentimentBox.StatItems[1].ValueText    = "0%";
                sentimentBox.StatItems[2].ValueText    = "0%";
                sentimentBox.StatItems[0].ValuePercent = 0;
                sentimentBox.StatItems[1].ValuePercent = 0;
                sentimentBox.StatItems[2].ValuePercent = 0;
            }
        }
コード例 #4
0
        public void BuildSentimentBox(SearchResultModel model, SentimentValuator sentimentValuator)
        {
            var sentimentBox = new StatBox() { Title = "Sentimiento" };
            model.StatBoxs.Add(sentimentBox);
            sentimentBox.StatItems.Add(new StatItem()
                                           {
                                               Title = "Positivas",
                                               Link = "#",
                                               Value = sentimentValuator.PositiveCount
                                           });
            sentimentBox.StatItems.Add(new StatItem()
                                           {
                                               Title = "Negativas",
                                               Link = "#",
                                               Value = sentimentValuator.NegativeCount
                                           });
            sentimentBox.StatItems.Add(new StatItem()
                                           {
                                               Title = "Neutras",
                                               Link = "#",
                                               Value = sentimentValuator.NeutralCount
                                           });
            if (model.Items.Count > 0)
            {
                sentimentBox.StatItems[0].ValueText =
                    ((decimal)sentimentValuator.PositiveCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[1].ValueText =
                    ((decimal)sentimentValuator.NegativeCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[2].ValueText =
                    ((decimal)sentimentValuator.NeutralCount / model.Items.Count * 100).ToString("f") + "%";
                sentimentBox.StatItems[0].ValuePercent =
                    ((decimal)sentimentValuator.PositiveCount / model.Items.Count * 100);
                sentimentBox.StatItems[1].ValuePercent =
                    ((decimal)sentimentValuator.NegativeCount / model.Items.Count * 100);
                sentimentBox.StatItems[2].ValuePercent =
                    ((decimal)sentimentValuator.NeutralCount / model.Items.Count * 100);

            }
            else
            {
                sentimentBox.StatItems[0].ValueText = "0%";
                sentimentBox.StatItems[1].ValueText = "0%";
                sentimentBox.StatItems[2].ValueText = "0%";
                sentimentBox.StatItems[0].ValuePercent = 0;
                sentimentBox.StatItems[1].ValuePercent = 0;
                sentimentBox.StatItems[2].ValuePercent = 0;
            }
        }
コード例 #5
0
        // ======================================
        // =========== Main Methods =============
        // ======================================

        #region World Methods

        /// <summary>
        /// Initializes internal data.
        /// </summary>
        public static void Init()
        {
            Dungeon.Init();
            AwardHandler.Init();
            m_combat             = new Combat();
            m_statBox            = new StatBox();
            m_levelTimer         = new Timer(120 * 60);
            m_healthBar          = new ProgressBar("Health Mana");
            m_attackBar          = new ProgressBar("Attack Mana");
            m_scoring            = new Scoring();
            m_healthBar.Position = new Vector2(10, 10);
            m_attackBar.Position = new Vector2(10, 40);
            m_healthBar.Init((int)Dungeon.MainPlayer.MaxMana, (int)Dungeon.MainPlayer.HealthMana);
            m_attackBar.Init((int)Dungeon.MainPlayer.MaxMana, (int)Dungeon.MainPlayer.AttackMana);
            m_combat.PerformCombat(Dungeon.MainPlayer, Dungeon.Monsters);
            m_levelTimer.PerformAction();
            m_statBox.GenerateStats(Dungeon.MainPlayer);
        }
コード例 #6
0
 public void BuildBox(SearchResultModel model)
 {
     foreach (var item in model.Items)
     {
         ProcessItem(item);
     }
     var box = new StatBox() { Title = BoxTitle };
     model.StatBoxs.Add(box);
     foreach (var engine in Engines.OrderByDescending(o=>o.Counter).Take(10))
     {
         var red = new StatItem() { Title = engine.Name, Value = engine.Counter, Link = "#" };
         box.StatItems.Add(red);
         if (model.Items.Count > 0)
         {
             red.ValueText = ((decimal)engine.Counter / model.Items.Count * 100).ToString("f") + "%";
             red.ValuePercent = ((decimal)engine.Counter / model.Items.Count * 100);
         }
         else
         {
             red.ValueText = "0%";
             red.ValuePercent = 0;
         }
     }
 }