예제 #1
0
    public void SelectSpell(JSONObject data, int idx)
    {
        SpellIcon ic = spellIcons.Find(x => x.spellName == data["spellName"].str);

        ic.Select(idx);

        SpellItem sData = spellsController.spells.Find(x => x.name == data["spellName"].str);

        spellData.SetActive(true);
        spellName.text = sData.showName;
        if (sData.type == "offensive")
        {
            spellMultiplier.text = (sData.knockbackMultiplier * 100) + "%";
            spellIncrement.text  = (sData.knockbackIncrement * 100 - 100) + "%";
            spellMultiplierIcon.SetActive(true);
            spellIncrementIcon.SetActive(true);
        }
        else
        {
            spellMultiplier.text = "";
            spellIncrement.text  = "";
            spellMultiplierIcon.SetActive(false);
            spellIncrementIcon.SetActive(false);
        }

        spellCooldown.text    = (sData.cooldown / 1000) + " sec.";
        spellDescription.text = sData.description;
    }
예제 #2
0
 public void HighlightSelectedSpellIcon()
 {
     if (_spell == null)
     {
         return;
     }
     if ((spIconRadio.IsChecked == true && _spell.Icon == 0) ||
         spActiveIconRadio.IsChecked == true && _spell.ActiveIcon == 0)
     {
         spIconCurrent.Source = null;
     }
     foreach (Grid g in spellIcons.Children)
     {
         if (g.Name == ("spIconBg" + (spIconRadio.IsChecked == true ? _spell.Icon : _spell.ActiveIcon)))
         {
             g.Background = new SolidColorBrush(Colors.Green);
             foreach (var c in g.Children)
             {
                 if (c.GetType() == typeof(SpellIcon))
                 {
                     SpellIcon icon = (SpellIcon)c;
                     spIconCurrent.Source = icon.Source;
                 }
             }
         }
         else
         {
             g.Background = null;
         }
     }
 }
예제 #3
0
    public void SpellsStatusUpdate()
    {
        foreach (Transform child in offensiveSpellsList)
        {
            Destroy(child.gameObject);
        }
        foreach (Transform child in defensiveSpellsList)
        {
            Destroy(child.gameObject);
        }

        spellIcons = new List <SpellIcon>();
        foreach (SpellItem spell in spellsController.spells)
        {
            SpellIcon icon = Instantiate(spellIconPrefab).GetComponent <SpellIcon>();
            icon.SetData(spell);
            if (spell.type == "offensive")
            {
                icon.transform.SetParent(offensiveSpellsList);
            }
            else
            {
                icon.transform.SetParent(defensiveSpellsList);
            }

            spellIcons.Add(icon);
        }
    }
예제 #4
0
        private bool _addNewSpellToSlot(int slot, ESFRecord data, short level)
        {
            var emptySpellInDestinationSlot = _childItems.Single(x => x.Slot == slot);

            if (slot < 0 || !(emptySpellInDestinationSlot is EmptySpellIcon))
            {
                return(false);
            }

            _setSpellSlotInRegistry(slot, data.ID);
            _childItems.Remove(emptySpellInDestinationSlot);
            ((XNAControl)emptySpellInDestinationSlot).SetParent(null);
            ((XNAControl)emptySpellInDestinationSlot).Close();

            var newSpell = new SpellIcon(this, data, slot)
            {
                Level = level
            };

            var displaySlot = GetDisplaySlotFromSlot(slot);

            newSpell.SetDisplaySlot(displaySlot);

            var scrollOffset = _scroll == null ? 0 : _scroll.ScrollOffset;

            newSpell.Visible = displaySlot >= scrollOffset * SPELL_ROW_LENGTH &&
                               displaySlot < scrollOffset * SPELL_ROW_LENGTH + 2 * SPELL_ROW_LENGTH;

            _childItems.Add(newSpell);

            return(true);
        }
        void SetDefaults()
        {
            allowedTargets  = defaultTargetFlags;
            allowedElements = defaultElementFlags;
            selectedIcon    = new SpellIcon()
            {
                index = defaultSpellIcon,
            };
            editOrDeleteSlot = -1;

            for (int i = 0; i < maxEffectsPerSpell; i++)
            {
                effectEntries[i] = new EffectEntry();
            }

            if (IsSetup)
            {
                effect1NameLabel.Text = string.Empty;
                effect2NameLabel.Text = string.Empty;
                effect3NameLabel.Text = string.Empty;
                spellNameLabel.Text   = string.Empty;
                UpdateAllowedButtons();
                SetIcon(selectedIcon);
                SetStatusLabels();
            }
        }
예제 #6
0
 void generateSpellIcons(List <Spell> spells)
 {
     spellIcons = new List <SpellIcon>();
     for (int i = 0; i < spells.Count; i++)
     {
         spellIcons.Add(SpellIcon.Create(i, spells[i].pathToIcon));
     }
 }
예제 #7
0
        void icon_MouseLeave(object sender, MouseEventArgs e)
        {
            SpellIcon icon = sender as SpellIcon;

            string[] c = Regex.Split(icon.Name, "itemIcon(\\d+)");
            if (Convert.ToInt32(c[1]) != SelectedIcon)
            {
                icon.Opacity = 1;
            }
        }
예제 #8
0
        void icon_MouseDown(object sender, MouseButtonEventArgs e)
        {
            SpellIcon icon = sender as SpellIcon;

            string[] c = Regex.Split(icon.Name, "itemIcon(\\d+)");
            SelectedIcon = Convert.ToInt32(c[1]);
            string s = "";

            iconFileNameStore.TryGetValue(SelectedIcon, out s);
            SelectedIconName = Regex.Split(s, "([\\w|\\-]*)\\.png")[1];
            itemCreateDisplayIDResult.Text = SelectedIconName;
        }
        void SetIcon(SpellIcon icon)
        {
            // Fallback to classic index if no valid icon pack key
            if (string.IsNullOrEmpty(icon.key) || !DaggerfallUI.Instance.SpellIconCollection.HasPack(icon.key))
            {
                icon.key   = string.Empty;
                icon.index = icon.index % DaggerfallUI.Instance.SpellIconCollection.SpellIconCount;
            }

            // Set icon
            selectedIcon = icon;
            selectIconButton.BackgroundTexture = DaggerfallUI.Instance.SpellIconCollection.GetSpellIcon(selectedIcon);
        }
예제 #10
0
    public static SpellIcon Create(int index, string pathToIcon)
    {
        Transform spellIconBarTransform = Camera.main.transform.Find("pfSpellIconBar").GetChild(index).transform;
        Transform spellIconTransform    = Instantiate(GameAssets.i.pfSpellIcon, spellIconBarTransform.position, Quaternion.identity);
        SpellIcon spellIcon             = spellIconTransform.GetComponent <SpellIcon>();
        Sprite    iconImage             = Resources.Load <Sprite>(pathToIcon);

        spellIconTransform.Find("Icon").GetComponent <Image>().sprite = iconImage;

        spellIconTransform.SetParent(spellIconBarTransform);
        // combatText.Setup(text, isCriticalHit);
        return(spellIcon);
    }
