Ejemplo n.º 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            GlobalData.currentGrid = LayoutRoot;
            checkForActiveProducts();
            try
            {
                if (currentlyRunning == 0)
                {
                    //start inital load
                    base.OnNavigatedTo(e);
                    for (int i = 0; i < UniversalData.godsList.Count; i++)
                    {
                        if (GlobalData.getPageView() == (string)UniversalData.godsList.ElementAt <ParseObject>(i)["Name"])
                        {
                            godNumber = i;
                            break;
                        }
                    }
                    GodPivot.Title = GlobalData.getPageView();

                    BitmapImage bgBitmap;
                    string      godName = (string)UniversalData.godsList.ElementAt <ParseObject>(godNumber)["Name"];
                    if (godName.Contains(' '))
                    {
                        string[] godSplit = godName.Split(' ');
                        bgBitmap = new BitmapImage(new Uri("images//" + godSplit[0] + "_" + godSplit[1] + "_card.jpg", UriKind.Relative));
                    }
                    else
                    {
                        bgBitmap = new BitmapImage(new Uri("images//" + godName + "_card.jpg", UriKind.Relative));
                    }
                    bgBitmap.DecodePixelHeight = 800;
                    bgBitmap.DecodePixelWidth  = 480;
                    bGBrush.ImageSource        = bgBitmap;
                    bGBrush.Opacity            = .35;
                    GodPivot.Background        = bGBrush;
                    //end initial load
                    //load skill pivot

                    setSkillImage(passiveIcon, 0);
                    setSkillImage(skill1, 1);
                    setSkillImage(skill2, 2);
                    setSkillImage(skill3, 3);
                    setSkillImage(skill4, 4);
                    string ABlock = setAbilityText(0);
                    setTextToGrid(PassiveText, ABlock, 0, 1, SkillsGrid, false);
                    ABlock = setAbilityText(1);
                    setTextToGrid(Skill1Text, ABlock, 1, 1, SkillsGrid, false);
                    ABlock = setAbilityText(2);
                    setTextToGrid(Skill2Text, ABlock, 2, 1, SkillsGrid, false);
                    ABlock = setAbilityText(3);
                    setTextToGrid(Skill3Text, ABlock, 3, 1, SkillsGrid, false);
                    ABlock = setAbilityText(4);
                    setTextToGrid(Skill4Text, ABlock, 4, 1, SkillsGrid, false);
                    //end skill pivot
                    //load stat pivot
                    RoleCaps.Text = "Role and capabilities: " + (string)UniversalData.godsList.ElementAt <ParseObject>(godNumber)["Roles"] + "  (" + (string)UniversalData.godsList.ElementAt <ParseObject>(godNumber)["Type"] + " )";
                    ParseObject god = UniversalData.godsList.ElementAt <ParseObject>(godNumber);
                    setTextToGrid(HealthBlock1, Convert.ToString(god["Health"]), 3, 1, StatsGrid, true);
                    setTextToGrid(HealthBlock2, Convert.ToString(god["HealthPerLevel"]), 3, 2, StatsGrid, true);
                    setTextToGrid(Health5Block1, Convert.ToString(god["HealthPerFive"]), 4, 1, StatsGrid, true);
                    setTextToGrid(Health5Block2, Convert.ToString(god["HP5PerLevel"]), 4, 2, StatsGrid, true);
                    setTextToGrid(ManaBlock1, Convert.ToString(god["Mana"]), 5, 1, StatsGrid, true);
                    setTextToGrid(ManaBlock2, Convert.ToString(god["ManaPerLevel"]), 5, 2, StatsGrid, true);
                    setTextToGrid(Mana5Block1, Convert.ToString(god["ManaPerFive"]), 6, 1, StatsGrid, true);
                    setTextToGrid(Mana5Block2, Convert.ToString(god["MP5PerLevel"]), 6, 2, StatsGrid, true);
                    setTextToGrid(PPowerBlock1, Convert.ToString(god["PhysicalPower"]), 7, 1, StatsGrid, true);
                    setTextToGrid(PPowerBlock2, Convert.ToString(god["PhysicalPowerPerLevel"]), 7, 2, StatsGrid, true);
                    setTextToGrid(PProtBlock1, Convert.ToString(god["PhysicalProtection"]), 8, 1, StatsGrid, true);
                    setTextToGrid(PProtBlock2, Convert.ToString(god["PhysicalProtectionPerLevel"]), 8, 2, StatsGrid, true);
                    setTextToGrid(MProtBlock1, Convert.ToString(god["MagicProtection"]), 9, 1, StatsGrid, true);
                    setTextToGrid(MProtBlock2, Convert.ToString(god["MagicProtectionPerLevel"]), 9, 2, StatsGrid, true);
                    setTextToGrid(MoveBlock1, Convert.ToString(god["AttackSpeed"]), 10, 1, StatsGrid, true);
                    setTextToGrid(MoveBlock2, Convert.ToString(god["AttackSpeedPerLevel"]), 10, 2, StatsGrid, true);
                    //end stat pivot
                    //load lore pivot
                    string[] split = new string[2];
                    string   lore  = (string)god["Lore"];
                    finalLore = "Pantheon: " + (string)god["Pantheon"] + "\n\n";
                    split[1]  = lore;
                    while (split[1].Contains("\\n\\n"))
                    {
                        split      = split[1].Split(new string[] { "\\n\\n" }, 2, StringSplitOptions.None);
                        finalLore += "\t" + split[0] + "\n\n";
                    }
                    finalLore    += "\t" + split[1] + "\n\n";
                    LoreText.Text = finalLore;
                    //end lore pivot
                    currentlyRunning = 1;
                }
            }
            catch (Exception excep)
            {
                MessageBox.Show(excep.Message);
            }
        }
Ejemplo n.º 2
0
        private void setGodIcons(int type, Grid nGrid)
        {
            LinkedList <int> godsToUse = new LinkedList <int>();
            int    row = 0, col = 0, offset = 0;
            double gridHeight = Math.Ceiling((double)UniversalData.godsList.Count / 4) * 114;

            switch (type)
            {
            case 0:
                for (int j = 0; j < UniversalData.godsList.Count; j++)
                {
                    godsToUse.AddLast(j);
                }
                break;

            case 1:
                for (int j = 0; j < UniversalData.godsList.Count; j++)
                {
                    string godType = (string)UniversalData.godsList.ElementAt <ParseObject>(j)["Type"];
                    if (godType.Contains("Physical"))
                    {
                        godsToUse.AddLast(j);
                    }
                }
                offset = UniversalData.godsList.Count;
                break;

            case 2:
                for (int j = 0; j < UniversalData.godsList.Count; j++)
                {
                    string godType = (string)UniversalData.godsList.ElementAt <ParseObject>(j)["Type"];
                    if (godType.Contains("Magical"))
                    {
                        godsToUse.AddLast(j);
                    }
                }
                offset = UniversalData.godsList.Count + totalType("Physical");
                break;

            case 3:
                for (int j = 0; j < UniversalData.godsList.Count; j++)
                {
                    string godRole = (string)UniversalData.godsList.ElementAt <ParseObject>(j)["Roles"];
                    if (godRole.Contains("Tank"))
                    {
                        godsToUse.AddLast(j);
                    }
                }
                offset = UniversalData.godsList.Count + totalType("Physical") + totalType("Magical");
                break;

            case 4:
                for (int j = 0; j < UniversalData.godsList.Count; j++)
                {
                    string godRole = (string)UniversalData.godsList.ElementAt <ParseObject>(j)["Roles"];
                    if (godRole.Contains("Support"))
                    {
                        godsToUse.AddLast(j);
                    }
                }
                offset = UniversalData.godsList.Count + totalType("Physical") + totalType("Magical") + totalType("Tank");
                break;
            }
            nGrid.Height = gridHeight;
            RowDefinition r1 = new RowDefinition();

            r1.Height = new GridLength(114);
            nGrid.RowDefinitions.Add(r1);


            for (int i = 0; i < UniversalData.godsList.Count; i++)
            {
                if (godsToUse.Count == 0)
                {
                    break;
                }

                var godN = godsToUse.First;
                godsToUse.RemoveFirst();
                combinedIcons[offset + i]      = GlobalData.getSmallGodIcons(godN.Value);
                combinedIcons[offset + i].Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(godClick);
                Grid.SetColumn(combinedIcons[offset + i], col);
                Grid.SetRow(combinedIcons[offset + i], row);
                nGrid.Children.Add(combinedIcons[offset + i]);
                col++;
                if (col == 4)
                {
                    col = 0;
                    row++;
                    RowDefinition r1n = new RowDefinition();
                    r1n.Height = new GridLength(114);
                    nGrid.RowDefinitions.Add(r1n);
                }
            }
        }