├── UnityInjector ├── CM3D2.AddYotogiSlider.Plugin.dll └── Config │ └── AddYotogiSlider.ini ├── README.md └── CM3D2.AddYotogiSlider.Plugin.cs /UnityInjector/CM3D2.AddYotogiSlider.Plugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CM3D2-01/CM3D2.AddYotogiSlider.Plugin/HEAD/UnityInjector/CM3D2.AddYotogiSlider.Plugin.dll -------------------------------------------------------------------------------- /UnityInjector/Config/AddYotogiSlider.ini: -------------------------------------------------------------------------------- 1 | ; AddYotogiSliderの設定ファイル 2 | 3 | 4 | [AutoAHE] 5 | ; AHEレベルが変わるのに必要な絶頂回数 6 | OrgasmsPerLevel=3 7 | 8 | ; 放置時の1フレーム当たりの瞳自然降下量 9 | EyeDecrement=0.00333 10 | 11 | ; AHEレベル毎のAHE発動興奮閾値 12 | ExciteThreshold_0=267 13 | ExciteThreshold_1=233 14 | ExciteThreshold_2=200 15 | 16 | ; AHEレベル毎の通常時の瞳上昇最大値 17 | NormalEyeMax_0=40 18 | NormalEyeMax_1=45 19 | NormalEyeMax_2=50 20 | 21 | ; AHEレベル毎の絶頂時の瞳上昇最大値 22 | OrgasmEyeMax_0=50 23 | OrgasmEyeMax_1=60 24 | OrgasmEyeMax_2=70 25 | 26 | ; AHEレベル毎の絶頂アニメーションの瞳終端値 27 | OrgasmEyeMin_0=30 28 | OrgasmEyeMin_1=35 29 | OrgasmEyeMin_2=40 30 | 31 | ; AHEレベル毎の絶頂時のモーション速度 32 | OrgasmMotionSpeed_0=90 33 | OrgasmMotionSpeed_1=80 34 | OrgasmMotionSpeed_2=70 35 | 36 | ; AHEレベル毎のOrgasmConvulsion有効時の痙攣度 37 | OrgasmConvulsion_0=60 38 | OrgasmConvulsion_1=80 39 | OrgasmConvulsion_2=100 40 | 41 | ; AHEレベル毎の絶頂時の表情名 42 | OrgasmFace_0=エロ放心 43 | OrgasmFace_1=エロ好感3 44 | OrgasmFace_2=通常射精後1 45 | 46 | ; AHEレベル毎の絶頂時の表情ブレンド名 47 | OrgasmFaceBlend_0=頬1涙1 48 | OrgasmFaceBlend_1=頬2涙2 49 | OrgasmFaceBlend_2=頬3涙3よだれ 50 | 51 | 52 | [AutoBOTE] 53 | ; 中出し一回当たりの腹の上昇値 54 | Increment=10 55 | 56 | ; 腹の最大値 57 | Max=100 58 | 59 | 60 | 61 | [AutoKUPA] 62 | ; AHE絶頂回数当たりの通常時局部開き値の増加値 (AHE絶頂を重ねる事で完全に閉じなくなる) 63 | IncrementPerOrgasm=1 64 | 65 | ; 上記の上昇の最大値 66 | NormalMax=10 67 | 68 | ; 種別毎の局部開き値 (0:セックス・太バイブ系, 1:オナニー・バイブ系) 69 | Value_0=100 70 | Value_1=50 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##CM3D2.AddYotogiSlider.Plugin 2 | 3 | 夜伽コマンド画面中にF5でGUI表示トグル。 4 | 夜伽中のメイドのステータス・表情等ををスライダー・ボタンで変更する事が可能。 5 | ![GUI](http://i.imgur.com/KNSFUPR.png "GUI") 6 | 7 | 8 | 9 | ##導入方法 10 | 11 | **前提条件** : **UnityInjector** が導入済みであること。 12 | 13 | [![ダウンロードボタン][img_download]][master zip]を押してzipファイルをダウンロード。 14 | zipファイルの中にあるUnityInjectorフォルダをCM3D2フォルダにD&Dすれば導入完了。 15 | 16 | 17 | 18 | ##更新履歴 19 | 20 | ###0.0.4.7 21 | * AutoAHE/BOTE/KUPAの各種数値をiniファイルで設定可能に変更。(./Config/AddYotogiSlider.ini) 22 | * AHE絶頂回数に従ってKUPA値が一定以上に下がらない様に変更。(改造スレ5>>446) 23 | * バイブ責め系スキル時にAutoKUPAが機能していなかったバグ修正。 24 | * アニメ再生中にコマンド実行時、kupaキー操作がharaキー操作になっていたバグ修正。 25 | 26 | 27 | #####0.0.3.6 28 | * 'kupa','orgasm'対応bodyで無い場合に該当項目のUIを表示しない内容に変更。 29 | * 'kupa','orgasm'対応bodyで無い場合にエラーメッセージが出るバグ修正。 30 | 31 | #####0.0.3.5 32 | * 男が表示されない夜伽スキルで初期化が完了しないバグ修正。 33 | * 男が複数される夜伽スキルで1人目の速度しか変更されないバグ修正。 34 | * 感度の値の計算が正しく行われてなかったバグ修正。 35 | 36 | ###0.0.3.4 37 | * 背景セレクタ追加。 38 | * 速度スライダー追加。モーション速度を操作可能。 39 | * AutoKUPAパネル・スライダー追加。有効化で挿入時にシェイプキー'kupa'を操作。※1 40 | * AutoAHEパネルにOrgasm convulsion追加。有効化でAHE絶頂時にシェイプキー'orgasm'を操作。※1 41 | * AutoAHE絶頂時にモーション速度が変わる様に変更。 42 | * スライダーピン有効かつパネル無効時にメイドの値を書き替えていたバグ修正。 43 | 44 | ※1:対応するシェイプキーを持つbodyが必要です。各自で用意して下さい。 45 | 46 | 47 | ###0.0.2.3 48 | * 感度スライダー追加。感度値に比例して夜伽コマンド実行時の興奮変動値が増減。 49 | * FaceAnimeパネルにLipsync cancelling追加。有効化でリップシンク停止。 50 | * FaceAnimeパネルで指定できるFace名を追加。 51 | * "ウインク照れ","にっこり照れ","ダンスあくび","ダンスびっくり","ダンス目あけ","ダンス目つむり" 52 | * "口開け","追加よだれ","エラー","デフォ","頬0涙0"~"頬2涙3"の+よだれ版 53 | * FaceBlendパネルでも全表情を指定できる様に変更。 54 | * 各パネルタイトルクリックでパネルを折り畳める様に変更。 55 | * AutoAHE表情適用、絶頂数カウントを閾値以上での絶頂時のみに変更。 56 | 57 | #####0.0.1.2 58 | * 夜伽画面に入りなおす毎に初期化開始時間が遅くなるバグ修正。 59 | 60 | 61 | ###0.0.1.1 62 | * AutoAHE機能追加。有効化で興奮値に従って瞳が上に移動する様に。絶頂回数で3段階変化。 63 | * AutoBOTE機能追加。有効化で中で出した時にお腹が徐々に膨らんでいく様に。 64 | * 腹スライダー追加。 65 | * FaceAnimeに上書禁止を追加。有効化で夜伽コマンドで表情が上書きされない様に。 66 | * FaceAnimeに適用中の表情名を表示するラベルを追加。 67 | * FaceAnimeに全ての表情のボタンを追加。 68 | * UIの出現の仕方を変更。 69 | 70 | 71 | ###0.0.0.0 72 | * 初版 ([CM3D2.AddModsSlider.Plugin][]から分離) 73 | * 瞳↑移動スライダーを追加 74 | * UIがドラッグで移動できるように 75 | 76 | 77 | 78 | ##注意書き 79 | 80 | 個人で楽しむ為の非公式Modです。 81 | 転載・再配布・改変・改変物配布等はKISSに迷惑のかからぬ様、 82 | 各自の判断・責任の下で行って下さい。 83 | 84 | 85 | 86 | [CM3D2.AddModsSlider.Plugin]: https://github.com/CM3D2-01/CM3D2.AddModsSlider.Plugin "CM3D2-01/CM3D2.AddModsSlider.Plugin" 87 | [master zip]:https://github.com/CM3D2-01/CM3D2.AddYotogiSlider.Plugin/archive/master.zip "master zip" 88 | [img_download]: http://i.imgur.com/byav3Uf.png "ダウンロードボタン" 89 | 90 | -------------------------------------------------------------------------------- /CM3D2.AddYotogiSlider.Plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.IO; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Text.RegularExpressions; 10 | using System.Xml; 11 | using System.Runtime.InteropServices; 12 | using UnityEngine; 13 | using UnityInjector.Attributes; 14 | 15 | using UnityObsoleteGui; 16 | using PV = UnityObsoleteGui.PixelValuesCM3D2; 17 | 18 | 19 | namespace CM3D2.AddYotogiSlider.Plugin 20 | { 21 | 22 | [PluginFilter("CM3D2x64"), PluginFilter("CM3D2x86"), PluginFilter("CM3D2VRx64")] 23 | [PluginName("CM3D2 AddYotogiSlider"), PluginVersion("0.0.4.7")] 24 | public class AddYotogiSlider : UnityInjector.PluginBase 25 | { 26 | #region Constants 27 | 28 | public const string PluginName = "AddYotogiSlider"; 29 | public const string Version = "0.0.4.7"; 30 | 31 | private readonly float TimePerInit = 1.00f; 32 | private readonly float TimePerUpdateSpeed = 0.33f; 33 | private readonly float WaitFirstInit = 5.00f; 34 | private readonly float WaitBoneLoad = 1.00f; 35 | private readonly string commandUnitName = "/UI Root/YotogiPlayPanel/CommandViewer/SkillViewer/MaskGroup/SkillGroup/CommandParent/CommandUnit"; 36 | private readonly string LogLabel = AddYotogiSlider.PluginName + " : "; 37 | 38 | #endregion 39 | 40 | 41 | 42 | #region Variables 43 | 44 | private int sceneLevel; 45 | private bool visible = false; 46 | private bool bInitCompleted = false; 47 | private bool bFadeInWait = false; 48 | private bool bLoadBoneAnimetion = false; 49 | private bool bSyncMotionSpeed = false; 50 | private bool bCursorOnWindow = false; 51 | private float fPassedTimeOnLevel = 0f; 52 | private bool canStart { get{ return bInitCompleted && bLoadBoneAnimetion && !bFadeInWait; } } 53 | private bool kagScriptCallbacksOverride = false; 54 | 55 | private string[] sKey = { "WIN", "STATUS", "AHE", "BOTE", "FACEBLEND", "FACEANIME"}; 56 | private string[] sliderName = {"興奮", "精神", "理性", "感度", "速度", "瞳Y", "腹", "値"}; 57 | private List sStageNames = new List(); 58 | private Dictionary pa = new Dictionary(); 59 | 60 | private Window window; 61 | private Rect winRatioRect = new Rect(0.75f, 0.25f, 0.20f, 0.65f); 62 | private Rect winAnimeRect; 63 | private float[] fWinAnimeFrom; 64 | private float[] fWinAnimeTo; 65 | 66 | private Dictionary panel = new Dictionary(); 67 | private Dictionary slider = new Dictionary(); 68 | private Dictionary grid = new Dictionary(); 69 | private Dictionary toggle = new Dictionary(); 70 | private Dictionary lSelect = new Dictionary(); 71 | 72 | private int iLastExcite = 0; 73 | private int iOrgasmCount = 0; 74 | private int iLastSliderFrustration = 0; 75 | private float fLastSliderSensitivity = 0f; 76 | private float fPassedTimeOnCommand = -1f; 77 | 78 | //AutoAHE 79 | private bool bOrgasmAvailable = false; //BodyShapeKeyチェック 80 | private float fEyePosToSliderMul = 5000f; 81 | private float fOrgasmsPerAheLevel = 3f; 82 | private int idxAheOrgasm 83 | { 84 | get{ return (int)Math.Min( Math.Max( Math.Floor((iOrgasmCount - 1) / fOrgasmsPerAheLevel) , 0) , 2); } 85 | } 86 | private int[] iAheExcite = new int[] { 267, 233, 200 }; //適用の興奮閾値 87 | private float fAheDefEye = 0f; 88 | private float fAheLastEye = 0f; 89 | private float fAheEyeDecrement = 0.20f / 60f; //放置時の瞳降下 90 | private float[] fAheNormalEyeMax = new float[] { 40f, 45f, 50f }; //通常時の瞳の最大値 91 | private float[] fAheOrgasmEyeMax = new float[] { 50f, 60f, 70f }; //絶頂時の瞳の最大値 92 | private float[] fAheOrgasmEyeMin = new float[] { 30f, 35f, 40f }; //絶頂時の瞳の最小値 93 | private float[] fAheOrgasmSpeed = new float[] { 90f, 80f, 70f }; //絶頂時のモーション速度 94 | private float[] fAheOrgasmConvulsion= new float[] { 60f, 80f, 100f }; //絶頂時の痙攣度 95 | private string[] sAheOrgasmFace = new string[] { "エロ放心", "エロ好感3", "通常射精後1" }; //絶頂時のFace 96 | private string[] sAheOrgasmFaceBlend = new string[] { "頬1涙1", "頬2涙2", "頬3涙3よだれ" }; //絶頂時のFaceBlend 97 | private int iAheOrgasmChain = 0; 98 | 99 | //AutoBOTE 100 | private int iDefHara; //腹の初期値 101 | private int iHaraIncrement = 10; //一回の腹の増加値 102 | private int iBoteHaraMax = 100; //腹の最大値 103 | private int iBoteCount = 0; //中出し回数 104 | 105 | //AutoKUPA 106 | private bool bKupaAvailable = false; //BodyShapeKeyチェック 107 | private bool bKupaFuck = false; //挿入しているかどうか 108 | private int iKupaDef = 0; 109 | private int iKupaIncrementPerOrgasm = 0; //絶頂回数当たりの通常時局部開き値の増加値 110 | private int iKupaNormalMax = 0; //通常時の局部開き最大値 111 | private int iKupaMin 112 | { 113 | get{ return (int)Mathf.Max(iKupaDef + iKupaIncrementPerOrgasm * iOrgasmCount, iKupaNormalMax); } 114 | } 115 | private int[] iKupaValue = { 100, 50 }; //最大の局部開き値 116 | 117 | //FaceNames 118 | private string[] sFaceNames = 119 | { 120 | "エロ通常1", "エロ通常2", "エロ通常3", "エロ羞恥1", "エロ羞恥2", "エロ羞恥3", 121 | "エロ興奮0", "エロ興奮1", "エロ興奮2", "エロ興奮3", "エロ緊張", "エロ期待", 122 | "エロ好感1", "エロ好感2", "エロ好感3", "エロ我慢1", "エロ我慢2", "エロ我慢3", 123 | "エロ嫌悪1", "エロ怯え", "エロ痛み1", "エロ痛み2", "エロ痛み3", "エロメソ泣き", 124 | "エロ絶頂", "エロ痛み我慢", "エロ痛み我慢2","エロ痛み我慢3", "エロ放心", "発情", 125 | "通常射精後1", "通常射精後2", "興奮射精後1", "興奮射精後2", "絶頂射精後1", "絶頂射精後2", 126 | "エロ舐め愛情", "エロ舐め愛情2", "エロ舐め快楽", "エロ舐め快楽2", "エロ舐め嫌悪", "エロ舐め通常", 127 | "閉じ舐め愛情", "閉じ舐め快楽", "閉じ舐め快楽2", "閉じ舐め嫌悪", "閉じ舐め通常", "接吻", 128 | "エロフェラ愛情", "エロフェラ快楽", "エロフェラ嫌悪", "エロフェラ通常", "エロ舌責", "エロ舌責快楽", 129 | "閉じフェラ愛情", "閉じフェラ快楽", "閉じフェラ嫌悪", "閉じフェラ通常", "閉じ目", "目口閉じ", 130 | "通常", "怒り", "笑顔", "微笑み", "悲しみ2", "泣き", 131 | "きょとん", "ジト目","あーん", "ためいき", "ドヤ顔", "にっこり", 132 | "びっくり", "ぷんすか", "まぶたギュ", "むー", "引きつり笑顔", "疑問", 133 | "苦笑い", "困った", "思案伏せ目", "少し怒り", "誘惑", "拗ね", 134 | "優しさ","居眠り安眠","目を見開いて","痛みで目を見開いて", "余韻弱","目口閉じ", 135 | "口開け","恥ずかしい","照れ", "照れ叫び","ウインク照れ", "にっこり照れ", 136 | "ダンス目つむり","ダンスあくび","ダンスびっくり","ダンス微笑み","ダンス目あけ","ダンス目とじ", 137 | "ダンスウインク", "ダンスキス", "ダンスジト目","ダンス困り顔", "ダンス真剣","ダンス憂い", 138 | "ダンス誘惑", "頬0涙0", "頬0涙1", "頬0涙2", "頬0涙3", "頬1涙0", 139 | "頬1涙1", "頬1涙2", "頬1涙3", "頬2涙0", "頬2涙1", "頬2涙2", 140 | "頬2涙3", "頬3涙1", "頬3涙0", "頬3涙2", "頬3涙3", "追加よだれ", 141 | "頬0涙0よだれ", "頬0涙1よだれ", "頬0涙2よだれ", "頬0涙3よだれ", "頬1涙0よだれ", "頬1涙1よだれ", 142 | "頬1涙2よだれ", "頬1涙3よだれ", "頬2涙0よだれ", "頬2涙1よだれ", "頬2涙2よだれ", "頬2涙3よだれ", 143 | "頬3涙0よだれ", "頬3涙1よだれ", "頬3涙2よだれ", "頬3涙3よだれ" , "エラー", "デフォ", 144 | }; 145 | private string[] sFaceBlendCheek = new string[]{"頬0", "頬1", "頬2", "頬3"}; 146 | private string[] sFaceBlendTear = new string[]{"涙0", "涙1", "涙2", "涙3"}; 147 | 148 | 149 | // ゲーム内部変数への参照 150 | private Maid maid; 151 | private FieldInfo maidStatusInfo; 152 | private FieldInfo maidFoceKuchipakuSelfUpdateTime; 153 | 154 | private YotogiPlayManager yotogiPlayManager; 155 | private YotogiParamBasicBar yotogiParamBasicBar; 156 | private GameObject goCommandUnit; 157 | private Action orgOnClickCommand; 158 | 159 | private KagScript kagScript; 160 | private Func orgTagFace; 161 | private Func orgTagFaceBlend; 162 | 163 | private Animation anm_BO_body001; 164 | private Animation[] anm_BO_mbody; 165 | 166 | #endregion 167 | 168 | 169 | 170 | #region Nested classes 171 | 172 | private class YotogiPanel : Container 173 | { 174 | public enum HeaderUI 175 | { 176 | None, 177 | Slider, 178 | Face 179 | } 180 | 181 | private Rect padding { get{ return PV.PropRect(paddingPx); } } 182 | private int paddingPx = 4; 183 | private GUIStyle labelStyle = "label"; 184 | private GUIStyle toggleStyle = "toggle"; 185 | private GUIStyle buttonStyle = "button"; 186 | private string headerHeightPV = "C1"; 187 | private string headerFontSizePV = "C1"; 188 | private HeaderUI headerUI; 189 | private bool childrenVisible = false; 190 | 191 | public string Title; 192 | public string HeaderUILabelText; 193 | public bool Enabled = false; 194 | public bool HeaderUIToggle = false; 195 | 196 | public YotogiPanel(string name, string title) : this(name, title, HeaderUI.None) {} 197 | public YotogiPanel(string name, string title, HeaderUI type) 198 | : base(name, new Rect (Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, 0)) 199 | { 200 | this.Title = title; 201 | this.headerUI = type; 202 | Resize(); 203 | } 204 | 205 | public override void Draw(Rect outRect) 206 | { 207 | Rect groupRect = PV.InsideRect(outRect, padding); 208 | 209 | labelStyle = "box"; 210 | GUI.Label(outRect, "", labelStyle); 211 | GUI.BeginGroup(groupRect); 212 | { 213 | int headerHeight = PV.Line(headerHeightPV); 214 | int headerFontSize = PV.Font(headerFontSizePV); 215 | 216 | Rect cur = new Rect(0f, 0f, padding.width, headerHeight); 217 | 218 | cur.width = groupRect.width * 0.325f; 219 | buttonStyle.fontSize = headerFontSize; 220 | resizeOnChangeChildrenVisible( GUI.Toggle(cur, childrenVisible, Title, buttonStyle) ); 221 | cur.x += cur.width; 222 | 223 | cur.width = groupRect.width * 0.300f; 224 | cur.y -= PV.PropPx(2); 225 | toggleStyle.fontSize = headerFontSize; 226 | toggleStyle.alignment = TextAnchor.MiddleLeft; 227 | toggleStyle.normal.textColor = toggleColor(Enabled); 228 | toggleStyle.hover.textColor = toggleColor(Enabled); 229 | Enabled = GUI.Toggle(cur, Enabled, toggleText(Enabled), toggleStyle); 230 | cur.y += PV.PropPx(2); 231 | cur.x += cur.width; 232 | 233 | labelStyle = "label"; 234 | labelStyle.fontSize = headerFontSize; 235 | switch (headerUI) 236 | { 237 | case HeaderUI.Slider: 238 | { 239 | cur.width = groupRect.width * 0.375f; 240 | labelStyle.alignment = TextAnchor.MiddleRight; 241 | GUI.Label(cur, "Pin", labelStyle); 242 | } 243 | break; 244 | 245 | case HeaderUI.Face: 246 | { 247 | cur.width = groupRect.width * 0.375f; 248 | labelStyle = "box"; 249 | labelStyle.fontSize = headerFontSize; 250 | labelStyle.alignment = TextAnchor.MiddleRight; 251 | GUI.Label(cur, HeaderUILabelText, labelStyle); 252 | } 253 | break; 254 | 255 | default: break; 256 | } 257 | 258 | cur.x = 0; 259 | cur.y += cur.height + + PV.PropPx(3); 260 | cur.width = groupRect.width; 261 | 262 | foreach (Element child in children) 263 | { 264 | if (!(child.Visible)) continue; 265 | 266 | cur.height = child.Height; 267 | child.Draw(cur); 268 | cur.y += cur.height + PV.PropPx(3); 269 | } 270 | } 271 | GUI.EndGroup(); 272 | } 273 | 274 | public override void Resize() { Resize(false); } 275 | public override void Resize(bool broadCast) 276 | { 277 | float height = PV.Line(headerHeightPV) + PV.PropPx(3); 278 | 279 | foreach (Element child in children) if (child.Visible) height += child.Height + PV.PropPx(3); 280 | rect.height = height + (int)padding.height * 2; 281 | 282 | if (!broadCast) notifyParent(true, false); 283 | } 284 | 285 | //---- 286 | 287 | private void resizeOnChangeChildrenVisible(bool b) 288 | { 289 | if (b != childrenVisible) 290 | { 291 | foreach(Element child in children) child.Visible = b; 292 | childrenVisible = b; 293 | } 294 | } 295 | 296 | private Color toggleColor(bool b) { return b ? new Color(1f, 1f, 1f, 1f) : new Color(1f, 0.2f, 0.2f, 1f); } 297 | private string toggleText(bool b) { return b ? "Enabled" : "Disabled"; } 298 | } 299 | 300 | 301 | private class YotogiSlider : Element 302 | { 303 | private HSlider slider; 304 | private string lineHeightPV = "C1"; 305 | private string fontSizePV = "C1"; 306 | private GUIStyle labelStyle = "label"; 307 | private string labelText = ""; 308 | private bool pinEnabled = false; 309 | 310 | public float Value { get{ return slider.Value; } set{ if(!Pin) slider.Value = value; } } 311 | public float Default; 312 | public bool Pin; 313 | 314 | public YotogiSlider(string name, float min, float max, float def, EventHandler onChange, string label, bool pinEnabled) 315 | : base(name, new Rect (Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, 0)) 316 | { 317 | this.slider = new HSlider(name+":slider", rect, min, max, def, onChange); 318 | this.Default = def; 319 | this.labelText = label; 320 | this.pinEnabled = pinEnabled; 321 | Resize(); 322 | } 323 | 324 | public override void Draw(Rect outRect) 325 | { 326 | Rect cur = outRect; 327 | labelStyle = "label"; 328 | 329 | cur.width = outRect.width * 0.1625f; 330 | labelStyle.fontSize = PV.Font(fontSizePV); 331 | labelStyle.alignment = TextAnchor.MiddleCenter; 332 | GUI.Label(cur, labelText, labelStyle); 333 | cur.x += cur.width; 334 | 335 | cur.width = outRect.width * 0.1575f; 336 | labelStyle = "box"; 337 | labelStyle.fontSize = PV.Font(fontSizePV); 338 | labelStyle.alignment = TextAnchor.MiddleRight; 339 | GUI.Label(cur, slider.Value.ToString("F0"), labelStyle); 340 | cur.x += cur.width + outRect.width * 0.005f; 341 | 342 | cur.width = outRect.width * 0.60f; 343 | cur.y += PV.PropPx(4); 344 | slider.Draw(cur); 345 | cur.y -= PV.PropPx(4); 346 | cur.x += cur.width; 347 | 348 | if (pinEnabled) 349 | { 350 | cur.width = outRect.width * 0.075f; 351 | cur.y -= PV.PropPx(2); 352 | Pin = GUI.Toggle(cur, Pin, ""); 353 | } 354 | } 355 | 356 | public override void Resize() { Resize(false); } 357 | public override void Resize(bool broadCast) { rect.height = PV.Line(lineHeightPV); } 358 | } 359 | 360 | private class YotogiToggle : Element 361 | { 362 | private bool val; 363 | private Toggle toggle; 364 | private GUIStyle labelStyle = "label"; 365 | private GUIStyle toggleStyle = "toggle"; 366 | private string lineHeightPV = "C1"; 367 | private string fontSizePV = "C1"; 368 | 369 | public bool Value { get{ return toggle.Value; } } 370 | public string LabelText; 371 | 372 | public YotogiToggle(string name, bool def, string text, EventHandler onChange) 373 | : base(name, new Rect (Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, 0)) 374 | { 375 | this.toggle = new Toggle(name+":toggle", rect, def, text, onChange); 376 | this.val = def; 377 | this.LabelText = text; 378 | Resize(); 379 | } 380 | 381 | public override void Draw(Rect outRect) 382 | { 383 | Rect cur = outRect; 384 | 385 | cur.width = outRect.width * 0.5f; 386 | labelStyle.fontSize = PV.Font(fontSizePV); 387 | labelStyle.alignment = TextAnchor.MiddleLeft; 388 | GUI.Label(cur, LabelText, labelStyle); 389 | cur.x += cur.width; 390 | 391 | cur.width = outRect.width * 0.5f; 392 | toggle.Style.fontSize = PV.Font(fontSizePV); 393 | toggle.Style.alignment = TextAnchor.MiddleLeft; 394 | toggle.Style.normal.textColor = toggleColor(toggle.Value); 395 | toggle.Style.hover.textColor = toggleColor(toggle.Value); 396 | toggle.Content.text = toggleText(toggle.Value); 397 | cur.y -= PV.PropPx(2); 398 | toggle.Draw(cur); 399 | } 400 | 401 | public override void Resize() { Resize(false); } 402 | public override void Resize(bool broadCast) { rect.height = PV.Line(lineHeightPV); } 403 | 404 | private Color toggleColor(bool b) { return b ? new Color(1f, 1f, 1f, 1f) : new Color(1f, 0.2f, 0.2f, 1f); } 405 | private string toggleText(bool b) { return b ? "Enabled" : "Disabled"; } 406 | } 407 | 408 | 409 | private class YotogiButtonGrid : Element 410 | { 411 | private string[] buttonNames; 412 | private GUIStyle labelStyle = "box"; 413 | private GUIStyle toggleStyle = "toggle"; 414 | private GUIStyle buttonStyle = "button"; 415 | private string lineHeightPV = "C1"; 416 | private string fontSizePV = "C1"; 417 | private int viewRow = 6; 418 | private int columns = 2; 419 | private int spacerPx = 5; 420 | private int rowPerSpacer = 3; 421 | private int colPerSpacer = -1; 422 | private bool tabEnabled = false; 423 | private int tabSelected = -1; 424 | private Vector2 scrollViewVector = Vector2.zero; 425 | private SelectButton[] selectButton; 426 | 427 | public bool GirdToggle = false; 428 | public string GirdLabelText = ""; 429 | 430 | public event EventHandler OnClick; 431 | 432 | public YotogiButtonGrid(string name, string[] buttonNames, EventHandler _onClick, int row, bool tabEnabled) 433 | : base(name, new Rect (Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, 0)) 434 | { 435 | this.buttonNames = buttonNames; 436 | this.OnClick += _onClick; 437 | this.viewRow = row; 438 | this.tabEnabled = tabEnabled; 439 | 440 | 441 | if (tabEnabled) 442 | { 443 | selectButton = new SelectButton[2] 444 | { new SelectButton("SelectButton:Cheek", rect, new string[4]{"頬0", "頬1", "頬2", "頬3"}, this.OnSelectButtonFaceBlend), 445 | new SelectButton("SelectButton:Tear", rect, new string[4]{"涙0", "涙1", "涙2", "涙3"}, this.OnSelectButtonFaceBlend)}; 446 | onChangeTab(0); 447 | } 448 | 449 | Resize(); 450 | } 451 | 452 | public override void Draw(Rect outRect) 453 | { 454 | int spacer = PV.PropPx(spacerPx); 455 | int btnNum = buttonNames.Length; 456 | int tabLine = PV.Line(lineHeightPV) + PV.PropPx(3); 457 | int rowNum = (int)Math.Ceiling((double)btnNum / columns); 458 | 459 | GUI.BeginGroup(outRect); 460 | { 461 | Rect cur = new Rect(0, 0, outRect.width, PV.Line(lineHeightPV)); 462 | 463 | if (tabEnabled) 464 | { 465 | cur.width = outRect.width * 0.3f; 466 | toggleStyle.fontSize = PV.Font(fontSizePV); 467 | toggleStyle.alignment = TextAnchor.MiddleLeft; 468 | toggleStyle.normal.textColor = toggleColor(GirdToggle); 469 | toggleStyle.hover.textColor = toggleColor(GirdToggle); 470 | onClickDroolToggle( GUI.Toggle(cur, GirdToggle, "よだれ", toggleStyle) ); 471 | cur.x += cur.width; 472 | 473 | cur.width = outRect.width * 0.7f; 474 | onChangeTab( GUI.Toolbar(cur, tabSelected, new string[2]{ "頬・涙・涎", "全種Face"}, buttonStyle) ); 475 | 476 | cur.x = 0f; 477 | cur.y += cur.height + PV.PropPx(3); 478 | cur.width = outRect.width; 479 | } 480 | 481 | if (!tabEnabled || tabSelected == 1) 482 | { 483 | Rect scrlRect = new Rect(cur.x, cur.y, cur.width, outRect.height - (tabEnabled ? tabLine : 0)); 484 | Rect contentRect = new Rect(0f, 0f, outRect.width - PV.Sys_("HScrollBar.Width") - spacer, 485 | PV.Line(lineHeightPV) * rowNum + spacer * (int)(rowNum / rowPerSpacer)); 486 | 487 | scrollViewVector = GUI.BeginScrollView(scrlRect, scrollViewVector, contentRect, false, true); 488 | { 489 | Rect scrlCur = new Rect(0, 0, contentRect.width / columns, PV.Line(lineHeightPV)); 490 | int row = 1, col = 1; 491 | 492 | foreach(string buttonName in buttonNames) 493 | { 494 | onClick( GUI.Button(scrlCur,buttonName), buttonName ); 495 | 496 | if (columns > 0 && col == columns) 497 | { 498 | scrlCur.x = 0; 499 | scrlCur.y += scrlCur.height; 500 | if (rowPerSpacer > 0 && row % rowPerSpacer == 0) scrlCur.y += spacer; 501 | row++; 502 | col = 1; 503 | } 504 | else 505 | { 506 | scrlCur.x += scrlCur.width; 507 | if (colPerSpacer > 0 && col % colPerSpacer == 0) scrlCur.x += spacer; 508 | col++; 509 | } 510 | } 511 | } 512 | GUI.EndScrollView(); 513 | 514 | } 515 | else if (tabSelected == 0) 516 | { 517 | selectButton[0].Draw(cur); 518 | cur.y += cur.height; 519 | selectButton[1].Draw(cur); 520 | } 521 | 522 | } 523 | GUI.EndGroup(); 524 | } 525 | 526 | public override void Resize() { Resize(false); } 527 | public override void Resize(bool broadCast) 528 | { 529 | int spacer = PV.PropPx(spacerPx); 530 | int tabLine = PV.Line(lineHeightPV) + PV.PropPx(3); 531 | 532 | if (!tabEnabled) rect.height = PV.Line(lineHeightPV) * viewRow + spacer * (int)(viewRow / rowPerSpacer); 533 | else if (tabSelected == 0) rect.height = tabLine + PV.Line(lineHeightPV) * 2; 534 | else if (tabSelected == 1) rect.height = tabLine + PV.Line(lineHeightPV) * viewRow + spacer * (int)(viewRow / rowPerSpacer); 535 | 536 | if (!broadCast) notifyParent(true, false); 537 | } 538 | 539 | public void OnSelectButtonFaceBlend(object sb, SelectEventArgs args) 540 | { 541 | if (((YotogiPanel)Parent).Enabled) 542 | { 543 | string senderName = args.Name; 544 | string faceName = args.ButtonName; 545 | 546 | if (senderName == "SelectButton:Cheek") faceName = faceName + selectButton[1].Value; 547 | else if (senderName == "SelectButton:Tear") faceName = selectButton[0].Value + faceName; 548 | if (GirdToggle) faceName += "よだれ"; 549 | 550 | OnClick(this, new ButtonEventArgs(this.name, faceName)); 551 | } 552 | } 553 | 554 | //---- 555 | 556 | private void onClickDroolToggle(bool b) 557 | { 558 | if (b != GirdToggle) 559 | { 560 | string faceName = selectButton[0].Value + selectButton[1].Value + (b ? "よだれ" : ""); 561 | OnClick(this, new ButtonEventArgs(this.name, faceName)); 562 | GirdToggle = b; 563 | } 564 | } 565 | 566 | private void onChangeTab(int i) 567 | { 568 | if (i != tabSelected) 569 | { 570 | tabSelected = i; 571 | Resize(); 572 | } 573 | } 574 | 575 | private void onClick(bool click, string s) 576 | { 577 | if (click) OnClick(this, new ButtonEventArgs(this.name, s)); 578 | } 579 | 580 | private Color toggleColor(bool b) { return b ? new Color(1f, 1f, 1f, 1f) : new Color(1f, 0.2f, 0.2f, 1f); } 581 | } 582 | 583 | private class YotogiLineSelect : Element 584 | { 585 | private string label; 586 | private string[] names; 587 | private int currentIndex = 0; 588 | private GUIStyle labelStyle = "label"; 589 | private GUIStyle buttonStyle = "button"; 590 | private string heightPV = "C1"; 591 | private string fontSizePV = "C1"; 592 | 593 | public int CurrentIndex { get{ return currentIndex;} } 594 | public string CurrentName { get{ return names[currentIndex];} } 595 | 596 | public event EventHandler OnClick; 597 | 598 | public YotogiLineSelect(string name, string _label, string[] _names, int def, EventHandler _onClick) 599 | : base(name, new Rect (Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, 0)) 600 | { 601 | this.label = _label; 602 | this.names = new string[_names.Length]; 603 | Array.Copy(_names, this.names, _names.Length); 604 | this.currentIndex = def; 605 | this.OnClick += _onClick; 606 | 607 | Resize(); 608 | } 609 | 610 | public override void Draw(Rect outRect) 611 | { 612 | Rect cur = outRect; 613 | int fontSize = PV.Font(fontSizePV); 614 | 615 | /*cur.width = outRect.width * 0.3f; 616 | labelStyle = "label"; 617 | labelStyle.fontSize = PV.Font(fontSizePV); 618 | labelStyle.alignment = TextAnchor.MiddleCenter; 619 | GUI.Label(cur, label, labelStyle); 620 | cur.x += cur.width;*/ 621 | 622 | cur.width = outRect.width * 0.125f; 623 | buttonStyle.fontSize = PV.Font(fontSizePV); 624 | labelStyle.alignment = TextAnchor.MiddleCenter; 625 | onClick( GUI.Button(cur, "<"), -1 ); 626 | cur.x += cur.width + outRect.width * 0.025f; 627 | 628 | cur.width = outRect.width * 0.7f; 629 | labelStyle = "box"; 630 | labelStyle.alignment = TextAnchor.MiddleCenter; 631 | GUI.Label(cur, names[currentIndex], labelStyle); 632 | cur.x += cur.width + outRect.width * 0.025f; 633 | 634 | cur.width = outRect.width * 0.125f; 635 | buttonStyle.fontSize = PV.Font(fontSizePV); 636 | buttonStyle.alignment = TextAnchor.MiddleCenter; 637 | onClick( GUI.Button(cur, ">"), 1 ); 638 | 639 | } 640 | 641 | public override void Resize(bool bc) 642 | { 643 | this.rect.height = PV.Line(heightPV); 644 | if (!bc) notifyParent(true, false); 645 | } 646 | 647 | private void onClick(bool click, int di) 648 | { 649 | if (click) 650 | { 651 | if ((di < 0 && currentIndex > 0) || (di > 0 && currentIndex < names.Length - 1)) 652 | { 653 | currentIndex += di; 654 | OnClick(this, new ButtonEventArgs(this.name, names[currentIndex])); 655 | } 656 | } 657 | } 658 | } 659 | 660 | private class PlayAnime 661 | { 662 | public enum Formula 663 | { 664 | Linear, 665 | Quadratic, 666 | Convulsion 667 | } 668 | 669 | private float[] value; 670 | private float[] vFrom; 671 | private float[] vTo; 672 | private Formula type; 673 | private int num; 674 | private bool play = false; 675 | private float passedTime = 0f; 676 | private float startTime = 0f; 677 | private float finishTime = 0f; 678 | //private float[] actionTime; 679 | public float progress { get{ return (passedTime - startTime) / (finishTime - startTime); } } 680 | 681 | private Action setValue0 = null; 682 | private Action setValue = null; 683 | 684 | public string Name; 685 | public string Key { get{ return (Name.Split('.'))[0]; } } 686 | public bool NowPlaying { get{ return play && (passedTime < finishTime); } } 687 | public bool SetterExist{ get{ return (num == 1) ? !IsNull(setValue0) : !IsNull(setValue); } } 688 | 689 | 690 | public PlayAnime(string name, int n, float st, float ft) : this(name, n, st, ft, Formula.Linear) {} 691 | public PlayAnime(string name, int n, float st, float ft, Formula t) 692 | { 693 | Name = name; 694 | num = n; 695 | value = new float[n]; 696 | vFrom = new float[n]; 697 | vTo = new float[n]; 698 | startTime = st; 699 | finishTime = ft; 700 | type = t; 701 | } 702 | 703 | public bool IsKye(string s) { return s == Key; } 704 | public bool Contains(string s) { return Name.Contains(s); } 705 | 706 | public void SetFrom(float vform) { vFrom[0] = vform; } 707 | public void SetTo(float vto) { vTo[0] = vto; } 708 | public void SetSetter(Action func) { setValue0 = func; } 709 | public void Set(float vform, float vto) { SetFrom(vform); SetTo(vto); } 710 | 711 | public void SetFrom(float[] vform) { if(vform.Length == num) Array.Copy(vform ,vFrom, num); } 712 | public void SetTo(float[] vto) { if(vto.Length == num) Array.Copy(vto, vTo, num); } 713 | public void SetSetter(Action func) { setValue = func; } 714 | public void Set(float[] vform, float[] vto) { SetFrom(vform); SetTo(vto); } 715 | 716 | public void Play() 717 | { 718 | if (SetterExist) 719 | { 720 | passedTime = 0f; 721 | play = true; 722 | } 723 | } 724 | public void Play(float vform, float vto) { Set(vform, vto); Play(); } 725 | public void Play(float[] vform, float[] vto) { Set(vform, vto); Play(); } 726 | 727 | public void Stop() { play = false; } 728 | 729 | public void Update() 730 | { 731 | if (play) 732 | { 733 | bool change = false; 734 | 735 | for(int i=0; i= finishTime) 740 | { 741 | Stop(); 742 | } 743 | else if (passedTime >= startTime) 744 | { 745 | switch (type) 746 | { 747 | case Formula.Linear : 748 | { 749 | value[i] = vFrom[i] + (vTo[i] - vFrom[i]) * progress; 750 | change = true; 751 | } 752 | break; 753 | 754 | case Formula.Quadratic : 755 | { 756 | value[i] = vFrom[i] + (vTo[i] - vFrom[i]) * Mathf.Pow(progress, 2); 757 | change = true; 758 | } 759 | break; 760 | 761 | case Formula.Convulsion : 762 | { 763 | float t = Mathf.Pow(progress + 0.05f * UnityEngine.Random.value, 2f) * 2f * Mathf.PI * 6f; 764 | 765 | value[i] = (vTo[i] - vFrom[i]) 766 | * Mathf.Clamp( Mathf.Clamp( Mathf.Pow((Mathf.Cos(t-Mathf.PI/2f)+1f)/2f, 3f) * Mathf.Pow(1f - progress, 2f) * 4f, 0f, 1f ) 767 | + Mathf.Sin(t*3f)*0.1f * Mathf.Pow(1f - progress, 3f), 0f, 1f ); 768 | 769 | if (progress < 0.03f) value[i] *= Mathf.Pow(1f - (0.03f - progress) * 33f, 2f); 770 | change = true; 771 | 772 | } 773 | break; 774 | 775 | default : break; 776 | } 777 | 778 | //Debug.LogError("PlayAnime["+Name+"].Update :"+ value[i]); 779 | } 780 | } 781 | 782 | if (change) 783 | { 784 | if(num == 1) setValue0(value[0]); 785 | else setValue(value); 786 | } 787 | } 788 | 789 | passedTime += Time.deltaTime; 790 | } 791 | } 792 | 793 | #endregion 794 | 795 | 796 | 797 | #region MonoBehaviour methods 798 | 799 | public void Awake() 800 | { 801 | pa["WIN.Load"] = new PlayAnime("WIN.Load", 2, 0.00f, 0.25f, PlayAnime.Formula.Quadratic); 802 | pa["AHE.継続.0"] = new PlayAnime("AHE.継続.0", 1, 0.00f, 0.75f); 803 | pa["AHE.絶頂.0"] = new PlayAnime("AHE.絶頂.0", 2, 6.00f, 9.00f); 804 | pa["AHE.痙攣.0"] = new PlayAnime("AHE.痙攣.0", 1, 0.00f, 9.00f, PlayAnime.Formula.Convulsion); 805 | pa["AHE.痙攣.1"] = new PlayAnime("AHE.痙攣.1", 1, 0.00f, 10.00f, PlayAnime.Formula.Convulsion); 806 | pa["AHE.痙攣.2"] = new PlayAnime("AHE.痙攣.2", 1, 0.00f, 11.00f, PlayAnime.Formula.Convulsion); 807 | pa["BOTE.絶頂"] = new PlayAnime("BOTE.絶頂", 1, 0.00f, 6.00f); 808 | pa["BOTE.止める"] = new PlayAnime("BOTE.止める", 1, 0.00f, 4.00f); 809 | pa["KUPA.挿入.0"] = new PlayAnime("KUPA.挿入.0", 1, 0.50f, 1.50f); 810 | pa["KUPA.挿入.1"] = new PlayAnime("KUPA.挿入.1", 1, 1.50f, 2.50f); 811 | pa["KUPA.止める"] = new PlayAnime("KUPA.止める", 1, 0.00f, 2.00f); 812 | } 813 | 814 | 815 | public void OnLevelWasLoaded(int level) 816 | { 817 | fPassedTimeOnLevel = 0f; 818 | 819 | if (level == 14) StartCoroutine( initCoroutine(TimePerInit) ); 820 | 821 | sceneLevel = level; 822 | } 823 | 824 | public void Update() 825 | { 826 | fPassedTimeOnLevel += Time.deltaTime; 827 | 828 | if (sceneLevel == 14 && bInitCompleted) 829 | { 830 | switch (yotogiPlayManager.fade_status) 831 | { 832 | case WfScreenChildren.FadeStatus.Null : 833 | { 834 | finalize(); 835 | } 836 | break; 837 | 838 | case WfScreenChildren.FadeStatus.FadeInWait : 839 | { 840 | if (!bFadeInWait) 841 | { 842 | bSyncMotionSpeed = false; 843 | bFadeInWait = true; 844 | } 845 | } 846 | break; 847 | 848 | case WfScreenChildren.FadeStatus.Wait : 849 | { 850 | if (bFadeInWait) 851 | { 852 | initOnStartSkill(); 853 | bFadeInWait = false; 854 | } 855 | else if (canStart) 856 | { 857 | if (Input.GetKeyDown(KeyCode.F5)) 858 | { 859 | winAnimeRect = window.Rectangle; 860 | visible = !visible; 861 | playAnimeOnInputKeyDown(KeyCode.F5); 862 | } 863 | 864 | if (fPassedTimeOnCommand >= 0f) fPassedTimeOnCommand += Time.deltaTime; 865 | 866 | updateAnimeOnUpdate(); 867 | } 868 | } 869 | break; 870 | 871 | default : break; 872 | } 873 | } 874 | } 875 | 876 | 877 | public void OnGUI() 878 | { 879 | if (sceneLevel == 14 && canStart) 880 | { 881 | updateAnimeOnGUI(); 882 | 883 | if (visible && !pa["WIN.Load"].NowPlaying) 884 | { 885 | updateCameraControl(); 886 | window.Draw(); 887 | } 888 | } 889 | } 890 | 891 | #endregion 892 | 893 | 894 | 895 | #region Callbacks 896 | 897 | public void OnYotogiPlayManagerOnClickCommand(Yotogi.SkillData.Command.Data command_data) 898 | { 899 | iLastExcite = maid.Param.status.cur_excite; 900 | fLastSliderSensitivity = slider["Sensitivity"].Value; 901 | iLastSliderFrustration = getSliderFrustration(); 902 | fPassedTimeOnCommand = 0f; 903 | 904 | if (panel["Status"].Enabled) updateMaidFrustration(iLastSliderFrustration); 905 | initAnimeOnCommand(); 906 | 907 | orgOnClickCommand(command_data); 908 | 909 | playAnimeOnCommand(command_data.basic); 910 | syncSlidersOnClickCommand(command_data.status); 911 | 912 | 913 | if (command_data.basic.command_type == Yotogi.SkillCommandType.絶頂) 914 | { 915 | if (!panel["FaceAnime"].Enabled && pa["AHE.絶頂.0"].NowPlaying) 916 | { 917 | maid.FaceAnime(sAheOrgasmFace[idxAheOrgasm], 5f, 0); 918 | panel["FaceAnime"].HeaderUILabelText = sAheOrgasmFace[idxAheOrgasm]; 919 | } 920 | } 921 | } 922 | 923 | public bool OnYotogiKagManagerTagFace(KagTagSupport tag_data) 924 | { 925 | if (panel["FaceAnime"].Enabled || pa["AHE.絶頂.0"].NowPlaying) 926 | { 927 | return false; 928 | } 929 | else 930 | { 931 | panel["FaceAnime"].HeaderUILabelText = tag_data.GetTagProperty("name").AsString(); 932 | return orgTagFace(tag_data); 933 | } 934 | } 935 | 936 | public bool OnYotogiKagManagerTagFaceBlend(KagTagSupport tag_data) 937 | { 938 | if (panel["FaceBlend"].Enabled || pa["AHE.絶頂.0"].NowPlaying) 939 | { 940 | return false; 941 | } 942 | else 943 | { 944 | panel["FaceBlend"].HeaderUILabelText = tag_data.GetTagProperty("name").AsString(); 945 | return orgTagFaceBlend(tag_data); 946 | } 947 | } 948 | 949 | //---- 950 | 951 | public void OnChangeSliderExcite(object ys, SliderEventArgs args) 952 | { 953 | if (panel["Status"].Enabled) updateMaidExcite((int)args.Value); 954 | } 955 | 956 | public void OnChangeSliderMind(object ys, SliderEventArgs args) 957 | { 958 | if (panel["Status"].Enabled) updateMaidMind((int)args.Value); 959 | } 960 | 961 | public void OnChangeSliderReason(object ys, SliderEventArgs args) 962 | { 963 | if (panel["Status"].Enabled) updateMaidReason((int)args.Value); 964 | } 965 | 966 | public void OnChangeSliderSensitivity(object ys, SliderEventArgs args) 967 | { 968 | ; 969 | } 970 | 971 | public void OnChangeSliderMotionSpeed(object ys, SliderEventArgs args) 972 | { 973 | if (panel["Status"].Enabled) updateMotionSpeed(args.Value); 974 | } 975 | 976 | public void OnChangeSliderEyeY(object ys, SliderEventArgs args) 977 | { 978 | updateMaidEyePosY(args.Value); 979 | } 980 | 981 | public void OnChangeSliderHara(object ys, SliderEventArgs args) 982 | { 983 | updateMaidHaraValue(args.Value); 984 | } 985 | 986 | public void OnChangeSliderKupa(object ys, SliderEventArgs args) 987 | { 988 | updateShapeKeyKupaValue(args.Value); 989 | } 990 | 991 | public void OnChangeToggleLipsync(object tgl, ToggleEventArgs args) 992 | { 993 | updateMaidFoceKuchipakuSelfUpdateTime(args.Value); 994 | } 995 | 996 | public void OnChangeToggleConvulsion(object tgl, ToggleEventArgs args) 997 | { 998 | ; 999 | } 1000 | 1001 | public void OnClickButtonFaceAnime(object ygb, ButtonEventArgs args) 1002 | { 1003 | if (panel["FaceAnime"].Enabled) 1004 | { 1005 | maid.FaceAnime(args.ButtonName, 1f, 0); 1006 | panel["FaceAnime"].HeaderUILabelText = args.ButtonName; 1007 | } 1008 | } 1009 | 1010 | public void OnClickButtonFaceBlend(object ysg, ButtonEventArgs args) 1011 | { 1012 | if (panel["FaceBlend"].Enabled) 1013 | { 1014 | maid.FaceBlend(args.ButtonName); 1015 | panel["FaceBlend"].HeaderUILabelText = args.ButtonName; 1016 | } 1017 | } 1018 | 1019 | public void OnClickButtonStageSelect(object ysg, ButtonEventArgs args) 1020 | { 1021 | GameMain.Instance.BgMgr.ChangeBg(args.ButtonName); 1022 | } 1023 | 1024 | #endregion 1025 | 1026 | 1027 | 1028 | #region Private methods 1029 | 1030 | private IEnumerator initCoroutine(float waitTime) 1031 | { 1032 | yield return new WaitForSeconds(WaitFirstInit); 1033 | while ( !(bInitCompleted = initialize()) ) yield return new WaitForSeconds(waitTime); 1034 | Debug.Log(LogLabel +"Initialization complete."); 1035 | } 1036 | 1037 | private bool initialize() 1038 | { 1039 | if (!this.goCommandUnit) this.goCommandUnit = GameObject.Find(commandUnitName); 1040 | if (!IsActive(this.goCommandUnit)) return false; // 夜伽コマンド画面かどうか 1041 | 1042 | this.maid = GameMain.Instance.CharacterMgr.GetMaid(0); 1043 | if (!this.maid) return false; 1044 | 1045 | this.maidStatusInfo = getFieldInfo("status_"); 1046 | if (IsNull(this.maidStatusInfo)) return false; 1047 | 1048 | this.maidFoceKuchipakuSelfUpdateTime = getFieldInfo("m_bFoceKuchipakuSelfUpdateTime"); 1049 | if (IsNull(this.maidFoceKuchipakuSelfUpdateTime)) return false; 1050 | 1051 | this.yotogiParamBasicBar = getInstance(); 1052 | if (!this.yotogiParamBasicBar) return false; 1053 | 1054 | // 夜伽コマンドフック 1055 | { 1056 | this.yotogiPlayManager = getInstance(); 1057 | if (!this.yotogiPlayManager) return false; 1058 | 1059 | YotogiCommandFactory cf = getFieldValue(this.yotogiPlayManager, "command_factory_"); 1060 | if (IsNull(cf)) return false; 1061 | 1062 | try { 1063 | cf.SetCommandCallback(new YotogiCommandFactory.CommandCallback(this.OnYotogiPlayManagerOnClickCommand)); 1064 | } catch(Exception ex) { Debug.LogError(LogLabel + "SetCommandCallback() : "+ ex); return false; } 1065 | 1066 | this.orgOnClickCommand = getMethodDelegate>(this.yotogiPlayManager, "OnClickCommand"); 1067 | if (IsNull(this.orgOnClickCommand)) return false; 1068 | } 1069 | 1070 | // Face・FaceBlendフック 1071 | { 1072 | YotogiKagManager ykm = GameMain.Instance.ScriptMgr.yotogi_kag; 1073 | if (IsNull(ykm)) return false; 1074 | 1075 | this.kagScript = getFieldValue(ykm, "kag_"); 1076 | if (IsNull(this.kagScript)) return false; 1077 | 1078 | try{ 1079 | this.kagScript.RemoveTagCallBack("face"); 1080 | this.kagScript.AddTagCallBack("face", new KagScript.KagTagCallBack(this.OnYotogiKagManagerTagFace)); 1081 | this.kagScript.RemoveTagCallBack("faceblend"); 1082 | this.kagScript.AddTagCallBack("faceblend", new KagScript.KagTagCallBack(this.OnYotogiKagManagerTagFaceBlend)); 1083 | kagScriptCallbacksOverride = true; 1084 | } catch(Exception ex) { Debug.LogError(LogLabel +"kagScriptCallBack() : "+ ex); return false; } 1085 | 1086 | this.orgTagFace = getMethodDelegate>(ykm, "TagFace"); 1087 | this.orgTagFaceBlend = getMethodDelegate>(ykm, "TagFaceBlend"); 1088 | if (IsNull(this.orgTagFace)) return false; 1089 | } 1090 | 1091 | // ステージリスト取得 1092 | foreach (KeyValuePair kvp in Yotogi.stage_data_list) sStageNames.Add(kvp.Value.prefab_name); 1093 | 1094 | // PlayAnime 1095 | { 1096 | foreach(KeyValuePair o in pa) 1097 | { 1098 | PlayAnime p = o.Value; 1099 | if (!p.SetterExist) 1100 | { 1101 | if (p.Contains("WIN")) p.SetSetter(updateWindowAnime); 1102 | if (p.Contains("BOTE")) p.SetSetter(updateMaidHaraValue); 1103 | if (p.Contains("KUPA")) p.SetSetter(updateShapeKeyKupaValue); 1104 | if (p.Contains("AHE")) p.SetSetter(updateOrgasmConvulsion); 1105 | 1106 | if (p.Contains("AHE.継続")) p.SetSetter(updateMaidEyePosY); 1107 | if (p.Contains("AHE.絶頂")) p.SetSetter(updateAheOrgasm); 1108 | 1109 | } 1110 | } 1111 | fAheDefEye = maid.body0.trsEyeL.localPosition.y * fEyePosToSliderMul; 1112 | iDefHara = maid.GetProp("Hara").value; 1113 | iBoteCount = 0; 1114 | iOrgasmCount = 0; 1115 | iAheOrgasmChain = 0; 1116 | } 1117 | 1118 | // BodyShapeKeyCheck 1119 | bKupaAvailable = maid.body0.goSlot[0].morph.hash.ContainsKey("kupa"); 1120 | bOrgasmAvailable = maid.body0.goSlot[0].morph.hash.ContainsKey("orgasm"); 1121 | 1122 | // Window 1123 | { 1124 | window = new Window(winRatioRect, AddYotogiSlider.Version, "Yotogi Slider"); 1125 | 1126 | float mind = (float)maid.Param.status.mind; 1127 | float reason = (float)maid.Param.status.reason; 1128 | float sensitivity = maid.Param.status.correction_data.excite + maid.Param.status.frustration; 1129 | int stageIndex = sStageNames.IndexOf(YotogiStageSelectManager.StagePrefab); 1130 | 1131 | slider["Excite"] = new YotogiSlider("Slider:Excite", -100f, 300f, 0f, this.OnChangeSliderExcite, sliderName[0], true); 1132 | slider["Mind"] = new YotogiSlider("Slider:Mind", 0f, mind, mind, this.OnChangeSliderMind, sliderName[1], true); 1133 | slider["Reason"] = new YotogiSlider("Slider:Reason", 0f, reason, reason, this.OnChangeSliderReason, sliderName[2], true); 1134 | slider["Sensitivity"] = new YotogiSlider("Slider:Sensitivity", -100f, 200f, sensitivity, this.OnChangeSliderSensitivity, sliderName[3], true); 1135 | slider["MotionSpeed"] = new YotogiSlider("Slider:MotionSpeed", 0f, 500f, 100f, this.OnChangeSliderMotionSpeed, sliderName[4], true); 1136 | slider["EyeY"] = new YotogiSlider("Slider:EyeY", 0f, 100f, fAheDefEye, this.OnChangeSliderEyeY, sliderName[5], false); 1137 | slider["Hara"] = new YotogiSlider("Slider:Hara", 0f, 150f, (float)iDefHara, this.OnChangeSliderHara, sliderName[6], false); 1138 | slider["Kupa"] = new YotogiSlider("Slider:Kupa", 0f, 150f, 0f, this.OnChangeSliderKupa, sliderName[7], false); 1139 | 1140 | toggle["Lipsync"] = new YotogiToggle("Toggle:Lipsync", false, " Lipsync cancelling", this.OnChangeToggleLipsync); 1141 | toggle["Convulsion"] = new YotogiToggle("Toggle:Convulsion", false, " Orgasm convulsion", this.OnChangeToggleConvulsion); 1142 | 1143 | grid["FaceAnime"] = new YotogiButtonGrid("GridButton:FaceAnime" , sFaceNames, this.OnClickButtonFaceAnime, 6, false); 1144 | grid["FaceBlend"] = new YotogiButtonGrid("GridButton:FaceBlend" , sFaceNames, this.OnClickButtonFaceBlend, 6, true); 1145 | 1146 | lSelect["StageSelcet"] = new YotogiLineSelect("LineSelect:StageSelcet", "Stage : ", sStageNames.ToArray(), stageIndex, this.OnClickButtonStageSelect); 1147 | 1148 | slider["EyeY"].Visible = false; 1149 | slider["Hara"].Visible = false; 1150 | slider["Kupa"].Visible = false; 1151 | toggle["Convulsion"].Visible = false; 1152 | toggle["Lipsync"].Visible = false; 1153 | grid["FaceAnime"].Visible = false; 1154 | grid["FaceBlend"].Visible = false; 1155 | 1156 | 1157 | window.AddChild(lSelect["StageSelcet"]); 1158 | window.AddHorizontalSpacer(); 1159 | 1160 | panel["Status"] = window.AddChild( new YotogiPanel("Panel:Status", "Status", YotogiPanel.HeaderUI.Slider) ); 1161 | panel["Status"].AddChild(slider["Excite"]); 1162 | panel["Status"].AddChild(slider["Mind"]); 1163 | panel["Status"].AddChild(slider["Reason"]); 1164 | panel["Status"].AddChild(slider["Sensitivity"]); 1165 | panel["Status"].AddChild(slider["MotionSpeed"]); 1166 | window.AddHorizontalSpacer(); 1167 | 1168 | panel["AutoAHE"] = window.AddChild( new YotogiPanel("Panel:AutoAHE", "AutoAHE") ); 1169 | if (bOrgasmAvailable) 1170 | { 1171 | panel["AutoAHE"].AddChild(toggle["Convulsion"]); 1172 | } 1173 | panel["AutoAHE"].AddChild(slider["EyeY"]); 1174 | window.AddHorizontalSpacer(); 1175 | 1176 | panel["AutoBOTE"] = window.AddChild( new YotogiPanel("Panel:AutoBOTE", "AutoBOTE") ); 1177 | panel["AutoBOTE"].AddChild(slider["Hara"]); 1178 | window.AddHorizontalSpacer(); 1179 | 1180 | panel["AutoKUPA"] = new YotogiPanel("Panel:AutoKUPA", "AutoKUPA"); 1181 | if (bKupaAvailable) 1182 | { 1183 | panel["AutoKUPA"] = window.AddChild(panel["AutoKUPA"]); 1184 | panel["AutoKUPA"].AddChild(slider["Kupa"]); 1185 | window.AddHorizontalSpacer(); 1186 | } 1187 | 1188 | panel["FaceAnime"] = window.AddChild( new YotogiPanel("Panel:FaceAnime", "FaceAnime", YotogiPanel.HeaderUI.Face) ); 1189 | panel["FaceAnime"].AddChild(toggle["Lipsync"]); 1190 | panel["FaceAnime"].AddChild(grid["FaceAnime"]); 1191 | window.AddHorizontalSpacer(); 1192 | 1193 | panel["FaceBlend"] = window.AddChild( new YotogiPanel("Panel:FaceBlend", "FaceBlend", YotogiPanel.HeaderUI.Face) ); 1194 | panel["FaceBlend"].AddChild(grid["FaceBlend"]); 1195 | } 1196 | 1197 | // Preferences 1198 | { 1199 | ReloadConfig(); 1200 | 1201 | fOrgasmsPerAheLevel = parseExIni("AutoAHE", "OrgasmsPerLevel", fOrgasmsPerAheLevel); 1202 | fAheEyeDecrement = parseExIni("AutoAHE", "EyeDecrement", fAheEyeDecrement); 1203 | for (int i = 0; i<3; i++) 1204 | { 1205 | iAheExcite[i] = (int)parseExIni("AutoAHE", "ExciteThreshold_"+ i, iAheExcite[i]); 1206 | fAheNormalEyeMax[i] = parseExIni("AutoAHE", "NormalEyeMax_"+ i, fAheNormalEyeMax[i]); 1207 | fAheOrgasmEyeMax[i] = parseExIni("AutoAHE", "OrgasmEyeMax_"+ i, fAheOrgasmEyeMax[i]); 1208 | fAheOrgasmEyeMin[i] = parseExIni("AutoAHE", "OrgasmEyeMin_"+ i, fAheOrgasmEyeMin[i]); 1209 | fAheOrgasmSpeed[i] = parseExIni("AutoAHE", "OrgasmMotionSpeed_"+ i, fAheOrgasmSpeed[i]); 1210 | fAheOrgasmConvulsion[i] = parseExIni("AutoAHE", "OrgasmConvulsion_"+ i, fAheOrgasmConvulsion[i]); 1211 | sAheOrgasmFace[i] = parseExIniRaw("AutoAHE", "OrgasmFace_"+ i, sAheOrgasmFace[i]); 1212 | sAheOrgasmFaceBlend[i] = parseExIniRaw("AutoAHE", "OrgasmFaceBlend_"+ i, sAheOrgasmFaceBlend[i]); 1213 | } 1214 | 1215 | iHaraIncrement = (int)parseExIni("AutoBOTE", "Increment", iHaraIncrement); 1216 | iBoteHaraMax = (int)parseExIni("AutoBOTE", "Max", iBoteHaraMax); 1217 | 1218 | iKupaIncrementPerOrgasm = (int)parseExIni("AutoKUPA", "IncrementPerOrgasm", iKupaIncrementPerOrgasm); 1219 | iKupaNormalMax = (int)parseExIni("AutoKUPA", "NormalMax", iKupaNormalMax); 1220 | for (int i = 0; i<2; i++) 1221 | { 1222 | iKupaValue[i] = (int)parseExIni("AutoKUPA", "Value_"+ i, iKupaValue[i]); 1223 | } 1224 | } 1225 | 1226 | return true; 1227 | } 1228 | 1229 | private void initOnStartSkill() 1230 | { 1231 | bLoadBoneAnimetion = false; 1232 | bSyncMotionSpeed = true; 1233 | bKupaFuck = false; 1234 | iBoteCount = 0; 1235 | 1236 | maid.SetProp("Hara", iDefHara, false); 1237 | if (bKupaAvailable) updateShapeKeyKupaValue(0f); 1238 | 1239 | foreach (KeyValuePair kvp in pa) if (kvp.Value.NowPlaying) kvp.Value.Stop(); 1240 | 1241 | StartCoroutine( getBoneAnimetionCoroutine(WaitBoneLoad) ); 1242 | 1243 | bSyncMotionSpeed = true; 1244 | StartCoroutine( syncMotionSpeedSliderCoroutine(TimePerUpdateSpeed) ); 1245 | 1246 | //if (lSelect["StageSelcet"].CurrentName != YotogiStageSelectManager.StagePrefab) 1247 | //{ 1248 | // GameMain.Instance.BgMgr.ChangeBg(lSelect["StageSelcet"].CurrentName); 1249 | //} 1250 | } 1251 | 1252 | private void finalize() 1253 | { 1254 | try{ 1255 | visible = false; 1256 | 1257 | window = null; 1258 | panel.Clear(); 1259 | slider.Clear(); 1260 | grid.Clear(); 1261 | toggle.Clear(); 1262 | lSelect.Clear(); 1263 | 1264 | bInitCompleted = false; 1265 | bSyncMotionSpeed = false; 1266 | fPassedTimeOnCommand = -1f; 1267 | bFadeInWait = false; 1268 | 1269 | iLastExcite = 0; 1270 | iOrgasmCount = 0; 1271 | iLastSliderFrustration = 0; 1272 | fLastSliderSensitivity = 0f; 1273 | 1274 | iDefHara = 0; 1275 | iBoteCount = 0; 1276 | 1277 | bKupaFuck = false; 1278 | 1279 | goCommandUnit = null; 1280 | maid = null; 1281 | maidStatusInfo = null; 1282 | maidFoceKuchipakuSelfUpdateTime = null; 1283 | yotogiParamBasicBar = null; 1284 | yotogiPlayManager = null; 1285 | orgOnClickCommand = null; 1286 | 1287 | if (kagScriptCallbacksOverride) 1288 | { 1289 | kagScript.RemoveTagCallBack("face"); 1290 | kagScript.AddTagCallBack("face", new KagScript.KagTagCallBack(this.orgTagFace)); 1291 | kagScript.RemoveTagCallBack("faceblend"); 1292 | kagScript.AddTagCallBack("faceblend", new KagScript.KagTagCallBack(this.orgTagFaceBlend)); 1293 | kagScriptCallbacksOverride = false; 1294 | 1295 | kagScript = null; 1296 | orgTagFace = null; 1297 | orgTagFaceBlend = null; 1298 | } 1299 | } catch(Exception ex) { Debug.LogError(LogLabel +"finalize() : "+ ex); return; } 1300 | 1301 | } 1302 | 1303 | //---- 1304 | 1305 | private void syncSlidersOnClickCommand(Yotogi.SkillData.Command.Data.Status cmStatus) 1306 | { 1307 | if (panel["Status"].Enabled && slider["Excite"].Pin) updateMaidExcite((int)slider["Excite"].Value); 1308 | else slider["Excite"].Value = (float)maid.Param.status.cur_excite; 1309 | 1310 | if (panel["Status"].Enabled && slider["Mind"].Pin) updateMaidMind((int)slider["Mind"].Value); 1311 | else slider["Mind"].Value = (float)maid.Param.status.cur_mind; 1312 | 1313 | if (panel["Status"].Enabled && slider["Reason"].Pin) updateMaidReason((int)slider["Reason"].Value); 1314 | else slider["Reason"].Value = (float)maid.Param.status.cur_reason; 1315 | 1316 | // コマンド実行によるfrustration変動でfrustrationは0-100内に補正される為、 1317 | // Statusパネル有効時はコマンド以前のスライダー値より感度を計算して表示 1318 | // メイドのfrustrationを実際に弄るのはコマンド直前のみ 1319 | slider["Sensitivity"].Value = (float)( maid.Param.status.correction_data.excite 1320 | + (panel["Status"].Enabled ? iLastSliderFrustration + cmStatus.frustration : maid.Param.status.frustration) 1321 | + (maid.Param.status.cur_reason < 20 ? 20 : 0) ); 1322 | 1323 | if (panel["Status"].Enabled && slider["MotionSpeed"].Pin) updateMotionSpeed(slider["MotionSpeed"].Value); 1324 | else foreach (AnimationState stat in anm_BO_body001) if (stat.enabled) slider["MotionSpeed"].Value = stat.speed * 100f; 1325 | 1326 | slider["EyeY"].Value = maid.body0.trsEyeL.localPosition.y * fEyePosToSliderMul; 1327 | slider["Hara"].Value = (float)maid.GetProp("Hara").value; 1328 | } 1329 | 1330 | private IEnumerator syncMotionSpeedSliderCoroutine(float waitTime) 1331 | { 1332 | while (bSyncMotionSpeed) 1333 | { 1334 | if (bLoadBoneAnimetion) 1335 | { 1336 | if (panel["Status"].Enabled && slider["MotionSpeed"].Pin && !pa["AHE.絶頂.0"].NowPlaying) 1337 | { 1338 | updateMotionSpeed(slider["MotionSpeed"].Value); 1339 | } 1340 | else 1341 | { 1342 | foreach (AnimationState stat in anm_BO_body001) 1343 | { 1344 | if (stat.enabled) 1345 | { 1346 | slider["MotionSpeed"].Value = stat.speed * 100f; 1347 | //Debug.Log(stat.name +":"+ stat.speed + ":"+ stat.enabled); 1348 | } 1349 | } 1350 | } 1351 | } 1352 | 1353 | yield return new WaitForSeconds(waitTime); 1354 | } 1355 | } 1356 | 1357 | private void initAnimeOnCommand() 1358 | { 1359 | if (panel["AutoAHE"].Enabled) 1360 | { 1361 | fAheLastEye = maid.body0.trsEyeL.localPosition.y * fEyePosToSliderMul; 1362 | 1363 | for (int i=0; i<1; i++) 1364 | { 1365 | if (pa["AHE.絶頂."+ i].NowPlaying) pa["AHE.絶頂."+ i].Stop(); 1366 | if (pa["AHE.継続."+ i].NowPlaying) pa["AHE.継続."+ i].Stop(); 1367 | } 1368 | 1369 | for (int i=0; i<2; i++) 1370 | { 1371 | if (pa["KUPA.挿入."+ i].NowPlaying) updateShapeKeyKupaValue(iKupaValue[i]); 1372 | pa["KUPA.挿入."+ i].Stop(); 1373 | } 1374 | } 1375 | 1376 | if (panel["AutoBOTE"].Enabled) 1377 | { 1378 | // アニメ再生中にコマンド実行で強制的に終端値に 1379 | if (pa["BOTE.絶頂"].NowPlaying) 1380 | { 1381 | updateMaidHaraValue(Mathf.Min(iDefHara + iHaraIncrement * iBoteCount, iBoteHaraMax)); 1382 | } 1383 | if (pa["BOTE.止める"].NowPlaying) 1384 | { 1385 | updateMaidHaraValue(iDefHara); 1386 | } 1387 | 1388 | pa["BOTE.絶頂"].Stop(); 1389 | pa["BOTE.止める"].Stop(); 1390 | } 1391 | 1392 | if (panel["AutoKUPA"].Enabled) 1393 | { 1394 | if (pa["KUPA.止める"].NowPlaying) updateShapeKeyKupaValue(iKupaMin); 1395 | 1396 | pa["KUPA.止める"].Stop(); 1397 | } 1398 | 1399 | } 1400 | 1401 | private void playAnimeOnCommand(Yotogi.SkillData.Command.Data.Basic data) 1402 | { 1403 | if (panel["AutoAHE"].Enabled) 1404 | { 1405 | float excite = maid.Param.status.cur_excite; 1406 | int i = idxAheOrgasm; 1407 | 1408 | if (data.command_type == Yotogi.SkillCommandType.絶頂) 1409 | { 1410 | if (iLastExcite >= iAheExcite[i]) 1411 | { 1412 | pa["AHE.継続.0"].Play(fAheLastEye ,fAheOrgasmEyeMax[i]); 1413 | 1414 | float[] xFrom = { fAheOrgasmEyeMax[i], fAheOrgasmSpeed[i] }; 1415 | float[] xTo = { fAheOrgasmEyeMin[i], 100f }; 1416 | 1417 | updateMotionSpeed(fAheOrgasmSpeed[i]); 1418 | pa["AHE.絶頂.0"].Play(xFrom, xTo); 1419 | 1420 | if (toggle["Convulsion"].Value) 1421 | { 1422 | if (pa["AHE.痙攣."+ i].NowPlaying) iAheOrgasmChain++; 1423 | pa["AHE.痙攣."+ i].Play(0f, fAheOrgasmConvulsion[i]); 1424 | } 1425 | 1426 | iOrgasmCount++; 1427 | } 1428 | } 1429 | else 1430 | { 1431 | if (excite >= iAheExcite[i]) 1432 | { 1433 | float to = fAheNormalEyeMax[i] * (excite - iAheExcite[i]) / (300f - iAheExcite[i]); 1434 | pa["AHE.継続.0"].Play(fAheLastEye, to); 1435 | } 1436 | } 1437 | } 1438 | 1439 | 1440 | if (panel["AutoBOTE"].Enabled) 1441 | { 1442 | float from = (float)maid.GetProp("Hara").value; 1443 | 1444 | if (data.command_type == Yotogi.SkillCommandType.絶頂) 1445 | { 1446 | if (data.name.Contains("中出し") || data.name.Contains("注ぎ込む")) 1447 | { 1448 | iBoteCount++; 1449 | float to = Mathf.Min(iDefHara + iHaraIncrement * iBoteCount, iBoteHaraMax); 1450 | pa["BOTE.絶頂"].Play(from, to); 1451 | } 1452 | else if (data.name.Contains("外出し")) 1453 | { 1454 | pa["BOTE.止める"].Play(from, iDefHara); 1455 | iBoteCount = 0; 1456 | } 1457 | } 1458 | else if (data.command_type == Yotogi.SkillCommandType.止める) 1459 | { 1460 | pa["BOTE.止める"].Play(from, iDefHara); 1461 | iBoteCount = 0; 1462 | } 1463 | } 1464 | 1465 | 1466 | if (panel["AutoKUPA"].Enabled) 1467 | { 1468 | if (data.command_type == Yotogi.SkillCommandType.挿入 && !data.name.Contains("口を責める")) 1469 | { 1470 | if (!bKupaFuck) 1471 | { 1472 | int i = checkGroupKupa(data.group_name); 1473 | if (i >= 0) 1474 | { 1475 | //Debug.Log(iKupaDef +":"+ iKupaIncrementPerOrgasm +":"+ iOrgasmCount +"="+ iKupaMin); 1476 | pa["KUPA.挿入."+ i].Play(iKupaMin, iKupaValue[i]); 1477 | bKupaFuck = true; 1478 | } 1479 | } 1480 | } 1481 | else if (data.command_type == Yotogi.SkillCommandType.止める || data.name.Contains("口を責める")) 1482 | { 1483 | //Debug.Log(iKupaDef +":"+ iKupaIncrementPerOrgasm +":"+ iOrgasmCount +"="+ iKupaMin); 1484 | pa["KUPA.止める"].Play(slider["Kupa"].Value, iKupaMin); 1485 | bKupaFuck = false; 1486 | } 1487 | else if (data.command_type == Yotogi.SkillCommandType.絶頂) 1488 | { 1489 | if (data.group_name.Contains("愛撫") || data.name.Contains("外出し")) 1490 | { 1491 | //Debug.Log(iKupaDef +":"+ iKupaIncrementPerOrgasm +":"+ iOrgasmCount +"="+ iKupaMin); 1492 | pa["KUPA.止める"].Play(slider["Kupa"].Value, iKupaMin); 1493 | bKupaFuck = false; 1494 | } 1495 | } 1496 | } 1497 | } 1498 | 1499 | private void playAnimeOnInputKeyDown(KeyCode keycode) 1500 | { 1501 | if (keycode == KeyCode.F5) 1502 | { 1503 | if (visible) 1504 | { 1505 | fWinAnimeFrom = new float[2] { Screen.width, 0f }; 1506 | fWinAnimeTo = new float[2] { winAnimeRect.x , 1f }; 1507 | } 1508 | else 1509 | { 1510 | fWinAnimeFrom = new float[2] { winAnimeRect.x, 1f }; 1511 | fWinAnimeTo = new float[2] { (winAnimeRect.x + winAnimeRect.width / 2> Screen.width / 2f) ? Screen.width : -winAnimeRect.width, 0f }; 1512 | } 1513 | pa["WIN.Load"].Play(fWinAnimeFrom, fWinAnimeTo); 1514 | } 1515 | } 1516 | 1517 | private void updateAnimeOnUpdate() 1518 | { 1519 | if (panel["AutoAHE"].Enabled) 1520 | { 1521 | if (pa["AHE.継続.0"].NowPlaying) pa["AHE.継続.0"].Update(); 1522 | 1523 | if (pa["AHE.絶頂.0"].NowPlaying) 1524 | { 1525 | pa["AHE.絶頂.0"].Update(); 1526 | maid.FaceBlend(sAheOrgasmFaceBlend[idxAheOrgasm]); 1527 | panel["FaceBlend"].HeaderUILabelText = sAheOrgasmFaceBlend[idxAheOrgasm]; 1528 | } 1529 | 1530 | for (int i=0; i<3; i++) if (pa["AHE.痙攣."+ i].NowPlaying) pa["AHE.痙攣."+ i].Update(); 1531 | 1532 | 1533 | // 放置中の瞳自然降下 1534 | if (!pa["AHE.継続.0"].NowPlaying && !pa["AHE.絶頂.0"].NowPlaying) 1535 | { 1536 | float eyepos = maid.body0.trsEyeL.localPosition.y * fEyePosToSliderMul; 1537 | if (eyepos > fAheDefEye) updateMaidEyePosY(eyepos - fAheEyeDecrement * (int)(fPassedTimeOnCommand / 10)); 1538 | } 1539 | } 1540 | 1541 | if (panel["AutoBOTE"].Enabled) 1542 | { 1543 | if (pa["BOTE.絶頂"].NowPlaying) pa["BOTE.絶頂"].Update(); 1544 | if (pa["BOTE.止める"].NowPlaying) pa["BOTE.止める"].Update(); 1545 | } 1546 | 1547 | if (panel["AutoKUPA"].Enabled) 1548 | { 1549 | if (pa["KUPA.挿入.0"].NowPlaying) pa["KUPA.挿入.0"].Update(); 1550 | if (pa["KUPA.挿入.1"].NowPlaying) pa["KUPA.挿入.1"].Update(); 1551 | if (pa["KUPA.止める"].NowPlaying) pa["KUPA.止める"].Update(); 1552 | } 1553 | } 1554 | 1555 | private void updateAnimeOnGUI() 1556 | { 1557 | if (pa["WIN.Load"].NowPlaying) 1558 | { 1559 | pa["WIN.Load"].Update(); 1560 | } 1561 | } 1562 | 1563 | private void dummyWin(int winID) {} 1564 | 1565 | //---- 1566 | 1567 | private void updateSlider(string name, float value) 1568 | { 1569 | Container.Find(window, name).Value = value; 1570 | } 1571 | 1572 | private void updateWindowAnime(float[] x) 1573 | { 1574 | winAnimeRect.x = x[0]; 1575 | GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, x[1]); 1576 | 1577 | GUIStyle winStyle = "box"; 1578 | winStyle.fontSize = PV.Font("C1"); 1579 | winStyle.alignment = TextAnchor.UpperRight; 1580 | winAnimeRect = GUI.Window(0, winAnimeRect, dummyWin, AddYotogiSlider.Version, winStyle); 1581 | } 1582 | 1583 | private void updateMaidExcite(int value) 1584 | { 1585 | maid.Param.SetCurExcite(value); 1586 | yotogiParamBasicBar.SetCurrentExcite(value, true); 1587 | iLastExcite = maid.Param.status.cur_excite; 1588 | } 1589 | 1590 | private void updateMaidMind(int value) 1591 | { 1592 | maid.Param.SetCurMind(value); 1593 | yotogiParamBasicBar.SetCurrentMind(value, true); 1594 | } 1595 | 1596 | private void updateMaidReason(int value) 1597 | { 1598 | maid.Param.SetCurReason(value); 1599 | yotogiParamBasicBar.SetCurrentReason(value, true); 1600 | } 1601 | 1602 | private void updateMaidFrustration(int value) 1603 | { 1604 | param.Status tmp = (param.Status)maidStatusInfo.GetValue(maid.Param); 1605 | tmp.frustration = value; 1606 | maidStatusInfo.SetValue(maid.Param, tmp); 1607 | } 1608 | 1609 | private void updateMaidEyePosY(float value) 1610 | { 1611 | if (value < 0f) value = 0f; 1612 | Vector3 vl = maid.body0.trsEyeL.localPosition; 1613 | Vector3 vr = maid.body0.trsEyeR.localPosition; 1614 | maid.body0.trsEyeL.localPosition = new Vector3(vl.x, Math.Max((fAheDefEye + value)/fEyePosToSliderMul, 0f), vl.z); 1615 | maid.body0.trsEyeR.localPosition = new Vector3(vl.x, Math.Min((fAheDefEye - value)/fEyePosToSliderMul, 0f), vl.z); 1616 | 1617 | updateSlider("Slider:EyeY", value); 1618 | } 1619 | 1620 | private void updateMaidHaraValue(float value) 1621 | { 1622 | try { 1623 | maid.SetProp("Hara", (int)value, false); 1624 | maid.body0.VertexMorph_FromProcItem("hara", value/100f); 1625 | } catch { /*Debug.LogError(LogLabel + ex);*/ } 1626 | 1627 | updateSlider("Slider:Hara", value); 1628 | } 1629 | 1630 | private void updateMaidFoceKuchipakuSelfUpdateTime(bool b) 1631 | { 1632 | maidFoceKuchipakuSelfUpdateTime.SetValue(maid, b); 1633 | } 1634 | 1635 | 1636 | private void updateShapeKeyKupaValue(float value) 1637 | { 1638 | try { 1639 | maid.body0.VertexMorph_FromProcItem("kupa", value/100f); 1640 | } catch { /*Debug.LogError(LogLabel + ex);*/ } 1641 | 1642 | updateSlider("Slider:Kupa", value); 1643 | } 1644 | 1645 | private void updateShapeKeyOrgasmValue(float value) 1646 | { 1647 | try { 1648 | maid.body0.VertexMorph_FromProcItem("orgasm", value/100f); 1649 | } catch { /*Debug.LogError(LogLabel + ex);*/ } 1650 | 1651 | //Debug.LogWarning(value); 1652 | } 1653 | 1654 | private void updateOrgasmConvulsion(float value) 1655 | { 1656 | //goBip01LThigh.transform.localRotation *= Quaternion.Euler(0f, 10f*value, 0f); 1657 | updateShapeKeyOrgasmValue(value); 1658 | } 1659 | 1660 | private void updateMotionSpeed(float value) 1661 | { 1662 | foreach (AnimationState stat in anm_BO_body001) if (stat.enabled) stat.speed = value/100f; 1663 | foreach (Animation anm in anm_BO_mbody) 1664 | { 1665 | foreach (AnimationState stat in anm) if (stat.enabled) stat.speed = value/100f; 1666 | } 1667 | } 1668 | 1669 | 1670 | private void updateCameraControl() 1671 | { 1672 | Vector2 cursor = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); 1673 | bool b = window.Rectangle.Contains(cursor); 1674 | if (b != bCursorOnWindow) 1675 | { 1676 | GameMain.Instance.MainCamera.SetControl(!b); 1677 | UICamera.InputEnable = !b; 1678 | bCursorOnWindow = b; 1679 | } 1680 | } 1681 | 1682 | private void updateAheOrgasm(float[] x) 1683 | { 1684 | updateMaidEyePosY(x[0]); 1685 | updateMotionSpeed(x[1]); 1686 | } 1687 | 1688 | private int getMaidFrustration() 1689 | { 1690 | param.Status tmp = (param.Status)maidStatusInfo.GetValue(maid.Param); 1691 | return tmp.frustration; 1692 | } 1693 | 1694 | private int getSliderFrustration() 1695 | { 1696 | return (int)(slider["Sensitivity"].Value - maid.Param.status.correction_data.excite + (maid.Param.status.cur_reason < 20 ? 20 : 0)); 1697 | } 1698 | 1699 | private IEnumerator getBoneAnimetionCoroutine(float waitTime) 1700 | { 1701 | yield return new WaitForSeconds(waitTime); 1702 | 1703 | this.anm_BO_body001 = maid.body0.GetAnimation(); 1704 | 1705 | List go_BO_mbody = new List(); 1706 | 1707 | int i = 0; 1708 | while(true) 1709 | { 1710 | GameObject go = GameObject.Find("Man["+ i +"]/Offset/_BO_mbody"); 1711 | if (!go) break; 1712 | 1713 | go_BO_mbody.Add(go); 1714 | i++; 1715 | } 1716 | 1717 | this.anm_BO_mbody = new Animation[i]; 1718 | for (int j=0; j(); 1719 | 1720 | bLoadBoneAnimetion = true; 1721 | //Debug.Log(LogLabel +"BoneAnimetion : "+ i); 1722 | } 1723 | 1724 | private int checkGroupKupa(string s) 1725 | { 1726 | if (!s.Contains("アナル")) 1727 | { 1728 | if (s.Contains("セックス") || s.Contains("太バイブ")) return 0; 1729 | 1730 | if (s.Contains("愛撫") || s.Contains("オナニー") || s.Contains("バイブ")) return 1; 1731 | 1732 | if (s == "詰られ騎乗位") return 0; 1733 | } 1734 | 1735 | if (s == "バイブ責めアナルセックス正常位") return 1; 1736 | if (s == "アナルバイブ責めセックス後背位") return 0; 1737 | 1738 | return -1; 1739 | } 1740 | 1741 | private float parseExIni(string section, string key, float def) 1742 | { 1743 | float x; 1744 | if (Preferences.HasSection(section)) 1745 | { 1746 | if (Preferences[section].HasKey(key)) 1747 | { 1748 | if (Single.TryParse(Preferences[section][key].Value, out x)) 1749 | { 1750 | //Debug.Log(section + ":"+ key + ":"+ x); 1751 | return x; 1752 | } 1753 | } 1754 | } 1755 | 1756 | //Debug.Log(section + ":"+ key + ":default"); 1757 | return def; 1758 | } 1759 | 1760 | private string parseExIniRaw(string section, string key, string def) 1761 | { 1762 | if (Preferences.HasSection(section)) 1763 | { 1764 | if (Preferences[section].HasKey(key)) 1765 | { 1766 | //Debug.Log(section + ":"+ key + ":"+ Preferences[section][key].Value); 1767 | return Preferences[section][key].Value; 1768 | 1769 | } 1770 | } 1771 | 1772 | //Debug.Log(section + ":"+ key + ":default"); 1773 | return def; 1774 | } 1775 | 1776 | 1777 | #endregion 1778 | 1779 | 1780 | 1781 | #region Utility methods 1782 | 1783 | 1784 | internal static IEnumerator CheckFadeStatus(WfScreenChildren wsc, float waitTime) 1785 | { 1786 | while(true) 1787 | { 1788 | Debug.Log(wsc.fade_status.ToString()); 1789 | yield return new WaitForSeconds(waitTime); 1790 | } 1791 | } 1792 | 1793 | internal static string GetFullPath(GameObject go) 1794 | { 1795 | string s = go.name; 1796 | if (go.transform.parent != null) s = GetFullPath(go.transform.parent.gameObject) + "/" + s; 1797 | 1798 | return s; 1799 | } 1800 | 1801 | internal static void WriteComponent(GameObject go) 1802 | { 1803 | Component[] compos = go.GetComponents(); 1804 | foreach(Component c in compos){ Debug.Log(go.name +":"+ c.GetType().Name); } 1805 | } 1806 | 1807 | internal static void WriteTrans(string s) 1808 | { 1809 | GameObject go = GameObject.Find(s); 1810 | if (IsNull(go, s +" not found.")) return; 1811 | 1812 | WriteTrans(go.transform, 0, null); 1813 | } 1814 | internal static void WriteTrans(Transform t) { WriteTrans(t, 0, null); } 1815 | internal static void WriteTrans(Transform t, int level, StreamWriter writer) 1816 | { 1817 | if (level == 0) writer = new StreamWriter(@".\"+ t.name +@".txt", false); 1818 | if (writer == null) return; 1819 | 1820 | string s = ""; 1821 | for(int i=0; i(T t) where T : class 1832 | { 1833 | return (t == null) ? true : false; 1834 | } 1835 | 1836 | internal static bool IsNull(T t, string s) where T : class 1837 | { 1838 | if(t == null) 1839 | { 1840 | Debug.LogError(s); 1841 | return true; 1842 | } 1843 | else return false; 1844 | } 1845 | 1846 | internal static bool IsActive(GameObject go) 1847 | { 1848 | return go ? go.activeInHierarchy : false; 1849 | } 1850 | 1851 | internal static T getInstance() where T : UnityEngine.Object 1852 | { 1853 | return UnityEngine.Object.FindObjectOfType(typeof(T)) as T; 1854 | } 1855 | 1856 | internal static TResult getMethodDelegate(T inst, string name) where T : class where TResult : class 1857 | { 1858 | return Delegate.CreateDelegate(typeof(TResult), inst, name) as TResult; 1859 | } 1860 | 1861 | internal static FieldInfo getFieldInfo(string name) 1862 | { 1863 | BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance; 1864 | 1865 | return typeof(T).GetField(name, bf); 1866 | } 1867 | 1868 | internal static TResult getFieldValue(T inst, string name) 1869 | { 1870 | if (inst == null) return default(TResult); 1871 | 1872 | FieldInfo field = getFieldInfo(name); 1873 | if (field == null) return default(TResult); 1874 | 1875 | return (TResult)field.GetValue(inst); 1876 | } 1877 | 1878 | #endregion 1879 | 1880 | } 1881 | 1882 | } 1883 | 1884 | 1885 | 1886 | 1887 | namespace UnityObsoleteGui 1888 | { 1889 | 1890 | public abstract class Element : IComparable 1891 | { 1892 | protected readonly int id; 1893 | 1894 | protected string name; 1895 | protected Rect rect; 1896 | protected bool visible; 1897 | 1898 | public string Name { get{ return name; } } 1899 | 1900 | public virtual Rect Rectangle { get{ return rect; } } 1901 | public virtual float Left { get{ return rect.x; } } 1902 | public virtual float Top { get{ return rect.y; } } 1903 | public virtual float Width { get{ return rect.width; } } 1904 | public virtual float Height { get{ return rect.height; } } 1905 | public virtual bool Visible 1906 | { 1907 | get{ return visible; } 1908 | set 1909 | { 1910 | visible = value; 1911 | if (Parent != null) notifyParent(false, true); 1912 | } 1913 | } 1914 | 1915 | public Container Parent = null; 1916 | public event EventHandler NotifyParent = delegate{}; 1917 | 1918 | 1919 | public Element() {} 1920 | public Element(string name, Rect rect) 1921 | { 1922 | this.id = this.GetHashCode(); 1923 | this.name = name; 1924 | this.rect = rect; 1925 | this.visible = true; 1926 | } 1927 | 1928 | public virtual void Draw() { Draw(this.rect); } 1929 | public virtual void Draw(Rect outRect) {} 1930 | public virtual void Resize() { Resize(false); } 1931 | public virtual void Resize(bool broadCast) { if(!broadCast) notifyParent(true, false); } 1932 | 1933 | public virtual int CompareTo(Element e) { return this.name.CompareTo(e.Name); } 1934 | 1935 | protected virtual void notifyParent(bool sizeChanged, bool visibleChanged) 1936 | { 1937 | NotifyParent(this, new ElementEventArgs(name, sizeChanged, visibleChanged)); 1938 | } 1939 | } 1940 | 1941 | 1942 | public abstract class Container : Element, IEnumerable 1943 | { 1944 | public static Element Find(Container parent, string s) { return Container.Find(parent, s); } 1945 | public static T Find(Container parent, string s) where T : Element 1946 | { 1947 | if (parent == null) return null; 1948 | 1949 | foreach (Element e in parent) 1950 | { 1951 | if (e is T && e.Name == s) return e as T; 1952 | if (e is Container) 1953 | { 1954 | T e2 = Find(e as Container, s); 1955 | if (e2 != null) return e2 as T; 1956 | } 1957 | } 1958 | 1959 | return null; 1960 | } 1961 | 1962 | //---- 1963 | 1964 | protected List children = new List(); 1965 | 1966 | public int ChildCount { get{ return children.Count; } } 1967 | 1968 | 1969 | public Container(string name, Rect rect) : base(name, rect) {} 1970 | 1971 | public Element this[string s] 1972 | { 1973 | get { return GetChild(s); } 1974 | set { if (value is Element) AddChild(value); } 1975 | } 1976 | 1977 | public Element AddChild(Element child) { return AddChild(child); } 1978 | public T AddChild(T child) where T : Element 1979 | { 1980 | if (child != null && !children.Contains(child)) 1981 | { 1982 | child.Parent = this; 1983 | child.NotifyParent += this.onChildChenged; 1984 | children.Add(child); 1985 | Resize(); 1986 | 1987 | return child; 1988 | } 1989 | 1990 | return null; 1991 | } 1992 | 1993 | public Element GetChild(string s) { return GetChild(s); } 1994 | public T GetChild() where T : Element { return GetChild(""); } 1995 | public T GetChild(string s) where T : Element 1996 | { 1997 | return children.FirstOrDefault(e => e is T && (s == "" ? true : e.Name == s)) as T; 1998 | } 1999 | 2000 | public void RemoveChild(string s) 2001 | { 2002 | Element child = children.FirstOrDefault(e => e.Name == s); 2003 | if (child != null) 2004 | { 2005 | child.Parent = null; 2006 | child.NotifyParent -= this.onChildChenged; 2007 | children.Remove(child); 2008 | Resize(); 2009 | } 2010 | } 2011 | 2012 | public void RemoveChildren() 2013 | { 2014 | foreach (Element child in children) 2015 | { 2016 | child.Parent = null; 2017 | child.NotifyParent -= this.onChildChenged; 2018 | } 2019 | children.Clear(); 2020 | Resize(); 2021 | } 2022 | 2023 | public virtual void onChildChenged(object sender, EventArgs e) { Resize(); } 2024 | 2025 | IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } 2026 | public IEnumerator GetEnumerator() { return children.GetEnumerator(); } 2027 | 2028 | } 2029 | 2030 | 2031 | public class Window : Container 2032 | { 2033 | 2034 | #region Constants 2035 | public const float AutoLayout = -1f; 2036 | 2037 | [Flags] 2038 | public enum Scroll 2039 | { 2040 | None = 0x00, 2041 | HScroll = 0x01, 2042 | VScroll = 0x02 2043 | } 2044 | 2045 | #endregion 2046 | 2047 | 2048 | 2049 | #region Nested classes 2050 | 2051 | private class HorizontalSpacer : Element 2052 | { 2053 | public HorizontalSpacer(float height) 2054 | : base("Spacer:", new Rect(Window.AutoLayout, Window.AutoLayout, Window.AutoLayout, height) ) 2055 | { 2056 | this.name += this.id; 2057 | } 2058 | } 2059 | 2060 | #endregion 2061 | 2062 | 2063 | 2064 | #region Variables 2065 | 2066 | private Rect sizeRatio; 2067 | private Rect baseRect; 2068 | private Rect titleRect; 2069 | private Rect contentRect; 2070 | private Vector2 autoSize = Vector2.zero; 2071 | private Vector2 hScrollViewPos = Vector2.zero; 2072 | private Vector2 vScrollViewPos = Vector2.zero; 2073 | private Vector2 lastScreenSize; 2074 | private int colums = 1; 2075 | 2076 | public GUIStyle WindowStyle = "window"; 2077 | public GUIStyle LabelStyle = "label"; 2078 | public string HeaderText; 2079 | public int HeaderFontSize; 2080 | public string TitleText; 2081 | public float TitleHeight; 2082 | public int TitleFontSize; 2083 | public Scroll scroll = Scroll.None; 2084 | 2085 | #endregion 2086 | 2087 | 2088 | 2089 | #region Methods 2090 | 2091 | public Window(Rect ratio, string header, string title) : this(title, ratio, header, title, null) {} 2092 | public Window(string name, Rect ratio, string header, string title) : this(name, ratio, header, title, null) {} 2093 | public Window(string name, Rect ratio, string header, string title, List children) : base(name, PV.PropScreenMH(ratio)) 2094 | { 2095 | this.sizeRatio = ratio; 2096 | this.HeaderText = header; 2097 | this.TitleText = title; 2098 | this.TitleHeight= PV.Line("C1"); 2099 | 2100 | if (children != null && children.Count > 0) 2101 | { 2102 | this.children = new List(children); 2103 | foreach (Element child in children) 2104 | { 2105 | child.Parent = this; 2106 | child.NotifyParent += this.onChildChenged; 2107 | 2108 | } 2109 | Resize(); 2110 | } 2111 | 2112 | lastScreenSize = new Vector2(Screen.width, Screen.height); 2113 | } 2114 | 2115 | public override void Draw(Rect outRect) 2116 | { 2117 | if (propScreen()) 2118 | { 2119 | resizeAllChildren(this); 2120 | Resize(); 2121 | outRect = rect; 2122 | } 2123 | 2124 | WindowStyle.fontSize = PV.Font("C2"); 2125 | WindowStyle.alignment = TextAnchor.UpperRight; 2126 | 2127 | rect = GUI.Window(id, outRect, drawWindow, HeaderText, WindowStyle); 2128 | } 2129 | 2130 | public override void Resize() 2131 | { 2132 | calcAutoSize(); 2133 | } 2134 | 2135 | public Element AddHorizontalSpacer() { return AddHorizontalSpacer((float)PV.Margin); } 2136 | public Element AddHorizontalSpacer(float height) { return AddChild( new HorizontalSpacer(height) ); } 2137 | 2138 | //---- 2139 | 2140 | private void drawWindow(int id) 2141 | { 2142 | TitleHeight = PV.Line("C1"); 2143 | TitleFontSize = PV.Font("C2"); 2144 | 2145 | LabelStyle.fontSize = TitleFontSize; 2146 | LabelStyle.alignment = TextAnchor.UpperLeft; 2147 | GUI.Label(titleRect, TitleText, LabelStyle); 2148 | 2149 | GUI.BeginGroup(contentRect); 2150 | { 2151 | Rect cur = new Rect(0f, 0f, 0f, 0f); 2152 | 2153 | foreach (Element child in children) 2154 | { 2155 | if (!child.Visible) continue; 2156 | 2157 | if (child.Left >= 0 || child.Top >= 0) 2158 | { 2159 | Rect tmp = new Rect ( (child.Left >= 0) ? child.Left : cur.x, 2160 | (child.Top >= 0) ? child.Top : cur.y, 2161 | (child.Width > 0) ? child.Width : autoSize.x, 2162 | (child.Height > 0) ? child.Height : autoSize.y); 2163 | 2164 | child.Draw(tmp); 2165 | } 2166 | else 2167 | { 2168 | cur.width = (child.Width > 0) ? child.Width : autoSize.x; 2169 | cur.height = (child.Height > 0) ? child.Height : autoSize.y; 2170 | child.Draw(cur); 2171 | cur.y += cur.height; 2172 | } 2173 | } 2174 | } 2175 | GUI.EndGroup(); 2176 | 2177 | GUI.DragWindow(); 2178 | } 2179 | 2180 | private bool propScreen() 2181 | { 2182 | Vector2 screenSize = new Vector2(Screen.width, Screen.height); 2183 | if (lastScreenSize != screenSize) 2184 | { 2185 | rect = PV.PropScreenMH(rect.x, rect.y, sizeRatio.width , sizeRatio.height, lastScreenSize); 2186 | lastScreenSize = screenSize; 2187 | calcRectSize(); 2188 | return true; 2189 | } 2190 | return false; 2191 | } 2192 | 2193 | private void calcRectSize() 2194 | { 2195 | baseRect = PV.InsideRect(rect); 2196 | titleRect = new Rect(PV.Margin, 0, baseRect.width, TitleHeight); 2197 | contentRect = new Rect(baseRect.x, baseRect.y + titleRect.height, baseRect.width, baseRect.height - titleRect.height); 2198 | } 2199 | 2200 | public void calcAutoSize() 2201 | { 2202 | Vector2 used = Vector2.zero; 2203 | Vector2 count = Vector2.zero; 2204 | 2205 | foreach (Element child in children) 2206 | { 2207 | if (!child.Visible) continue; 2208 | 2209 | if (!(child.Left > 0 || child.Top > 0) && child.Width > 0) used.x += child.Width; 2210 | else count.x += 1; 2211 | 2212 | if (!(child.Left > 0 || child.Top > 0) && child.Height > 0) used.y += child.Height; 2213 | else count.y += 1; 2214 | } 2215 | 2216 | { 2217 | bool rectChanged = false; 2218 | 2219 | if ((scroll & Window.Scroll.HScroll) == 0x00) 2220 | { 2221 | if (contentRect.width < used.x || (contentRect.width > used.x && count.x == 0)) 2222 | { 2223 | rect.width = used.x + PV.Margin * 2; 2224 | rectChanged = true; 2225 | } 2226 | } 2227 | 2228 | if ((scroll & Window.Scroll.VScroll) == 0x00) 2229 | { 2230 | if (contentRect.height < used.y || (contentRect.height > used.y && count.y == 0)) 2231 | { 2232 | rect.height = used.y + titleRect.height + PV.Margin * 3; 2233 | rectChanged = true; 2234 | } 2235 | } 2236 | 2237 | if (rectChanged) calcRectSize(); 2238 | } 2239 | 2240 | autoSize.x = (count.x > 0) ? (contentRect.width - used.x) / colums : contentRect.width; 2241 | autoSize.y = (count.y > 0) ? (contentRect.height - used.y) / (float)Math.Ceiling(count.y/colums) : contentRect.height; 2242 | } 2243 | 2244 | private void resizeAllChildren(Container parent) 2245 | { 2246 | if (parent == null) return; 2247 | 2248 | foreach(Element child in parent) 2249 | { 2250 | if (child is Container) resizeAllChildren(child as Container); 2251 | else child.Resize(true); 2252 | } 2253 | } 2254 | 2255 | #endregion 2256 | 2257 | } 2258 | 2259 | 2260 | public class HSlider : Element 2261 | { 2262 | public GUIStyle Style = "horizontalSlider"; 2263 | public GUIStyle ThumbStyle = "horizontalSliderThumb"; 2264 | public float Value; 2265 | public float Min; 2266 | public float Max; 2267 | 2268 | public event EventHandler OnChange; 2269 | 2270 | public HSlider(string name, Rect rect, float min, float max, float def, EventHandler _OnChange) : base(name, rect) 2271 | { 2272 | this.Value = def; 2273 | this.Min = min; 2274 | this.Max = max; 2275 | this.OnChange += _OnChange; 2276 | } 2277 | 2278 | public override void Draw(Rect outRect) 2279 | { 2280 | onChange( GUI.HorizontalSlider(outRect, Value, Min, Max, Style, ThumbStyle) ); 2281 | } 2282 | 2283 | private void onChange(float newValue) 2284 | { 2285 | if (newValue != Value) 2286 | { 2287 | OnChange(this, new SliderEventArgs(name, newValue)); 2288 | Value = newValue; 2289 | } 2290 | } 2291 | } 2292 | 2293 | public class Toggle : Element 2294 | { 2295 | private bool val; 2296 | 2297 | public GUIStyle Style = "toggle"; 2298 | public GUIContent Content; 2299 | public bool Value { get{ return val; } } 2300 | public string Text { get{ return Content.text; } set{ Content.text = value; } } 2301 | 2302 | public event EventHandler OnChange; 2303 | 2304 | public Toggle(string name, Rect rect, EventHandler _OnChange) : this(name, rect, false, "", _OnChange) {} 2305 | public Toggle(string name, Rect rect, bool def, EventHandler _OnChange) : this(name, rect, def, "", _OnChange) {} 2306 | public Toggle(string name, Rect rect, string text, EventHandler _OnChange) : this(name, rect, false, text, _OnChange) {} 2307 | public Toggle(string name, Rect rect, bool def, string text, EventHandler _OnChange) : base(name, rect) 2308 | { 2309 | this.val = def; 2310 | this.Content = new GUIContent(text); 2311 | this.OnChange += _OnChange; 2312 | } 2313 | 2314 | public override void Draw(Rect outRect) 2315 | { 2316 | onChange( GUI.Toggle(outRect, Value, Content, Style) ); 2317 | } 2318 | 2319 | private void onChange(bool newValue) 2320 | { 2321 | if (newValue != val) OnChange(this, new ToggleEventArgs(name, newValue)); 2322 | val = newValue; 2323 | } 2324 | } 2325 | 2326 | public class SelectButton : Element 2327 | { 2328 | private string[] buttonNames; 2329 | private int selected = 0; 2330 | 2331 | public int SelectedIndex { get{ return selected; } } 2332 | public string Value { get{ return buttonNames[selected]; } } 2333 | 2334 | public event EventHandler OnSelect; 2335 | 2336 | public SelectButton(string name, Rect rect, string[] buttonNames, EventHandler _onSelect) : base(name, rect) 2337 | { 2338 | this.buttonNames = buttonNames; 2339 | this.OnSelect += _onSelect; 2340 | } 2341 | 2342 | public override void Draw(Rect outRect) 2343 | { 2344 | onSelect( GUI.Toolbar(outRect, selected, buttonNames) ); 2345 | } 2346 | 2347 | private void onSelect(int newSelected) 2348 | { 2349 | if (selected != newSelected) 2350 | { 2351 | OnSelect(this, new SelectEventArgs(name, newSelected, buttonNames[newSelected])); 2352 | selected = newSelected; 2353 | } 2354 | } 2355 | } 2356 | 2357 | 2358 | public class ElementEventArgs : EventArgs 2359 | { 2360 | public string Name; 2361 | public bool SizeChanged; 2362 | public bool VisibleChanged; 2363 | 2364 | public ElementEventArgs(string name, bool sizeChanged, bool visibleChanged) 2365 | { 2366 | this.Name = name; 2367 | this.SizeChanged = sizeChanged; 2368 | this.VisibleChanged = visibleChanged; 2369 | } 2370 | } 2371 | 2372 | public class SliderEventArgs : EventArgs 2373 | { 2374 | public string Name; 2375 | public float Value; 2376 | 2377 | public SliderEventArgs(string name, float value) 2378 | { 2379 | this.Name = name; 2380 | this.Value = value; 2381 | } 2382 | } 2383 | 2384 | public class ButtonEventArgs : EventArgs 2385 | { 2386 | public string Name; 2387 | public string ButtonName; 2388 | 2389 | public ButtonEventArgs(string name, string buttonName) 2390 | { 2391 | this.Name = name; 2392 | this.ButtonName = buttonName; 2393 | } 2394 | } 2395 | 2396 | public class ToggleEventArgs : EventArgs 2397 | { 2398 | public string Name; 2399 | public bool Value; 2400 | 2401 | public ToggleEventArgs(string name, bool b) 2402 | { 2403 | this.Name = name; 2404 | this.Value = b; 2405 | } 2406 | } 2407 | 2408 | public class SelectEventArgs : EventArgs 2409 | { 2410 | public string Name; 2411 | public int Index; 2412 | public string ButtonName; 2413 | 2414 | public SelectEventArgs(string name, int idx, string buttonName) 2415 | { 2416 | this.Name = name; 2417 | this.Index = idx; 2418 | this.ButtonName = buttonName; 2419 | } 2420 | } 2421 | 2422 | 2423 | public static class PixelValuesCM3D2 2424 | { 2425 | 2426 | #region Variables 2427 | 2428 | private static int margin = 10; 2429 | private static Dictionary font = new Dictionary(); 2430 | private static Dictionary line = new Dictionary(); 2431 | private static Dictionary sys = new Dictionary(); 2432 | 2433 | public static float BaseWidth = 1280f; 2434 | public static float PropRatio = 0.6f; 2435 | public static int Margin { get{ return PropPx(margin); } set{ margin = value; } } 2436 | 2437 | #endregion 2438 | 2439 | 2440 | 2441 | #region Methods 2442 | 2443 | static PixelValuesCM3D2() 2444 | { 2445 | font["C1"] = 12; 2446 | font["C2"] = 11; 2447 | font["H1"] = 20; 2448 | font["H2"] = 16; 2449 | font["H3"] = 14; 2450 | 2451 | line["C1"] = 18; 2452 | line["C2"] = 14; 2453 | line["H1"] = 30; 2454 | line["H2"] = 24; 2455 | line["H3"] = 22; 2456 | 2457 | sys["Menu.Height"] = 45; 2458 | sys["OkButton.Height"] = 95; 2459 | 2460 | sys["HScrollBar.Width"] = 15; 2461 | } 2462 | 2463 | public static int Font(string key) { return PropPx(font[key]); } 2464 | public static int Line(string key) { return PropPx(line[key]); } 2465 | public static int Sys(string key) { return PropPx(sys[key]); } 2466 | 2467 | public static int Font_(string key) { return font[key]; } 2468 | public static int Line_(string key) { return line[key]; } 2469 | public static int Sys_(string key) { return sys[key]; } 2470 | 2471 | public static Rect PropScreen(Rect ratio) 2472 | { 2473 | return new Rect((Screen.width - Margin * 2) * ratio.x + Margin 2474 | ,(Screen.height - Margin * 2) * ratio.y + Margin 2475 | ,(Screen.width - Margin * 2) * ratio.width 2476 | ,(Screen.height - Margin * 2) * ratio.height); 2477 | } 2478 | 2479 | public static Rect PropScreenMH(Rect ratio) 2480 | { 2481 | Rect r = PropScreen(ratio); 2482 | r.y += Sys("Menu.Height"); 2483 | r.height -= (Sys("Menu.Height") + Sys("OkButton.Height")); 2484 | 2485 | return r; 2486 | } 2487 | 2488 | public static Rect PropScreenMH(float left, float top, float width, float height, Vector2 last) 2489 | { 2490 | Rect r = PropScreen(new Rect((float)(left/(last.x - Margin * 2)), (float)(top/(last.y - Margin * 2)), width, height)); 2491 | r.height -= (Sys("Menu.Height") + Sys("OkButton.Height")); 2492 | 2493 | return r; 2494 | } 2495 | 2496 | public static Rect InsideRect(Rect rect) 2497 | { 2498 | return new Rect(Margin, Margin, rect.width - Margin * 2, rect.height - Margin * 2); 2499 | } 2500 | 2501 | public static Rect InsideRect(Rect rect, int height) 2502 | { 2503 | return new Rect(Margin, Margin, rect.width - Margin * 2, height); 2504 | } 2505 | 2506 | public static Rect InsideRect(Rect rect, Rect padding) 2507 | { 2508 | return new Rect(rect.x + padding.x, rect.y + padding.x, rect.width - padding.width * 2, rect.height - padding.height * 2); 2509 | } 2510 | 2511 | public static int PropPx(int px) 2512 | { 2513 | return (int)(px * (1f + (Screen.width/BaseWidth - 1f) * PropRatio)); 2514 | } 2515 | 2516 | public static Rect PropRect(int px) 2517 | { 2518 | return new Rect(PropPx(px), PropPx(px), PropPx(px), PropPx(px)); 2519 | } 2520 | #endregion 2521 | 2522 | } 2523 | 2524 | } 2525 | --------------------------------------------------------------------------------