예제 #1
0
        private void ChangeTextureID()
        {
            try
            {
                XMLData.TextureID = int.Parse(textBoxTextureID.Text);
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("TextureID is invalid! Must be an integer between 0 and 255.\n{0}", e.Message));
                LogHelper.Info("TextureID is invalid! Must be an integer between 0 and 255.");
                textBoxTextureID.Text = XMLData.TextureID.ToString();
                return;
            }
            if (XMLData.TextureID < 0)
            {
                XMLData.TextureID = 0;
            }
            if (XMLData.TextureID > 255)
            {
                XMLData.TextureID = 255;
            }
            textBoxTextureID.Text = XMLData.TextureID.ToString();

            TextureIDFix.ChangeTextureID(ModPath + Path.DirectorySeparatorChar + "model", _SmashProjectManager._CharacterModsPage.CurrentFighter.id, (ushort)XMLData.TextureID);
            LogHelper.Info(String.Format("Changed Texture ID of {0} to {1} successfully.", ModPath, XMLData.TextureID));
        }
        private void buttonTextureIDFixAll_Click(object sender, EventArgs e)
        {
            Globals.LogHelper.Info(string.Format("Beginning Texture ID Fixing for character: {0}.", _CurrentFighter.nameHuman));

            List <ushort> usedIDs = new List <ushort>();

            foreach (CharacterSlotMod slot in CurrentFighterActiveSlotMods)
            {
                string kamiPath         = Globals.PathHelper.GetCharacterSlotModKamiPath(_CurrentFighter.name, slot.FolderName);
                string modPath          = Globals.PathHelper.GetCharacterSlotModPath(_CurrentFighter.name, slot.FolderName);
                CharacterSlotModXML xml = Globals.Utils.DeserializeXML <CharacterSlotModXML>(kamiPath);
                ushort currentID        = (ushort)xml.TextureID;

                if ((currentID % 4 == 0 && currentID < 128) || usedIDs.Contains(currentID))
                {
                    xml.TextureID = 255;
                    while (usedIDs.Contains((ushort)xml.TextureID))
                    {
                        --xml.TextureID;
                        if (xml.TextureID < 1)
                        {
                            Globals.LogHelper.Error(Globals.UIStrings.TEXTURE_ID_FIX_NO_IDS_AVAILABLE);
                            return;
                        }
                    }

                    TextureIDFix.ChangeTextureID(modPath + "model", _CurrentFighter.id, (ushort)xml.TextureID);
                    Globals.Utils.SerializeXMLToFile(xml, kamiPath);
                    Globals.LogHelper.Info(String.Format("Changed Texture ID of {0} to {1} successfully.", slot.FolderName, xml.TextureID));
                }
                usedIDs.Add((ushort)xml.TextureID);
            }
            Globals.LogHelper.Info(string.Format("Finished Texture ID Fixing for character: {0}.", _CurrentFighter.nameHuman));
        }