Пример #1
0
        public void SetValueFromModel()
        {
            var model = SettingPanelController.GetModelObjectSelected();

            if (model != null)
            {
                if (model.GetComponent <Live2DModelController>() != null)
                {
                    var controller = model.GetComponent <Live2DModelController>();
                    ModelLostResetToggle.isOn    = controller.LostReset;
                    ModelLostResetEyeToggle.isOn = controller.LostResetEye;
                    ModelMotionLoopToggle.isOn   = controller.LostResetMotionLoop;
                    ModelKeyboardBindToggle.isOn = controller.KeyboardBind;
                    ModelLostResetChooseDropdown.selectedText.text = ModelLostResetChooseDropdown.listItems[controller.LostResetAction];
                    ModelLostResetActionDropdown.listItems         = new string[controller.animationClips.Count];
                    var i = 0;
                    foreach (var name in controller.animationClips)
                    {
                        ModelLostResetActionDropdown.listItems[i] = name.ToString();
                        i++;
                    }
                    ModelLostResetActionDropdown.RefreshList();
                    ModelLostResetActionDropdown.selectedText.text = controller.LostResetMotion;
                    ModelShowLevelSlider.value = model.gameObject.GetComponent <CubismRenderController>().SortingOrder;
                }
            }
        }
Пример #2
0
        public void OnShortcutItemAddButtonClick()
        {
            var model = SettingPanelController.GetModelObjectSelected();

            if (model != null)
            {
                var item = Instantiate(ShortcutObject);
                item.transform.SetParent(ShortcutObjectParent.transform, false);
                var itemController = item.GetComponent <NewShortcutItemController>();
                itemController.DAction.ClearOptions();
                itemController.DAction.options = OptionDatas;
                itemController.Model           = model;
                item.SetActive(true);
            }
        }
Пример #3
0
        public void Enabled(SettingPanelController SettingPanelController)
        {
            var model = SettingPanelController.GetModelObjectSelected();

            if (model != null)
            {
                var aniDict = new Dictionary <string, ShortcutClass>();
                foreach (KeyValuePair <List <string>, Dictionary <string, ShortcutClass> > kvp in ShortcutController.ShortcutDict)
                {
                    foreach (KeyValuePair <string, ShortcutClass> kkvp in ShortcutController.ShortcutDict[kvp.Key])
                    {
                        if (kkvp.Value.Model == model)
                        {
                            if (kkvp.Value.Type == 0)
                            {
                                aniDict.Add(kkvp.Value.AnimationClip, kkvp.Value);
                            }
                            else if (kkvp.Value.Type == 1)
                            {
                                aniDict.Add(kkvp.Value.Parameter, kkvp.Value);
                            }
                        }
                    }
                }
                if (model.GetComponent <Live2DModelController>() != null)
                {
                    var cubismmodel = model.FindCubismModel();
                    var controller  = model.GetComponent <Live2DModelController>();

                    var temoData = new Dropdown.OptionData();
                    temoData.text = "/";
                    OptionDatas.Add(temoData);
                    OptionDataString.Add("/");

                    for (int i = 0; i < cubismmodel.Parameters.Count(); i++)
                    {
                        temoData      = new Dropdown.OptionData();
                        temoData.text = cubismmodel.Parameters[i].name;
                        OptionDatas.Add(temoData);
                        OptionDataString.Add(cubismmodel.Parameters[i].name);
                    }

                    for (int i = 0; i < controller.animationClips.Count; i++)
                    {
                        temoData      = new Dropdown.OptionData();
                        temoData.text = controller.animationClips[i].ToString();
                        OptionDatas.Add(temoData);
                        OptionDataString.Add(controller.animationClips[i].ToString());
                    }

                    foreach (KeyValuePair <string, ShortcutClass> kvp in aniDict)
                    {
                        var item = Instantiate(ShortcutObject);
                        item.transform.SetParent(ShortcutObjectParent.transform, false);
                        var itemController = item.GetComponent <NewShortcutItemController>();

                        itemController.DAction.ClearOptions();
                        itemController.DAction.options = OptionDatas;

                        if (kvp.Value.Type == 0)
                        {
                            itemController.isAnimation   = true;
                            itemController.DAction.value = OptionDataString.IndexOf(kvp.Value.AnimationClip);
                            itemController.Name          = kvp.Value.AnimationClip;
                        }
                        else if (kvp.Value.Type == 1)
                        {
                            itemController.isAnimation   = false;
                            itemController.DAction.value = OptionDataString.IndexOf(kvp.Value.Parameter);
                            itemController.Name          = kvp.Value.Parameter;
                        }

                        itemController.Shortcut.text     = kvp.Value.isPressedText;
                        itemController.UUID              = kvp.Value.UUID;
                        itemController.InvertToggle.isOn = kvp.Value.IsInvert;
                        itemController.LockToggle.isOn   = kvp.Value.IsLock;
                        itemController.LoopToggle.isOn   = kvp.Value.IsLoop;
                        itemController.Model             = model;

                        item.SetActive(true);
                        Objects.Add(item);
                    }
                }
            }
        }
Пример #4
0
        public void OnEnable()
        {
            if (!IsProcessing)
            {
                IsProcessing = true;
                var model = SettingPanelController.GetModelObjectSelected();
                if (model != null)
                {
                    if (model.GetComponent <Live2DModelController>() != null)
                    {
                        var InitedParameters = model.GetComponent <Live2DModelController>().InitedParameters;
                        foreach (KeyValuePair <string, ParametersClass> kvp in InitedParameters)
                        {
                            if (kvp.Value.Name != "paramBreath")
                            {
                                var advancedObject = Instantiate(AdvancedObject);
                                advancedObject.transform.SetParent(AdvancedObjectParent.transform, false);
                                advancedObject.SetActive(true);
                                var controller = advancedObject.GetComponent <ModelAdvancedItemController>();
                                controller.ParameterName.text = kvp.Value.Name;
                                var increase = 1f;
                                if (kvp.Value.MaxValue > 5)
                                {
                                    increase = 50;
                                }
                                //最小值
                                controller.TMinSlider.minValue = kvp.Value.MinValue - increase;
                                controller.TMinSlider.maxValue = kvp.Value.MaxValue + increase;
                                controller.TMinSlider.value    = kvp.Value.MinSetValue;

                                controller.MMinSlider.minValue = kvp.Value.MinValue;
                                controller.MMinSlider.maxValue = kvp.Value.MaxValue;
                                controller.MMinSlider.value    = kvp.Value.MinParamValue;
                                //最大值
                                controller.TMaxSlider.minValue = kvp.Value.MinValue - increase;
                                controller.TMaxSlider.maxValue = kvp.Value.MaxValue + increase;
                                controller.TMaxSlider.value    = kvp.Value.MaxSetValue;

                                controller.MMaxSlider.minValue = kvp.Value.MinValue;
                                controller.MMaxSlider.maxValue = kvp.Value.MaxValue;
                                controller.MMaxSlider.value    = kvp.Value.MaxParamValue;

                                //当前值
                                controller.TNowSlider.value = kvp.Value.NowValue;

                                controller.MNowSlider.value = kvp.Value.NowValue;

                                controller.TNowSlider.minValue = kvp.Value.MinValue - increase;
                                controller.TNowSlider.maxValue = kvp.Value.MaxValue + increase;

                                controller.MNowSlider.minValue = kvp.Value.MinValue;
                                controller.MNowSlider.maxValue = kvp.Value.MaxValue;

                                controller.SSlider.value   = kvp.Value.SmoothValue;
                                controller.parametersClass = kvp.Value;
                                Objects.Add(advancedObject);
                            }
                        }
                    }
                }
                IsProcessing = false;
            }
        }