Exemple #1
0
        private void RefreshUI(string key)
        {
            //Log.Message($"Calling RefreshUI");
            activeHairSims.ToList()
            .Where(kvp => kvp.Key != key && kvp.Value.hasSliders).ToList()
            .ForEach(kvp => kvp.Value.UnsetSliders());

            if (activeHairSims.ContainsKey(key))
            {
                ActiveHairSim selected = activeHairSims[key];
                if (!selected.hasSliders)
                {
                    selected.InitSliders();
                }
                if (selected.wasLetLoose)
                {
                    UIElementStore.UpdateToggleButtonText(selected.enabled);
                    RefreshNotifications(selected);
                }
            }
            else
            {
                UIElementStore.UpdateToggleButtonText(null);
                UIElementStore.ApplyDummySliders();
            }
        }
Exemple #2
0
        private void InitPluginUIRight()
        {
            hairSimHandler.CreateHairSelect();
            UIDynamicPopup hairUISelectPopup = CreatePopup(hairSimHandler.hairUISelect, rightSide: true);

            hairUISelectPopup.height = 100;

            UIElementStore.toggleEnableButton        = CreateButton("Disable for selected hairstyle", rightSide: true);
            UIElementStore.toggleEnableButton.height = 50;
            UIElementStore.toggleEnableButton.button.onClick.AddListener(() =>
            {
                if (enabled)
                {
                    bool?result = hairSimHandler.ToggleEnableSelected();
                    UIElementStore.UpdateToggleButtonText(result);
                }
            });
            UIElementStore.UpdateToggleButtonText(null);

            JSONStorableString helpUIText      = new JSONStorableString("helpText", "");
            UIDynamicTextField helpUITextField = CreateTextField(helpUIText, rightSide: true);

            helpUITextField.UItext.fontSize = 26;
            helpUITextField.height          = 325;
            helpUIText.val = $"\n<b><size=30>How it works</size></b>\n\n" +
                             $"Hair is the least rigid at the lower limit angle, and the most rigid at the upper limit angle.\n\n" +
                             $"90° is upright, 0° is horizontal, -90° is upside down.";

            hairSimHandler.valuesUIText = new JSONStorableString("valuesText", "");
            UIDynamicTextField valuesUITextField = CreateTextField(hairSimHandler.valuesUIText, rightSide: true);

            valuesUITextField.UItext.fontSize = 26;
            valuesUITextField.height          = 255;

            hairSimHandler.notificationsUIText = new JSONStorableString("notificationsText", "<");
            UIDynamicTextField notificationsUITextField = CreateTextField(hairSimHandler.notificationsUIText, rightSide: true);

            notificationsUITextField.UItext.fontSize = 26;
            notificationsUITextField.height          = 390;
        }