Esempio n. 1
0
        public static void RefreshBackgroundCharacter(RoR2.UI.CharacterSelectController self)
        {
            var component = HasBackgroundComponent(self);

            if (component)
            {
                if (component.survivorDisplays.Count > 0)
                {
                    //List<SurvivorIndex> difference = new List<SurvivorIndex>();


                    foreach (var backgroundCharacters in component.survivorDisplays)
                    {
                        backgroundCharacters.Value.SetActive(true);
                    }
                    foreach (var currentDisplays in self.characterDisplayPads)
                    {
                        var index = currentDisplays.displaySurvivorIndex;
                        component.survivorDisplays.TryGetValue(index, out GameObject objectToToggle);
                        if (objectToToggle)
                        {
                            var delay = self.gameObject.AddComponent <LAI_Delayer>();
                            delay.characterDisplay = objectToToggle;
                        }
                        //selectedCharacters.Add(currentDisplays.displaySurvivorIndex);
                    }
                }
            }
        }
Esempio n. 2
0
        public static void HideBackgroundCharacters(RoR2.UI.CharacterSelectController self)
        {
            var component = HasBackgroundComponent(self);

            if (component)
            {
                // Re-enable everything
                if (component.survivorDisplays.Count > 0)
                {
                    foreach (var backgroundCharacters in component.survivorDisplays)
                    {
                        backgroundCharacters.Value.SetActive(true);
                    }
                    // Now we can disable
                    foreach (var currentDisplays in self.characterDisplayPads)
                    {
                        var index = currentDisplays.displaySurvivorIndex;
                        component.survivorDisplays.TryGetValue(index, out GameObject objectToToggle);
                        if (objectToToggle)
                        {
                            objectToToggle.SetActive(false);
                        }
                        //selectedCharacters.Add(currentDisplays.displaySurvivorIndex);
                    }
                }
            }
        }
Esempio n. 3
0
 public static LAI_BGCHARCOMP HasBackgroundComponent(RoR2.UI.CharacterSelectController self)
 {
     if (self && self.gameObject.GetComponent <LAI_BGCHARCOMP>())
     {
         return(self.gameObject.GetComponent <LAI_BGCHARCOMP>());
     }
     else
     {
         return(null);
     }
 }
Esempio n. 4
0
        public static void UpdateSurvivorCache(RoR2.UI.CharacterSelectController self)
        {
            var component = HasBackgroundComponent(self);

            if (component)
            {
                if (component.survivorDisplays.Count > 0)
                {
                    component.currentlySelectedSurvivors.Clear();
                    foreach (var currentDisplays in self.characterDisplayPads)
                    {
                        var index = currentDisplays.displaySurvivorIndex;
                        component.currentlySelectedSurvivors.Add(index);
                    }
                }
            }
        }
Esempio n. 5
0
        // Zoom //
        private void ZoomOnSelected(On.RoR2.UI.CharacterSelectController.orig_SelectSurvivor orig, RoR2.UI.CharacterSelectController self, SurvivorIndex survivor)
        {
            orig(self, survivor);
            var cameraRig = GameObject.Find("Main Camera").gameObject.GetComponent <CameraRigController>();

            if (characterCameraSettings.TryGetValue(survivor, out float[] cameraParams))
Esempio n. 6
0
        // Custom Background //

        // Survivors in Lobby //
        // Lobby View Type//
        // Hide //
        private void HideOnSelected(On.RoR2.UI.CharacterSelectController.orig_OnNetworkUserLoadoutChanged orig, RoR2.UI.CharacterSelectController self, NetworkUser networkUser)
        {
            orig(self, networkUser);
            Methods.HideBackgroundCharacters(self);
        }
Esempio n. 7
0
        private void CharacterSelectController_Awake(On.RoR2.UI.CharacterSelectController.orig_Awake orig, RoR2.UI.CharacterSelectController self)
        {
            orig(self);
            var directionalLight = GameObject.Find("Directional Light");
            var ui_main          = GameObject.Find("CharacterSelectUI").transform;
            var SafeArea         = ui_main.Find("SafeArea").transform;
            var ui_left          = SafeArea.Find("LeftHandPanel (Layer: Main)");
            var ui_right         = SafeArea.Find("RightHandPanel");

            // UI //
            if (HideFade.Value)
            {
                ui_main.Find("BottomSideFade").gameObject.SetActive(false);
                ui_main.Find("TopSideFade").gameObject.SetActive(false);
            }
            if (UIScale.Value != 1f)
            {
                ui_left.localScale  *= UIScale.Value;
                ui_right.localScale *= UIScale.Value;
            }
            if (BlurValue.Value != 255)
            {
                var newBlurValue   = Mathf.Clamp(BlurValue.Value, 0f, 255f);
                var leftBlurColor  = ui_left.Find("BlurPanel").GetComponent <TranslucentImage>().color;
                var rightBlurColor = ui_right.Find("RuleVerticalLayout").Find("BlurPanel").GetComponent <TranslucentImage>().color;
                leftBlurColor.a  = newBlurValue;
                rightBlurColor.a = newBlurValue;
            }
            if (BlurValue.Value == 255) // UNUSED / TESTING
            {
                var SurvivorChoiceGrid = ui_left.Find("SurvivorChoiceGrid, Panel");
                ui_left.GetComponent <UnityEngine.UI.VerticalLayoutGroup>().enabled = false;
                var KingEnderBrine = SurvivorChoiceGrid.Find("SurvivorChoiseGridContainer");
                if (KingEnderBrine)
                {
                    KingEnderBrine.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>().enabled = false;
                    KingEnderBrine.transform.position = new Vector3(-70, 55, 100);
                }
                else
                {
                }
            } //TESTING

            // Overlay //
            // Post Processing //
            GameObject.Find("PP").SetActive(!PostProcessing.Value);

            // Light //
            if (Light_Color.Value != "default" && TryParseHtmlString(Light_Color.Value, out Color color))
            {
                Methods.ChangeLobbyLightColor(color);
            }
            directionalLight.gameObject.GetComponent <Light>().intensity      = Light_Intensity.Value;
            directionalLight.gameObject.GetComponent <FlickerLight>().enabled = !Light_Flicker_Disable.Value;

            // Character Pad Displays //
            if (CharacterPadScale.Value != 1f)
            {
                if (LobbyViewType != StaticValues.LobbyViewType.Zoom) //if Zoom is selected, then this will NRE //here
                {
                    GameObject.Find("CharacterPadAlignments").transform.localScale *= CharacterPadScale.Value;
                }
            }

            // Background Elements //
            if (MeshProps.Value)
            {
                GameObject.Find("HANDTeaser")?.SetActive(false);
                GameObject.Find("MeshProps").SetActive(false);
                GameObject.Find("HumanCrate1Mesh").SetActive(false);
                GameObject.Find("HumanCrate2Mesh").SetActive(false);
                GameObject.Find("HumanCanister1Mesh").SetActive(false);
            }
            else if (PhysicsProps.Value)
            {
                var thing = GameObject.Find("MeshProps").transform;
                foreach (string text in new string[] { "PropAnchor", "ExtinguisherMesh", "FolderMesh", "LaptopMesh (1)", "ChairPropAnchor", "ChairMesh",
                                                       "ChairWeight", "PropAnchor (1)", "ExtinguisherMesh (1)", "ExtinguisherMesh (2)", "FolderMesh (1)", "LaptopMesh (2)" })
                {
                    thing.Find(text)?.gameObject.SetActive(false);
                }
            }

            // CUSTOM BACKGROUND //


            // SURVIVORS IN LOBBY //
            if (SurvivorsInLobby.Value)
            {
                var component        = self.gameObject.AddComponent <LAI_BGCHARCOMP>();
                var characterHolder  = new GameObject("HOLDER: Characters");
                var survivorDisplays = component.survivorDisplays;

                foreach (var setting in StaticValues.characterDisplaySettings)
                {
                    CreateDisplayMaster(setting.Key, setting.Value[0], setting.Value[1], characterHolder.transform, survivorDisplays);
                }
                if (LobbyViewType == StaticValues.LobbyViewType.Zoom) //here
                {
                    GameObject.Find("CharacterPadAlignments").SetActive(false);
                }
            }
        }
Esempio n. 8
0
        private void CharacterSelectController_SelectSurvivor(On.RoR2.UI.CharacterSelectController.orig_SelectSurvivor orig, RoR2.UI.CharacterSelectController self, SurvivorIndex survivor)
        {
            orig(self, survivor);

            var skillPreview = UnityEngine.Object.FindObjectOfType <SkillPreview>();

            self.characterDisplayPads[0].displayInstance.transform.GetComponentInChildren <Animator>();
        }
Esempio n. 9
0
 private void CharacterSelectController_Start(On.RoR2.UI.CharacterSelectController.orig_Start orig, RoR2.UI.CharacterSelectController self)
 {
     orig(self);
     self.gameObject.AddComponent <SkillPreview>();
 }
        private void CharacterSelectController_SelectSurvivor(On.RoR2.UI.CharacterSelectController.orig_SelectSurvivor orig, RoR2.UI.CharacterSelectController self, SurvivorIndex survivor)
        {
            orig(self, survivor);

            var skillPreview = UnityEngine.Object.FindObjectOfType <SkillPreview>();

            skillPreview.UpdateInstance(SurvivorCatalog.GetSurvivorDef(survivor));
        }
Esempio n. 11
0
        //update character preview
        private void UpdateCharacterPreview(On.RoR2.UI.CharacterSelectController.orig_OnNetworkUserLoadoutChanged orig, RoR2.UI.CharacterSelectController self, NetworkUser networkUser)
        {
            orig(self, networkUser);
            int num = self.GetSortedNetworkUsersList().IndexOf(networkUser);

            if (num != -1)
            {
                RoR2.UI.CharacterSelectController.CharacterPad safe = HG.ArrayUtils.GetSafe <RoR2.UI.CharacterSelectController.CharacterPad>(self.characterDisplayPads, num);
                if (safe.displayInstance)
                {
                    Loadout loadout = new Loadout();
                    networkUser.networkLoadout.CopyLoadout(loadout);
                    int            bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(safe.displaySurvivorIndex);
                    int            skinIndex           = (int)loadout.bodyLoadoutManager.GetSkinIndex(bodyIndexFromSurvivorIndex);
                    SkinDef        safe2               = HG.ArrayUtils.GetSafe <SkinDef>(BodyCatalog.GetBodySkins(bodyIndexFromSurvivorIndex), skinIndex);
                    CharacterModel componentInChildren = safe.displayInstance.GetComponentInChildren <CharacterModel>();
                    if (componentInChildren && safe2 != null)
                    {
                        safe2.Apply(componentInChildren.gameObject);
                    }
                }
            }
        }
Esempio n. 12
0
 private void ReplayAnimationOnSelect(On.RoR2.UI.CharacterSelectController.orig_OnNetworkUserLoadoutChanged orig, RoR2.UI.CharacterSelectController self, NetworkUser networkUser)
 {
     orig(self, networkUser);
     RefreshBackgroundCharacter(self);
 }