示例#1
0
 public Suit_Filter(KerbalData kData, int lvl, Suit_Set suitSet)
 {
     kerbalData = kData;
     gender     = kerbalData.gender;
     isVeteran  = kerbalData.isVeteran;
     isBadass   = kerbalData.isBadass;
     level      = lvl;
     suit       = suitSet;
 }
        public Suit_Selector(KerbalData kData, int lvl, Suit_Set suitSet)
        {
            kerbalData = kData;
            level      = lvl;
            suit       = suitSet;

            suit_Filter.kerbalData = kerbalData;
            suit_Filter.gender     = kerbalData.gender;
            suit_Filter.isVeteran  = kerbalData.isVeteran;
            suit_Filter.isBadass   = kerbalData.isBadass;
            suit_Filter.level      = level;
            suit_Filter.suit       = suit;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="suitsList"></param>
        /// <param name="defaultSuit"></param>
        internal static void LoadSuits(List <Suit_Set> suitsList, Suit_Set defaultSuit)
        {
            var suitDirs = new Dictionary <string, int>();

            //temp fix for default suit
            foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture)
            {
                Texture2D texture = texInfo.texture;
                if (texture == null || !texture.name.StartsWith(Folders.DIR_DEFAULT, StringComparison.Ordinal))
                {
                    continue;
                }

                if (texture.name.StartsWith(Folders.DIR_DEFAULT, StringComparison.Ordinal))
                {
                    int    lastSlash    = texture.name.LastIndexOf('/');
                    string originalName = texture.name.Substring(lastSlash + 1);


                    if (originalName == "Suit_Iva_Veteran_Default")
                    {
                        defaultSuit.setTexture("Suit_Iva_Veteran_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_Iva_Standard_Default")
                    {
                        defaultSuit.setTexture("Suit_Iva_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_Iva_NRM_Default")
                    {
                        defaultSuit.setTexture("Suit_Iva_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_Iva_Default")
                    {
                        defaultSuit.setTexture("Helmet_Iva_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_Iva_NRM_Default")
                    {
                        defaultSuit.setTexture("Helmet_Iva_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Visor_Iva_Default")
                    {
                        defaultSuit.setTexture("Visor_Iva_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Visor_NRM_Default")
                    {
                        defaultSuit.setTexture("Visor_Iva_Standard_MaleNRM0", texture);
                        defaultSuit.setTexture("Visor_EvaSpace_Standard_MaleNRM0", texture);
                        defaultSuit.setTexture("Visor_EvaGround_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }



                    if (originalName == "Suit_EvaSpace_Veteran_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaSpace_Veteran_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_EvaSpace_Standard_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaSpace_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_EvaSpace_NRM_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaSpace_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_EvaSpace_Default")
                    {
                        defaultSuit.setTexture("Helmet_EvaSpace_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_EvaSpace_NRM_Default")
                    {
                        defaultSuit.setTexture("Helmet_EvaSpace_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Jetpack_EvaSpace_Default")
                    {
                        defaultSuit.setTexture("Jetpack_EvaSpace_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Jetpack_EvaSpace_NRM_Default")
                    {
                        defaultSuit.setTexture("Jetpack_EvaSpace_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Visor_EvaSpace_Default")
                    {
                        defaultSuit.setTexture("Visor_EvaSpace_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }


                    if (originalName == "Suit_EvaGround_Veteran_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaGround_Veteran_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_EvaGround_Standard_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaGround_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Suit_EvaGround_NRM_Default")
                    {
                        defaultSuit.setTexture("Suit_EvaGround_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_EvaGround_Default")
                    {
                        defaultSuit.setTexture("Helmet_EvaGround_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Helmet_EvaGround_NRM_Default")
                    {
                        defaultSuit.setTexture("Helmet_EvaGround_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Jetpack_EvaGround_Default")
                    {
                        defaultSuit.setTexture("Jetpack_EvaGround_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Jetpack_EvaGround_NRM_Default")
                    {
                        defaultSuit.setTexture("Jetpack_EvaGround_Standard_MaleNRM0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }

                    if (originalName == "Visor_EvaGround_Default")
                    {
                        defaultSuit.setTexture("Visor_EvaGround_Standard_Male0", texture);
                        texture.wrapMode = TextureWrapMode.Clamp;
                    }
                }
            }

            // search all default/ folders and assign the default suit texture
            foreach (string defaultFolders in Folders.DEFAULT)
            {
                foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture)
                {
                    Texture2D texture = texInfo.texture;
                    if (texture == null || !texture.name.StartsWith(defaultFolders, StringComparison.Ordinal))
                    {
                        continue;
                    }

                    if (texture.name.StartsWith(defaultFolders, StringComparison.Ordinal))
                    {
                        int    lastSlash    = texture.name.LastIndexOf('/');
                        string originalName = texture.name.Substring(lastSlash + 1);
                        //Util.log("default folder = " +defaultFolders);
                        //Util.log("DEFAULT : texture name \"{0}\": {1}", originalName, texture.name);
                        if (defaultSuit.setTexture(originalName, texture) || originalName == "kerbalMain")
                        {
                            texture.wrapMode = TextureWrapMode.Clamp;
                        }
                    }
                }
            }

            // search all suit/ folder and assign the textures to the suit set
            foreach (string suitSetFolder in Folders.SUITS)
            {
                foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture)
                {
                    Texture2D texture = texInfo.texture;
                    if (texture == null || !texture.name.StartsWith(suitSetFolder, StringComparison.Ordinal))
                    {
                        continue;
                    }

                    // Add a suit texture.
                    if (texture.name.StartsWith(suitSetFolder, StringComparison.Ordinal))
                    {
                        texture.wrapMode = TextureWrapMode.Clamp;

                        int    lastSlash     = texture.name.LastIndexOf('/');
                        int    dirNameLength = lastSlash - suitSetFolder.Length;
                        string originalName  = texture.name.Substring(lastSlash + 1);

                        if (dirNameLength < 1)
                        {
                            Util.log("Suit texture should be inside a subdirectory: {0}", texture.name);
                        }
                        else
                        {
                            string dirName = texture.name.Substring(suitSetFolder.Length, dirNameLength);

                            int index;
                            if (!suitDirs.TryGetValue(dirName, out index))
                            {
                                index = suitsList.Count;
                                suitsList.Add(new Suit_Set {
                                    name = dirName
                                });
                                suitDirs.Add(dirName, index);
                                Util.log("SuitSet added : {0}", dirName);
                            }

                            Suit_Set suit = suitsList[index];

                            if (!suit.setTexture(originalName, texture))
                            {
                                Util.log("Unknown suit texture name \"{0}\": {1}", originalName, texture.name);
                            }
                        }
                    }
                }
            }
        }