Пример #1
0
    // Use this for initialization
    void Awake()
    {
        // Check if a customization manager instance exists
        if (instance == null)
        {
            // If no, this object is our instance
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            // If yes, destroy this object
            Destroy(gameObject);
            return;
        }

        // Set current costume to the first in the list if the list is not empty
        currentCostume      = costumeList.Count > 0 ? costumeList[0] : null;
        currentCostumeIndex = costumeList.Count > 0 ? 0 : -1;

        // Set current hairstyle to the first in the list if the list is not empty
        currentHair      = hairList.Count > 0 ? hairList[0] : null;
        currentHairIndex = hairList.Count > 0 ? 0 : -1;

        // Set current face to the first in the list if the list is not empty
        currentFace      = faceList.Count > 0 ? faceList[0] : null;
        currentFaceIndex = faceList.Count > 0 ? 0 : -1;
    }
Пример #2
0
    /// <summary>
    /// SetCurrentHairStyle
    /// Sets the current hairstyle to the given index
    /// </summary>
    /// <param name="index">Hairstyle to set</param>
    public void SetCurrentHairStyle(int index)
    {
        // Set the hairstyle to the index if it is in bounds, otherwise, set it to null
        currentHair      = (index >= hairList.Count || index < 0) ? null : hairList[index];
        currentHairIndex = (index >= hairList.Count || index < 0) ? -1 : index;

        OnHairStyleChanged.Invoke();
    }
Пример #3
0
    /// <summary>
    /// SetCurrentFace
    /// Sets the current face to the given index
    /// </summary>
    /// <param name="index">Face to set</param>
    public void SetCurrentFace(int index)
    {
        // Set the hairstyle to the index if it is in bounds, otherwise, set it to null
        currentFace      = (index >= faceList.Count || index < 0) ? null : faceList[index];
        currentFaceIndex = (index >= faceList.Count || index < 0) ? -1 : index;

        OnFaceChanged.Invoke();
    }
Пример #4
0
    /// <summary>
    /// SetCurrentCostume
    /// Sets the current costume to the given index
    /// </summary>
    /// <param name="index">Costume to set</param>
    public void SetCurrentCostume(int index)
    {
        // Set the costume to the index if it is in bounds, otherwise, set it to null
        currentCostume      = (index >= costumeList.Count || index < 0) ? null : costumeList[index];
        currentCostumeIndex = (index >= costumeList.Count || index < 0) ? -1: index;

        OnCostumeChanged.Invoke();
    }
Пример #5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        // If the CostumizationManager is null, grab a reference to the CustomizationManager prefab.
        if (cm == null)
        {
            cm = (AssetDatabase.LoadAssetAtPath
                      ("Assets/PreFabs/Managers/CustomizationManager.prefab", typeof(GameObject)) as GameObject).GetComponent <CustomizationManager>();
        }

        // If the value of this object has not been assigned, assign it.
        if (value == null)
        {
            value = serializedObject.targetObject as CostumeData;
        }

        // If the add button is clicked, show the popup
        if (GUILayout.Button("Add New Piece"))
        {
            PopupWindow.Show(buttonRect, new NewCostumePopup(this));
        }


        // If this costume is already in the manager, do not allow this button to be accessed
        EditorGUILayout.Space();
        EditorGUI.BeginDisabledGroup(value.IsSelectable(cm));

        // When clicked, add the costume to the manager
        if (GUILayout.Button("Add To Customization Manager"))
        {
            value.MakeSelectable(cm);
            // Refresh the manager
            EditorUtility.SetDirty(cm.gameObject);
        }

        EditorGUI.EndDisabledGroup();

        // If this costume is not already in the manager, do not allow this button to be accessed
        EditorGUI.BeginDisabledGroup(!value.IsSelectable(cm));

        // When clicked, remove the costume from the manager
        if (GUILayout.Button("Remove From Customization Manager"))
        {
            value.MakeUnselectable(cm);
            // Refresh the manager
            EditorUtility.SetDirty(cm.gameObject);
        }

        EditorGUI.EndDisabledGroup();

        if (Event.current.type == EventType.Repaint)
        {
            buttonRect = GUILayoutUtility.GetLastRect();
        }
    }
Пример #6
0
    /// <summary>
    /// FaceChanged
    /// Called whenever the face is changed and updates the meshes based on the face.
    /// </summary>
    private void FaceChanged()
    {
        // Determine the components that need to be changed based on the hair.
        CostumeData face = CustomizationManager.instance.GetCurrentFace();

        // If the hair is valid
        if (face != null)
        {
            UpdateSpriteMeshes(face.skinMeshes);
        }
    }
Пример #7
0
    /// <summary>
    /// CostumeChanged
    /// Called whenever a costume is changed and updates the meshes based on the costume.
    /// </summary>
    private void CostumeChanged()
    {
        // Determine the components that need to be changed based on the costume.
        CostumeData costume = CustomizationManager.instance.GetCurrentCostume();

        // If costume is valid
        if (costume != null)
        {
            UpdateSpriteMeshes(costume.skinMeshes);
        }
    }
Пример #8
0
        private void SaveIndividualRefAttires()
        {
            string str = AttireExtensionForm.RemoveSpecialCharacters(AttireExtensionForm.refDatList[this.refereeList.SelectedIndex].Data.Prm.name);
            int    num = AttireExtensionForm.refIDList[this.refereeList.SelectedIndex];

            AttireExtensionForm.saveData = SaveData.inst;
            RefereeData editRefereeData = AttireExtensionForm.saveData.GetEditRefereeData((RefereeID)num);
            CostumeData costumeData     = editRefereeData.appearanceData.costumeData[0];
            bool        valid           = costumeData.valid;

            if (valid)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.InitialDirectory = "./EGOData/RefereeCostumes";
                saveFileDialog.Filter           = "COSTUME Files (*.cos)|*.cos";
                saveFileDialog.FileName         = str + "_";
                bool flag = saveFileDialog.ShowDialog() == DialogResult.OK;
                if (flag)
                {
                    try
                    {
                        using (StreamWriter streamWriter = new StreamWriter(saveFileDialog.FileName))
                        {
                            for (int i = 0; i < 9; i++)
                            {
                                for (int j = 0; j < 16; j++)
                                {
                                    streamWriter.WriteLine(costumeData.layerTex[i, j]);
                                    streamWriter.WriteLine(costumeData.color[i, j].r);
                                    streamWriter.WriteLine(costumeData.color[i, j].g);
                                    streamWriter.WriteLine(costumeData.color[i, j].b);
                                    streamWriter.WriteLine(costumeData.color[i, j].a);
                                    streamWriter.WriteLine(costumeData.highlightIntensity[i, j]);
                                }
                                streamWriter.WriteLine(costumeData.partsScale[i]);
                            }
                            streamWriter.Dispose();
                            streamWriter.Close();
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Couldn't save attire to './EGOData/RefereeCostumes" + AttireExtensionForm.name + ".cos'");
                    }
                }
            }
        }
Пример #9
0
    /// <summary>
    /// Costume Changed
    /// Called whenever a costume is changed and updates the meshes to be impacted by the shader.
    /// </summary>
    private void CostumeChanged()
    {
        ResetSkinTargets();

        // Determine the components that need to be recolored based on the costume.
        CostumeData costume = CustomizationManager.instance.GetCurrentCostume();

        if (costume != null)
        {
            List <string> costumeTargets = costume.GetSkinTargets();

            foreach (string s in costumeTargets)
            {
                AddSkinTarget(s);
            }
        }

        ApplySkinColorToTargets();
    }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        CustomizationManager.instance.OnSkinChanged.AddListener(SetSkinSV);
        CustomizationManager.instance.OnCostumeChanged.AddListener(CostumeChanged);

        HSVRangeMin = CustomizationManager.instance.GetHSVRangeMin();
        HSVRangeMax = CustomizationManager.instance.GetHSVRangeMax();

        // Creates instances of the HSV and default sprite materials to be applied at runtime as needed.
        skinMaterial   = new Material(Shader.Find("Custom/HSVRangeShader"));
        spriteMaterial = new Material(Shader.Find("Sprites/Default"));

        // Adjust HSV ranges
        skinMaterial.SetFloat("_HSVRangeMin", HSVRangeMin);
        skinMaterial.SetFloat("_HSVRangeMax", HSVRangeMax);

        // Find all sprite meshes attached to the player. This makes recoloring far easier.
        skeleton = PlayerMeshSkeleton.GetSkeleton();

        // Gets a reference to the player's head
        head = skeleton.Find(h => h.name == "Head");
        skinBodyParts.Add(head);

        // Determine the components that need to be recolored based on the costume.
        CostumeData costume = CustomizationManager.instance.GetCurrentCostume();

        if (costume != null)
        {
            List <string> costumeTargets = costume.GetSkinTargets();

            foreach (string s in costumeTargets)
            {
                AddSkinTarget(s);
            }
        }

        // Applies skin color
        SetSkinSV();
        ApplySkinColorToTargets();
    }
Пример #11
0
        public OdysseyCostumeSelector()
        {
            InitializeComponent();

            if (Runtime.marioOdysseyGamePath == "")
            {
                MessageBox.Show("Game path not configured!");

                FolderSelectDialog ofd = new FolderSelectDialog();

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    string folderPath = ofd.SelectedPath;
                    Runtime.marioOdysseyGamePath = folderPath;
                    Config.Save();
                }
            }

            string[] dirs = Directory.GetFiles($"{Runtime.marioOdysseyGamePath}\\ObjectData", "Mario*");

            foreach (string dir in dirs)
            {
                string filename = Path.GetFileNameWithoutExtension(dir);

                bool Exluded = ExcludeFileList.Any(filename.Contains);

                if (Exluded == false)
                {
                    CostumeData cd = new CostumeData();

                    listBox1.Items.Add(filename);

                    cd.FullPath = dir;
                    Costumelist.Add(cd);
                }
            }
        }
Пример #12
0
 public void RemoveCostume(CostumeData cd)
 {
     costumeList.Remove(cd);
 }
Пример #13
0
 public void AddFace(CostumeData cd)
 {
     faceList.Add(cd);
 }
Пример #14
0
        public static void LoadAttire()
        {
            GlobalWork gw       = GlobalWork.inst;
            PlayerMan  pm       = PlayerMan.inst;
            SaveData   saveData = SaveData.inst;

            for (int pl = 0; pl < 8; pl++)
            {
                needsToChangeToMatchAttire[pl] = false;

                if (gw.MatchSetting.matchWrestlerInfo[pl].entry)
                {
                    plObj = pm.GetPlObj(pl);
                    //string[] list = Directory.GetFiles("./AceModsData/AttireExtension/", DataBase.GetWrestlerFullName(plObj.WresParam) + "*.*");
                    DirectoryInfo di    = new DirectoryInfo("./AceModsData/AttireExtension/");
                    FileInfo[]    files = di.GetFiles(DataBase.GetWrestlerFullName(plObj.WresParam) + "*.cos");
                    if (files.Length > 0)
                    {
                        //MessageBox.Show(files.Length.ToString());

                        Attire_Select attireSelect = new Attire_Select(files, pl);
                        attireSelect.ShowDialog();

                        if (File.Exists("./AceModsData/AttireExtension/" + DataBase.GetWrestlerFullName(plObj.WresParam) + attireSelect.chosenAttire + ".cos"))
                        {
                            StreamReader cdReader          = new StreamReader("./AceModsData/AttireExtension/" + DataBase.GetWrestlerFullName(plObj.WresParam) + attireSelect.chosenAttire + ".cos");
                            CostumeData  loadedCostumeData = new CostumeData();
                            while (cdReader.Peek() != -1)
                            {
                                loadedCostumeData.valid = true;
                                for (int i = 0; i < 9; i++)
                                {
                                    for (int j = 0; j < 16; j++)
                                    {
                                        loadedCostumeData.layerTex[i, j]           = cdReader.ReadLine();
                                        loadedCostumeData.color[i, j].r            = float.Parse(cdReader.ReadLine());
                                        loadedCostumeData.color[i, j].g            = float.Parse(cdReader.ReadLine());
                                        loadedCostumeData.color[i, j].b            = float.Parse(cdReader.ReadLine());
                                        loadedCostumeData.color[i, j].a            = float.Parse(cdReader.ReadLine());
                                        loadedCostumeData.highlightIntensity[i, j] = float.Parse(cdReader.ReadLine());
                                    }
                                    loadedCostumeData.partsScale[i] = float.Parse(cdReader.ReadLine());
                                }
                                entAttire = cdReader.ReadLine();
                            }
                            cdReader.Dispose();
                            cdReader.Close();

                            bool check = false;

                            if (!String.IsNullOrEmpty(entAttire))
                            {
                                if (gw.MatchSetting.BattleRoyalKind != BattleRoyalKindEnum.RoyalRumble)
                                {
                                    if (!gw.MatchSetting.isSkipEntranceScene)
                                    {
                                        if (gw.MatchSetting.arena != VenueEnum.BarbedWire && gw.MatchSetting.arena != VenueEnum.Cage && gw.MatchSetting.arena != VenueEnum.Dodecagon && gw.MatchSetting.arena != VenueEnum.Dojo && gw.MatchSetting.arena != VenueEnum.LandMine_BarbedWire && gw.MatchSetting.arena != VenueEnum.LandMine_FluorescentLamp && gw.MatchSetting.arena != VenueEnum.YurakuenHall)
                                        {
                                            check = true;
                                        }
                                    }
                                }
                            }

                            if (check)
                            {
                                needsToChangeToMatchAttire[pl] = true;
                                StreamReader cdReader2            = new StreamReader("./AceModsData/AttireExtension/" + entAttire + ".cos");
                                CostumeData  loadedCostumeDataEnt = new CostumeData();
                                while (cdReader2.Peek() != -1)
                                {
                                    loadedCostumeDataEnt.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            loadedCostumeDataEnt.layerTex[i, j]           = cdReader2.ReadLine();
                                            loadedCostumeDataEnt.color[i, j].r            = float.Parse(cdReader2.ReadLine());
                                            loadedCostumeDataEnt.color[i, j].g            = float.Parse(cdReader2.ReadLine());
                                            loadedCostumeDataEnt.color[i, j].b            = float.Parse(cdReader2.ReadLine());
                                            loadedCostumeDataEnt.color[i, j].a            = float.Parse(cdReader2.ReadLine());
                                            loadedCostumeDataEnt.highlightIntensity[i, j] = float.Parse(cdReader2.ReadLine());
                                        }
                                        loadedCostumeDataEnt.partsScale[i] = float.Parse(cdReader2.ReadLine());
                                    }
                                }

                                try
                                {
                                    plObj.FormRen.DestroySprite();
                                    plObj.FormRen.InitTexture(loadedCostumeDataEnt);
                                    for (int i = 0; i < 9; i++)
                                    {
                                        plObj.FormRen.partsScale[i] = loadedCostumeDataEnt.partsScale[i];
                                    }
                                    plObj.FormRen.InitSprite(false);
                                    L.D("ATTIRE EXTENSION: ATTIRE CHANGED TO ENTRANCE ATTIRE");
                                }
                                catch
                                {
                                    L.D("ATTIRE EXTENSION: ATTIRE NOT CHANGED TO ENTRANCE ATTIRE");
                                    MatchWrestlerInfo w = GlobalWork.inst.MatchSetting.matchWrestlerInfo[plObj.PlIdx];
                                    plObj.FormRen.InitTexture(SaveData.GetInst().GetEditWrestlerData(w.wrestlerID).appearanceData.costumeData[w.costume_no]);
                                    plObj.FormRen.InitSprite(false);
                                    needsToChangeToMatchAttire[pl] = false;
                                }

                                if (pl == 0)
                                {
                                    cosDat1.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat1.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat1.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat1.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat1.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat1.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat1.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat1.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 1)
                                {
                                    cosDat2.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat2.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat2.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat2.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat2.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat2.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat2.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat2.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 2)
                                {
                                    cosDat3.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat3.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat3.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat3.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat3.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat3.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat3.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat3.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 3)
                                {
                                    cosDat4.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat4.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat4.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat4.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat4.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat4.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat4.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat4.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 4)
                                {
                                    cosDat5.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat5.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat5.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat5.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat5.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat5.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat5.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat5.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 5)
                                {
                                    cosDat6.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat6.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat6.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat6.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat6.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat6.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat6.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat6.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 6)
                                {
                                    cosDat7.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat7.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat7.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat7.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat7.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat7.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat7.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat7.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                                else if (pl == 7)
                                {
                                    cosDat8.valid = true;
                                    for (int i = 0; i < 9; i++)
                                    {
                                        for (int j = 0; j < 16; j++)
                                        {
                                            cosDat8.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                            cosDat8.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                            cosDat8.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                            cosDat8.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                            cosDat8.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                            cosDat8.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                                        }
                                        cosDat8.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                }
                            }
                            else
                            {
                                try
                                {
                                    plObj.FormRen.DestroySprite();
                                    plObj.FormRen.InitTexture(loadedCostumeData);
                                    for (int i = 0; i < 9; i++)
                                    {
                                        plObj.FormRen.partsScale[i] = loadedCostumeData.partsScale[i];
                                    }
                                    plObj.FormRen.InitSprite(false);
                                    L.D("ATTIRE EXTENSION: ATTIRE CHANGED");
                                }
                                catch
                                {
                                    L.D("ATTIRE EXTENSION: ATTIRE NOT CHANGED");
                                    MatchWrestlerInfo w = GlobalWork.inst.MatchSetting.matchWrestlerInfo[plObj.PlIdx];
                                    plObj.FormRen.InitTexture(SaveData.GetInst().GetEditWrestlerData(w.wrestlerID).appearanceData.costumeData[w.costume_no]);
                                    plObj.FormRen.InitSprite(false);
                                }
                            }
                        }
                        attireSelect.Dispose();
                    }
                }
            }
        }
Пример #15
0
        private void ImportAttire(int cos)
        {
            GlobalWork gw = GlobalWork.inst;
            PlayerMan  pm = PlayerMan.inst;

            saveData = SaveData.inst;
            int         id        = listBox1.SelectedIndex;
            string      plObjname = DataBase.GetWrestlerFullName(saveData.editWrestlerData[listBox1.SelectedIndex].wrestlerParam);
            CostumeData plObjCos  = saveData.editWrestlerData[listBox1.SelectedIndex].appearanceData.costumeData[cos];

            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter           = "COSTUME Files (*.cos)|*.cos";
            fileDialog.InitialDirectory = "./AceModsData/AttireExtension/";


            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                DialogResult dialogResult = MessageBox.Show("Overwrite in-game attire " + (cos + 1) + " with " + fileDialog.FileName + "? Are you certain? There is no undoing this.", "Please confirm your action.", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    StreamReader cdReader          = new StreamReader(fileDialog.FileName);
                    CostumeData  loadedCostumeData = new CostumeData();
                    while (cdReader.Peek() != -1)
                    {
                        loadedCostumeData.valid = true;
                        for (int i = 0; i < 9; i++)
                        {
                            for (int j = 0; j < 16; j++)
                            {
                                loadedCostumeData.layerTex[i, j]           = cdReader.ReadLine();
                                loadedCostumeData.color[i, j].r            = float.Parse(cdReader.ReadLine());
                                loadedCostumeData.color[i, j].g            = float.Parse(cdReader.ReadLine());
                                loadedCostumeData.color[i, j].b            = float.Parse(cdReader.ReadLine());
                                loadedCostumeData.color[i, j].a            = float.Parse(cdReader.ReadLine());
                                loadedCostumeData.highlightIntensity[i, j] = float.Parse(cdReader.ReadLine());
                            }
                            loadedCostumeData.partsScale[i] = float.Parse(cdReader.ReadLine());
                        }
                        string test = cdReader.ReadLine();
                    }

                    try
                    {
                        plObjCos.valid = true;
                        for (int i = 0; i < 9; i++)
                        {
                            for (int j = 0; j < 16; j++)
                            {
                                plObjCos.layerTex[i, j]           = loadedCostumeData.layerTex[i, j];
                                plObjCos.color[i, j].r            = loadedCostumeData.color[i, j].r;
                                plObjCos.color[i, j].g            = loadedCostumeData.color[i, j].g;
                                plObjCos.color[i, j].b            = loadedCostumeData.color[i, j].b;
                                plObjCos.color[i, j].a            = loadedCostumeData.color[i, j].a;
                                plObjCos.highlightIntensity[i, j] = loadedCostumeData.highlightIntensity[i, j];
                            }
                            plObjCos.partsScale[i] = loadedCostumeData.partsScale[i];
                        }

                        //plObjCos = loadedCostumeData;
                        L.D("ATTIRE EXTENSION: ATTIRE IMPORTED TO ATTIRE SLOT " + cos);
                    }
                    catch
                    {
                        L.D("ATTIRE EXTENSION: ATTIRE NOT IMPORTED");
                    }


                    cdReader.Dispose();
                    cdReader.Close();
                }
                else
                {
                    return;
                }
            }
        }
