habeebweeb 4 anni fa
parent
commit
3fe634382e

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Slider.cs

@@ -55,7 +55,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.value = Utility.Bound(value, left, right);
         }
 
-        public Slider(float min, float max, float value = 0) : this(String.Empty, min, max, value) { }
+        public Slider(float min, float max, float value = 0f) : this(String.Empty, min, max, value) { }
 
         public Slider(string label, SliderProp prop) : this(label, prop.Left, prop.Right, prop.Initial) { }
 
@@ -102,7 +102,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.Left = left;
             this.Right = right;
-            this.Initial = initial;
+            this.Initial = Utility.Bound(initial, left, right);
         }
     }
 }

+ 26 - 26
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/FaceWindowPanes/MaidFaceSliderPane.cs

@@ -7,56 +7,56 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class MaidFaceSliderPane : BasePane
     {
         // TODO: Consider placing in external file to be user editable
-        private static readonly Dictionary<string, float[]> SliderRange = new Dictionary<string, float[]>()
+        private static readonly Dictionary<string, SliderProp> SliderRange = new Dictionary<string, SliderProp>()
         {
             // Eye Shut
-            ["eyeclose"] = new[] { 0f, 1f },
+            ["eyeclose"] = new SliderProp(0f, 1f),
             // Eye Smile
-            ["eyeclose2"] = new[] { 0f, 1f },
+            ["eyeclose2"] = new SliderProp(0f, 1f),
             // Glare
-            ["eyeclose3"] = new[] { 0f, 1f },
+            ["eyeclose3"] = new SliderProp(0f, 1f),
             // Wide Eyes
-            ["eyebig"] = new[] { 0f, 1f },
+            ["eyebig"] = new SliderProp(0f, 1f),
             // Wink 1
-            ["eyeclose6"] = new[] { 0f, 1f },
+            ["eyeclose6"] = new SliderProp(0f, 1f),
             // Wink 2
-            ["eyeclose5"] = new[] { 0f, 1f },
+            ["eyeclose5"] = new SliderProp(0f, 1f),
             // Highlight
-            ["hitomih"] = new[] { 0f, 2f },
+            ["hitomih"] = new SliderProp(0f, 2f),
             // Pupil Size
-            ["hitomis"] = new[] { 0f, 3f },
+            ["hitomis"] = new SliderProp(0f, 3f),
             // Brow 1
-            ["mayuha"] = new[] { 0f, 1f },
+            ["mayuha"] = new SliderProp(0f, 1f),
             // Brow 2
-            ["mayuw"] = new[] { 0f, 1f },
+            ["mayuw"] = new SliderProp(0f, 1f),
             // Brow Up
-            ["mayuup"] = new[] { 0f, 0.8f },
+            ["mayuup"] = new SliderProp(0f, 0.8f),
             // Brow Down 1
-            ["mayuv"] = new[] { 0f, 0.8f },
+            ["mayuv"] = new SliderProp(0f, 0.8f),
             // Brow Down 2
-            ["mayuvhalf"] = new[] { 0f, 0.9f },
+            ["mayuvhalf"] = new SliderProp(0f, 0.9f),
             // Mouth Open 1
-            ["moutha"] = new[] { 0f, 1f },
+            ["moutha"] = new SliderProp(0f, 1f),
             // Mouth Open 2
-            ["mouths"] = new[] { 0f, 0.9f },
+            ["mouths"] = new SliderProp(0f, 0.9f),
             // Mouth Narrow
-            ["mouthc"] = new[] { 0f, 1f },
+            ["mouthc"] = new SliderProp(0f, 1f),
             // Mouth Widen
-            ["mouthi"] = new[] { 0f, 1f },
+            ["mouthi"] = new SliderProp(0f, 1f),
             // Smile
-            ["mouthup"] = new[] { 0f, 1.4f },
+            ["mouthup"] = new SliderProp(0f, 1.4f),
             // Frown
-            ["mouthdw"] = new[] { 0f, 1f },
+            ["mouthdw"] = new SliderProp(0f, 1f),
             // Mouth Pucker
-            ["mouthhe"] = new[] { 0f, 1f },
+            ["mouthhe"] = new SliderProp(0f, 1f),
             // Grin
-            ["mouthuphalf"] = new[] { 0f, 2f },
+            ["mouthuphalf"] = new SliderProp(0f, 2f),
             // Tongue Out
-            ["tangout"] = new[] { 0f, 1f },
+            ["tangout"] = new SliderProp(0f, 1f),
             // Tongue Up
-            ["tangup"] = new[] { 0f, 0.7f },
+            ["tangup"] = new SliderProp(0f, 0.7f),
             // Tongue Base
-            ["tangopen"] = new[] { 0f, 1f }
+            ["tangopen"] = new SliderProp(0f, 1f)
         };
         private MeidoManager meidoManager;
         private Dictionary<string, BaseControl> faceControls;
@@ -69,7 +69,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             foreach (string key in faceKeys)
             {
                 string uiName = Translation.Get("faceBlendValues", key);
-                Slider slider = new Slider(uiName, SliderRange[key][0], SliderRange[key][1]);
+                Slider slider = new Slider(uiName, SliderRange[key]);
                 string myKey = key;
                 slider.ControlEvent += (s, a) => this.SetFaceValue(myKey, slider.Value);
                 faceControls[key] = slider;

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MessageWindow.cs

@@ -40,7 +40,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             nameTextField = new TextField();
             Controls.Add(nameTextField);
 
-            fontSizeSlider = new Slider(25, 60);
+            fontSizeSlider = new Slider(MessageWindowManager.fontBounds);
             fontSizeSlider.ControlEvent += ChangeFontSize;
             Controls.Add(fontSizeSlider);
 

+ 1 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs

@@ -113,6 +113,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void DestroyLight(DragPointLight light)
         {
+            if (light == null) return;
             light.Rotate -= OnRotate;
             light.Scale -= OnScale;
             light.Delete -= OnDelete;

+ 2 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MessageWindowManager.cs

@@ -4,6 +4,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MessageWindowManager
     {
+        public static readonly SliderProp fontBounds = new SliderProp(25f, 60f);
         private static GameObject sysRoot;
         private MessageClass msgClass;
         private MessageWindowMgr msgWnd;
@@ -77,7 +78,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void SetFontSize(int fontSize)
         {
-            Utility.SetFieldValue<UILabel, int>(this.msgLabel, "mFontSize", fontSize);
+            this.msgLabel.fontSize = fontSize;
         }
 
         public void CloseMessagePanel()

+ 4 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -12,7 +12,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private const string pluginGuid = "com.habeebweeb.com3d2.meidophotostudio";
         public const string pluginName = "MeidoPhotoStudio";
         public const string pluginVersion = "0.0.0";
-        public static string pluginString;
+        public static string pluginString = $"{pluginName} {pluginVersion}";
         private WindowManager windowManager;
         private MeidoManager meidoManager;
         private EnvironmentManager environmentManager;
@@ -22,11 +22,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private EffectManager effectManager;
         private Constants.Scene currentScene;
         private bool initialized = false;
-        private bool isActive = false;
+        private bool active = false;
         private bool uiActive = false;
 
-        static MeidoPhotoStudio() => pluginString = $"{pluginName} {pluginVersion}";
-
         private void Awake() => DontDestroyOnLoad(this);
 
         private void Start()
@@ -42,12 +40,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 if (Input.GetKeyDown(KeyCode.F6))
                 {
-                    if (isActive) Deactivate();
+                    if (active) Deactivate();
                     else Activate();
                 }
 
-                if (isActive)
-                {
+                if (active)
                     bool qFlag = Input.GetKey(KeyCode.Q);
                     if (!qFlag && Input.GetKeyDown(KeyCode.S))
                     {