Advertisement
cm3d2-01

CM3D2.AddModsSlider.Plugin.0.0.4.5

Aug 27th, 2015
2,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 24.68 KB | None | 0 0
  1. // CM3D2.AddModsSlider.Plugin.0.0.4.5 : フリーコメント欄の各modパラメータをスライドバーで操作する UnityInjector 用プラグイン
  2.  
  3. // 必須ファイル: \CM3D2\UnityInjector\Config\ModsParam.xml
  4. // (サンプル: http://pastebin.com/hL2T3pP9 ) modパラメータ定義xml
  5. //
  6. // メイドエディット画面中にF5でUI表示トグル。 ( http://i.imgur.com/u4OeSlV.png )
  7. // コメント欄で操作する数値をスライドバーで調整する事が可能。
  8. //
  9.  
  10. // 更新履歴
  11. // 0.0.4.5 UIを0.1.0.5と同等に更新。
  12. //         コメント欄文字数を表示するように。
  13. //         夜伽スライダー分離。
  14. // 0.0.3.4 夜伽時に興奮・精神・理性を変更できるスライドバーを追加。
  15. //         夜伽時にFaceBlend(頬・涙・よだれの組合せ)とFaceAnime(エロ○○系表情)を選べるボタンを追加。
  16. // 0.0.2.3 フォントサイズがウィンドウ幅と比例する様に。
  17. //         スクロールバーが滑らかに。
  18. //         ModsParam.xmlの<mod>属性 forced="..." が正常に機能していなかったのを修正。
  19. //         リフレクションがフレーム毎に実行されてたのを修正。(軽量化)
  20. // 0.0.2.2 ModsParam.xmlの書式を変更。
  21. //         ModsParam.xmlで<mod>の属性に forced="true" 指定で、フリーコメント欄にかかわらずそのmodのスライダーが表示される様に。
  22. //         <value>の属性でtype="scale"指定の時、最小値をスライダーに反映してなかったのを修正。
  23. // 0.0.1.1 各mod定義をxmlファイルにして読み込む様に。
  24. //         スライダーバーとフリーコメント欄が連動する様に。(改造スレその2>>192)
  25. //         EYEBALL,TEST_EYE_ANGの縦横が逆だったのを修正。
  26. // 0.0.0.0 初版
  27.  
  28. using System;
  29. using System.Collections.Generic;
  30. using System.IO;
  31. using System.Reflection;
  32. using System.Text;
  33. using System.Text.RegularExpressions;
  34. using System.Xml;
  35. using UnityEngine;
  36. using UnityInjector.Attributes;
  37.  
  38. namespace CM3D2.AddModsSlider.Plugin
  39. {
  40.     [PluginFilter("CM3D2x64"),
  41.     PluginFilter("CM3D2x86"),
  42.     PluginFilter("CM3D2VRx64"),
  43.     PluginName("CM3D2 AddModsSlider"),
  44.     PluginVersion("0.0.4.5")]
  45.     public class AddModsSlider : UnityInjector.PluginBase
  46.     {
  47.         public const string Version = "0.0.4.5";
  48.  
  49.         private const int MAX_FREE_COMMENT_LENGTH = 304;
  50.  
  51.         private int sceneLevel;
  52.         private bool visible = false;
  53.         private bool xmlLoad = false;
  54.         private bool oneLoad = false;
  55.         private ModsParam mp;
  56.         private PixelValues pv;
  57.  
  58.         private Maid maid;
  59.         private string freeComment;
  60.         private Rect winRect;
  61.         private Vector2 lastScreenSize;
  62.         private UIInput uiInputFreeComment;
  63.  
  64.         private float modsSliderWidth = 0.25f;
  65.          private Vector2 scrollViewVector = Vector2.zero;
  66.  
  67.         private class ModsParam
  68.         {
  69.             public readonly string DefMatchPattern = @"([-+]?[0-9]*\.?[0-9]+)";
  70.             public readonly string XmlFileName = Directory.GetCurrentDirectory() + @"\UnityInjector\Config\ModsParam.xml";
  71.  
  72.             public string XmlFormat;
  73.             public List<string> sKey = new List<string>();
  74.  
  75.             public Dictionary<string, string>   sDescription  = new Dictionary<string, string>();
  76.             public Dictionary<string, bool>     bForced       = new Dictionary<string, bool>();
  77.             public Dictionary<string, bool>     bEnabled      = new Dictionary<string, bool>();
  78.             public Dictionary<string, string>   sType         = new Dictionary<string, string>();
  79.  
  80.             public Dictionary<string, string[]> sPropName     = new Dictionary<string, string[]>();
  81.             public Dictionary<string, Dictionary<string, float>>  fValue        = new Dictionary<string, Dictionary<string, float>>();
  82.             public Dictionary<string, Dictionary<string, float>>  fVmin         = new Dictionary<string, Dictionary<string, float>>();
  83.             public Dictionary<string, Dictionary<string, float>>  fVmax         = new Dictionary<string, Dictionary<string, float>>();
  84.             public Dictionary<string, Dictionary<string, string>> sVType        = new Dictionary<string, Dictionary<string, string>>();
  85.             public Dictionary<string, Dictionary<string, string>> sLabel        = new Dictionary<string, Dictionary<string, string>>();
  86.             public Dictionary<string, Dictionary<string, string>> sMatchPattern = new Dictionary<string, Dictionary<string, string>>();
  87.  
  88.             public int KeyCount { get{return sKey.Count;} }
  89.             public int ValCount(string key) { return sPropName[key].Length; }
  90.  
  91.         //--------
  92.  
  93.             public ModsParam()
  94.             {
  95.                 Init();
  96.             }
  97.  
  98.             public bool Init()
  99.             {
  100.                 if(!loadModsParamXML())
  101.                 {
  102.                     Debug.LogError("AddModsSlider : loadModsParamXML() failed.");
  103.                     return false;
  104.                 }
  105.  
  106.                 return true;
  107.             }
  108.  
  109.  
  110.             private bool loadModsParamXML()
  111.             {
  112.                 if (!File.Exists(XmlFileName))
  113.                 {
  114.                     Debug.LogError("AddModsSlider : \"" + XmlFileName + "\" does not exist.");
  115.                     return false;
  116.                 }
  117.  
  118.                 XmlDocument doc = new XmlDocument();
  119.                 doc.Load(XmlFileName);
  120.  
  121.                  XmlNode mods = doc.DocumentElement;
  122.                  XmlFormat = ((XmlElement)mods).GetAttribute("format");
  123.                 if (XmlFormat != "1.1")
  124.                 {
  125.                     Debug.LogError("AddModsSlider : "+ AddModsSlider.Version +" requires fomart=\"1.1\" of ModsParam.xml.");
  126.                     return false;
  127.                 }
  128.  
  129.                 XmlNodeList modNodeS = mods.SelectNodes("/mods/mod");
  130.                 if (!(modNodeS.Count > 0))
  131.                 {
  132.                     Debug.LogError("AddModsSlider :  \"" + XmlFileName + "\" has no <mod>elements.");
  133.                     return false;
  134.                 }
  135.  
  136.                 sKey.Clear();
  137.  
  138.                 foreach(XmlNode modNode in modNodeS)
  139.                 {    
  140.                     // mod属性
  141.                     string key = ((XmlElement)modNode).GetAttribute("id");
  142.                     if(key != "" && !sKey.Contains(key)) sKey.Add(key);
  143.                     else continue;
  144.  
  145.                     bool f = false;
  146.                     sDescription[key] = ((XmlElement)modNode).GetAttribute("description");
  147.                     bEnabled[key] = (Boolean.TryParse(((XmlElement)modNode).GetAttribute("enabled"), out f)) ? f : true;
  148.                     bForced[key] = (Boolean.TryParse(((XmlElement)modNode).GetAttribute("forced"), out f)) ? f : true;
  149.  
  150.                     sType[key] = ((XmlElement)modNode).GetAttribute("type");
  151.                     if (sType[key] == "") sType[key] = "slider";
  152.                     if (sType[key] == "toggle") continue;
  153.  
  154.                     XmlNodeList valueNodeS = ((XmlElement)modNode).GetElementsByTagName("value");
  155.                     if (!(valueNodeS.Count > 0)) continue;
  156.  
  157.                     sPropName[key]     = new string[valueNodeS.Count];
  158.                     fValue[key]        = new Dictionary<string, float>();
  159.                     fVmin[key]         = new Dictionary<string, float>();
  160.                     fVmax[key]         = new Dictionary<string, float>();
  161.                     sVType[key]        = new Dictionary<string, string>();
  162.                     sLabel[key]        = new Dictionary<string, string>();
  163.                     sMatchPattern[key] = new Dictionary<string, string>();
  164.                    
  165.                     // value属性
  166.                     int j = 0;
  167.                     foreach (XmlNode valueNode in valueNodeS)
  168.                     {
  169.                         float x = 0f;
  170.                        
  171.                         string prop = ((XmlElement)valueNode).GetAttribute("prop_name");
  172.                         if (prop != "" && Array.IndexOf(sPropName[key], prop) < 0 ) sPropName[key][j] = prop;
  173.                         else
  174.                         {    
  175.                             sKey.Remove(key);
  176.                             break;
  177.                         }
  178.                        
  179.                         fValue[key][prop]  = Single.TryParse(((XmlElement)valueNode).GetAttribute("default"), out x) ? x : 0f;;
  180.                         fVmin[key][prop]   = Single.TryParse(((XmlElement)valueNode).GetAttribute("min"), out x) ? x : 0f;
  181.                         fVmax[key][prop]   = Single.TryParse(((XmlElement)valueNode).GetAttribute("max"), out x) ? x : 0f;
  182.  
  183.                         sVType[key][prop] = ((XmlElement)valueNode).GetAttribute("type");
  184.                         switch (sVType[key][prop])
  185.                         {
  186.                             case "num":   break;
  187.                             case "scale": break;
  188.                             case "int" : break;
  189.                             default : sVType[key][prop] = "num"; break;
  190.                         }
  191.  
  192.                         sLabel[key][prop] = ((XmlElement)valueNode).GetAttribute("label");
  193.                         sMatchPattern[key][prop] = ((XmlElement)valueNode).GetAttribute("match_pattern");
  194.  
  195.                         j++;
  196.                     }
  197.                     if (j == 0) sKey.Remove(key);
  198.                 }
  199.                
  200.                 return true;
  201.             }
  202.  
  203.  
  204.         }
  205.  
  206.         private class PixelValues
  207.         {
  208.             public float BaseWidth = 1280f;
  209.             public float PropRatio = 0.6f;
  210.             public int Margin;
  211.  
  212.             private Dictionary<string, int> font = new Dictionary<string, int>();
  213.             private Dictionary<string, int> line = new Dictionary<string, int>();
  214.             private Dictionary<string, int> sys =  new Dictionary<string, int>();
  215.  
  216.             public PixelValues()
  217.             {
  218.                 Margin = PropPx(10);
  219.  
  220.                 font["C1"] = 11;
  221.                 font["C2"] = 12;
  222.                 font["H1"] = 14;
  223.                 font["H2"] = 16;
  224.                 font["H3"] = 20;
  225.  
  226.                 line["C1"] = 14;
  227.                 line["C2"] = 18;
  228.                 line["H1"] = 22;
  229.                 line["H2"] = 24;
  230.                 line["H3"] = 30;
  231.  
  232.                 sys["Menu.Height"] = 45;
  233.                 sys["OkButton.Height"] = 95;
  234.  
  235.                 sys["HScrollBar.Width"] = 15;
  236.             }
  237.            
  238.             public int Font(string key) { return PropPx(font[key]); }
  239.             public int Line(string key) { return PropPx(line[key]); }
  240.             public int Sys(string key)  { return PropPx(sys[key]); }
  241.  
  242.             public int Font_(string key) { return font[key]; }
  243.             public int Line_(string key) { return line[key]; }
  244.             public int Sys_(string key)  { return sys[key]; }
  245.  
  246.             public Rect PropScreen(float left, float top, float width, float height)
  247.             {
  248.                 return new Rect((int)((Screen.width - Margin * 2) * left + Margin)
  249.                                ,(int)((Screen.height - Margin * 2) * top + Margin)
  250.                                ,(int)((Screen.width - Margin * 2) * width)
  251.                                ,(int)((Screen.height - Margin * 2) * height));
  252.             }
  253.  
  254.             public Rect PropScreenMH(float left, float top, float width, float height)
  255.             {
  256.                 Rect r = PropScreen(left, top, width, height);
  257.                 r.y += Sys("Menu.Height");
  258.                 r.height -= (Sys("Menu.Height") + Sys("OkButton.Height"));
  259.                
  260.                 return r;
  261.             }
  262.  
  263.             public Rect PropScreenMH(float left, float top, float width, float height, Vector2 last)
  264.             {
  265.                 Rect r = PropScreen((float)(left/(last.x - Margin * 2)), (float)(top/(last.y - Margin * 2)), width, height);
  266.                 r.height -= (Sys("Menu.Height") + Sys("OkButton.Height"));
  267.                
  268.                 return r;
  269.             }
  270.  
  271.             public Rect InsideRect(Rect rect)
  272.             {
  273.                 return new Rect(Margin, Margin, rect.width - Margin * 2, rect.height - Margin * 2);
  274.             }
  275.  
  276.             public Rect InsideRect(Rect rect, int height)
  277.             {
  278.                 return new Rect(Margin, Margin, rect.width - Margin * 2, height);
  279.             }
  280.  
  281.             public int PropPx(int px)
  282.             {
  283.                 return (int)(px * (1f + (Screen.width/BaseWidth - 1f) * PropRatio));
  284.             }
  285.         }
  286.  
  287.         public void Awake()
  288.         {
  289.             mp = new ModsParam();
  290.             pv = new PixelValues();
  291.             lastScreenSize = new Vector2(Screen.width, Screen.height);
  292.         }
  293.  
  294.         public void OnLevelWasLoaded(int level)
  295.         {
  296.             sceneLevel = level;
  297.             if (sceneLevel == 5)
  298.             {
  299.                 xmlLoad = mp.Init();
  300.                 oneLoad = false;
  301.                 winRect = pv.PropScreenMH(1f - modsSliderWidth, 0f, modsSliderWidth, 1f);
  302.             }
  303.         }
  304.  
  305.         public void Update()
  306.         {
  307.             if (sceneLevel == 5 && xmlLoad)
  308.              {
  309.                 if (Input.GetKeyDown(KeyCode.F5)) visible = !visible;
  310.  
  311.                 if (!uiInputFreeComment)
  312.                 {
  313.                     uiInputFreeComment = getUIInputFreeComment();
  314.                 }
  315.             }
  316.             else
  317.             {
  318.                 if(visible) visible = false;
  319.             }
  320.         }
  321.  
  322.         public void OnGUI()
  323.         {
  324.             if (!visible) return;
  325.            
  326.             GUIStyle winStyle = "box";
  327.             winStyle.fontSize = pv.Font("C1");
  328.             winStyle.alignment = TextAnchor.UpperRight;
  329.  
  330.             if (sceneLevel == 5 && xmlLoad && uiInputFreeComment)
  331.             {
  332.                 freeComment = null;
  333.                 maid =  GameMain.Instance.CharacterMgr.GetMaid(0);
  334.                 if (maid == null) return;
  335.  
  336.                 if (maid.Param != null && maid.Param.status != null && maid.Param.status.free_comment != null)
  337.                 {
  338.                     freeComment = maid.Param.status.free_comment;
  339.                 }
  340.  
  341.                 if (GUI.changed || !oneLoad) checkFreeComment();
  342.                 if (lastScreenSize != new Vector2(Screen.width, Screen.height))
  343.                 {
  344.                     winRect = pv.PropScreenMH(winRect.x, winRect.y, modsSliderWidth, 1f, lastScreenSize);
  345.                     lastScreenSize = new Vector2(Screen.width, Screen.height);
  346.                 }
  347.                 winRect = GUI.Window(0, winRect, addModsSlider, AddModsSlider.Version, winStyle);
  348.                 oneLoad = true;
  349.             }
  350.         }
  351.  
  352.  
  353.     //--------
  354.  
  355.         private void addModsSlider(int winID)
  356.         {
  357.             int mod_num = mp.KeyCount;
  358.             Rect baseRect = pv.InsideRect(this.winRect);
  359.             Rect headerRect = new Rect(baseRect.x, baseRect.y, baseRect.width, pv.Line("H3"));
  360.             Rect scrollRect = new Rect(baseRect.x, baseRect.y + headerRect.height + pv.Margin
  361.                                       ,baseRect.width + pv.PropPx(5), baseRect.height - headerRect.height - pv.Margin);
  362.             Rect conRect = new Rect(0, 0 ,scrollRect.width - pv.Sys_("HScrollBar.Width") - pv.Margin , 0);
  363.             Rect outRect = new Rect();
  364.             GUIStyle lStyle = "label";
  365.             GUIStyle tStyle = "toggle";
  366.             Color color = new Color(1f, 1f, 1f, 0.9f);
  367.  
  368.  
  369.             lStyle.normal.textColor = color;
  370.             lStyle.alignment = TextAnchor.UpperLeft;
  371.  
  372.             for (int i=0; i<mod_num; i++)
  373.             {
  374.                 string key = mp.sKey[i];
  375.  
  376.                 conRect.height += pv.Line("H1");
  377.                 if(mp.sType[key] != "toggle" && mp.bEnabled[key])
  378.                 {
  379.                     for (int j=0; j<mp.ValCount(key); j++) conRect.height += pv.Line("H1");
  380.                     conRect.height += pv.Margin * 2;
  381.                 }
  382.                 else conRect.height += pv.Margin;
  383.             }
  384.  
  385.             lStyle.fontSize = pv.Font("H3");
  386.             drawWinHeader(headerRect, "Mods Slider", lStyle);
  387.  
  388.             // スクロールビュー
  389.             scrollViewVector = GUI.BeginScrollView(scrollRect, scrollViewVector, conRect);
  390.  
  391.             // 各modスライダー
  392.             outRect.Set(0, 0, conRect.width, 0);
  393.             for (int i=0; i<mod_num; i++)
  394.             {
  395.                 string key = mp.sKey[i];
  396.        
  397.                 //----
  398.                 outRect.width = conRect.width;
  399.                 outRect.height  = pv.Line("H1");
  400.                 tStyle.fontSize = pv.Font("H1");
  401.                 mp.bEnabled[key] = GUI.Toggle(outRect, mp.bEnabled[key], mp.sDescription[key]+" ("+key+")", tStyle);
  402.                 outRect.y += outRect.height;
  403.  
  404.                 if (mp.sType[key] == "toggle" || !mp.bEnabled[key])
  405.                 {
  406.                     outRect.y += pv.Margin;
  407.                     continue;
  408.                 }
  409.                 //----
  410.  
  411.                 int val_num = mp.ValCount(key);
  412.                 for (int j=0; j<val_num; j++)
  413.                 {
  414.                     string prop = mp.sPropName[key][j];
  415.                    
  416.                     float value = mp.fValue[key][prop];
  417.                     float vmin = mp.fVmin[key][prop];
  418.                     float vmax = mp.fVmax[key][prop];
  419.                     string label = mp.sLabel[key][prop] +" : "+ value.ToString("F");
  420.                     string vType = mp.sVType[key][prop];
  421.  
  422.                     outRect.width = conRect.width;
  423.                     outRect.height  = pv.Line("H1");
  424.                     lStyle.fontSize = pv.Font("H1");
  425.                     if (value < vmin) value = vmin;
  426.                     if (value > vmax) value = vmax;
  427.                     if (vType == "scale" && vmin < 1f)
  428.                     {
  429.                         if (vmin < 0f) vmin = 0f;
  430.                         if (value < 0f) value = 0f;
  431.  
  432.                         float tmpmin = -Mathf.Abs(vmax - 1f);
  433.                         float tmpmax = Mathf.Abs(vmax - 1f);
  434.                         float tmp = (value < 1f) ? tmp = Mathf.Abs((1f-value)/(1f-vmin)) * tmpmin : value - 1f;
  435.  
  436.                         if(tmp < tmpmin) tmp = tmpmin;
  437.                         if(tmp > tmpmax) tmp = tmpmax;
  438.  
  439.                         tmp = drawModValueSlider(outRect, tmp, tmpmin, tmpmax, label, lStyle);
  440.  
  441.                         mp.fValue[key][prop] = (tmp < 0f) ? 1f - tmp/tmpmin * Mathf.Abs(1f-vmin) : 1f + tmp;
  442.                     }
  443.                     else if (vType == "int")
  444.                     {
  445.                         value = (int)Mathf.Round(value);
  446.                         mp.fValue[key][prop] = (int)Mathf.Round(drawModValueSlider(outRect, value, vmin, vmax, label, lStyle));
  447.                     }
  448.                     else mp.fValue[key][prop] = drawModValueSlider(outRect, value, vmin, vmax, label, lStyle);
  449.  
  450.                     outRect.y += outRect.height;
  451.                 }
  452.  
  453.                 outRect.y += pv.Margin * 2;
  454.             }
  455.  
  456.             GUI.EndScrollView();
  457.             if (GUI.changed || !oneLoad) updateFreeComment();
  458.             drawCommentNum(headerRect);
  459.             GUI.DragWindow();
  460.         }
  461.  
  462.         private void drawWinHeader(Rect rect, string s, GUIStyle style)
  463.         {
  464.             GUI.Label(rect, s, style);
  465.             {
  466.                 ;
  467.             }
  468.         }
  469.  
  470.         private float drawModValueSlider(Rect outRect, float value, float min, float max, string label, GUIStyle lstyle)
  471.         {
  472.             float conWidth = outRect.width;
  473.            
  474.             outRect.width = conWidth * 0.3f;
  475.             GUI.Label(outRect, label, lstyle);
  476.             outRect.x += outRect.width;
  477.            
  478.             outRect.width = conWidth * 0.7f;
  479.             outRect.y += pv.PropPx(5);
  480.             return GUI.HorizontalSlider(outRect, value, min, max);
  481.         }
  482.  
  483.         private void drawCommentNum(Rect outRect)
  484.         {
  485.             int n = freeComment.Length;
  486.             GUIStyle lStyle = "label";
  487.             lStyle.fontSize = pv.Font("C1");
  488.             lStyle.alignment = TextAnchor.LowerRight;
  489.  
  490.             if (n >= AddModsSlider.MAX_FREE_COMMENT_LENGTH)
  491.             {
  492.                 lStyle.normal.textColor = Color.red;
  493.                 GUI.Label(outRect, "コメント欄文字数オーバー", lStyle);
  494.             }
  495.             else
  496.             {
  497.                 lStyle.normal.textColor = Color.white;
  498.                 GUI.Label(outRect, "文字数(max:"+ AddModsSlider.MAX_FREE_COMMENT_LENGTH +") = " + n, lStyle);
  499.             }
  500.         }
  501.  
  502.     //--------
  503.  
  504.         private void checkFreeComment()
  505.         {
  506.             for(int i=0; i<mp.KeyCount; i++)
  507.             {
  508.                 string key = mp.sKey[i];
  509.            
  510.                 Match match = Regex.Match(freeComment, getMatchPattern(key));
  511.                
  512.                 if (mp.sType[key] == "toggle")
  513.                 {
  514.                      mp.bEnabled[key] = (match.Groups.Count > 1) ? true : false;
  515.                 }
  516.                 else if (match.Groups.Count > mp.ValCount(key))
  517.                 {
  518.                     int val_num = mp.ValCount(key);
  519.                     bool tpf = true;
  520.  
  521.                     for(int j=0; j<val_num; j++)
  522.                     {
  523.                         float f = 0f;
  524.                         string prop = mp.sPropName[key][j];
  525.                    
  526.                         mp.bEnabled[key] = true;
  527.                         tpf &= Single.TryParse(match.Groups[j + 1].Value, out f);
  528.                         if(tpf) mp.fValue[key][prop] = f;
  529.  
  530.                     }
  531.                     if(!tpf) mp.bEnabled[key] = false;
  532.                 }
  533.                 else mp.bEnabled[key] = false;
  534.             }
  535.         }
  536.  
  537.         private void updateFreeComment()
  538.         {
  539.             freeComment = "";
  540.             for(int i=0; i<mp.KeyCount; i++)
  541.             {
  542.                 string key = mp.sKey[i];
  543.  
  544.                 if (mp.bEnabled[key])
  545.                 {
  546.                     //freeComment = Regex.Replace(freeComment, getMatchPattern(key), "");
  547.  
  548.                     if (mp.sType[key] == "toggle")
  549.                     {
  550.                         freeComment += @"#"+ key +@"#";
  551.                     }
  552.                     else
  553.                     {
  554.                         int vnum = mp.ValCount(key);
  555.                         string ws = @"#" + key;
  556.  
  557.                         for(int j=0; j<vnum; j++)
  558.                         {
  559.                             string prop = mp.sPropName[key][j];
  560.  
  561.                             ws +=  (j == 0) ? "=" : ",";
  562.                             ws += mp.fValue[key][prop].ToString("F2");
  563.                         }
  564.  
  565.                         ws += "#";
  566.                    
  567.                         freeComment += ws;
  568.                     }
  569.                 }
  570.             }
  571.  
  572.             uiInputFreeComment.value = freeComment;
  573.             //maid.Param.SetFreeComment(freeComment);
  574.         }
  575.  
  576.         private string getMatchPattern(string key)
  577.         {
  578.             if (mp.sType[key] == "toggle") return "#("+ key + ")#";
  579.              
  580.             string s = "#" + key;
  581.             int val_num = mp.ValCount(key);
  582.            
  583.             for(int j=0; j<val_num; j++)
  584.             {
  585.                  string prop = mp.sPropName[key][j];
  586.                 s += (j==0) ? "=" : ",";
  587.                
  588.                 if(mp.sMatchPattern[key][prop] == "")
  589.                 {
  590.                     s += mp.DefMatchPattern;
  591.                 }
  592.                 else
  593.                 {
  594.                     s += mp.sMatchPattern[key][prop];
  595.                 }                
  596.             }
  597.             s += "#";
  598.            
  599.             return s;
  600.         }
  601.  
  602.     //--------
  603.    
  604.         // 改造スレその2 >>192
  605.         private UIInput getUIInputFreeComment()
  606.         {
  607.             BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
  608.  
  609.             ProfileMgr profileMgr = BaseMgr<ProfileMgr>.Instance;
  610.             if (profileMgr == null) return null;
  611.  
  612.             FieldInfo field_m_profileCtrl = typeof(ProfileMgr).GetField("m_profileCtrl", bf);
  613.             if (field_m_profileCtrl == null) return null;
  614.  
  615.             ProfileCtrl profileCtrl = (ProfileCtrl)field_m_profileCtrl.GetValue(profileMgr);
  616.             if (profileCtrl == null) return null;
  617.  
  618.             FieldInfo field_m_inFreeComment = typeof(ProfileCtrl).GetField("m_inFreeComment", bf);
  619.             if (field_m_inFreeComment == null) return null;
  620.  
  621.             UIInput uiInputFreeComment = (UIInput)field_m_inFreeComment.GetValue(profileCtrl);
  622.             if (uiInputFreeComment == null) return null;
  623.  
  624.             return uiInputFreeComment;
  625.           }
  626.     }
  627.  
  628. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement