private void DoMainMenu(int winID)
{
int mod_num = ssParam.KeyCount;
Rect baseRect = pv.InsideRect(this.winRect);
Rect headerRect = new Rect(baseRect.x, baseRect.y, baseRect.width, pv.Line("H3"));
Rect scrollRect = new Rect(baseRect.x, baseRect.y + headerRect.height + pv.Margin
, baseRect.width + pv.PropPx(5), baseRect.height - headerRect.height - pv.Margin);
Rect conRect = new Rect(0, 0, scrollRect.width - pv.Sys_("HScrollBar.Width") - pv.Margin, 0);
Rect outRect = new Rect();
GUIStyle lStyle = "label";
GUIStyle tStyle = "toggle";
GUIStyle bStyle = "button";
Color color = new Color(1f, 1f, 1f, 0.98f);
for (int i = 0; i < mod_num; i++)
{
string key = ssParam.sKey[i];
conRect.height += pv.Line("H1");
if (ssParam.sType[key] == "check")
{
conRect.height += pv.Margin;
}
else if (ssParam.sType[key] == "button")
{
conRect.height += pv.Line("H1") + pv.Margin;
}
else if (ssParam.sType[key] == "toggle" && !ssParam.bEnabled[key])
{
conRect.height += pv.Margin;
}
else
{
for (int j = 0; j < ssParam.ValCount(key); j++)
conRect.height += pv.Line("H1");
conRect.height += pv.Margin * 2;
}
}
conRect.height += pv.Margin * 4;
if (ssParam.autoPreset)
{
conRect.height += pv.Line("H1") * 2 + pv.Margin;
}
lStyle.normal.textColor = color;
tStyle.normal.textColor = color;
bStyle.normal.textColor = color;
lStyle.fontSize = pv.Font("H3");
bStyle.fontSize = pv.Font("H1");
drawWinHeader(headerRect, "サブスクリーン", lStyle);
// スクロールビュー
scrollViewVector = GUI.BeginScrollView(scrollRect, scrollViewVector, conRect);
// 各modスライダー
outRect.Set(0, 0, conRect.width, 0);
for (int i = 0; i < mod_num; i++)
{
string key = ssParam.sKey[i];
//----
outRect.width = conRect.width;
outRect.height = pv.Line("H1");
color = new Vector4(1f, 1f, 1f, 0.98f);
lStyle.normal.textColor = color;
tStyle.normal.textColor = color;
tStyle.fontSize = pv.Font("H1");
if (ssParam.sType[key] == "button")
{
if (GUI.Button(outRect, ssParam.sDescription[key], bStyle))
{
onClickButton(key);
}
outRect.y += outRect.height;
outRect.y += pv.Margin;
continue;
}
if (ssParam.sType[key] == "check")
{
ssParam.bEnabled[key] = GUI.Toggle(outRect, ssParam.bEnabled[key], ssParam.sDescription[key] + " (" + key + ")", tStyle);
outRect.y += outRect.height;
outRect.y += pv.Margin;
continue;
}
if (ssParam.sType[key] == "toggle")
{
ssParam.bEnabled[key] = GUI.Toggle(outRect, ssParam.bEnabled[key], ssParam.sDescription[key] + " (" + key + ")", tStyle);
outRect.y += outRect.height;
outRect.y += pv.Margin;
if (!ssParam.bEnabled[key])
continue;
}
else
{
// slider
GUI.Label(outRect, ssParam.sDescription[key], tStyle);
outRect.y += outRect.height;
}
int val_num = ssParam.ValCount(key);
for (int j = 0; j < val_num; j++)
{
string prop = ssParam.sPropName[key][j];
float value = ssParam.fValue[key][prop];
float vmin = ssParam.fVmin[key][prop];
float vmax = ssParam.fVmax[key][prop];
string label = ssParam.sLabel[key][prop] + " : ";
string vType = ssParam.sVType[key][prop];
outRect.width = conRect.width;
outRect.height = pv.Line("H1");
lStyle.fontSize = pv.Font("H1");
if (value < vmin)
value = vmin;
if (value > vmax)
value = vmax;
if (vType == "scale" && vmin < 1f)
{
if (vmin < 0f)
vmin = 0f;
if (value < 0f)
value = 0f;
float tmpmin = -Mathf.Abs(vmax - 1f);
float tmpmax = Mathf.Abs(vmax - 1f);
float tmp = (value < 1f) ? tmp = Mathf.Abs((1f - value) / (1f - vmin)) * tmpmin : value - 1f;
if (tmp < tmpmin)
tmp = tmpmin;
if (tmp > tmpmax)
tmp = tmpmax;
tmp = drawModValueSlider(outRect, tmp, tmpmin, tmpmax, label, lStyle);
ssParam.fValue[key][prop] = (tmp < 0f) ? 1f - tmp / tmpmin * Mathf.Abs(1f - vmin) : 1f + tmp;
}
else if (vType == "int")
{
value = (int)Mathf.Round(value);
ssParam.fValue[key][prop] = (int)Mathf.Round(drawModValueSlider(outRect, value, vmin, vmax, label, lStyle));
}
else
ssParam.fValue[key][prop] = drawModValueSlider(outRect, value, vmin, vmax, label, lStyle);
outRect.y += outRect.height;
}
outRect.y += pv.Margin * 2;
}
GUIStyle winStyle = "box";
winStyle.fontSize = pv.Font("C1");
winStyle.alignment = TextAnchor.UpperRight;
if (GUI.Button(outRect, "プリセットの呼び出し", bStyle))
{
loadPresetXml();
if (presets != null && presets.Count() > 0)
{
menuType = MenuType.LoadPreset;
}
}
outRect.y += outRect.height + pv.Margin;
if (GUI.Button(outRect, "プリセットの削除", bStyle))
{
loadPresetXml();
if (presets != null && presets.Count() > 0)
{
menuType = MenuType.RemovePreset;
}
}
outRect.y += outRect.height + pv.Margin;
if (GUI.Button(outRect, "現在値をプリセットとして保存", bStyle))
{
loadPresetXml();
menuType = MenuType.SavePreset;
}
outRect.y += outRect.height + pv.Margin;
if (ssParam.autoPreset)
{
if (GUI.Button(outRect, "現在のシーンにプリセットを割り当て", bStyle))
{
loadPresetXml();
menuType = MenuType.SaveScenePreset;
}
outRect.y += outRect.height + pv.Margin;
}
GUI.EndScrollView();
GUI.DragWindow();
}