public MontageController(DollmasterPlugin dm, PoseController poseController) : base(dm) { montagePath = new JSONStorableUrl("montagePath", DollmasterPlugin.VAMASUTRA_PATH); dm.RegisterUrl(montagePath); UIDynamicButton selectMontageFolderButton = dm.CreateButton("Select Montage Folder", true); selectMontageFolderButton.button.onClick.AddListener(() => { SuperController.singleton.directoryBrowserUI.defaultPath = SuperController.singleton.savesDir; SuperController.singleton.directoryBrowserUI.showDirs = true; SuperController.singleton.directoryBrowserUI.showFiles = false; SuperController.singleton.directoryBrowserUI.selectDirectory = true; SuperController.singleton.directoryBrowserUI.SetTextEntry(true); SuperController.singleton.directoryBrowserUI.Show((path) => { montagePath.SetVal(path); LoadMontagesFromPath(path); }); }); UIDynamicButton montageButton = ui.CreateButton("Random Montage", 200, 50); montageButton.button.onClick.AddListener(RandomMontage); montageButton.transform.Translate(0, 0.3f, 0, Space.Self); UI.ColorButton(montageButton, accessTextColor, accessButtonColor); poseButton = ui.CreateButton("Random Pose", 200, 50); poseButton.button.onClick.AddListener(RandomPose); poseButton.transform.Translate(0.3f, 0.3f, 0, Space.Self); UI.ColorButton(poseButton, accessTextColor, accessButtonColor); }
public MontageController(DollmasterPlugin dm, PoseController poseController) : base(dm) { this.poseController = poseController; UIDynamicButton saveButton = dm.CreateButton("Create Montage", true); saveButton.button.onClick.AddListener(() => { SuperController.singleton.currentSaveDir = SuperController.singleton.currentLoadDir; string name = "Montage " + montages.Count; Montage montage = new Montage(name, GetMontageAtoms()); montages.Add(montage); montageChoice.SetVal(name); montageChoice.choices = GetMontageNamesList(); currentMontage = montage; nextMontageButton.gameObject.SetActive(true); poseController.nextPoseButton.gameObject.SetActive(true); }); montageChoice = new JSONStorableStringChooser("montage", GetMontageNamesList(), "", "Select Montage", (string montageName) => { Montage found = FindMontageByName(montageName); if (found == null) { //SuperController.LogError("montage not found " + montageName); SetPoseUIActive(false); return; } float prevThrustValue = dm.thrustController.slider.slider.value; found.Apply(); currentMontage = found; Debug.Log("Applying Montage " + montageName); poseController.SetMontage(found); dm.thrustController.slider.slider.value = prevThrustValue; nextMontageButton.gameObject.SetActive(true); poseController.nextPoseButton.gameObject.SetActive(true); SetPoseUIActive(true); }); dm.RegisterStringChooser(montageChoice); //montageChoice.storeType = JSONStorableParam.StoreType.Appearance; nextMontageButton = dm.ui.CreateButton("Next Montage", 300, 80); nextMontageButton.transform.Translate(0, -0.1f, 0, Space.Self); nextMontageButton.buttonColor = new Color(0.4f, 0.3f, 0.05f); nextMontageButton.textColor = new Color(1, 1, 1); nextMontageButton.button.onClick.AddListener(() => { if (montages.Count == 0) { return; } int index = montageChoice.choices.IndexOf(montageChoice.val); int nextIndex = index + 1; if (nextIndex >= montageChoice.choices.Count) { nextIndex = 0; } string choice = montageChoice.choices[nextIndex]; montageChoice.SetVal(choice); poseController.StopCurrentAnimation(); }); nextMontageButton.gameObject.SetActive(false); dm.CreateSpacer(true).height = 25; dm.CreatePopup(montageChoice, true); montageChoice.popup.onOpenPopupHandlers += () => { montageChoice.choices = GetMontageNamesList(); }; dm.CreateButton("Update Selected Montage", true).button.onClick.AddListener(() => { if (currentMontage != null) { currentMontage.montageJSON = GetMontageAtoms(); } }); //dm.CreateButton("Clear Montages", true).button.onClick.AddListener(() => //{ // montages.Clear(); // currentMontage = null; // poseController.SetMontage(null); // nextMontageButton.gameObject.SetActive(false); // poseController.nextPoseButton.gameObject.SetActive(false); //}); dm.CreateButton("Delete Selected Montage", true).button.onClick.AddListener(() => { if (currentMontage == null) { return; } montages.Remove(currentMontage); currentMontage = null; poseController.SetMontage(null); montageChoice.SetVal(""); if (montages.Count == 0) { nextMontageButton.gameObject.SetActive(false); poseController.nextPoseButton.gameObject.SetActive(false); } else { montageChoice.SetVal(montages[0].name); } }); dm.CreateSpacer(true).height = 50; poseChoicePopup = dm.CreatePopup(poseController.poseChoice, true); poseChoicePopup.label = "Select Pose"; poseChoicePopup.popup.onOpenPopupHandlers += () => { if (currentMontage == null) { poseController.poseChoice.choices = new List <string>(); return; } poseController.poseChoice.choices = currentMontage.GetPoseNames(); }; dm.CreateSpacer(true).height = 25; addPoseButton = dm.CreateButton("Add Pose", true); addPoseButton.button.onClick.AddListener(() => { if (currentMontage == null) { return; } currentMontage.AddPose(PoseController.GetLocalPose(atom)); }); deletePoseButton = dm.CreateButton("Delete Selected Pose", true); deletePoseButton.button.onClick.AddListener(() => { if (currentMontage == null) { return; } JSONClass pose = poseController.GetPoseFromName(poseController.poseChoice.val); if (pose == null) { return; } currentMontage.poses.Remove(pose); }); //clearPosesButton = dm.CreateButton("Clear Poses", true); //clearPosesButton.button.onClick.AddListener(() => //{ // if (currentMontage == null) // { // return; // } // currentMontage.poses.Clear(); // poseController.poseChoice.choices = new List<string>(); //}); SetPoseUIActive(false); }
public override void Init() { try { if (containingAtom.type != "Person") { SuperController.LogError("Please add Doll Master to a Person atom"); return; } lastAtomName = containingAtom.uid; PLUGIN_PATH = GetPluginPath(); ASSETS_PATH = PLUGIN_PATH + "/Assets"; VAMASUTRA_PATH = ASSETS_PATH + "/VAMasutra"; LOAD_PATH = SuperController.singleton.currentLoadDir; headAudioSource = containingAtom.GetStorableByID("HeadAudioSource") as AudioSourceControl; RegisterActions(); ui = new UI(this, 0.001f); ui.canvas.transform.Translate(0, 0.2f, 0); config = new Config(this); personas = new Personas(this); ps = new PluginState(this); arousal = new Arousal(this); expressions = new Expressions(this); expressionController = new ExpressionController(this); sfxController = new SFXController(this); thrustController = new ThrustController(this); thrustAutoController = new ThrustAutoController(this); breathController = new BreathController(this); headController = new HeadController(this); poseController = new PoseController(this); montageController = new MontageController(this, poseController); dressController = new DressController(this); climaxController = new ClimaxController(this); kissController = new KissController(this); new TopButtons(this); //new WorldUI(this); CreateSpacer().height = 200; //SuperController singleton = SuperController.singleton; //singleton.onAtomUIDRenameHandlers = (SuperController.OnAtomUIDRename)Delegate.Combine(singleton.onAtomUIDRenameHandlers, new SuperController.OnAtomUIDRename(HandleRename)); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }