Advertisement
cm3d2-01

CM3D2.AddModsSlider.Plugin.0.0.3.4

Aug 26th, 2015
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 33.53 KB | None | 0 0
  1. // CM3D2.AddModsSlider.Plugin.0.0.3.4 : フリーコメント欄の各modパラメータをスライドバーで操作する UnityInjector 用プラグイン
  2.  
  3. // 必須ファイル: \CM3D2\UnityInjector\Config\ModsParam.xml
  4. // (サンプル: http://pastebin.com/wiCL6ETM ) modパラメータ定義xml
  5. //
  6. // 機能1.
  7. // メイドエディット画面中にF5でUI表示トグル。 ( http://i.imgur.com/61U9Xzg.png )
  8. // コメント欄で操作する数値をスライドバーで調整する事が可能。
  9. // フリーコメント欄にそのmodの有効な書式が在れば、該当するスライドバーが表示される。
  10. //
  11. // 機能2.
  12. // 夜伽画面中にF5でUI表示トグル。( http://i.imgur.com/CohQ8Io.png )
  13. // 興奮・精神・理性をスライドバーで調整、または固定する事が可能。
  14. // また、各ボタン押下で夜伽中のメイドにFaceBlend(頬・涙・よだれの組合せ)とFaceAnime(エロ○○系表情)を適用出来る。
  15. // ※注意
  16. // 夜伽ステータスのスライドバーは夜伽コマンド実行画面まではEnabledにしないで下さい。
  17. // 会話画面やスキル選択画面でEnabledにすると、ロード画面でフリーズします。
  18.  
  19. // 更新履歴
  20. // 0.0.3.4 夜伽時に興奮・精神・理性を変更できるスライドバーを追加。
  21. //     夜伽時にFaceBlend(頬・涙・よだれの組合せ)とFaceAnime(エロ○○系表情)を選べるボタンを追加。
  22. // 0.0.2.3 フォントサイズがウィンドウ幅と比例する様に。
  23. //     スクロールバーが滑らかに。
  24. //         ModsParam.xmlの<mod>属性 forced="..." が正常に機能していなかったのを修正。
  25. //         リフレクションがフレーム毎に実行されてたのを修正。(軽量化)
  26. // 0.0.2.2 ModsParam.xmlの書式を変更。
  27. //     ModsParam.xmlで<mod>の属性に forced="true" 指定で、フリーコメント欄にかかわらずそのmodのスライダーが表示される様に。
  28. //         <value>の属性でtype="scale"指定の時、最小値をスライダーに反映してなかったのを修正。
  29. // 0.0.1.1 各mod定義をxmlファイルにして読み込む様に。
  30. //         スライダーバーとフリーコメント欄が連動する様に。(改造スレその2>>192)
  31. //         EYEBALL,TEST_EYE_ANGの縦横が逆だったのを修正。
  32. // 0.0.0.0 初版
  33.  
  34. using System;
  35. using System.Collections.Generic;
  36. using System.IO;
  37. using System.Reflection;
  38. using System.Text;
  39. using System.Text.RegularExpressions;
  40. using System.Xml;
  41. using UnityEngine;
  42. using UnityInjector.Attributes;
  43.  
  44. namespace CM3D2.AddModsSlider.Plugin
  45. {
  46.     [PluginFilter("CM3D2x64"),
  47.     PluginFilter("CM3D2x86"),
  48.     PluginFilter("CM3D2VRx64"),
  49.     PluginName("CM3D2 AddModsSlider"),
  50.     PluginVersion("0.0.3.4")]
  51.     public class AddModsSlider : UnityInjector.PluginBase
  52.     {
  53.         public const string Version = "0.0.3.4";
  54.  
  55.         private int sceneLevel;
  56.         private bool visible = false;
  57.         private bool success = true;
  58.         private ModsParam mp;
  59.         private UIInput uiInputFreeComment;
  60.         private YotogiParamBasicBar yotogiParamBasicBar;
  61.         private Vector2 scrollViewVector = Vector2.zero;
  62.  
  63.         private bool[] fToggleEnabled = new bool[] { false, false };
  64.         private bool[] fTogglePin = new bool[] { false, false, false };
  65.         private bool fToggleYodare = false;
  66.         private float[] fYotogiValue = new float[] { 100f, 100f, 100f};
  67.         private int[] iFaceBlend = new int[] { 0, 0 };
  68.         private string[][] sFaceBlend = new string[2][];
  69.         private string[] sEroFaceAnime = new string[] {"-----","通常1","通常2","通常3"
  70.                                                       ,"興奮0","興奮1","興奮2","興奮3"
  71.                                                       ,"メソ泣き","羞恥1","羞恥2","羞恥3"
  72.                                                       ,"嫌悪1","好感1","好感2","好感3"
  73.                                                       ,"怯え","期待","絶頂","放心"
  74.                                                       ,"我慢1","我慢2","我慢3","舌責"
  75.                                                       ,"痛み1","痛み2","痛み3","舌責快楽"
  76.                                                       ,"痛み我慢2","痛み我慢3","舐め通常","舐め嫌悪"
  77.                                                       ,"フェラ愛情","フェラ快楽","フェラ嫌悪","フェラ通常"
  78.                                                       ,"舐め愛情","舐め愛情2","舐め快楽","舐め快楽2"
  79.                                                       };
  80.  
  81.         public class ModsParam
  82.         {
  83.             public string DefMatchPattern = @"([-+]?[0-9]*\.?[0-9]+)";
  84.             public string XmlFileName = Directory.GetCurrentDirectory() + @"\UnityInjector\Config\ModsParam.xml";
  85.  
  86.             public string[] sKey;
  87.             public Dictionary<string, float[]> fValue = new Dictionary<string, float[]>();
  88.             public Dictionary<string, float[]> fVmin = new Dictionary<string, float[]>();
  89.             public Dictionary<string, float[]> fVmax = new Dictionary<string, float[]>();
  90.             public Dictionary<string, string[]> sLabel = new Dictionary<string, string[]>();
  91.             public Dictionary<string, bool[]> bScale = new Dictionary<string, bool[]>();
  92.             public Dictionary<string, string[]> sMatchPattern = new Dictionary<string, string[]>();
  93.  
  94.             public Dictionary<string, string> sDescription = new Dictionary<string, string>();
  95.             public Dictionary<string, bool> bForced = new Dictionary<string, bool>();
  96.             public Dictionary<string, bool> bEnabled = new Dictionary<string, bool>();
  97.  
  98.             public int KeyCount { get{return this.sKey.Length; } }
  99.             public int ValCount(string key) { return this.fValue[key].Length; }
  100.  
  101.             //--------
  102.  
  103.             public ModsParam()
  104.             {
  105.                 this.Init();
  106.             }
  107.  
  108.             public bool Init()
  109.             {
  110.                 if(!loadModsParamXML(this))
  111.                 {
  112.                     Debug.LogError("AddModsSlider : loadModsParamXML() failed.");
  113.                     return false;
  114.                 }
  115.  
  116.                 return true;
  117.             }
  118.  
  119.  
  120.             private bool loadModsParamXML(ModsParam mp)
  121.             {
  122.                 string fn = mp.XmlFileName;
  123.                 bool flag = true;
  124.                
  125.                 if (File.Exists(fn))
  126.                 {
  127.                     XmlDocument doc = new XmlDocument();
  128.                     doc.Load(fn);
  129.  
  130.                     XmlNode root = doc.DocumentElement;
  131.  
  132.                     string format = ((XmlElement)root).GetAttribute("format");
  133.                     if (format != "1.0")
  134.                     {
  135.                         flag = false;
  136.                     }
  137.                     else if (root.HasChildNodes)
  138.                     {
  139.                         XmlNodeList mod_nodes = ((XmlElement)root).GetElementsByTagName("mod");
  140.  
  141.                         if (mod_nodes.Count > 0)
  142.                         {
  143.                             mp.sKey = new string[mod_nodes.Count];
  144.                         }
  145.                         else
  146.                         {
  147.                         }
  148.  
  149.                         for (int i=0; i<mod_nodes.Count; i++)
  150.                         {
  151.                             if (!flag) break;
  152.                            
  153.                             // modノード
  154.                             XmlNode mod_node = mod_nodes[i];
  155.                             string key = ((XmlElement)mod_node).GetAttribute("id");
  156.  
  157.                             if (key != "" )
  158.                             {
  159.                                 mp.sKey[i] = key;
  160.                             }
  161.                             else
  162.                             {
  163.                                 flag = false;
  164.                                 break;
  165.                             }
  166.  
  167.                             // mod属性
  168.                             bool f,r;
  169.                             mp.sDescription[key] = ((XmlElement)mod_node).GetAttribute("description");
  170.  
  171.                             r = Boolean.TryParse(((XmlElement)mod_node).GetAttribute("forced"), out f);
  172.                             mp.bForced[key] = (r) ? f :false;
  173.                            
  174.                             r = Boolean.TryParse(((XmlElement)mod_node).GetAttribute("enabled"), out f);
  175.                             mp.bEnabled[key] = (r) ? f :false;
  176.  
  177.                             XmlNodeList values = ((XmlElement)mod_node).GetElementsByTagName("value");
  178.                             if (values.Count > 0)
  179.                             {
  180.                                 int tmp = values.Count;
  181.                                 mp.fValue[key] = new float[tmp];
  182.                                 mp.fVmin[key] = new float[tmp];
  183.                                 mp.fVmax[key] = new float[tmp];
  184.                                 mp.sLabel[key] = new string[tmp];
  185.                                 mp.bScale[key] = new bool[tmp];
  186.                                 mp.sMatchPattern[key] = new string[tmp];
  187.                             }
  188.                             else flag = false;    
  189.  
  190.                             // valueノード
  191.                             for (int j=0; j<values.Count; j++)
  192.                             {
  193.                                 if (!flag) break;
  194.  
  195.                                 mp.fValue[key][j] = 0f;
  196.                                 mp.fVmin[key][j] = 0f;
  197.                                 mp.fVmax[key][j] = 10f;
  198.                                 mp.sLabel[key][j] = "";
  199.                                 mp.bScale[key][j] = false;
  200.                                 mp.sMatchPattern[key][j] = "";
  201.  
  202.                                 XmlNode val_node = values[j];
  203.                                 int arg_no = -1;
  204.  
  205.                                 // value属性
  206.                                 r = Int32.TryParse(((XmlElement)val_node).GetAttribute("arg_no"), out arg_no);
  207.                                 arg_no = (r) ? arg_no-1 : -1;
  208.  
  209.                                 if (arg_no >= 0)
  210.                                 {
  211.                                     r = Single.TryParse(((XmlElement)val_node).GetAttribute("min"), out mp.fVmin[key][arg_no]);
  212.                                     if(!r) mp.fVmin[key][arg_no] = 0f;
  213.                                     r = Single.TryParse(((XmlElement)val_node).GetAttribute("max"), out mp.fVmax[key][arg_no]);
  214.                                     if(!r) mp.fVmax[key][arg_no] = 10f;
  215.  
  216.                                     mp.sLabel[key][arg_no] = ((XmlElement)val_node).GetAttribute("label");
  217.                                     mp.sMatchPattern[key][arg_no] = ((XmlElement)val_node).GetAttribute("match_pattern");
  218.  
  219.                                     string sv = ((XmlElement)mod_node).GetAttribute("type");
  220.                                     switch (sv)
  221.                                     {
  222.                                         case "num":      mp.bScale[key][arg_no] = false; break;
  223.                                         case "scale":    mp.bScale[key][arg_no] = true;  break;
  224.                                         default :        mp.bScale[key][arg_no] = false; break;
  225.                                     }
  226.                                 }
  227.                                 else  flag = false;
  228.                             }
  229.                         }
  230.                     }
  231.                 }
  232.                 else
  233.                 {
  234.                     Debug.LogError("AddModsSlider : \"" + fn + "\" does not exist.");
  235.                     flag = false;
  236.                 }
  237.                
  238.                 return flag;
  239.             }
  240.         }
  241.  
  242.     //--------
  243.  
  244.         public void Awake()
  245.         {
  246.             GameObject.DontDestroyOnLoad(this);
  247.  
  248.             this.mp = new ModsParam();
  249.  
  250.             sFaceBlend[0] = new string[] {"頬0", "頬1", "頬2", "頬3"};
  251.             sFaceBlend[1] = new string[] {"涙0", "涙1", "涙2", "涙3"};
  252.         }
  253.  
  254.         public void OnLevelWasLoaded(int level)
  255.         {
  256.             sceneLevel = level;
  257.             if (sceneLevel == 5)
  258.             {
  259.                 success = this.mp.Init();
  260.             }
  261.             else if (sceneLevel == 14)
  262.             {
  263.                 for(int i=0; i<this.fToggleEnabled.Length; i++) this.fToggleEnabled[i] =  false;
  264.                 for(int i=0; i<this.fTogglePin.Length; i++) this.fTogglePin[i] =  false;
  265.                 this.fToggleYodare = false;
  266.             }
  267.         }
  268.  
  269.         public void Update()
  270.         {
  271.             if (sceneLevel == 5 && success) {
  272.                 if (Input.GetKeyDown(KeyCode.F5)) visible = !visible;
  273.  
  274.                 if (!this.uiInputFreeComment)
  275.                 {
  276.                     this.uiInputFreeComment = getUIInputFreeComment();
  277.                 }
  278.             }
  279.             else if (sceneLevel == 14) {
  280.                 if (Input.GetKeyDown(KeyCode.F5)) visible = !visible;
  281.  
  282.                 if (!this.yotogiParamBasicBar)
  283.                 {
  284.                     this.yotogiParamBasicBar = getYotogiParamBasicBar();
  285.                 }
  286.             }
  287.             else
  288.             {
  289.                 if(visible) visible = false;
  290.             }
  291.         }
  292.  
  293.         public void OnGUI()
  294.         {
  295.             if (!visible) return;
  296.            
  297.             if (sceneLevel == 5 && success)
  298.             {
  299.                 Maid maid =  GameMain.Instance.CharacterMgr.GetMaid(0);
  300.                 string freeComment = null;
  301.  
  302.                 if (maid == null) return;
  303.  
  304.                 if (maid.Param != null && maid.Param.status != null && maid.Param.status.free_comment != null)
  305.                 {
  306.                 freeComment = maid.Param.status.free_comment;
  307.                 }
  308.                 if (freeComment == null) return;
  309.  
  310.                 checkModsEnabled(this.mp, freeComment);
  311.                 addModsSlider(this.mp);
  312.                 updateFreeComment(maid, this.mp);
  313.             }
  314.             else if (sceneLevel == 14 && this.yotogiParamBasicBar)
  315.             {
  316.                 Maid maid =  GameMain.Instance.CharacterMgr.GetMaid(0);
  317.                
  318.                 if (maid == null) return;
  319.            
  320.                 addYotogiSlider(maid);
  321.             }
  322.          }
  323.  
  324.     //--------
  325.  
  326.         private void checkModsEnabled(ModsParam mp, string freeComment)
  327.         {
  328.             for(int i=0; i<mp.KeyCount; i++)
  329.             {
  330.                 string key = mp.sKey[i];
  331.                
  332.                 int val_num = mp.ValCount(key);
  333.                
  334.                 Match match = Regex.Match(freeComment, getMatchPattern(mp, key));
  335.                
  336.                 if (match.Groups.Count > val_num)
  337.                 {
  338.                     bool tpf = true;
  339.  
  340.                     for(int j=0; j<val_num; j++)
  341.                     {
  342.                         mp.bEnabled[key] = true;
  343.                         tpf &= Single.TryParse(match.Groups[j + 1].Value, out mp.fValue[key][j]);
  344.                     }
  345.                     if(!tpf) mp.bEnabled[key] = false;
  346.                 }
  347.                 else mp.bEnabled[key] = false;
  348.  
  349.                 if (mp.bForced[key]) mp.bEnabled[key] = true;
  350.             }
  351.         }
  352.  
  353.         private void addModsSlider(ModsParam mp)
  354.          {
  355.             int mod_num = mp.KeyCount;
  356.  
  357.             int margin =         fixPx(10);
  358.             int menuHeight =     fixPx(45);
  359.             int okButtonHeight = fixPx(95);
  360.             int lineC =          fixPx(14);
  361.             int lineH =          fixPx(22);
  362.             int lineH2 =         fixPx(24);
  363.             int lineH3 =         fixPx(30);
  364.             int fontC =          fixPx(11);
  365.             int fontH =          fixPx(14);
  366.             int fontH2 =         fixPx(16);
  367.             int fontH3 =         fixPx(20);
  368.  
  369.             int winTop = margin + menuHeight;
  370.             int winLeft = margin + (int)((Screen.width - margin * 2) * 0.75);
  371.             int winWidth = (int)((Screen.width - margin * 2) * 0.25);
  372.             int winHeight = (int)(Screen.height- winTop - margin - okButtonHeight);
  373.  
  374.             int conTop = lineH3 + margin * 1;
  375.             int conLeft = margin;
  376.             int conWidth = winWidth - margin * 4 ;
  377.             int conHeight = 0;
  378.            
  379.  
  380.             for (int i=0; i<mod_num; i++)
  381.             {
  382.                 string key = mp.sKey[i];
  383.                 if (!mp.bEnabled[key]) continue;
  384.  
  385.                 int val_num = mp.ValCount(key);
  386.  
  387.                 conHeight += lineH2;
  388.                 for (int j=0; j<val_num; j++) conHeight += lineH * 2;
  389.                 conHeight += margin * 2;
  390.             }
  391.  
  392.             Rect outRect = new Rect(winLeft, winTop, winWidth, winHeight);
  393.             GUI.BeginGroup(outRect);
  394.            
  395.             // 下地のボックス
  396.             GUIStyle bStyle = "box";
  397.             outRect.Set(0, 0, winWidth, winHeight);
  398.             bStyle.fontSize = fontC;
  399.             bStyle.alignment = TextAnchor.UpperRight;
  400.             GUI.Box(outRect, AddModsSlider.Version, bStyle);
  401.  
  402.             GUIStyle lStyle = "label";
  403.             lStyle.fontSize = fontH3;
  404.             outRect.Set(margin, margin, conWidth, lineH3);
  405.             GUI.Label(outRect, "Mods Slider", lStyle);
  406.            
  407.             // スクロールビュー
  408.             outRect.Set(0, conTop, winWidth-margin/2, winHeight-conTop-margin);
  409.             scrollViewVector = GUI.BeginScrollView(outRect, scrollViewVector, new Rect (0, 0, conWidth, conHeight));
  410.  
  411.             // 各modスライダーバー
  412.             outRect.Set(margin, 0, conWidth, lineH2);
  413.             for (int i=0; i<mod_num; i++)
  414.             {
  415.                 string key = mp.sKey[i];
  416.                 if (!mp.bEnabled[key]) continue;
  417.  
  418.                 int val_num = mp.ValCount(key);
  419.  
  420.                 for (int j=0; j<val_num; j++)
  421.                 {
  422.                     float value = mp.fValue[key][j];
  423.                     float vmin = mp.fVmin[key][j];
  424.                     float vmax = mp.fVmax[key][j];
  425.                     string label = mp.sLabel[key][j] +" : "+ value.ToString("F");
  426.                     bool isScale = mp.bScale[key][j];
  427.  
  428.                     if (j == 0)
  429.                     {
  430.                         lStyle.fontSize = fontH2;
  431.                         outRect.height = lineH2;
  432.                         GUI.Label(outRect, key, lStyle);
  433.                         outRect.y += outRect.height;
  434.                     }
  435.  
  436.                     outRect.height = lineH;
  437.                     if (value < vmin) value = vmin;
  438.                     if (value > vmax) value = vmax;
  439.                     if (isScale && vmin < 1f)
  440.                     {
  441.                         if (vmin < 0f) vmin = 0f;
  442.                         if (value < 0f) value = 0f;
  443.  
  444.                         float tmp = 0;
  445.                         float tmpmin = -Mathf.Abs(vmax - 1f);
  446.                         float tmpmax = Mathf.Abs(vmax - 1f);
  447.  
  448.                         if (value < 1f)
  449.                         {
  450.                             tmp = Mathf.Abs((1f-value)/(1f-vmin)) * tmpmin;
  451.                         }
  452.                         else tmp = value - 1f;
  453.  
  454.                         if(tmp < tmpmin) tmp = tmpmin;
  455.                         if(tmp > tmpmax) tmp = tmpmax;
  456.  
  457.                         tmp = drawModValueSlider(outRect, tmp, tmpmin, tmpmax, label, fontH);
  458.  
  459.                         if (tmp < 0f)
  460.                         {
  461.                             mp.fValue[key][j] = 1f - tmp/tmpmin * Mathf.Abs(1f-vmin);
  462.                         }
  463.                         else mp.fValue[key][j] = 1f + tmp;
  464.                     }
  465.                     else mp.fValue[key][j] = drawModValueSlider(outRect, value, vmin, vmax, label, fontH);
  466.                     outRect.y += outRect.height * 2;
  467.                 }
  468.  
  469.                 outRect.y += margin*2;
  470.             }
  471.  
  472.             GUI.EndScrollView();
  473.             GUI.EndGroup();
  474.         }
  475.  
  476.         private void addYotogiSlider(Maid maid)
  477.         {
  478.             int mod_num = 3;
  479.  
  480.             int margin =         fixPx(10);
  481.             int margin2 =        fixPx( 5);
  482.             int statusLeft  =    fixPx(14);
  483.             int statusSHeight =  fixPx(20);
  484.             int statusHeight =   fixPx(40);
  485.             int statusWidth  =   fixPx(700);
  486.             int commandWidth =   fixPx(200);
  487.             int btnWidth =       fixPx(100);
  488.             int btnHeight =      fixPx(50);
  489.             int okButtonHeight = fixPx(95);
  490.             int lineC =          fixPx(14);
  491.             int lineC2 =         fixPx(18);
  492.             int lineH =          fixPx(22);
  493.             int lineH2 =         fixPx(24);
  494.             int lineH3 =         fixPx(30);
  495.             int fontC =          fixPx(11);
  496.             int fontC2 =         fixPx(12);
  497.             int fontH =          fixPx(14);
  498.             int fontH2 =         fixPx(16);
  499.             int fontH3 =         fixPx(20);
  500.  
  501.             int winLeft = margin + (int)((Screen.width - margin * 2) * 0.80);
  502.             int winTop = margin + (int)((Screen.height - margin * 2) * 0.32);
  503.             int winWidth = (int)((Screen.width - margin * 2) * 0.18);
  504.             int winHeight = (int)((Screen.height - margin * 2) * 0.68) - okButtonHeight;
  505.  
  506.             int conLeft = margin;
  507.             int conTop =  margin + lineC2;
  508.             int conWidth = winWidth - margin * 2 ;
  509.             int conHeight = winHeight - margin * 2;
  510.            
  511.             Rect outRect = new Rect(winLeft, winTop, winWidth, winHeight);
  512.             GUI.BeginGroup(outRect);
  513.            
  514.             // 下地のボックス
  515.             GUIStyle bStyle = "box";
  516.             outRect.Set(0, 0, winWidth, winHeight);
  517.             bStyle.fontSize = fontC;
  518.             bStyle.alignment = TextAnchor.UpperRight;
  519.             GUI.Box(outRect, AddModsSlider.Version, bStyle);
  520.  
  521.             GUIStyle lStyle = "label";
  522.             lStyle.fontSize = fontH;
  523.             lStyle.alignment = TextAnchor.UpperLeft;
  524.             outRect.Set(margin, margin2, conWidth, lineH);
  525.             GUI.Label(outRect, "Mods Slider", lStyle);
  526.  
  527.             // 各スライダー・ボタン
  528.             lStyle.fontSize = fontC2;
  529.             outRect.Set(conLeft, conTop, conWidth * 0.35f, lineC2);
  530.             GUI.Label(outRect, "Status : ", lStyle);
  531.             outRect.x += outRect.width;
  532.  
  533.             GUIStyle tStyle = "toggle";
  534.             tStyle.fontSize = fontC2;
  535.             tStyle.alignment = TextAnchor.MiddleLeft;
  536.             tStyle.normal.textColor = (this.fToggleEnabled[0]) ? Color.white : Color.red;
  537.             tStyle.hover.textColor = (this.fToggleEnabled[0]) ? Color.white : Color.red;
  538.             outRect.width = conWidth * 0.35f;
  539.             this.fToggleEnabled[0] = GUI.Toggle(outRect, this.fToggleEnabled[0], (this.fToggleEnabled[0]) ? "Enabled" : "Disabled", tStyle);
  540.  
  541.             lStyle.fontSize = fontC2;
  542.             lStyle.alignment = TextAnchor.LowerRight;
  543.             outRect.x = conWidth * 0.9f;
  544.             outRect.width = conWidth * 0.15f;
  545.             GUI.Label(outRect, "固定", lStyle);
  546.  
  547.             int min,max;
  548.             lStyle.alignment = TextAnchor.LowerLeft;
  549.             outRect.Set(conLeft, conTop + lineC2, conWidth, lineC2);
  550.             for (int i=0; i<mod_num; i++)
  551.             {    
  552.                 switch(i)
  553.                 {
  554.                     case 0:
  555.                         min = -100;
  556.                         max = 300;
  557.                         if(!this.fTogglePin[i]) this.fYotogiValue[i] = maid.Param.status.cur_excite;
  558.  
  559.                         outRect.width = conWidth * 0.3f;
  560.                         GUI.Label(outRect, "興奮 : "+ this.fYotogiValue[i], lStyle);
  561.                         outRect.x += outRect.width;
  562.  
  563.                         outRect.width = conWidth * 0.6f;
  564.                          this.fYotogiValue[i] = GUI.HorizontalSlider(outRect, this.fYotogiValue[i], min, max);
  565.                         outRect.x += outRect.width;
  566.  
  567.                         outRect.y -= fixPx(5);
  568.                         outRect.width = conWidth * 0.1f;
  569.                          this.fTogglePin[i] = GUI.Toggle(outRect, this.fTogglePin[i], "");
  570.                         outRect.y += fixPx(5);
  571.                        
  572.                         if(this.fToggleEnabled[0])
  573.                         {
  574.                             maid.Param.SetCurExcite((int)this.fYotogiValue[i]);
  575.                             this.yotogiParamBasicBar.SetCurrentExcite((int)this.fYotogiValue[i], true);
  576.                         }
  577.                         break;
  578.                     case 1:
  579.                         min = 0;
  580.                         max = maid.Param.status.mind + maid.Param.status.maid_class_bonus_status.mind;
  581.                         if(!this.fTogglePin[i]) this.fYotogiValue[i] = maid.Param.status.cur_mind;
  582.  
  583.                         outRect.width = conWidth * 0.3f;
  584.                         GUI.Label(outRect, "精神 : "+ this.fYotogiValue[i], lStyle);
  585.                         outRect.x += outRect.width;
  586.                         outRect.width = conWidth * 0.6f;
  587.                          this.fYotogiValue[i] = GUI.HorizontalSlider(outRect, this.fYotogiValue[i], min, max);
  588.                         outRect.x += outRect.width;
  589.  
  590.                         outRect.y -= fixPx(5);
  591.                         outRect.width = conWidth * 0.1f;
  592.                          this.fTogglePin[i] = GUI.Toggle(outRect, this.fTogglePin[i], "");
  593.                         outRect.y += fixPx(5);
  594.  
  595.                         if(this.fToggleEnabled[0])
  596.                         {
  597.                             maid.Param.SetCurMind((int)this.fYotogiValue[i]);
  598.                             this.yotogiParamBasicBar.SetCurrentMind((int)this.fYotogiValue[i], true);
  599.                         }
  600.                         break;
  601.                     case 2:
  602.                         min = 0;
  603.                         max = maid.Param.status.reason;
  604.                         if(!this.fTogglePin[i]) this.fYotogiValue[i] = maid.Param.status.cur_reason;
  605.  
  606.                         outRect.width = conWidth * 0.3f;
  607.                         GUI.Label(outRect, "理性 : "+ this.fYotogiValue[i], lStyle);
  608.                         outRect.x += outRect.width;
  609.  
  610.                         outRect.width = conWidth * 0.6f;
  611.                          this.fYotogiValue[i] = GUI.HorizontalSlider(outRect, this.fYotogiValue[i], min, max);
  612.                         outRect.x += outRect.width;
  613.  
  614.                         outRect.y -= fixPx(5);
  615.                         outRect.width = conWidth * 0.1f;
  616.                          this.fTogglePin[i] = GUI.Toggle(outRect, this.fTogglePin[i], "");
  617.                         outRect.y += fixPx(5);
  618.  
  619.                         if(this.fToggleEnabled[0])
  620.                         {
  621.                             maid.Param.SetCurReason((int)this.fYotogiValue[i]);
  622.                             this.yotogiParamBasicBar.SetCurrentReason((int)this.fYotogiValue[i], true);
  623.                         }
  624.                         break;
  625.                     default: break;
  626.                 }
  627.                 outRect.x = conLeft;
  628.                 outRect.y += outRect.height;
  629.             }
  630.             outRect.y += margin2;
  631.  
  632.             outRect.width = conWidth * 0.35f;
  633.             GUI.Label(outRect, "FaceBlend :", lStyle);
  634.             outRect.x += outRect.width;
  635.  
  636.             outRect.width = conWidth * 0.35f;
  637.             GUIStyle t1Style = "toggle";
  638.             t1Style.alignment = TextAnchor.MiddleLeft;
  639.             t1Style.normal.textColor = (this.fToggleEnabled[1]) ? Color.white : Color.red;
  640.             t1Style.hover.textColor = (this.fToggleEnabled[1]) ? Color.white : Color.red;
  641.             this.fToggleEnabled[1] = GUI.Toggle(outRect, this.fToggleEnabled[1], (this.fToggleEnabled[1]) ? "Enabled" : "Disabled", t1Style);
  642.             outRect.x += outRect.width;
  643.             outRect.width = conWidth * 0.30f;
  644.             GUIStyle t2Style = "toggle";
  645.             t2Style.alignment = TextAnchor.MiddleLeft;
  646.             t2Style.hover.textColor = (this.fToggleYodare) ? Color.white : Color.white;
  647.             t2Style.normal.textColor = (this.fToggleYodare) ? Color.white : Color.white;
  648.             this.fToggleYodare = GUI.Toggle(outRect, this.fToggleYodare, (this.fToggleYodare) ? "よだれ有" : "よだれ無", t2Style);
  649.             outRect.y += outRect.height;
  650.  
  651.             string tmp = "";
  652.             GUIStyle btnStyle = "button";
  653.             btnStyle.fontSize = fontC;
  654.             outRect.x = conLeft;
  655.             outRect.width = conWidth;
  656.             for(int i=0; i<iFaceBlend.Length; i++)
  657.             {
  658.                 this.iFaceBlend[i] = GUI.SelectionGrid(outRect, this.iFaceBlend[i], sFaceBlend[i], 4, btnStyle);
  659.                 tmp += sFaceBlend[i][iFaceBlend[i]];
  660.                 outRect.y += outRect.height;
  661.             }
  662.             if(this.fToggleEnabled[1])
  663.             {
  664.                 if (this.fToggleYodare) tmp += "よだれ";
  665.                 maid.FaceBlend(tmp);
  666.             }
  667.  
  668.             outRect.y += margin2;
  669.  
  670.             tStyle.normal.textColor = Color.white;
  671.             outRect.x = conLeft;
  672.             GUI.Label(outRect, "FaceAnime :", lStyle);
  673.             outRect.y += outRect.height;
  674.            
  675.             outRect.width = conWidth * 0.25f;
  676.             outRect.y += this.drawEroFaceAnimeButton(outRect, maid) * outRect.height;
  677.  
  678.             GUI.EndGroup();
  679.         }
  680.  
  681.         private void updateFreeComment(Maid maid, ModsParam mp)
  682.         {
  683.             string freeComment = maid.Param.status.free_comment;
  684.  
  685.             for(int i=0; i<mp.KeyCount; i++)
  686.             {
  687.                 string key = mp.sKey[i];
  688.                 int vnum = mp.ValCount(key);
  689.  
  690.                 if (mp.bEnabled[key])
  691.                 {
  692.                     freeComment = Regex.Replace(freeComment, getMatchPattern(mp, key), "");
  693.                     string ws = @"#" + key;
  694.  
  695.                     for(int j=0; j<vnum; j++)
  696.                     {
  697.                         ws +=  (j == 0) ? "=" : ",";
  698.                         ws += mp.fValue[key][j].ToString("F2");
  699.                     }
  700.  
  701.                     ws += "#";
  702.                    
  703.                     freeComment += ws;
  704.                 }
  705.             }
  706.  
  707.             if(this.uiInputFreeComment) this.uiInputFreeComment.value = freeComment;
  708.             else maid.Param.SetFreeComment(freeComment);
  709.         }
  710.  
  711.     //--------
  712.    
  713.         private float drawModValueSlider(Rect outRect, float value, float min, float max, string label, int fsize)
  714.         {
  715.             GUIStyle lStyle = "label";
  716.             lStyle.fontSize = fsize;
  717.             GUI.Label(outRect, label, lStyle);
  718.  
  719.             outRect.y += outRect.height;
  720.              value = GUI.HorizontalSlider(outRect, value, min, max);
  721.             return value;
  722.         }
  723.  
  724.         private int drawEroFaceAnimeButton(Rect outRect, Maid maid)
  725.         {
  726.             int j = 0;
  727.             for(int i = 0; i<this.sEroFaceAnime.Length; i++)
  728.             {
  729.                 if(GUI.Button(outRect, this.sEroFaceAnime[i]))
  730.                 {
  731.                     maid.FaceAnime("エロ" + this.sEroFaceAnime[i], 1f, 0);
  732.                 }
  733.  
  734.                 if((i + 1) % 4 == 0)
  735.                 {
  736.                     outRect.x -= outRect.width*3;
  737.                     outRect.y += outRect.height;
  738.                     if (j == 4 || j == 7) outRect.y += fixPx(5);
  739.                     j++;
  740.                 }
  741.                 else outRect.x += outRect.width;
  742.             }
  743.            
  744.             return j;
  745.         }
  746.  
  747.         private int fixPx(int px)
  748.         {
  749.             float mag = 1f + (Screen.width/1280f - 1f) * 0.6f;
  750.  
  751.             return (int)(mag * px);
  752.         }
  753.        
  754.         private string getMatchPattern(ModsParam mp, string key)
  755.         {
  756.             string s = "#" + key;
  757.             int val_num = mp.ValCount(key);
  758.            
  759.             for(int j=0; j<val_num; j++)
  760.             {
  761.                 s += (j==0) ? "=" : ",";
  762.                
  763.                 if(mp.sMatchPattern[key][j] == "")
  764.                 {
  765.                     s += mp.DefMatchPattern;
  766.                 }
  767.                 else
  768.                 {
  769.                     s += mp.sMatchPattern[key][j];
  770.                 }                
  771.             }
  772.             s += "#";
  773.            
  774.             return s;
  775.         }
  776.  
  777.     //--------
  778.    
  779.         // 改造スレその2 >>192
  780.         private UIInput getUIInputFreeComment()
  781.         {
  782.             BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
  783.  
  784.             ProfileMgr profileMgr = BaseMgr<ProfileMgr>.Instance;
  785.             if (profileMgr == null) return null;
  786.  
  787.             FieldInfo field_m_profileCtrl = typeof(ProfileMgr).GetField("m_profileCtrl", bf);
  788.             if (field_m_profileCtrl == null) return null;
  789.  
  790.             ProfileCtrl profileCtrl = (ProfileCtrl)field_m_profileCtrl.GetValue(profileMgr);
  791.             if (profileCtrl == null) return null;
  792.  
  793.             FieldInfo field_m_inFreeComment = typeof(ProfileCtrl).GetField("m_inFreeComment", bf);
  794.             if (field_m_inFreeComment == null) return null;
  795.  
  796.             UIInput uiInputFreeComment = (UIInput)field_m_inFreeComment.GetValue(profileCtrl);
  797.             if (uiInputFreeComment == null) return null;
  798.  
  799.             return uiInputFreeComment;
  800.         }
  801.  
  802.         private YotogiParamBasicBar getYotogiParamBasicBar()
  803.         {
  804.             YotogiParamBasicBar ypbb = BaseMgr<YotogiParamBasicBar>.Instance;
  805.             if (ypbb == null) return null;
  806.  
  807.             return ypbb;
  808.         }
  809.  
  810.     }
  811.  
  812. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement