You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

529 lines
15 KiB
C#

using Assets.Scripts;
using Qoo.Def;
using System.Collections.Generic;
using UnityEngine;
// Token: 0x02000121 RID: 289
public class OptionSettingsWindow : BaseWindow
{
private Dictionary<string,int> dict = null;
// Token: 0x060007BF RID: 1983 RVA: 0x0002138C File Offset: 0x0001F58C
private void SetResolutionHandler(int value)
{
PlayerPrefs.SetInt("res" , value);
if (value == 0)
{
Screen.SetResolution(1024, 576, false, 60);
}
else if (value == 1)
{
Screen.SetResolution(1280, 720, false, 60);
}
else if (value == 2)
{
Screen.SetResolution(1366, 768, false, 60);
}
else if (value == 3)
{
Screen.SetResolution(1920, 1080, false, 60);
}
else if (value == 4)
{
Screen.SetResolution(2560, 1440, false, 60);
}
PlayerPrefs.Save();
//SysData.SetTextSpeed(value);
}
// Token: 0x060007C0 RID: 1984 RVA: 0x00021394 File Offset: 0x0001F594
private void SetFontHandler(int value)
{
PlayerPrefs.SetInt("font", value);
switch (value)
{
case 0:
UnityApp.Instance.font = FontEnum.NewRodin;
break;
case 1:
UnityApp.Instance.font = FontEnum.Humming;
break;
case 2:
UnityApp.Instance.font = FontEnum.NewCezanne;
break;
case 3:
UnityApp.Instance.font = FontEnum.Slump;
break;
case 4:
UnityApp.Instance.font = FontEnum.UDMincho;
break;
}
PlayerPrefs.Save();
//SysData.SetAutoPage(value);
}
private void SetWindowedFullscreenHandler(int value)
{
PlayerPrefs.SetInt("windowedfullscreen", value);
switch (value)
{
case 0:
Screen.fullScreen = false;
break;
case 1:
Screen.fullScreen = true;
break;
}
PlayerPrefs.Save();
//SysData.SetAutoPage(value);
}
private void FontSizeHandler(int value)
{
PlayerPrefs.SetInt("fontsize", value);
switch (value)
{
case 0:
UnityApp.PlatformApp.preferredFontSize = 22;
FontDef.SetFontInfo(new FONTINFO[]
{
new FONTINFO(22, 22, 1f, 0),
new FONTINFO(22, 22, 1f, 0),
new FONTINFO(42, 42, 1f, -1),
new FONTINFO(62, 62, 1f, -2)
});
break;
case 1:
UnityApp.PlatformApp.preferredFontSize = 28;
FontDef.SetFontInfo(new FONTINFO[]
{
new FONTINFO(22, 22, 1f, 0),
new FONTINFO(28, 28, 1f, 0),
new FONTINFO(42, 42, 1f, -1),
new FONTINFO(62, 62, 1f, -2)
});
break;
}
PlayerPrefs.Save();
//SysData.SetAutoPage(value);
}
private void LanguageHandler(int value)
{
PlayerPrefs.SetInt("language", value);
switch (value)
{
case 0:
UnityApp.Instance.locale = LocaleEnum.Japanese;
break;
case 1:
UnityApp.Instance.locale = LocaleEnum.English;
break;
case 2:
UnityApp.Instance.locale = LocaleEnum.Spanish;
break;
}
PlayerPrefs.Save();
//RebootGame();
//SysData.SetAutoPage(value);
}
// Token: 0x060007C1 RID: 1985 RVA: 0x0002139C File Offset: 0x0001F59C
private void SetCursorPosition()
{
ImageObject imageObject = base.GetImageObject("ResCursor");
ImageObject imageObject2 = base.GetImageObject("FontCursor");
ImageObject imageObject3 = base.GetImageObject("WindowedFullscreenCursor");
ImageObject imageObject4 = base.GetImageObject("FontSizeCursor");
ImageObject imageObject5 = base.GetImageObject("LanguageCursor");
int res = PlayerPrefs.GetInt("res");
int font = PlayerPrefs.GetInt("font");
int windowedFullscreen = PlayerPrefs.GetInt("windowedfullscreen");
int fontSize = PlayerPrefs.GetInt("fontsize");
int language = PlayerPrefs.GetInt("language");
imageObject.UIObject.ScreenX = this.ResolutionCursorXPositions[res];
imageObject.UIObject.ScreenY = this.ResolutionCursorYPositions[res];
imageObject2.UIObject.ScreenX = this.FontCursorXPositions[font];
imageObject2.UIObject.ScreenY = this.FontCursorYPositions[font];
imageObject3.UIObject.ScreenX = this.WindowedFullscreenXPositions[windowedFullscreen];
imageObject3.UIObject.ScreenY = this.WindowedFullscreenYPositions[windowedFullscreen];
imageObject4.UIObject.ScreenX = this.FontSizeXPositions[fontSize];
imageObject4.UIObject.ScreenY = this.FontSizeYPositions[fontSize];
imageObject5.UIObject.ScreenX = this.LanguageXPositions[language];
imageObject5.UIObject.ScreenY = this.LanguageYPositions[language];
imageObject.InitPosition();
imageObject2.InitPosition();
imageObject3.InitPosition();
imageObject4.InitPosition();
imageObject5.InitPosition();
}
// Token: 0x060007C2 RID: 1986 RVA: 0x000213FC File Offset: 0x0001F5FC
/*protected override OptionBaseWindow.OptionType GetOptionType()
{
return OptionBaseWindow.OptionType.Text;
}*/
// Token: 0x060007C3 RID: 1987 RVA: 0x00021400 File Offset: 0x0001F600
protected sealed override string[] newSceneTextureNameArray()
{
string[] collection = base.newSceneTextureNameArray();
string[] collection2 = new string[]
{
"screen/sysmenu/sys_plate",
"screen/sysmenu/sys_btn_10",
"screen/sysmenu/sys_btn_11",
"screen/sysmenu/sys_plate_speed",
"screen/sysmenu/sys_plate_page",
"screen/sysmenu/sys_check",
"screen/common/cancel"
};
List<string> list = new List<string>();
list.AddRange(collection);
list.AddRange(collection2);
return list.ToArray();
}
// Token: 0x060007C4 RID: 1988 RVA: 0x00021470 File Offset: 0x0001F670
protected sealed override void BeforeInit()
{
Vector3 localPosition = base.transform.parent.localPosition;
localPosition.z = -50f;
base.transform.parent.localPosition = localPosition;
}
// Token: 0x060007C5 RID: 1989 RVA: 0x000214AC File Offset: 0x0001F6AC
protected sealed override void AfterInit()
{
this.SetCursorPosition();
}
// Token: 0x060007C6 RID: 1990 RVA: 0x000214B4 File Offset: 0x0001F6B4
protected override void OnGraphicLoadComplete()
{
base.OnGraphicLoadComplete();
}
// Token: 0x060007C7 RID: 1991 RVA: 0x000214BC File Offset: 0x0001F6BC
protected sealed override BaseWindow.UIComponent[] newComponentArray()
{
BaseWindow.UIComponent[] collection = base.newComponentArray();
BaseWindow.UIComponent[] collection2 = new BaseWindow.UIComponent[]
{
new BaseWindow.UIButton("Cancel", 887, 6, this.wndz + 3, "screen/common/cancel", true, true, 1, 2, 0),
new BaseWindow.UICollision("res0", 134, 162, this.wndz + 4, 175, 25),
new BaseWindow.UICollision("res1", 134, 197, this.wndz + 4, 175, 25),
new BaseWindow.UICollision("res2", 134, 232, this.wndz + 4, 175, 25),
new BaseWindow.UICollision("res3", 125, 267, this.wndz + 4, 193, 25),
new BaseWindow.UICollision("res4", 123, 302, this.wndz + 4, 195, 25),
new BaseWindow.UICollision("font0", 363, 162, this.wndz + 4, 190, 25),
new BaseWindow.UICollision("font1", 376, 197, this.wndz + 4, 168, 32),
new BaseWindow.UICollision("font2", 356, 232, this.wndz + 4, 205, 25),
new BaseWindow.UICollision("font3", 398, 267, this.wndz + 4, 122, 30),
new BaseWindow.UICollision("font4", 369, 302, this.wndz + 4, 178, 27),
new BaseWindow.UICollision("windowed", 115, 382, this.wndz + 4, 213, 32),
new BaseWindow.UICollision("fullscreen", 112, 429, this.wndz + 4, 209, 32),
new BaseWindow.UICollision("fontsize0", 406, 419, this.wndz + 4, 105, 25),
new BaseWindow.UICollision("fontsize1", 396, 454, this.wndz + 4, 128, 25),
new BaseWindow.UICollision("language0", 645, 162, this.wndz + 4, 110, 28),
new BaseWindow.UICollision("language1", 638, 197, this.wndz + 4, 126, 31),
new BaseWindow.UICollision("language2", 633, 232, this.wndz + 4, 133, 31),
//new BaseWindow.UICollision("font5", 673, 300, this.wndz + 4, 75, 34),
new BaseWindow.UIImage("BackGround", 0, 0, this.wndz + 1, "screen/sysmenu/options_01", true, true),
//new BaseWindow.UIButton("Clear", 208, 380, this.wndz + 2, "screen/sysmenu/sys_btn_10", true, true, 1, 2, 0),
//new BaseWindow.UIButton("Decide", 686, 380, this.wndz + 2, "screen/sysmenu/sys_btn_11", true, true, 1, 2, 0),
//new BaseWindow.UIButton("Cancel", 715, 73, this.wndz + 2, "screen/common/cancel", true, true, 1, 2, 0),
//new BaseWindow.UIImage("Speed", 225, 129, this.wndz + 2, "screen/sysmenu/sys_plate_speed", false, true),
//new BaseWindow.UIImage("Page", 225, 251, this.wndz + 2, "screen/sysmenu/sys_plate_page", false, true),
new BaseWindow.UIImage("ResCursor", 216, 182, this.wndz + 3, "screen/sysmenu/sys_check", false, true),
new BaseWindow.UIImage("FontCursor", 216, 304, this.wndz + 3, "screen/sysmenu/sys_check", false, true),
new BaseWindow.UIImage("WindowedFullscreenCursor", 216, 304, this.wndz + 3, "screen/sysmenu/sys_check", false, true),
new BaseWindow.UIImage("FontSizeCursor", 216, 304, this.wndz + 3, "screen/sysmenu/sys_check", false, true),
new BaseWindow.UIImage("LanguageCursor", 216, 182, this.wndz + 3, "screen/sysmenu/sys_check", false, true),
};
List<BaseWindow.UIComponent> list = new List<BaseWindow.UIComponent>();
list.AddRange(collection);
list.AddRange(collection2);
return list.ToArray();
}
// Token: 0x060007C8 RID: 1992 RVA: 0x000217B0 File Offset: 0x0001F9B0
protected sealed override void OnBaseWindowOnButton(string obj)
{
base.OnBaseWindowOnButton(obj);
if (obj != null)
{
if (this.dict == null)
{
this.dict = new Dictionary<string, int>(10)
{
{
"Cancel",
0
},
{
"res0",
1
},
{
"res1",
1
},
{
"res2",
1
},
{
"res3",
1
},
{
"res4",
1
},
{
"font0",
2
},
{
"font1",
2
},
{
"font2",
2
},
{
"font3",
2
},
{
"font4",
2
},
{
"windowed",
3
},
{
"fullscreen",
3
},
{
"fontsize0",
4
},
{
"fontsize1",
4
},
{
"language0",
5
},
{
"language1",
5
},
{
"language2",
5
}
};
}
int num;
if (this.dict.TryGetValue(obj, out num))
{
if (num == 0)
{
base.PlaySE_Cancel();
SceneManager.BackScene();
}
else if (num == 1)
{
base.PlaySE_Select();
this.SetResolutionHandler(this.ResolutionToInt(obj));
}
else if (num == 2)
{
base.PlaySE_Select();
this.SetFontHandler(this.FontToInt(obj));
}
else if( num == 3)
{
base.PlaySE_Select();
this.SetWindowedFullscreenHandler(this.WindowedFullscreenToInt(obj));
}
else if (num == 4)
{
base.PlaySE_Select();
this.FontSizeHandler(this.FontSizeToInt(obj));
}
else if (num == 5)
{
base.PlaySE_Select();
this.LanguageHandler(this.LanguageToInt(obj));
}
}
}
this.SetCursorPosition();
}
// Token: 0x060007C9 RID: 1993 RVA: 0x000218B8 File Offset: 0x0001FAB8
private int ResolutionToInt(string obj)
{
switch (obj)
{
case "res0":
return 0;
case "res1":
return 1;
case "res2":
return 2;
case "res3":
return 3;
case "res4":
return 4;
}
return -1;
}
// Token: 0x060007CA RID: 1994 RVA: 0x0002194C File Offset: 0x0001FB4C
private int FontToInt(string obj)
{
switch (obj)
{
case "font0":
return 0;
case "font1":
return 1;
case "font2":
return 2;
case "font3":
return 3;
case "font4":
return 4;
}
return -1;
}
private int WindowedFullscreenToInt(string obj)
{
switch (obj)
{
case "windowed":
return 0;
case "fullscreen":
return 1;
}
return -1;
}
private int FontSizeToInt(string obj)
{
switch (obj)
{
case "fontsize0":
return 0;
case "fontsize1":
return 1;
}
return -1;
}
private int LanguageToInt(string obj)
{
switch (obj)
{
case "language0":
return 0;
case "language1":
return 1;
case "language2":
return 2;
}
return -1;
}
// Token: 0x040006CF RID: 1743
private readonly int wndz;
// Token: 0x040006D0 RID: 1744
private int[] ResolutionCursorXPositions = new int[]
{
134,
134,
134,
125,
123
};
private int[] ResolutionCursorYPositions = new int[]
{
162,
197,
232,
267,
302
};
// Token: 0x040006D1 RID: 1745
private int[] FontCursorXPositions = new int[]
{
363,
376,
356,
398,
369,
};
private int[] FontCursorYPositions = new int[]
{
162,
197,
232,
267,
302
};
private int[] WindowedFullscreenXPositions = new int[]
{
115,
112,
};
private int[] WindowedFullscreenYPositions = new int[]
{
382,
429,
};
private int[] FontSizeXPositions = new int[]
{
406,
396,
};
private int[] FontSizeYPositions = new int[]
{
419,
454,
};
private int[] LanguageXPositions = new int[]
{
645,
636,
633
};
private int[] LanguageYPositions = new int[]
{
162,
197,
232
};
}