Пример #16
0
 public void RemoveHairStyle(CostumeData cd)
 {
     hairList.Remove(cd);
 }
Пример #17
0
 public void RemoveFace(CostumeData cd)
 {
     faceList.Remove(cd);
 }
Пример #18
0
 public bool IsCostumeIncluded(CostumeData cd)
 {
     return(costumeList.Contains(cd));
 }
Пример #19
0
        int DrawLimb(Actor a, int limb)
        {
            int         i;
            int         code;
            long        baseptr, frameptr;
            CostumeData cost = a.Cost;

            // If the specified limb is stopped or not existing, do nothing.
            if ((cost.Curpos[limb] == 0xFFFF) || ((cost.Stopped & (1 << limb)) > 0))
            {
                return(0);
            }

            // Determine the position the limb is at
            i = cost.Curpos[limb] & 0x7FFF;

            baseptr = _loaded.BasePtr;

            // Get the frame pointer for that limb
            _loaded.CostumeReader.BaseStream.Seek(_loaded.FrameOffsets + limb * 2, System.IO.SeekOrigin.Begin);

            frameptr = baseptr + _loaded.CostumeReader.ReadUInt16();

            // Determine the offset to the costume data for the limb at position i
            _loaded.CostumeReader.BaseStream.Seek(_loaded.AnimCmds + i, System.IO.SeekOrigin.Begin);
            code = _loaded.CostumeReader.ReadByte() & 0x7F;

            // Code 0x7B indicates a limb for which there is nothing to draw
            if (code != 0x7B)
            {
                _loaded.CostumeReader.BaseStream.Seek(frameptr + code * 2, System.IO.SeekOrigin.Begin);
                _srcptr = baseptr + _loaded.CostumeReader.ReadUInt16();

                int xmoveCur, ymoveCur;

                _loaded.CostumeReader.BaseStream.Seek(_srcptr, System.IO.SeekOrigin.Begin);

                if (!_vm.Game.Features.HasFlag(GameFeatures.Old256) || code < 0x79)
                {
                    if (_loaded.Format == 0x57)
                    {
                        _width   = _loaded.CostumeReader.ReadByte() * 8;
                        _height  = _loaded.CostumeReader.ReadByte();
                        xmoveCur = _xmove + (sbyte)_loaded.CostumeReader.ReadByte() * 8;
                        ymoveCur = _ymove - (sbyte)_loaded.CostumeReader.ReadByte();
                        _xmove  += (sbyte)_loaded.CostumeReader.ReadByte() * 8;
                        _ymove  -= (sbyte)_loaded.CostumeReader.ReadByte();
                        _srcptr += 6;
                    }
                    else
                    {
                        _width   = _loaded.CostumeReader.ReadUInt16();
                        _height  = _loaded.CostumeReader.ReadUInt16();
                        xmoveCur = _xmove + _loaded.CostumeReader.ReadInt16();
                        ymoveCur = _ymove + _loaded.CostumeReader.ReadInt16();
                        _xmove  += _loaded.CostumeReader.ReadInt16();
                        _ymove  -= _loaded.CostumeReader.ReadInt16();
                        _srcptr += 12;
                    }

                    return(MainRoutine(xmoveCur, ymoveCur));
                }
            }
            return(0);
        }
Пример #20
0
 public bool IsHairStyleIncluded(CostumeData cd)
 {
     return(hairList.Contains(cd));
 }
Пример #21
0
 public bool IsFaceIncluded(CostumeData cd)
 {
     return(faceList.Contains(cd));
 }
Пример #22
0
 public void AddCostume(CostumeData cd)
 {
     costumeList.Add(cd);
 }
Пример #23
0
 public void SetPlayerSpriteData(int playerIndex, CostumeData data)
 {
     _playerSpriteData[playerIndex] = data;
 }
Пример #24
0
 public void AddHairStyle(CostumeData cd)
 {
     hairList.Add(cd);
 }
Пример #25
0
        private CostumeData UpdateCostume(Operation operand, CostumeData originalCostume)
        {
            if (headCB.Checked)
            {
                float headScale = originalCostume.partsScale[(int)PartsTexEnum.Face];

                float newScale = UpdateScale(operand, headScale, (float)headUD.Value / 100);
                originalCostume.partsScale[(int)PartsTexEnum.Face] = newScale;
            }
            if (chestCB.Checked)
            {
                float chestScale = originalCostume.partsScale[(int)PartsTexEnum.Chest];

                float newScale = UpdateScale(operand, chestScale, (float)chestUD.Value / 100);
                originalCostume.partsScale[(int)PartsTexEnum.Chest] = newScale;
            }
            if (uarmCB.Checked)
            {
                float uArmScale = originalCostume.partsScale[(int)PartsTexEnum.UpperArm];
                L.D("Original uArm Scale: " + uArmScale);

                float newScale = UpdateScale(operand, uArmScale, (float)uarmUD.Value / 100);
                L.D("New uArm Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.UpperArm] = newScale;
            }
            if (larmCB.Checked)
            {
                float lArmScale = originalCostume.partsScale[(int)PartsTexEnum.ForeArm];
                L.D("Original lArm Scale: " + lArmScale);

                float newScale = UpdateScale(operand, lArmScale, (float)larmUD.Value / 100);
                L.D("New lArm Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.ForeArm] = newScale;
            }
            if (handsCB.Checked)
            {
                float handsScale = originalCostume.partsScale[(int)PartsTexEnum.Hand];
                L.D("Original hands Scale: " + handsScale);

                float newScale = UpdateScale(operand, handsScale, (float)handsUD.Value / 100);
                L.D("New hands Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.Hand] = newScale;
            }
            if (waistCB.Checked)
            {
                float waistScale = originalCostume.partsScale[(int)PartsTexEnum.Body];
                L.D("Original waist Scale: " + waistScale);

                float newScale = UpdateScale(operand, waistScale, (float)waistUD.Value / 100);
                L.D("New waist Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.Body] = newScale;
            }
            if (thighCB.Checked)
            {
                float thighScale = originalCostume.partsScale[(int)PartsTexEnum.Thigh];
                L.D("Original thigh Scale: " + thighScale);

                float newScale = UpdateScale(operand, thighScale, (float)thighUD.Value / 100);
                L.D("New thigh Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.Thigh] = newScale;
            }
            if (calfCB.Checked)
            {
                float calfScale = originalCostume.partsScale[(int)PartsTexEnum.Shin];

                float newScale = UpdateScale(operand, calfScale, (float)calfUD.Value / 100);
                originalCostume.partsScale[(int)PartsTexEnum.Shin] = newScale;
            }
            if (feetCB.Checked)
            {
                float footScale = originalCostume.partsScale[(int)PartsTexEnum.Foot];
                L.D("Original foot Scale: " + footScale);

                float newScale = UpdateScale(operand, footScale, (float)feetUD.Value / 100);
                L.D("New foot Scale: " + newScale);
                originalCostume.partsScale[(int)PartsTexEnum.Foot] = newScale;
            }
            return(originalCostume);
        }
Пример #26
0
        private void ImportRefAttire()
        {
            GlobalWork inst  = GlobalWork.inst;
            RefereeMan inst2 = RefereeMan.inst;

            AttireExtensionForm.saveData = SaveData.inst;
            int            num            = AttireExtensionForm.refIDList[this.refereeList.SelectedIndex];
            string         text           = AttireExtensionForm.saveData.GetEditRefereeData((RefereeID)num).Prm.name;
            CostumeData    costumeData    = AttireExtensionForm.saveData.GetEditRefereeData((RefereeID)num).appearanceData.costumeData[0];
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "COSTUME Files (*.cos)|*.cos|MCD Files (*.mcd)|*.mcd)";
            openFileDialog.InitialDirectory = "./EGOData/RefereeCostumes";
            bool flag = openFileDialog.ShowDialog() == DialogResult.OK;

            if (flag)
            {
                DialogResult dialogResult = MessageBox.Show("Overwrite in-game referee attire with " + openFileDialog.FileName + "? Are you certain? There is no undoing this.", "Please confirm your action.", MessageBoxButtons.YesNo);
                bool         flag2        = dialogResult == DialogResult.Yes;
                if (flag2)
                {
                    StreamReader streamReader = new StreamReader(openFileDialog.FileName);
                    CostumeData  costumeData2 = new CostumeData();
                    while (streamReader.Peek() != -1)
                    {
                        costumeData2.valid = true;
                        for (int i = 0; i < 9; i++)
                        {
                            for (int j = 0; j < 16; j++)
                            {
                                costumeData2.layerTex[i, j]           = streamReader.ReadLine();
                                costumeData2.color[i, j].r            = float.Parse(streamReader.ReadLine());
                                costumeData2.color[i, j].g            = float.Parse(streamReader.ReadLine());
                                costumeData2.color[i, j].b            = float.Parse(streamReader.ReadLine());
                                costumeData2.color[i, j].a            = float.Parse(streamReader.ReadLine());
                                costumeData2.highlightIntensity[i, j] = float.Parse(streamReader.ReadLine());
                            }
                            costumeData2.partsScale[i] = float.Parse(streamReader.ReadLine());
                        }
                        string text2 = streamReader.ReadLine();
                    }
                    try
                    {
                        costumeData.valid = true;
                        for (int k = 0; k < 9; k++)
                        {
                            for (int l = 0; l < 16; l++)
                            {
                                costumeData.layerTex[k, l]           = costumeData2.layerTex[k, l];
                                costumeData.color[k, l].r            = costumeData2.color[k, l].r;
                                costumeData.color[k, l].g            = costumeData2.color[k, l].g;
                                costumeData.color[k, l].b            = costumeData2.color[k, l].b;
                                costumeData.color[k, l].a            = costumeData2.color[k, l].a;
                                costumeData.highlightIntensity[k, l] = costumeData2.highlightIntensity[k, l];
                            }
                            costumeData.partsScale[k] = costumeData2.partsScale[k];
                        }
                        L.D("ATTIRE EXTENSION: REFEREE ATTIRE IMPORTED", new object[0]);
                    }
                    catch
                    {
                        L.D("ATTIRE EXTENSION: REFEREE ATTIRE NOT IMPORTED", new object[0]);
                    }
                    streamReader.Dispose();
                    streamReader.Close();
                }
            }
        }