Beispiel #1
0
        internal static void ApplySettings(Apply apply)
        {
            // Refresh character list
            Utilities.LoadCharList();

            // Set counter for number of cards applied to
            int appliedNo = 0;

            // Get currently viewed ClassList
            int currSchoolClass = Traverse.Create(Utilities.ClassroomScene.classRoomList).Field("_page").GetValue <IntReactiveProperty>().Value;

            // If character is Minase Ai, add her to players class
            Utilities.CharaList.Find(x => ((SaveData.Heroine)x).fixCharaID == -10).schoolClass = 1;

            foreach (SaveData.CharaData chaData in apply == Apply.Class ? Utilities.CharaList.Where(c => c.schoolClass == currSchoolClass) : Utilities.CharaList)
            {
                if (apply == Apply.Card && CurrClassData != null && chaData.schoolClassIndex != CurrClassData.data.schoolClassIndex)
                {
                    continue;
                }
                if (!((SaveData.Heroine)chaData).isTeacher)
                {
                    if (currSchoolClass == 4)
                    {
                        // Set cards for Fixed Characters
                        SetRandomClothes(CurrClassData.data.charFile);
                        appliedNo++;
                        if (apply == Apply.Card)
                        {
                            break;
                        }
                    }
                    else
                    {
                        SetRandomClothes(chaData.charFile);
                        appliedNo++;
                    }
                }
                if (chaData.chaCtrl != null)
                {
                    chaData.chaCtrl.chaFile.coordinate = chaData.charFile.coordinate;
                }
            }

            // Reset Minase Ai to fixed character list
            CharaList.Find(x => ((SaveData.Heroine)x).fixCharaID == -10).schoolClass = -1;

            // Apply colors to player
            SaveData.Player player = Singleton <Manager.Game> .Instance.Player;
            if (apply != Apply.Card)
            {
                if (apply == Apply.All || currSchoolClass == player.schoolClass)
                {
                    Colors.SetColors(player.charFile);
                    appliedNo++;
                    if (player.chaCtrl != null)
                    {
                        player.chaCtrl.chaFile.coordinate = player.charFile.coordinate;
                    }
                }
            }

            // Play sound and write message
            Utils.Sound.Play(SystemSE.ok_l);
            Logger.Log(BepInEx.Logging.LogLevel.Message, String.Format("Successfully changed clothes for {0} characters!", appliedNo));
        }
Beispiel #2
0
        private static void SetRandomClothes(ChaFileControl chaFile)
        {
            // Get list of outfits to change
            List <int> outfitsToChange = Outfits.GetOutfitsToChange();

            // Apply clothes to outfits
            foreach (int outfit in outfitsToChange)
            {
                ChaFileClothes.PartsInfo[] currParts = chaFile.coordinate[outfit].clothes.parts;
                int[] currSubParts = chaFile.coordinate[outfit].clothes.subPartsId;
                bool  topChanged   = false;

                currParts[Clothes.Top].emblemeId = Outfits.EmblemFlag ? Outfits.EmblemID : currParts[Clothes.Top].emblemeId;

                List <int> tops;
                List <int> bottoms;

                if (outfit == Outfits.School || outfit == Outfits.GoingHome)
                {
                    tops    = Default.Top;
                    bottoms = Default.Bottom;
                }
                else if (outfit == Outfits.PE)
                {
                    tops    = Default.PETop;
                    bottoms = Default.PEBottom;
                }
                else
                {
                    tops    = Default.SwimsuitTop;
                    bottoms = Default.SwimsuitBottom;
                }

                // Change Tops
                if (Clothes.StrictUniform == 0)
                {
                    if (Clothes.TopFlag && !tops.Contains(currParts[Clothes.Top].id))
                    {
                        currParts[Clothes.Top].id = tops[Utilities.Rand.Next(tops.Count)];
                        topChanged = true;
                    }
                }
                else
                {
                    currParts[Clothes.Top].id = Clothes.StrictUniform;
                    topChanged = true;
                }

                // Change Bottoms
                if (Clothes.BottomFlag && !bottoms.Contains(currParts[Clothes.Bottom].id))
                {
                    currParts[Clothes.Bottom].id = bottoms[Utilities.Rand.Next(bottoms.Count)];
                }

                // Change Swimsuit
                if (outfit == Outfits.Swimsuit)
                {
                    currParts[Clothes.Bra].id = Default.SwimsuitBras[Utilities.Rand.Next(Default.SwimsuitBras.Count)];
                }

                List <int> subunder;
                List <int> subover;
                List <int> subdeco;

                // Set random subparts
                if (outfit == Outfits.School || outfit == Outfits.GoingHome)
                {
                    if (currParts[Clothes.Top].id == 2)
                    {
                        subunder = Default.SubBlazerUnder;
                        subover  = Default.SubBlazerOver;
                        subdeco  = Default.SubBlazerdeco;
                    }
                    else
                    {
                        subunder = Default.SubSailorUnder;
                        subover  = Default.SubSailorOver;
                        subdeco  = Default.SubSailorDeco;
                    }
                }
                else if (outfit == Outfits.PE)
                {
                    subunder = Default.SubPEUnder;
                    subover  = Default.SubPEOver;
                    subdeco  = Default.SubPEDeco;
                }
                else
                {
                    subunder = Default.SubSwimsuitUnder;
                    subover  = Default.SubSwimsuitOver;
                    subdeco  = Default.SubSwimsuitDeco;
                }


                if (topChanged)
                {
                    currSubParts[Clothes.Subshirt]        = subunder[Utilities.Rand.Next(subunder.Count)];
                    currSubParts[Clothes.Subjacketcollar] = subover[Utilities.Rand.Next(subover.Count)];
                    currSubParts[Clothes.Subdecoration]   = subdeco[Utilities.Rand.Next(subdeco.Count)];
                }
            }

            // Set Colors
            Colors.SetColors(chaFile);
        }