コード例 #1
0
        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);


            if (IsControl || MenuState.MateriaArrange.IsControl || MenuState.MateriaPrompt.IsControl)
            {
                int j = Math.Min(rows + topRow, Materiatory.MATERIATORY_SIZE);

                for (int i = topRow; i < j; i++)
                {
                    MateriaOrb orb = MenuState.Party.Materiatory.Get(i);
                    if (orb != null)
                    {
                        Shapes.RenderCircle(g, Colors.WHITE, 9, X + x1, Y + cy + (i - topRow) * y);
                        Shapes.RenderCircle(g, orb.Color, 7, X + x1, Y + cy + (i - topRow) * y);

                        Text.ShadowedText(g, orb.Name, X + x2, Y + (i - topRow + 1) * y);
                    }
                }
            }

            if (IsControl)
            {
                Shapes.RenderCursor(g, X + cx, Y + cy + (option - topRow) * y);
            }
        }
コード例 #2
0
 protected SlotHolder(SlotHolderData data)
     : base(data)
 {
     Slots  = new MateriaOrb[data.Slots];
     Links  = data.Links;
     Growth = data.Growth;
 }
コード例 #3
0
ファイル: Weapon.cs プロジェクト: skinitimski/Reverence
        public void AttachMateria(MateriaOrb orb, int slot)
        {
            if (slot >= Slots.Length)
            {
                throw new ImplementationException("Tried to attach materia to a slot not on this Weapon");
            }

            Slots[slot] = orb;
        }
コード例 #4
0
ファイル: Materiatory.cs プロジェクト: skinitimski/Reverence
 public void Put(MateriaOrb orb)
 {
     int i = 0;
     
     while (_materiatory[i] != null)
     {
         i++;
     }
     
     _materiatory [i] = orb;
 }
コード例 #5
0
ファイル: Ally.cs プロジェクト: skinitimski/Reverence
        private void GetSummons(SlotHolder sh, List <SummonMenuEntry> list)
        {
            // First, add all the new summons.
            foreach (MateriaOrb m in sh.Slots)
            {
                if (m != null && m.Type == MateriaType.Summon)
                {
                    foreach (string ability in m.Abilities)
                    {
                        Spell summon = CurrentBattle.Seven.Data.GetSummonSpell(ability);

                        if (!list.Any(x => x.Name == summon.Name))
                        {
                            list.Add(new SummonMenuEntry(m.Name, summon));
                        }
                    }
                }
            }

            // Then, go through and attach any support abilities
            for (int i = 0; i < sh.Links; i++)
            {
                MateriaOrb left  = sh.Slots[i * 2];
                MateriaOrb right = sh.Slots[(i * 2) + 1];


                if (left != null && right != null)
                {
                    if (left.Type == MateriaType.Summon && right.Type == MateriaType.Support)
                    {
                        MateriaOrb temp = left;
                        left  = right;
                        right = temp;
                    }

                    if (right.Type == MateriaType.Summon && left.Type == MateriaType.Support)
                    {
                        foreach (string ability in right.Abilities)
                        {
                            Spell summon = CurrentBattle.Seven.Data.GetSummonSpell(ability);

                            foreach (SummonMenuEntry entry in list.Where(x => x.Name == summon.Name))
                            {
                                entry.AddAbility(left);
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: Ally.cs プロジェクト: skinitimski/Reverence
        private void GetMagicSpells(SlotHolder sh, List <MagicMenuEntry> list)
        {
            // First, add all the new magic spells.
            foreach (MateriaOrb m in sh.Slots)
            {
                if (m != null && m.Type == MateriaType.Magic)
                {
                    foreach (string ability in m.Abilities)
                    {
                        Spell magicSpell = CurrentBattle.Seven.Data.GetMagicSpell(ability);

                        if (!list.Any(x => x.Name == magicSpell.Name))
                        {
                            list.Add(new MagicMenuEntry(magicSpell));
                        }
                    }
                }
            }

            for (int i = 0; i < sh.Links; i++)
            {
                MateriaOrb left  = sh.Slots[i * 2];
                MateriaOrb right = sh.Slots[(i * 2) + 1];

                if (left != null && right != null)
                {
                    if (left.Type == MateriaType.Magic && right.Type == MateriaType.Support)
                    {
                        MateriaOrb temp = left;
                        left  = right;
                        right = temp;
                    }

                    if (right.Type == MateriaType.Magic && left.Type == MateriaType.Support)
                    {
                        foreach (string ability in right.Abilities)
                        {
                            Spell magicSpell = CurrentBattle.Seven.Data.GetMagicSpell(ability);

                            foreach (MagicMenuEntry entry in list.Where(x => x.Name == magicSpell.Name))
                            {
                                entry.AddAbility(left);
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
        public void AddAbility(MateriaOrb s)
        {
            switch (s.Name)
            {
            case "All":
                AllCount = s.Level + 1;
                break;

            case "Quadra Magic":
                if (s.Name != "Knights of Round")
                {
                    QMagicCount = s.Level + 1;
                }
                break;
            }
        }
コード例 #8
0
        public void AddAbility(MateriaOrb s)
        {
            if (s.Type != MateriaType.Support)
            {
                throw new ImplementationException("Used non-support materia '{0}' in a support context.", s.Name);
            }

            //_addedAbilities.Add(s.GetAbility());
            if (s.Name == "All")
            {
                _allCount = Math.Min(s.Level + 1, 5);
            }
            if (s.Name == "Quadra Magic")
            {
                _qmagicCount = Math.Min(s.Level + 1, 5);
            }
            if (s.Name == "MP Turbo")
            {
                _mpTurboFactor = Math.Min(s.Level + 1, 5);
            }
        }
コード例 #9
0
ファイル: Materiatory.cs プロジェクト: skinitimski/Reverence
        public void WriteToXml(XmlWriter writer)
        {
            writer.WriteStartElement(typeof(Materiatory).Name.ToLower());

            for (int i = 0; i < MATERIATORY_SIZE; i++)
            {
                MateriaOrb materia = _materiatory[i];
                if (materia != null)
                {
                    writer.WriteStartElement("orb");
                    
                    writer.WriteAttributeString("name", materia.Name);
                    writer.WriteAttributeString("type", materia.Type.ToString());
                    writer.WriteAttributeString("ap", materia.AP.ToString());
                    writer.WriteAttributeString("slot", i.ToString());
                    
                    writer.WriteEndElement();
                }
            }

            writer.WriteEndElement(); // materiatory;
        }
コード例 #10
0
ファイル: Materiatory.cs プロジェクト: skinitimski/Reverence
 public void Swap(SlotHolder @from, SlotHolder to, Character c)
 {
     for (int i = 0; i < @from.Slots.Length; i++)
     {
         MateriaOrb m = @from.Slots[i];
         
         if (m != null)
         {
             if (i >= to.Slots.Length)
             {
                 m.Detach(c);
                 Put(m);
             }
             else
             {
                 to.Slots[i] = m;
             }
         }
         
         @from.Slots[i] = null;
     }
 }
コード例 #11
0
        public MateriaOrb GetMateria(string name, int ap)
        {
            MateriaOrb materia = null;

            if (name == EnemySkillMateria.NAME)
            {
                materia = new EnemySkillMateria(ap, this);
            }
            else if (name == "Master Magic")
            {
                materia = new MasterMateria(MateriaType.Magic, this);
            }
            else if (name == "Master Command")
            {
                materia = new MasterMateria(MateriaType.Command, this);
            }
            else if (name == "Master Summon")
            {
                materia = new MasterMateria(MateriaType.Summon, this);
            }
            else
            {
                XmlDocument gamedata = Resource.GetXmlFromResource("data.materia.xml", Assembly);

                XmlNode node = gamedata.SelectSingleNode(String.Format("//materia[name = '{0}']", name));

                if (node == null)
                {
                    throw new GameDataException("Could not find materia with name " + name);
                }

                materia = new MateriaOrb(node, Lua);
                materia.AddAP(ap);
            }

            return(materia);
        }
コード例 #12
0
        public override void ControlHandle(Key k)
        {
            switch (k)
            {
            case Key.Up:
                if (option > 0)
                {
                    option--;
                }
                break;

            case Key.Down:
                if (option < 3)
                {
                    option++;
                }
                break;

            case Key.Circle:
                switch (option)
                {
                case 0:
                    MenuState.Party.Materiatory.Sort();
                    break;

                case 1:
                    break;

                case 2:
                    for (int i = 0; i < MenuState.Party.Selected.Weapon.Slots.Length; i++)
                    {
                        MateriaOrb orb = MenuState.Party.Selected.Weapon.Slots[i];
                        if (orb != null)
                        {
                            MenuState.Party.Selected.Weapon.Slots[i] = null;
                            orb.Detach(MenuState.Party.Selected);
                            MenuState.Party.Materiatory.Put(orb);
                        }
                    }
                    for (int j = 0; j < MenuState.Party.Selected.Armor.Slots.Length; j++)
                    {
                        MateriaOrb orb = MenuState.Party.Selected.Armor.Slots[j];
                        if (orb != null)
                        {
                            MenuState.Party.Selected.Armor.Slots[j] = null;
                            orb.Detach(MenuState.Party.Selected);
                            MenuState.Party.Materiatory.Put(orb);
                        }
                    }
                    break;

                case 3:
                    MenuState.MateriaScreen.ChangeControl(MenuState.MateriaList);
                    MenuState.MateriaList.Trashing = true;
                    break;

                default: break;
                }
                break;

            case Key.X:
                Visible = false;
                MenuState.MateriaScreen.ChangeToDefaultControl();
                break;

            default: break;
            }
        }
コード例 #13
0
        protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            MateriaOrb orb = MenuState.MateriaTop.Selection;

            if (orb == null)
            {
                orb = MenuState.MateriaList.Selection;
            }


            if (orb != null)
            {
                Shapes.RenderCircle(g, Colors.WHITE, 9, X + x1, Y + yp);
                Shapes.RenderCircle(g, orb.Color, 7, X + x1, Y + yp);
                Text.ShadowedText(g, orb.Name, X + x2, Y + y0);

                Cairo.Color greenish = Colors.TEXT_TEAL;
                Cairo.Color yellow   = Colors.TEXT_YELLOW;
                Cairo.Color red      = Colors.TEXT_RED;

                if (orb is EnemySkillMateria)
                {
                    EnemySkillMateria esm = (EnemySkillMateria)orb;

                    string mask = "";
                    for (int i = 0; i < MenuState.Seven.Data.EnemySkillCount; i++)
                    {
                        mask += ((esm.AP >> i) & 1) > 0 ? "1" : "0";
                    }
                    Text.ShadowedText(g, mask, X + x1, Y + y3);
                }
                else
                {
                    string lvl = (orb.Level + 1).ToString() + "/";
                    te = g.TextExtents(lvl);
                    Text.ShadowedText(g, lvl, X + x6 - te.Width, Y + y0);

                    string lvls = orb.Tiers.Length.ToString();
                    te = g.TextExtents(lvls);
                    Text.ShadowedText(g, lvls, X + x7 - te.Width, Y + y0);

                    te = g.TextExtents("Level");
                    Text.ShadowedText(g, greenish, "Level", X + x5 - te.Width, Y + y0);


                    string ap;
                    if (orb.AP < orb.Tiers[orb.Tiers.Length - 1])
                    {
                        ap = orb.AP.ToString();
                    }
                    else
                    {
                        ap = "MASTER";
                    }
                    te = g.TextExtents(ap);
                    Text.ShadowedText(g, ap, X + x7 - te.Width, Y + y1);
                    te = g.TextExtents("AP");
                    Text.ShadowedText(g, greenish, "AP", X + x5 - te.Width, Y + y1);


                    string nxt;
                    if (orb.Master)
                    {
                        nxt = "0";
                    }
                    else
                    {
                        nxt = (orb.Tiers[orb.Level + 1] - orb.AP).ToString();
                    }
                    te = g.TextExtents(nxt);
                    Text.ShadowedText(g, nxt, X + x7 - te.Width, Y + y2);
                    te = g.TextExtents("To next level");
                    Text.ShadowedText(g, greenish, "To next level", X + x5 - te.Width, Y + y2);


                    Text.ShadowedText(g, greenish, "Ability List", X + x0, Y + y3);

                    int k = 0;
                    foreach (string s in orb.AbilityDescriptions)
                    {
                        if (!String.IsNullOrEmpty(s))
                        {
                            Color abilityTextColor = Colors.GRAY_4;

                            if (orb is MasterMateria || orb.Abilities.Contains(s))
                            {
                                abilityTextColor = Colors.WHITE;
                            }

                            Text.ShadowedText(g, abilityTextColor, s, X + x1, Y + y4 + (ys * k));

                            k++;
                        }
                    }

                    Text.ShadowedText(g, greenish, "Equip Effect", X + x4, Y + y3);

                    int    i = 0;
                    string stat;

                    te = g.TextExtents("-");
                    double dashw = te.Width;

                    te = g.TextExtents("+");
                    double plusw = te.Width;

                    #region Strength
                    if (orb.StrengthMod != 0)
                    {
                        Text.ShadowedText(g, "Str", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.StrengthMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.StrengthMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Strength
                    #region Vitality
                    if (orb.VitalityMod != 0)
                    {
                        Text.ShadowedText(g, "Vit", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.VitalityMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.VitalityMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Vitality
                    #region Dexterity
                    if (orb.DexterityMod != 0)
                    {
                        Text.ShadowedText(g, "Dex", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.DexterityMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.DexterityMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Dexterity
                    #region Magic
                    if (orb.MagicMod != 0)
                    {
                        Text.ShadowedText(g, "Mag", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.MagicMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.MagicMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Magic
                    #region Spirit
                    if (orb.SpiritMod != 0)
                    {
                        Text.ShadowedText(g, "Spr", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.SpiritMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.SpiritMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Spirit
                    #region Luck
                    if (orb.LuckMod != 0)
                    {
                        Text.ShadowedText(g, "Lck", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.LuckMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }

                        te = g.TextExtents(stat);
                        if (orb.LuckMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion Luck
                    #region HP
                    if (orb.HPMod != 0)
                    {
                        Text.ShadowedText(g, "MaxHP", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.HPMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }
                        stat = stat + "%";
                        te   = g.TextExtents(stat);
                        if (orb.HPMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x8 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x8 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x8 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x8 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion HP
                    #region MP
                    if (orb.MPMod != 0)
                    {
                        Text.ShadowedText(g, "MaxMP", X + x5, Y + y4 + (ys * i));

                        stat = Math.Abs(orb.MPMod).ToString();
                        if (stat.Length < 2)
                        {
                            stat = "0" + stat;
                        }
                        stat = stat + "%";
                        te   = g.TextExtents(stat);
                        if (orb.MPMod < 0)
                        {
                            Text.ShadowedText(g, "-", X + x8 - te.Width - dashw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, red, stat, X + x8 - te.Width, Y + y4 + (ys * i));
                        }
                        else
                        {
                            Text.ShadowedText(g, "+", X + x8 - te.Width - plusw, Y + y4 + (ys * i));
                            Text.ShadowedText(g, yellow, stat, X + x8 - te.Width, Y + y4 + (ys * i));
                        }
                        i++;
                    }
                    #endregion MP
                }
            }
        }
コード例 #14
0
        public override void ControlHandle(Key k)
        {
            switch (k)
            {
            case Key.Up:
                if (option > 0)
                {
                    option--;
                }
                if (topRow > option)
                {
                    topRow--;
                }
                break;

            case Key.Down:
                if (option < Materiatory.MATERIATORY_SIZE - 1)
                {
                    option++;
                }
                if (topRow < option - rows + 1)
                {
                    topRow++;
                }
                break;

            case Key.X:
                if (trashing)
                {
                    MenuState.MateriaScreen.ChangeControl(MenuState.MateriaArrange);
                }
                else
                {
                    MenuState.MateriaScreen.ChangeToDefaultControl();
                }
                trashing = false;
                break;

            case Key.Circle:
                if (Trashing)
                {
                    MenuState.MateriaScreen.ChangeControl(MenuState.MateriaPrompt);
                    break;
                }
                MateriaOrb neworb = MenuState.Party.Materiatory.Get(option);
                MateriaOrb oldorb;
                switch (MenuState.MateriaTop.OptionY)
                {
                case 0:
                    oldorb = MenuState.Party.Selected.Weapon.Slots[MenuState.MateriaTop.OptionX];
                    if (oldorb != null)
                    {
                        oldorb.Detach(MenuState.Party.Selected);
                    }
                    MenuState.Party.Materiatory.Put(oldorb, option);
                    if (neworb != null)
                    {
                        neworb.Attach(MenuState.Party.Selected);
                    }
                    MenuState.Party.Selected.Weapon.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
                    MenuState.MateriaScreen.ChangeToDefaultControl();
                    break;

                case 1:
                    oldorb = MenuState.Party.Selected.Armor.Slots[MenuState.MateriaTop.OptionX];
                    if (oldorb != null)
                    {
                        oldorb.Detach(MenuState.Party.Selected);
                    }
                    MenuState.Party.Materiatory.Put(oldorb, option);
                    if (neworb != null)
                    {
                        neworb.Attach(MenuState.Party.Selected);
                    }
                    MenuState.Party.Selected.Armor.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
                    MenuState.MateriaScreen.ChangeToDefaultControl();
                    break;

                default: break;
                }
                break;

            default:
                break;
            }
        }
コード例 #15
0
        public void WriteToXml(XmlWriter writer)
        {
            writer.WriteStartElement(Name);
            writer.WriteStartElement("stats");
            writer.WriteElementString("str", _strength_base.ToString());
            writer.WriteElementString("dex", _dexterity_base.ToString());
            writer.WriteElementString("vit", _vitality_base.ToString());
            writer.WriteElementString("mag", _magic_base.ToString());
            writer.WriteElementString("spi", _spirit_base.ToString());
            writer.WriteElementString("lck", _luck_base.ToString());
            writer.WriteElementString("lvl", _level.ToString());
            writer.WriteEndElement();//stats
            writer.WriteElementString("exp", _exp.ToString());
            writer.WriteElementString("hp", _hp.ToString());
            writer.WriteElementString("mp", _mp.ToString());
            writer.WriteElementString("maxhp", _maxhp.ToString());
            writer.WriteElementString("maxmp", _maxmp.ToString());
            writer.WriteElementString("limitlvl", _limitlvl.ToString());
            writer.WriteElementString("fury", Fury.ToString().ToLower());
            writer.WriteElementString("sadness", Sadness.ToString().ToLower());
            writer.WriteElementString("backRow", BackRow.ToString().ToLower());


            writer.WriteStartElement("weapon");
            writer.WriteElementString("name", Weapon.ID);
            writer.WriteStartElement("materia");
            for (int i = 0; i < Weapon.Slots.Length; i++)
            {
                MateriaOrb m = Weapon.Slots[i];

                if (m != null)
                {
                    writer.WriteStartElement("orb");
                    writer.WriteAttributeString("name", m.Name);
                    writer.WriteAttributeString("type", m.Type.ToString());
                    writer.WriteAttributeString("ap", m.AP.ToString());
                    writer.WriteAttributeString("slot", i.ToString());
                    writer.WriteEndElement();
                }
            }
            writer.WriteEndElement();
            writer.WriteEndElement();


            writer.WriteStartElement("armor");
            writer.WriteElementString("name", Armor.ID);
            writer.WriteStartElement("materia");
            for (int i = 0; i < Armor.Slots.Length; i++)
            {
                MateriaOrb m = Armor.Slots[i];

                if (m != null)
                {
                    writer.WriteStartElement("orb");
                    writer.WriteAttributeString("name", m.Name);
                    writer.WriteAttributeString("type", m.Type.ToString());
                    writer.WriteAttributeString("ap", m.AP.ToString());
                    writer.WriteAttributeString("slot", i.ToString());
                    writer.WriteEndElement();
                }
            }
            writer.WriteEndElement();
            writer.WriteEndElement();


            writer.WriteElementString("accessory", Accessory == null ? "" : Accessory.ID);

            writer.WriteEndElement();
        }
コード例 #16
0
ファイル: Materiatory.cs プロジェクト: skinitimski/Reverence
        public void Sort()
        {
            Array.Sort<MateriaOrb>(_materiatory, MateriaOrb.CompareByType);

            // HACK. We want nulls at the end, but for some reason they're not
            // getting passed to the comparison.
            int q = 0;
            while (_materiatory[q] == null)
            {
                q++;
            }

            MateriaOrb[] tempNull = new MateriaOrb[q];
            MateriaOrb[] tempNotNull = new MateriaOrb[MATERIATORY_SIZE - q];
            Array.Copy(_materiatory, 0, tempNull, 0, q);
            Array.Copy(_materiatory, q, tempNotNull, 0, MATERIATORY_SIZE - q);
            Array.Copy(tempNull, 0, _materiatory, MATERIATORY_SIZE - q, q);
            Array.Copy(tempNotNull, 0, _materiatory, 0, MATERIATORY_SIZE - q);
            // END HACK


            
            // sort magic
            int a = 0;
            while (_materiatory[a].Type == MateriaType.Magic)
            {
                a++;
            }

            MateriaOrb[] tempMagic = new MateriaOrb[a];
            Array.Copy(_materiatory, 0, tempMagic, 0, a);
            Array.Sort<MateriaOrb>(tempMagic, MateriaOrb.CompareByOrder);
            Array.Copy(tempMagic, 0, _materiatory, 0, a);
            
            
            // sort support
            int b = a;
            while (_materiatory[b].Type == MateriaType.Support)
            {
                b++;                
            }

            MateriaOrb[] tempSupport = new MateriaOrb[b - a];
            Array.Copy(_materiatory, a, tempSupport, 0, b - a);
            Array.Sort<MateriaOrb>(tempSupport, MateriaOrb.CompareByOrder);
            Array.Copy(tempSupport, 0, _materiatory, a, b - a);


            // sort command
            int c = b;
            while (_materiatory[c].Type == MateriaType.Command)
            {
                c++;
            }

            MateriaOrb[] tempCommand = new MateriaOrb[c - b];
            Array.Copy(_materiatory, b, tempCommand, 0, c - b);
            Array.Sort<MateriaOrb>(tempCommand, MateriaOrb.CompareByOrder);
            Array.Copy(tempCommand, 0, _materiatory, b, c - b);


            // sort independent
            int d = c;
            while (_materiatory[d].Type == MateriaType.Independent)
            {
                d++;
            }

            MateriaOrb[] tempIndependent = new MateriaOrb[d - c];
            Array.Copy(_materiatory, c, tempIndependent, 0, d - c);
            Array.Sort<MateriaOrb>(tempIndependent, MateriaOrb.CompareByOrder);
            Array.Copy(tempIndependent, 0, _materiatory, c, d - c);


            // sort summon
            int e = d;
            while (e < MATERIATORY_SIZE && _materiatory[e] != null)
            {
                e++;
            }

            MateriaOrb[] tempSummon = new MateriaOrb[e - d];
            Array.Copy(_materiatory, d, tempSummon, 0, e - d);
            Array.Sort<MateriaOrb>(tempSummon, MateriaOrb.CompareByOrder);
            Array.Copy(tempSummon, 0, _materiatory, d, e - d);
            

        }
コード例 #17
0
ファイル: Materiatory.cs プロジェクト: skinitimski/Reverence
 public void Put(MateriaOrb orb, int slot)
 {
     _materiatory [slot] = orb;
 }