using LinePutScript;
using LinePutScript.Dictionary;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using VPet_Simulator.Core;
namespace VPet_Simulator.Windows.Interface
{
///
/// 游戏设置
///
public class Setting : LPS_D
{
///
/// 游戏设置
///
public Setting(string lps) : base(lps)
{
var line = FindLine("zoomlevel");
if (line == null)
zoomlevel = 0.5;
else
{
zoomlevel = line.InfoToDouble;
if (zoomlevel < 0.1 || zoomlevel > 8)
{
zoomlevel = 0.5;
}
}
presslength = this["gameconfig"].GetInt("presslength", 500);
intercycle = this["gameconfig"].GetInt("intercycle", 200);
allowmove = !this["gameconfig"].GetBool("allowmove");
smartmove = this["gameconfig"].GetBool("smartmove");
enablefunction = !this["gameconfig"].GetBool("nofunction");
Statistics = new Statistics(this["statistics"].ToList());
autobuy = this["gameconfig"].GetBool("autobuy");
}
public override string ToString()
{
this["statistics"] = new Line("statistics", "", "", Statistics.ToSubs().ToArray());
return base.ToString();
}
///
/// 统计数据信息
///
public Statistics Statistics;
//public Size WindowsSize
//{
// get
// {
// var line = FindLine("windowssize");
// if (line == null)
// return new Size(1366, 799);
// var strs = line.GetInfos();
// if (int.TryParse(strs[0], out int x))
// x = 1366;
// if (int.TryParse(strs[0], out int y))
// y = 799;
// return new Size(x, y);
// }
// set
// {
// FindorAddLine("windowssize").info = $"{value.Width},{value.Height}";
// }
//}
private double zoomlevel = 0;
///
/// 缩放倍率
///
public double ZoomLevel
{
get
{
return zoomlevel;
}
set
{
FindorAddLine("zoomlevel").InfoToDouble = value;
zoomlevel = value;
}
}
///
/// 播放声音大小
///
public double VoiceVolume
{
get => GetFloat("voicevolume", 0.5);
set => SetFloat("voicevolume", value);
}
///
/// 是否为更大的屏幕
///
public bool IsBiggerScreen
{
get => GetBool("bigscreen");
set => SetBool("bigscreen", value);
}
///
/// 是否启用数据收集
///
public bool Diagnosis
{
get => this["diagnosis"].GetBool("enable");
set => this["diagnosis"].SetBool("enable", value);
}
///// //经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
///// 是将图片储存到内存
/////
//public bool StoreInMemory
//{
// get => !this["set"].GetBool("storemem");
// set => this["set"].SetBool("storemem", value);
//}
///
/// 非计算模式下默认模式
///
public GameSave.ModeType CalFunState
{
get => (GameSave.ModeType)this[(gint)"calfunstate"];
set => this[(gint)"calfunstate"] = (int)value;
}
///
/// 数据收集频率
///
public int DiagnosisInterval
{
get => Math.Max(this["diagnosis"].GetInt("interval", 500), 20000);
set => this["diagnosis"].SetInt("interval", value);
}
///
/// 自动保存频率 (min)
///
public int AutoSaveInterval
{
get => Math.Max(GetInt("autosave", 10), -1);
set => SetInt("autosave", value);
}
///
/// 备份保存最大数量
///
public int BackupSaveMaxNum
{
get => Math.Max(GetInt("bakupsave", 30), 1);
set => SetInt("bakupsave", value);
}
///
/// 是否置于顶层
///
public bool TopMost
{
get => !GetBool("topmost");
set => SetBool("topmost", !value);
}
///
/// 是否显示宠物帮助窗口
///
public bool PetHelper
{
get => GetBool("pethelper");
set => SetBool("pethelper", value);
}
///
/// 是否鼠标穿透
///
public bool HitThrough
{
get => GetBool("hitthrough");
set => SetBool("hitthrough", value);
}
///
/// 上次清理缓存日期
///
public DateTime LastCacheDate
{
get => GetDateTime("lastcachedate", DateTime.MinValue);
set => SetDateTime("lastcachedate", value);
}
///
/// 数据收集是否被禁止(当日)
///
public bool DiagnosisDayEnable = true;
///
/// 语言
///
public string Language
{
get => GetString("language", "null");
set => this[(gstr)"language"] = value;
}
public string Font
{
get => GetString("font", "OPPOSans R");
set => this[(gstr)"font"] = value;
}
public string Theme
{
get
{
var line = FindLine("theme");
if (line == null)
return "default";
return line.Info;
}
set
{
FindorAddLine("theme").Info = value;
}
}
///
/// 当前宠物的储存数据
///
public ILine PetData => this["petdata"];
private int presslength;
private int intercycle;
///
/// 按多久视为长按 单位毫秒
///
public int PressLength
{
get => presslength;
set
{
presslength = value;
this["gameconfig"].SetInt("presslength", value);
}
}
///
/// 互动周期
///
public int InteractionCycle
{
get => intercycle;
set
{
intercycle = value;
this["gameconfig"].SetInt("intercycle", value);
}
}
///
/// 计算间隔 (秒)
///
public double LogicInterval
{
get => this["gameconfig"].GetDouble("logicinterval", 15);
set => this["gameconfig"].SetDouble("logicinterval", value);
}
///
/// 计算间隔
///
public double PetHelpLeft
{
get => this["pethelp"].GetFloat("left", 0);
set => this["pethelp"].SetFloat("left", value);
}
///
/// 计算间隔
///
public double PetHelpTop
{
get => this["pethelp"].GetFloat("top", 0);
set => this["pethelp"].SetFloat("top", value);
}
bool allowmove;
///
/// 允许移动事件
///
public bool AllowMove
{
get => allowmove;
set
{
allowmove = value;
this["gameconfig"].SetBool("allowmove", !value);
}
}
bool smartmove;
///
/// 智能移动
///
public bool SmartMove
{
get => smartmove;
set
{
smartmove = value;
this["gameconfig"].SetBool("smartmove", value);
}
}
bool enablefunction;
///
/// 启用计算等数据功能
///
public bool EnableFunction
{
get => enablefunction;
set
{
enablefunction = value;
this["gameconfig"].SetBool("nofunction", !value);
}
}
///
/// 智能移动周期 (秒)
///
public int SmartMoveInterval
{
get => this["gameconfig"].GetInt("smartmoveinterval", 20 * 60);
set => this["gameconfig"].SetInt("smartmoveinterval", value);
}
///
/// 消息框外置
///
public bool MessageBarOutside
{
get => this["gameconfig"].GetBool("msgbarout");
set => this["gameconfig"].SetBool("msgbarout", value);
}
///
/// 开机启动
///
public bool StartUPBoot
{
get => this["gameconfig"].GetBool("startboot");
set => this["gameconfig"].SetBool("startboot", value);
}
///
/// 开机启动 Steam
///
public bool StartUPBootSteam
{
get => !this["gameconfig"].GetBool("startbootsteam");
set => this["gameconfig"].SetBool("startbootsteam", !value);
}
///
/// 桌宠选择内容
///
public string PetGraph
{
get => this["gameconfig"].GetString("petgraph", "默认虚拟桌宠");
set => this["gameconfig"].SetString("petgraph", value);
}
///
/// 是否记录游戏退出位置 (默认:是)
///
public bool StartRecordLast
{
get => !this["gameconfig"].GetBool("startboot");
set => this["gameconfig"].SetBool("startboot", !value);
}
///
/// 记录上次退出位置
///
public Point StartRecordLastPoint
{
get
{
var line = FindLine("startrecordlast");
if (line == null)
return new Point();
return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0));
}
set
{
var line = FindorAddLine("startrecordlast");
line.SetDouble("x", value.X);
line.SetDouble("y", value.Y);
}
}
///
/// 设置中桌宠启动的位置
///
public Point StartRecordPoint
{
get
{
var line = FindLine("startrecord");
if (line == null)
return StartRecordLastPoint;
return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0));
}
set
{
var line = FindorAddLine("startrecord");
line.SetDouble("x", value.X);
line.SetDouble("y", value.Y);
}
}
///
/// 当实时播放音量达到该值时运行音乐动作
///
public double MusicCatch
{
get => this["gameconfig"].GetDouble("musiccatch", 0.3);
set => this["gameconfig"].SetDouble("musiccatch", value);
}
///
/// 当实时播放音量达到该值时运行特殊音乐动作
///
public double MusicMax
{
get => this["gameconfig"].GetDouble("musicmax", 0.70);
set => this["gameconfig"].SetDouble("musicmax", value);
}
///
/// 桌宠图形渲染的分辨率,越高图形越清晰
///
public int Resolution
{
get => this["gameconfig"].GetInt("resolution", 500);
set => this["gameconfig"].SetInt("resolution", value);
}
bool autobuy;
///
/// 允许桌宠自动购买食品
///
public bool AutoBuy
{
get => autobuy;
set
{
autobuy = value;
this["gameconfig"].SetBool("autobuy", value);
}
}
}
}