예제 #11
0
 public static void LoadAchievementsEditor()
 {
     try
     {
         DbcStores.InitFiles();
         Achievement.LoadData();
         AchievementCategory.LoadData();
         AchievementCriteria.LoadData();
         Map.LoadData();
         SpellIcon.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #12
0
 public static void LoadTalentsEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         ChrClasses.LoadData();
         ChrRaces.LoadData();
         Spell.LoadData();
         SpellIcon.LoadData();
         Talent.LoadData();
         TalentTab.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
            public Texture2D GetSpellIcon(SpellIcon icon)
            {
                // Fallback to classic icons
                if (string.IsNullOrEmpty(icon.key) || !HasPack(icon.key))
                {
                    return(GetSpellIcon(icon.index));
                }

                // If pack and index seem valid then return texture from pack
                SpellIconPack pack = spellIconPacks[icon.key];

                if (pack.iconCount == 0 || pack.icons == null || icon.index < 0 || icon.index >= pack.iconCount)
                {
                    return(null);
                }
                else
                {
                    return(pack.icons[icon.index].texture);
                }
            }
예제 #14
0
 public void Load()
 {
     SpellIconStore = new Dictionary <int, SpellIcon>();
     foreach (var icon in LegacyToolBox.Data.SpellIcon)
     {
         string path = LegacyToolBox.ASSET_PATH + icon.Value + ".png";
         if (File.Exists(path))
         {
             BitmapImage image = new BitmapImage(new Uri(path, UriKind.Absolute));
             Grid        g     = new Grid();
             g.Width       = 68;
             g.Height      = 68;
             g.MouseEnter += HighlightIconBg;
             g.MouseLeave += UnhighlightIconBg;
             SpellIcon spellIcon = new SpellIcon();
             spellIcon.Width      = 64;
             spellIcon.Height     = 64;
             spellIcon.Margin     = new Thickness(2);
             spellIcon.Source     = image;
             spellIcon.MouseDown += SpellIcon_Click;
             spellIcon.Name       = "spIcon" + icon.Key;
             g.Children.Add(spellIcon);
             SpellIconStore.Add(icon.Key, spellIcon);
             Label label = new Label();
             label.HorizontalAlignment = HorizontalAlignment.Stretch;
             label.VerticalAlignment   = VerticalAlignment.Top;
             label.Padding             = new System.Windows.Thickness(2);
             label.Margin = new System.Windows.Thickness(0, 10, 36, 0);
             label.HorizontalContentAlignment = HorizontalAlignment.Center;
             label.Foreground         = new SolidColorBrush(Colors.White);
             label.Background         = new SolidColorBrush(Colors.Black);
             label.Background.Opacity = 0.8;
             label.Content            = icon.Key.ToString();
             g.Children.Add(label);
             g.Name = "spIconBg" + icon.Key;
             spellIcons.Children.Add(g);
         }
     }
 }
예제 #15
0
        public void LoadAllIcons()
        {
            itemGroupSound.SelectedValuePath = "Key";
            itemGroupSound.DisplayMemberPath = "Value";
            iconFileNameStore = new Dictionary <int, string>();
            DirectoryInfo dir   = new DirectoryInfo(LegacyToolBox.ASSET_PATH + "Interface/Icons/");
            int           index = 0;

            FileInfo[] fileInfo = dir.GetFiles("*.png");
            int        count    = fileInfo.Length;

            itemIcons.Children.Clear();
            itemIconProgress.Maximum = count;
            foreach (FileInfo f in fileInfo)
            {
                ++index;
                try
                {
                    itemIconProgress.Value        = index;
                    itemIconProgressLabel.Content = "Processing " + index + " of " + count;
                    BitmapImage image = new BitmapImage(new Uri(f.FullName, UriKind.Absolute));
                    SpellIcon   icon  = new SpellIcon();
                    icon.Source      = image;
                    icon.Width       = 40;
                    icon.Height      = 40;
                    icon.MouseEnter += icon_MouseEnter;
                    icon.MouseLeave += icon_MouseLeave;
                    icon.MouseDown  += icon_MouseDown;
                    icon.Margin      = new Thickness(2);
                    icon.Name        = "itemIcon" + index;
                    itemIcons.Children.Add(icon);
                }
                catch (System.Exception /*ex*/)
                {
                }
                iconFileNameStore.Add(index, f.Name);
            }
        }
예제 #16
0
        private void SpellIcon_Click(object sender, RoutedEventArgs e)
        {
            SpellIcon icon = (SpellIcon)sender;

            try
            {
                // name format:
                // spIconXXXXX
                uint id = Convert.ToUInt32(icon.Name.Substring(6));
                if (spIconRadio.IsChecked == true)
                {
                    _spell.Icon = id;
                }
                else
                {
                    _spell.ActiveIcon = id;
                }
                HighlightSelectedSpellIcon();
            }
            catch (System.Exception /*ex*/)
            {
            }
        }
예제 #17
0
    public void DeselectSpell(string spellName)
    {
        SpellIcon ic = spellIcons.Find(x => x.spellName == spellName);

        ic.Deselect();
    }
예제 #18
0
 public void Select(GameObject spell)
 {
     spellSelected = spell.GetComponent <SpellIcon>();
     shopUI.spellDescripton.GetComponent <Text> ().text = spellSelected.spell.spellDescription;
     shopUI.contourSpell.transform.GetComponent <RectTransform> ().localPosition = spell.transform.GetComponent <RectTransform> ().localPosition;
 }
 Texture2D GetSpellIcon(SpellIcon icon)
 {
     return(DaggerfallUI.Instance.SpellIconCollection.GetSpellIcon(icon));
 }
예제 #20
0
        void icon_MouseEnter(object sender, MouseEventArgs e)
        {
            SpellIcon icon = sender as SpellIcon;

            icon.Opacity = 0.6;
        }