using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using Kasizuki;
using MaidStatus;
using MaidStatus.CsvData;
using MaidStatus.Old;
using PlayerStatus;
using Schedule;
using UnityEngine;
using wf;

public class ScriptManager : IDisposable
{
	public static string ReplaceCharaName(string text)
	{
		if (string.IsNullOrEmpty(text))
		{
			return text;
		}
		string[] array = new string[]
		{
			"[HF]",
			"[HF1]",
			"[HF2]",
			"[HF3]",
			"[HF4]"
		};
		string[] array2 = new string[]
		{
			"[HL]",
			"[HL1]",
			"[HL2]",
			"[HL3]",
			"[HL4]"
		};
		string[] array3 = new string[]
		{
			"[HLF]",
			"[HLF1]",
			"[HLF2]",
			"[HLF3]",
			"[HLF4]"
		};
		for (int i = 0; i < array.Length; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				string text2 = (j != 0) ? "[HF]" : "[hf]";
				string text3 = (j != 0) ? array[i].ToUpper() : array[i].ToLower();
				if (0 <= text.IndexOf(text3))
				{
					Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
					if (maid != null)
					{
						if (text3 != text2)
						{
							text = text.Replace(text3, text2);
						}
						text = text.Replace(text2, (!maid.status.isFirstNameCall) ? maid.status.lastName : maid.status.firstName);
					}
				}
				text2 = ((j != 0) ? "[HL]" : "[hl]");
				text3 = ((j != 0) ? array2[i].ToUpper() : array2[i].ToLower());
				if (0 <= text.IndexOf(text3))
				{
					Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(i);
					if (maid2 != null)
					{
						if (text3 != text2)
						{
							text = text.Replace(text3, text2);
						}
						text = text.Replace(text2, maid2.status.lastName);
					}
				}
				text2 = ((j != 0) ? "[HLF]" : "[hlf]");
				text3 = ((j != 0) ? array3[i].ToUpper() : array3[i].ToLower());
				if (0 <= text.IndexOf(text3))
				{
					Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(i);
					if (maid3 != null)
					{
						if (text3 != text2)
						{
							text = text.Replace(text3, text2);
						}
						text = text.Replace(text2, maid3.status.fullNameJpStyle);
					}
				}
			}
		}
		if (0 <= text.IndexOf("[SF]"))
		{
			text = text.Replace("[SF]", GameMain.Instance.CharacterMgr.status.playerName);
		}
		if (0 <= text.IndexOf("[sf]"))
		{
			text = text.Replace("[sf]", GameMain.Instance.CharacterMgr.status.playerName);
		}
		return text;
	}

	public static string ReplaceCharaName(Maid maid, string text)
	{
		if (text == null)
		{
			return string.Empty;
		}
		if (maid == null)
		{
			maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		}
		if (maid == null)
		{
			return text;
		}
		if (0 <= text.IndexOf("[HF]"))
		{
			if (maid.status.isFirstNameCall)
			{
				text = text.Replace("[HF]", maid.status.firstName);
			}
			else
			{
				text = text.Replace("[HF]", maid.status.lastName);
			}
		}
		if (0 <= text.IndexOf("[HL]"))
		{
			text = text.Replace("[HL]", maid.status.lastName);
		}
		if (0 <= text.IndexOf("[SF]"))
		{
			text = text.Replace("[SF]", GameMain.Instance.CharacterMgr.status.playerName);
		}
		return text;
	}

	public static string ReplacePersonal(Maid maid, string text)
	{
		return ScriptManager.ReplacePersonal(new Maid[]
		{
			maid
		}, text);
	}

	public static string ReplacePersonal(Maid[] maid_array, string text)
	{
		if (string.IsNullOrEmpty(text))
		{
			return string.Empty;
		}
		Maid maid = null;
		string oldValue = string.Empty;
		if (0 <= text.IndexOf("?4"))
		{
			maid = maid_array[4];
			oldValue = "?4";
		}
		else if (0 <= text.IndexOf("?3"))
		{
			maid = maid_array[3];
			oldValue = "?3";
		}
		else if (0 <= text.IndexOf("?2"))
		{
			maid = maid_array[2];
			oldValue = "?2";
		}
		else if (0 <= text.IndexOf("?1"))
		{
			maid = maid_array[1];
			oldValue = "?1";
		}
		else if (0 <= text.IndexOf("?0"))
		{
			maid = maid_array[0];
			oldValue = "?0";
		}
		else if (0 <= text.IndexOf("?"))
		{
			maid = maid_array[0];
			oldValue = "?";
		}
		if (maid == null)
		{
			return text;
		}
		if (maid.status.subCharaData == null)
		{
			text = text.Replace(oldValue, maid.status.personal.replaceText);
		}
		else
		{
			text = text.Replace(oldValue, maid.status.subCharaData.replaceText);
		}
		return text;
	}

	public void Initialize()
	{
		this.is_motion_blend = true;
		GameObject gameObject = GameObject.Find("SystemUI Root/Manager_SystemUI/MessageWindowMgr");
		NDebug.Assert(gameObject != null, "MessageWindowMgrが見つかりません");
		this.message_mgr_ = gameObject.GetComponent<MessageWindowMgr>();
		NDebug.Assert(this.message_mgr_ != null, "コンポーネント:MessageWindowMgrが見つかりません");
		this.tjs_ = TJSScript.Create(this.file_system);
		this.tjs_.AddFunction("GetMaidMPN", new TJSScript.FunctionCallBack(this.TJSFuncGetMaidMPN));
		this.tjs_.AddFunction("GetMenuFileNameFromMaidMPN", new TJSScript.FunctionCallBack(this.TJSFuncGetMenuFileNameFromMaidMPN));
		this.tjs_.AddFunction("SetMaidFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetMaidFlag));
		this.tjs_.AddFunction("SetManFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetManFlag));
		this.tjs_.AddFunction("SetTmpFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetTmpFlag));
		this.tjs_.AddFunction("GetMaidFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetMaidFlag));
		this.tjs_.AddFunction("GetManFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetManFlag));
		this.tjs_.AddFunction("GetTmpFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetTmpFlag));
		this.tjs_.AddFunction("SetSystemFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetSystemFlag));
		this.tjs_.AddFunction("GetSystemFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetSystemFlag));
		this.tjs_.AddFunction("GetMaidStatus", new TJSScript.FunctionCallBack(this.TJSFuncGetMaidStatus));
		this.tjs_.AddFunction("SetMainCharaFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetMainCharaFlag));
		this.tjs_.AddFunction("IsSeikantai", new TJSScript.FunctionCallBack(this.OldTJSFuncConIsSeikantai));
		this.tjs_.AddFunction("CreateNewMaid", new TJSScript.FunctionCallBack(this.TJSFuncCreateNewMaid));
		this.tjs_.AddFunction("PresetLoad", new TJSScript.FunctionCallBack(this.TJSFuncPresetLoad));
		this.tjs_.AddFunction("PresetLoadNPC", new TJSScript.FunctionCallBack(this.TJSFuncPresetLoadNPC));
		this.tjs_.AddFunction("AddMaidStatus", new TJSScript.FunctionCallBack(this.TJSFuncAddMaidStatus));
		this.tjs_.AddFunction("IsMaidFeature", new TJSScript.FunctionCallBack(this.TJSFuncIsMaidFeature));
		this.tjs_.AddFunction("IsMaidPropensity", new TJSScript.FunctionCallBack(this.TJSFuncIsMaidPropensity));
		this.tjs_.AddFunction("GetYotogiSkillLevel", new TJSScript.FunctionCallBack(this.TJSFuncGetYotogiSkillLevel));
		this.tjs_.AddFunction("IsYotogiSkill", new TJSScript.FunctionCallBack(this.TJSFuncIsYotogiSkill));
		this.tjs_.AddFunction("GetStockMaidCount", new TJSScript.FunctionCallBack(this.TJSFuncGetStockMaidCount));
		this.tjs_.AddFunction("SetSalonGrade", new TJSScript.FunctionCallBack(this.TJSFuncSetSalonGrade));
		this.tjs_.AddFunction("GetSalonGrade", new TJSScript.FunctionCallBack(this.TJSFuncGetSalonGrade));
		this.tjs_.AddFunction("GetClubEvaluation", new TJSScript.FunctionCallBack(this.TJSFuncGetClubEvaluation));
		this.tjs_.AddFunction("SetClubGauge", new TJSScript.FunctionCallBack(this.TJSFuncSetClubGauge));
		this.tjs_.AddFunction("GetClubGauge", new TJSScript.FunctionCallBack(this.TJSFuncGetClubGauge));
		this.tjs_.AddFunction("GetBGName", new TJSScript.FunctionCallBack(this.TJSFuncGetBGName));
		this.tjs_.AddFunction("IsItemParam", new TJSScript.FunctionCallBack(this.TJSFuncIsItemParam));
		this.tjs_.AddFunction("IsItemSlot", new TJSScript.FunctionCallBack(this.TJSFuncIsItemSlot));
		this.tjs_.AddFunction("IsMaidClass", new TJSScript.FunctionCallBack(this.OldTJSFuncIsMaidClass));
		this.tjs_.AddFunction("GetMaidClassLevel", new TJSScript.FunctionCallBack(this.OldTJSFuncGetMaidClassLevel));
		this.tjs_.AddFunction("IsJobMaid", new TJSScript.FunctionCallBack(this.TJSFuncIsJobMaid));
		this.tjs_.AddFunction("GetJobMaidLevel", new TJSScript.FunctionCallBack(this.TJSFuncGetJobMaidLevel));
		this.tjs_.AddFunction("IsYotogiClass", new TJSScript.FunctionCallBack(this.TJSFuncIsYotogiClass));
		this.tjs_.AddFunction("GetYotogiClassLevel", new TJSScript.FunctionCallBack(this.TJSFuncGetYotogiClassLevel));
		this.tjs_.AddFunction("GetNoonScuccessLevel", new TJSScript.FunctionCallBack(this.TJSFuncGetNoonScuccessLevel));
		this.tjs_.AddFunction("IsMaid", new TJSScript.FunctionCallBack(this.TJSFuncIsMaid));
		this.tjs_.AddFunction("IsOldPersonal", new TJSScript.FunctionCallBack(this.TJSFuncIsOldPersonal));
		this.tjs_.AddFunction("GetSalonLoan", new TJSScript.FunctionCallBack(this.TJSFuncConGetSalonLoan));
		this.tjs_.AddFunction("GetPhase", new TJSScript.FunctionCallBack(this.TJSFuncConGetPhase));
		this.tjs_.AddFunction("GetDay", new TJSScript.FunctionCallBack(this.TJSFuncGetDay));
		this.tjs_.AddFunction("CreateStockMaidLoopData", new TJSScript.FunctionCallBack(this.TJSFuncCreateStockMaidLoopData));
		this.tjs_.AddFunction("CreateCompetitiveShowLoopData", new TJSScript.FunctionCallBack(this.TJSFuncCreateCompetitiveShowLoopData));
		this.tjs_.AddFunction("GetCompetitiveShowLoopCount", new TJSScript.FunctionCallBack(this.TJSFuncGetCompetitiveShowLoopCount));
		this.tjs_.AddFunction("SetActiveSlotFromStockMaidLoopData", new TJSScript.FunctionCallBack(this.TJSFuncSetActiveSlotFromStockMaidLoopData));
		this.tjs_.AddFunction("SetMaidCondition", new TJSScript.FunctionCallBack(this.TJSFuncSetMaidCondition));
		this.tjs_.AddFunction("SetSeikeikenFront", new TJSScript.FunctionCallBack(this.TJSFuncSetSeikeikenFront));
		this.tjs_.AddFunction("SetSeikeikenBack", new TJSScript.FunctionCallBack(this.TJSFuncSetSeikeikenBack));
		this.tjs_.AddFunction("SetInitSeikeiken", new TJSScript.FunctionCallBack(this.TJSFuncSetInitSeikeiken));
		this.tjs_.AddFunction("SetNewItem", new TJSScript.FunctionCallBack(this.TJSFuncSetNewItem));
		this.tjs_.AddFunction("IsGameInShopItemPurchased", new TJSScript.FunctionCallBack(this.TJSFuncIsGameInShopItemPurchased));
		this.tjs_.AddFunction("SetContractType", new TJSScript.FunctionCallBack(this.TJSFuncSetContractType));
		this.tjs_.AddFunction("SetFeature", new TJSScript.FunctionCallBack(this.TJSFuncSetFeature));
		this.tjs_.AddFunction("SetPropensity", new TJSScript.FunctionCallBack(this.TJSFuncSetPropensity));
		this.tjs_.AddFunction("SetSexualParam", new TJSScript.FunctionCallBack(this.TJSFuncComSetSexualParam));
		this.tjs_.AddFunction("SetNewTrophy", new TJSScript.FunctionCallBack(this.TJSFuncSetNewTrophy));
		this.tjs_.AddFunction("CheckTrophyContractType", new TJSScript.FunctionCallBack(this.TJSFuncCheckTrophyContractType));
		this.tjs_.AddFunction("SetYotogiSelectStageName", new TJSScript.FunctionCallBack(this.TJSFuncSetYotogiSelectStageName));
		this.tjs_.AddFunction("GetYotogiSelectStageName", new TJSScript.FunctionCallBack(this.TJSFuncGetYotogiSelectStageName));
		this.tjs_.AddFunction("ClearCallStack", new TJSScript.FunctionCallBack(this.TJSFuncClearCallStack));
		this.tjs_.AddFunction("IsCommunicationChara", new TJSScript.FunctionCallBack(this.OldTJSFuncIsCommunicationChara));
		this.tjs_.AddFunction("SetCommunicationChara", new TJSScript.FunctionCallBack(this.TJSFuncSetCommunicationChara));
		this.tjs_.AddFunction("SetRandomCommuChara", new TJSScript.FunctionCallBack(this.TJSFuncSetRandomCommuChara));
		this.tjs_.AddFunction("CreateYotogiCharaList", new TJSScript.FunctionCallBack(this.TJSFuncCreateYotogiCharaList));
		this.tjs_.AddFunction("CreateVipCharaList", new TJSScript.FunctionCallBack(this.TJSFuncCreateVipCharaList));
		this.tjs_.AddFunction("CreateFacilityCharaList", new TJSScript.FunctionCallBack(this.TJSFuncCreateFacilityCharaList));
		this.tjs_.AddFunction("IsReceptionChara", new TJSScript.FunctionCallBack(this.TJSFuncIsReceptionChara));
		this.tjs_.AddFunction("SetRandomReceptionChara", new TJSScript.FunctionCallBack(this.TJSFuncSetRandomReceptionChara));
		this.tjs_.AddFunction("IsSelectChara", new TJSScript.FunctionCallBack(this.TJSFuncIsSelectChara));
		this.tjs_.AddFunction("GetDateYear", new TJSScript.FunctionCallBack(this.TJSFuncGetDateYear));
		this.tjs_.AddFunction("GetDateMonth", new TJSScript.FunctionCallBack(this.TJSFuncGetDateMonth));
		this.tjs_.AddFunction("GetDateDay", new TJSScript.FunctionCallBack(this.TJSFuncGetDateDay));
		this.tjs_.AddFunction("UpdateMaidRanking", new TJSScript.FunctionCallBack(this.TJSFuncUpdateMaidRanking));
		this.tjs_.AddFunction("ResetMaidRanking", new TJSScript.FunctionCallBack(this.TJSFuncResetMaidRanking));
		this.tjs_.AddFunction("SetMaidRanking1st", new TJSScript.FunctionCallBack(this.TJSFuncSetMaidRanking1st));
		this.tjs_.AddFunction("IsAvailableRanking", new TJSScript.FunctionCallBack(this.TJSFuncIsAvailableRanking));
		this.tjs_.AddFunction("IsMVPEvent", new TJSScript.FunctionCallBack(this.TJSFuncIsMVPEvent));
		this.tjs_.AddFunction("IsYotogiSubCharaSelect", new TJSScript.FunctionCallBack(this.TJSFuncIsYotogiSubCharaSelect));
		this.tjs_.AddFunction("GetYotogiSkillSpecialType", new TJSScript.FunctionCallBack(this.TJSFuncGetYotogiSkillSpecialType));
		this.tjs_.AddFunction("IsSelectedYotogiSkill", new TJSScript.FunctionCallBack(this.TJSFuncIsSelectedYotogiSkill));
		this.tjs_.AddFunction("IsExistentFile", new TJSScript.FunctionCallBack(this.TJSFuncIsExistentFile));
		this.tjs_.AddFunction("IsExistentFileLegacy", new TJSScript.FunctionCallBack(this.TJSFuncIsExistentFileLegacy));
		this.tjs_.AddFunction("CheckClearVIP", new TJSScript.FunctionCallBack(this.TJSFuncCheckClearVIP));
		this.tjs_.AddFunction("IsCBLVersion", new TJSScript.FunctionCallBack(this.TJSFuncIsCBLVersion));
		this.tjs_.AddFunction("GetRentalNPCName", new TJSScript.FunctionCallBack(this.OldTJSFuncGetRentalNPCName));
		this.tjs_.AddFunction("IsMarriage", new TJSScript.FunctionCallBack(this.OldTJSFuncIsMarriage));
		this.tjs_.AddFunction("IsNewWifeFlag", new TJSScript.FunctionCallBack(this.OldTJSFuncIsNewWifeFlag));
		this.tjs_.AddFunction("IsPluginPack", new TJSScript.FunctionCallBack(this.TJSFuncIsPluginPack));
		this.tjs_.AddFunction("AddShopLineup", new TJSScript.FunctionCallBack(this.TJSFuncAddShopLineup));
		this.tjs_.AddFunction("SetEventItemFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetEventItemFlag));
		this.tjs_.AddFunction("IsEventItemFlag", new TJSScript.FunctionCallBack(this.TJSFuncIsEventItemFlag));
		this.tjs_.AddFunction("GetVRMode", new TJSScript.FunctionCallBack(this.TJSFuncGetVRMode));
		this.tjs_.AddFunction("IsVRMode", new TJSScript.FunctionCallBack(this.TJSFuncIsVRMode));
		this.tjs_.AddFunction("SetDanceData", new TJSScript.FunctionCallBack(this.TJSFuncSetDanceData));
		this.tjs_.AddFunction("GetEventAdded", new TJSScript.FunctionCallBack(this.TJSFuncGetEventAdded));
		this.tjs_.AddFunction("GetLockNTRPlayFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetLockNTRPlayFlag));
		this.tjs_.AddFunction("GetLockUserDraftMaid", new TJSScript.FunctionCallBack(this.TJSFuncGetLockUserDraftMaid));
		this.tjs_.AddFunction("IsComPlayer", new TJSScript.FunctionCallBack(this.TJSFuncIsComPlayer));
		this.tjs_.AddFunction("SetPlayerMoney", new TJSScript.FunctionCallBack(this.TJSFuncSetPlayerMoney));
		this.tjs_.AddFunction("GetPlayerMoney", new TJSScript.FunctionCallBack(this.TJSFuncGetPlayerMoney));
		this.tjs_.AddFunction("SetMaidLeader", new TJSScript.FunctionCallBack(this.TJSFuncSetMaidLeader));
		this.tjs_.AddFunction("SetMaidCostumeFacility", new TJSScript.FunctionCallBack(this.TJSFuncSetMaidCostumeFacility));
		this.tjs_.AddFunction("ResetMaidCostumeFacility", new TJSScript.FunctionCallBack(this.TJSFuncResetMaidCostumeFacility));
		this.tjs_.AddFunction("CallTitleBar", new TJSScript.FunctionCallBack(this.TJSFuncCallTitleBar));
		this.tjs_.AddFunction("SetCompatibilityMode", new TJSScript.FunctionCallBack(this.TJSFuncSetCompatibilityMode));
		this.tjs.AddFunction("IsBuildingFacility", new TJSScript.FunctionCallBack(this.TJSFuncIsBuildingFacility));
		this.tjs.AddFunction("IsBuildingFacilityUpward", new TJSScript.FunctionCallBack(this.TJSFuncIsBuildingFacilityUpward));
		this.tjs.AddFunction("CheckDanceType", new TJSScript.FunctionCallBack(this.TJSCheckDanceType));
		this.tjs.AddFunction("SetMusicRelease", new TJSScript.FunctionCallBack(this.TJSSetMusicRelease));
		this.tjs.AddFunction("GetChallengeRank", new TJSScript.FunctionCallBack(this.TJSGetChallengeRank));
		this.tjs.AddFunction("SetVsSetting", new TJSScript.FunctionCallBack(this.TJSSetVsSetting));
		this.tjs.AddFunction("NeedDanceResult", new TJSScript.FunctionCallBack(this.TJSNeedDanceResult));
		this.tjs.AddFunction("BjDayFirst", new TJSScript.FunctionCallBack(this.TJSBjDayFirst));
		this.tjs.AddFunction("CasinoShopBuy", new TJSScript.FunctionCallBack(this.TJSCasinoShopBuy));
		this.tjs.AddFunction("SetEventEndFlag", new TJSScript.FunctionCallBack(this.TJSSetEventEndFlag));
		this.tjs_.AddFunction("IsKasizukiGuest", new TJSScript.FunctionCallBack(this.TJSFuncIsKasizukiGuest));
		this.tjs_.AddFunction("GetKasizukiSelectRoomName", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiSelectRoomName));
		this.tjs_.AddFunction("GetKasizukiMaidLikability", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiMaidLikability));
		this.tjs_.AddFunction("GetKasizukiMaidLikabilityName", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiMaidLikabilityName));
		this.tjs_.AddFunction("GetKasizukiMaidWorkCount", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiMaidWorkCount));
		this.tjs_.AddFunction("GetKasizukiMaidWorkCountName", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiMaidWorkCountName));
		this.tjs_.AddFunction("GetKasizukiSystemFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiSystemFlag));
		this.tjs_.AddFunction("SetKasizukiSystemFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetKasizukiSystemFlag));
		this.tjs_.AddFunction("AddKasizukiSystemFlag", new TJSScript.FunctionCallBack(this.TJSFuncAddKasizukiSystemFlag));
		this.tjs_.AddFunction("SetKasizukiPassFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetKasizukiPassFlag));
		this.tjs_.AddFunction("GetKasizukiMaidFlag", new TJSScript.FunctionCallBack(this.TJSFuncGetKasizukiMaidFlag));
		this.tjs_.AddFunction("SetKasizukiMaidFlag", new TJSScript.FunctionCallBack(this.TJSFuncSetKasizukiMaidFlag));
		this.tjs_.AddFunction("IsKasizukiCorrectSenarioFlag", new TJSScript.FunctionCallBack(this.TJSFuncIsKasizukiCorrectSenarioFlag));
		this.tjs_.AddFunction("IsVRKaraokeMode", new TJSScript.FunctionCallBack(this.TJSFuncIsVRKaraokeMode));
		this.tjs_.AddFunction("GetRemainingDanceTime", new TJSScript.FunctionCallBack(this.TJSFuncGetRemainingDanceTime));
		MotionKagManager motionKagManager = new MotionKagManager(this.tjs_, this);
		motionKagManager.Initialize();
		motionKagManager.SetSloatNo(0);
		this.kag_mot_dic_.Add(0, motionKagManager);
		this.adv_kag_ = new ADVKagManager(this.tjs_, this, this.message_mgr_);
		this.adv_kag_.Initialize();
		this.adv_kag_.kag.SetOnReturnFunction(new KagScript.OnReturnCallBack(this.OnReturnEvent));
		this.adv_kag_.kag.SetOnRReturnFunction(new KagScript.OnScenarioLoadCallBack(this.OnRReturnEvent));
		this.yotogi_kag_ = new YotogiKagManager(this.tjs_, this);
		this.yotogi_kag_.Initialize();
		this.tmp_kag_ = new BaseKagManager(this.tjs_, this);
		this.tmp_kag_.Initialize();
		using (AFileBase afileBase = this.file_system.FileOpen("startup.tjs"))
		{
			this.tjs_.ExecScript(afileBase);
		}
	}

	~ScriptManager()
	{
		this.Dispose(false);
	}

	public void ClearCallStack()
	{
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.kag.ClearCallStack();
		}
		this.adv_kag_.kag.ClearCallStack();
		this.yotogi_kag_.kag.ClearCallStack();
		this.tmp_kag_.kag.ClearCallStack();
	}

	public void Update()
	{
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.Update();
		}
		this.adv_kag_.Update();
		this.yotogi_kag_.Update();
		this.tmp_kag_.Update();
	}

	public void ExecScript(string exec_str, ref TJSVariant result)
	{
		this.tjs_.ExecScript(exec_str, ref result);
	}

	public void ExecScript(string exec_str)
	{
		this.tjs_.ExecScript(exec_str);
	}

	public void ExecScriptFile(string file_name, ref TJSVariant result)
	{
		using (AFileBase afileBase = this.file_system.FileOpen(file_name))
		{
			NDebug.Assert(afileBase.IsValid(), "not found file.\n" + file_name);
			this.tjs_.ExecScript(afileBase, ref result);
		}
	}

	public void ExecScriptFile(string file_name)
	{
		using (AFileBase afileBase = this.file_system.FileOpen(file_name))
		{
			NDebug.Assert(afileBase.IsValid(), "not found file.\n" + file_name);
			this.tjs_.ExecScript(afileBase);
		}
	}

	public void EvalScript(string eval_str, TJSVariant result)
	{
		this.tjs_.EvalScript(eval_str, result);
	}

	public void EvalScript(string eval_str)
	{
		this.tjs_.EvalScript(eval_str);
	}

	public void EvalScriptFile(string file_name, TJSVariant result)
	{
		using (AFileBase afileBase = this.file_system.FileOpen(file_name))
		{
			NDebug.Assert(afileBase.IsValid(), "not found file.\n" + file_name);
			this.tjs_.EvalScript(afileBase, result);
		}
	}

	public void EvalScriptFile(string file_name)
	{
		using (AFileBase afileBase = this.file_system.FileOpen(file_name))
		{
			NDebug.Assert(afileBase.IsValid(), "not found file.\n" + file_name);
			this.tjs_.EvalScript(afileBase);
		}
	}

	public void LoadAdvScenarioScript(string file_name, string label_name = "")
	{
		this.adv_kag_.enabled = true;
		this.adv_kag_.LoadScriptFile(file_name, label_name);
	}

	public void LoadYotogiScript(string file_name, string label_name = "")
	{
		this.yotogi_kag_.enabled = true;
		this.yotogi_kag_.LoadScriptFile(file_name, string.Empty);
		this.yotogi_kag_.Exec();
	}

	public void LoadTempScript(string file_name, string label_name = "")
	{
		this.tmp_kag_.enabled = true;
		this.tmp_kag_.LoadScriptFile(file_name, label_name);
	}

	public void LoadMotionScript(int sloat, bool is_next, string file_name, string label_name = "", string maid_guid = "", string man_guid = "", bool face_fix = false, bool valid_pos = true)
	{
		if (!string.IsNullOrEmpty(maid_guid))
		{
			Maid x = null;
			for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
			{
				Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(i);
				if (maid3 != null && maid3.status.guid == maid_guid)
				{
					x = maid3;
					break;
				}
			}
			if (x == null)
			{
				return;
			}
		}
		if (!string.IsNullOrEmpty(man_guid))
		{
			Maid x2 = null;
			for (int j = 0; j < GameMain.Instance.CharacterMgr.GetManCount(); j++)
			{
				Maid man = GameMain.Instance.CharacterMgr.GetMan(j);
				if (man != null && man.status.guid == man_guid)
				{
					x2 = man;
					break;
				}
			}
			if (x2 == null)
			{
				return;
			}
		}
		this.is_motion_all_prop_seq = false;
		this.motion_all_prop_seq_maid = null;
		MotionKagManager motionKagManager2;
		if (!this.kag_mot_dic_.ContainsKey(sloat))
		{
			MotionKagManager motionKagManager = new MotionKagManager(this.tjs_, this);
			motionKagManager.Initialize();
			motionKagManager.SetSloatNo(sloat);
			motionKagManager.kag.SetFileSystem(this.file_system);
			this.kag_mot_dic_.Add(sloat, motionKagManager);
			motionKagManager2 = motionKagManager;
		}
		else
		{
			motionKagManager2 = this.kag_mot_dic_[sloat];
		}
		Maid mainMaid = motionKagManager2.SetMainMaid(maid_guid);
		Maid maid2 = motionKagManager2.SetMainMan(man_guid);
		if (mainMaid == null && maid2 != null)
		{
			mainMaid = maid2;
		}
		motionKagManager2.valid_pos = valid_pos;
		motionKagManager2.enabled = true;
		motionKagManager2.ExecForcWaitEvent();
		motionKagManager2.LoadScriptFile(file_name, label_name);
		motionKagManager2.SetNextMotion(is_next);
		motionKagManager2.SetFaceFix(face_fix);
		Vector3 b = Vector3.zero;
		if (mainMaid != null)
		{
			b = mainMaid.transform.position;
		}
		motionKagManager2.Exec();
		if (mainMaid != null && motionKagManager2.maidOffsetSetList.Find((Maid maid) => maid == mainMaid) != null)
		{
			Vector3 b2 = mainMaid.transform.position - b;
			Quaternion rotation = mainMaid.transform.rotation;
			for (int k = 0; k < motionKagManager2.maidOffsetSetList.Count; k++)
			{
				motionKagManager2.maidOffsetSetList[k].transform.rotation = rotation;
				motionKagManager2.maidOffsetSetList[k].transform.position -= b2;
			}
		}
	}

	public void StopMotionScript()
	{
		this.ClearForcExecWaitEvent();
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.ClearMotion();
			keyValuePair.Value.enabled = false;
		}
	}

	public void ClearForcExecWaitEvent()
	{
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.ClearForcExecWaitEvent();
		}
	}

	private void TJSFuncGetMaidMPN(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(2 == param.Length, "GetMaidMPN args count error.");
		if (result == null)
		{
			return;
		}
		TJSVariantRef.Type[] array = new TJSVariantRef.Type[]
		{
			TJSVariantRef.Type.tvtInteger,
			TJSVariantRef.Type.tvtString
		};
		for (int i = 0; i < param.Length; i++)
		{
			NDebug.Assert(param[i].type == array[i], "TJSFuncGetMaidProp args[" + i + "] type error.");
		}
		int nMaidNo = param[0].AsInteger();
		string text = param[1].AsString();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MPN mpn = (MPN)Enum.Parse(typeof(MPN), text);
		MaidProp prop = maid.GetProp(mpn);
		NDebug.Assert(prop != null, "[" + text + "] 指定MPNが不正です。");
		if (prop.type == 3)
		{
			result.SetString(prop.name);
		}
		else
		{
			result.SetInteger(prop.value);
		}
	}

	private void TJSFuncGetMenuFileNameFromMaidMPN(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(2 == param.Length, "GetMenuFileNameFromMaidMPN args count error.");
		if (result == null)
		{
			return;
		}
		TJSVariantRef.Type[] array = new TJSVariantRef.Type[]
		{
			TJSVariantRef.Type.tvtInteger,
			TJSVariantRef.Type.tvtString
		};
		for (int i = 0; i < param.Length; i++)
		{
			NDebug.Assert(param[i].type == array[i], "TJSFuncGetMaidProp args[" + i + "] type error.");
		}
		int nMaidNo = param[0].AsInteger();
		string text = param[1].AsString();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MPN mpn = (MPN)Enum.Parse(typeof(MPN), text);
		MaidProp prop = maid.GetProp(mpn);
		NDebug.Assert(prop != null, "[" + text + "] 指定MPNが不正です。");
		if (prop.type == 3)
		{
			result.SetString(prop.strFileName.ToLower());
		}
		else
		{
			result.SetString(string.Empty);
		}
	}

	private void TJSFuncSetMaidFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(param.Length == 2 || 3 == param.Length, "SetMaidFlag args count error.");
		int nMaidNo = 0;
		string flagName = string.Empty;
		int num;
		if (param.Length == 3)
		{
			nMaidNo = param[0].AsInteger();
			flagName = param[1].AsString();
			num = param[2].AsInteger();
		}
		else
		{
			flagName = param[0].AsString();
			num = param[1].AsInteger();
		}
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			maid.status.OldStatus.SetFlag(flagName, num);
		}
		else
		{
			maid.status.SetFlag(flagName, num);
		}
		if (result != null)
		{
			result.SetInteger(num);
		}
	}

	private void TJSFuncSetManFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(param.Length == 2 || 3 == param.Length, "SetManFlag args count error.");
		string flagName = string.Empty;
		int value;
		if (param.Length == 3)
		{
			int num = param[0].AsInteger();
			flagName = param[1].AsString();
			value = param[2].AsInteger();
		}
		else
		{
			flagName = param[0].AsString();
			value = param[1].AsInteger();
		}
		if (!this.compatibilityMode)
		{
			GameMain.Instance.CharacterMgr.status.SetFlag(flagName, value);
		}
	}

	private void TJSFuncSetTmpFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(2 == param.Length, "SetTmpFlag args count error.");
		string flag_name = string.Empty;
		flag_name = param[0].AsString();
		int num = param[1].AsInteger();
		GameMain.Instance.CMSystem.SetTmpGenericFlag(flag_name, num);
		if (result != null)
		{
			result.SetInteger(num);
		}
	}

	private void TJSFuncGetMaidFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(param.Length == 1 || 2 == param.Length, "GetMaidFlag args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = 0;
		string flagName = string.Empty;
		if (param.Length == 2)
		{
			nMaidNo = param[0].AsInteger();
			flagName = param[1].AsString();
		}
		else
		{
			flagName = param[0].AsString();
		}
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			result.SetInteger(maid.status.OldStatus.GetFlag(flagName));
		}
		else
		{
			result.SetInteger(maid.status.GetFlag(flagName));
		}
	}

	private void TJSFuncGetManFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(param.Length == 1 || 2 == param.Length, "GetManFlag args count error.");
		if (result == null)
		{
			return;
		}
		string flagName = string.Empty;
		if (param.Length == 2)
		{
			int num = param[0].AsInteger();
			flagName = param[1].AsString();
		}
		else
		{
			flagName = param[0].AsString();
		}
		result.SetInteger(GameMain.Instance.CharacterMgr.status.GetFlag(flagName));
	}

	private void TJSFuncGetTmpFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(1 == param.Length, "GetTmpFlag args count error.");
		if (result == null)
		{
			return;
		}
		string flag_name = param[0].AsString();
		result.SetInteger(GameMain.Instance.CMSystem.GetTmpGenericFlag(flag_name));
	}

	private void TJSFuncSetSystemFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(2 == param.Length, "SetSystemFlag args count error.");
		string f_strKey = string.Empty;
		f_strKey = param[0].AsString();
		int integer = param[1].AsInteger();
		GameMain.Instance.CMSystem.SetSystemVers(f_strKey, integer.ToString());
		if (result != null)
		{
			result.SetInteger(integer);
		}
	}

	private void TJSFuncGetSystemFlag(TJSVariantRef[] param, TJSVariantRef result)
	{
		NDebug.Assert(1 == param.Length, "GetSystemFlag args count error.");
		if (result == null)
		{
			return;
		}
		string f_strKey = param[0].AsString();
		string text = GameMain.Instance.CMSystem.GetSystemVers(f_strKey);
		if (string.IsNullOrEmpty(text))
		{
			text = "0";
		}
		result.SetInteger(int.Parse(text));
	}

	private void TJSFuncGetMaidStatus(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "GetMaidStatus args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Status status = maid.status;
		string a = tjs_param[1].AsString();
		bool flag = this.compatibilityMode || this.tjsLegacyMode;
		if (flag && a == "状態")
		{
			a = "旧関係";
		}
		if (a == "性経験")
		{
			result.SetString(EnumConvert.GetString(status.seikeiken));
		}
		else if (a == "初期性経験")
		{
			result.SetString(EnumConvert.GetString(status.initSeikeiken));
		}
		else if (a == "性格")
		{
			result.SetString(status.personal.drawName);
		}
		else if (a == "契約タイプ")
		{
			result.SetString(EnumConvert.GetString(status.contract));
		}
		else if (a == "ヒロインタイプ")
		{
			result.SetString(EnumConvert.GetString(status.heroineType));
		}
		else if (a == "サブメイドユニークネーム")
		{
			if (status.subCharaData != null)
			{
				result.SetString(status.subCharaData.uniqueName);
			}
			else
			{
				result.SetString(string.Empty);
			}
		}
		else if (a == "ジョブメイド")
		{
			result.SetString(status.selectedJobClass.data.uniqueName);
		}
		else if (a == "夜伽クラス")
		{
			if (status.selectedJobClass.data.classType == AbstractClassData.ClassType.New)
			{
				result.SetString("Debut");
			}
			else
			{
				result.SetString(status.selectedYotogiClass.data.drawName);
			}
		}
		else if (a == "関係")
		{
			result.SetString(EnumConvert.GetString(status.relation));
		}
		else if (a == "旧関係")
		{
			if (status.OldStatus != null)
			{
				result.SetString(EnumConvert.GetString(status.OldStatus.relation));
			}
			else
			{
				result.SetString(EnumConvert.GetString(status.relation));
			}
		}
		else if (a == "カップ")
		{
			result.SetString(status.body.cup);
		}
		else if (a == "苗字")
		{
			result.SetString(status.lastName);
		}
		else if (a == "名前")
		{
			result.SetString(status.firstName);
		}
		else if (a == "身長")
		{
			result.SetInteger(status.body.height);
		}
		else if (a == "夜伽プレイ回数")
		{
			result.SetInteger(status.playCountYotogi);
		}
		else if (a == "接客プレイ回数")
		{
			result.SetInteger(status.playCountNightWork);
		}
		else if (a == "興奮値")
		{
			result.SetInteger(status.currentExcite);
		}
		else if (a == "好感度")
		{
			result.SetInteger(status.likability);
			if (flag && 300 <= status.likability)
			{
				result.SetInteger(299);
			}
		}
		else if (a == "習得率")
		{
			result.SetInteger(status.studyRate);
		}
		else if (a == "接待")
		{
			result.SetInteger(status.reception);
		}
		else if (a == "お世話")
		{
			result.SetInteger(status.care);
		}
		else if (a == "可憐")
		{
			result.SetInteger(status.lovely);
		}
		else if (a == "淫欲")
		{
			result.SetInteger(status.inyoku);
		}
		else if (a == "気品")
		{
			result.SetInteger(status.elegance);
		}
		else if (a == "M性")
		{
			result.SetInteger(status.mvalue);
		}
		else if (a == "魅惑")
		{
			result.SetInteger(status.charm);
		}
		else if (a == "変態")
		{
			result.SetInteger(status.hentai);
		}
		else if (a == "奉仕")
		{
			result.SetInteger(status.housi);
		}
		else if (a == "料理")
		{
			result.SetInteger(status.cooking);
		}
		else if (a == "ボーカル")
		{
			result.SetInteger(status.vocal);
		}
		else if (a == "ダンス")
		{
			result.SetInteger(status.dance);
		}
		else if (a == "アピール")
		{
			result.SetInteger(status.appealPoint);
		}
		else if (a == "指導")
		{
			result.SetInteger(status.teachRate);
		}
		else if (a == "経験人数")
		{
			result.SetInteger(status.sexPlayNumberOfPeople);
		}
		else if (a == "昼仕事ID")
		{
			result.SetInteger(status.noonWorkId);
		}
		else if (a == "夜仕事ID")
		{
			result.SetInteger(status.nightWorkId);
		}
		else if (a == "昼仕事レベル")
		{
			if (!status.workDatas.ContainsKey(status.noonWorkId))
			{
				result.SetInteger(1);
			}
			else
			{
				result.SetInteger(status.workDatas.Get(status.noonWorkId).level);
			}
		}
		else if (a == "夜仕事レベル")
		{
			if (!status.workDatas.ContainsKey(status.nightWorkId))
			{
				result.SetInteger(1);
			}
			else
			{
				result.SetInteger(status.workDatas.Get(status.nightWorkId).level);
			}
		}
		else if (a == "夜伽クラスレベル")
		{
			result.SetInteger(status.selectedYotogiClass.level);
		}
		else if (a == "ジョブメイドレベル")
		{
			result.SetInteger(status.selectedJobClass.level);
		}
		else if (flag)
		{
			if (a == "レンタルメイド")
			{
				result.SetInteger(0);
			}
			else if (a == "雇用中")
			{
				result.SetInteger(1);
			}
			else if (a == "特殊状態")
			{
				result.SetString(EnumConvert.GetString(status.OldStatus.condition));
			}
			else if (a == "欲求不満")
			{
				result.SetInteger(status.OldStatus.frustration);
			}
			else if (a == "淫乱ギャップ値")
			{
				result.SetInteger(status.inranGap);
			}
			else if (a == "M性ギャップ値")
			{
				result.SetInteger(status.mValueGap);
			}
			else if (a == "変態ギャップ値")
			{
				result.SetInteger(status.hentaiGap);
			}
			else if (a == "メイドクラス")
			{
				if (status.selectedJobClass.data.classType == AbstractClassData.ClassType.Old)
				{
					result.SetString(status.selectedJobClass.data.drawName);
				}
				else
				{
					result.SetString("ノービスメイド");
				}
			}
		}
	}

	private void TJSFuncSetMainCharaFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetMainCharaFlag args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (maid == null)
		{
			Debug.LogError("SetMainCharaFlag error\nメイド[" + nMaidNo.ToString() + "]にはメイドはいません");
		}
		else
		{
			maid.status.mainChara = tjs_param[1].AsBool();
		}
	}

	private void OldTJSFuncConIsSeikantai(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@IsSeikantaiがよばれました");
		NDebug.Assert(2 == tjs_param.Length, "IsSeikantai args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Old.Status oldStatus = maid.status.OldStatus;
		string text = tjs_param[1].AsString();
		int num = 1000;
		if (text == "口")
		{
			result.SetBool(num <= oldStatus.sexual.mouth);
		}
		else if (text == "喉")
		{
			result.SetBool(num <= oldStatus.sexual.throat);
		}
		else if (text == "乳首")
		{
			result.SetBool(num <= oldStatus.sexual.nipple);
		}
		else if (text == "前穴")
		{
			result.SetBool(num <= oldStatus.sexual.front);
		}
		else if (text == "後穴")
		{
			result.SetBool(num <= oldStatus.sexual.back);
		}
		else if (text == "クリ")
		{
			result.SetBool(num <= oldStatus.sexual.curi);
		}
		else
		{
			NDebug.Assert("IsSeikantai error.\n" + text, false);
		}
	}

	private void TJSFuncCreateNewMaid(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "CreateNewMaid args count error.");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		Maid maid = null;
		string text = tjs_param[0].AsString();
		if (!MaidStatus.Personal.Contains(text))
		{
			NDebug.Assert(SubMaid.Contains(text), "CreateNewMaidの指定名が間違っています[" + text + "]");
			SubMaid.Data data = SubMaid.GetData(text);
			GameMain.Instance.ScriptMgr.StopMotionScript();
			bool flag = false;
			for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
			{
				Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
				if (stockMaid != null && stockMaid.status.heroineType == HeroineType.Sub && stockMaid.status.subCharaData.id == data.id)
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				maid = characterMgr.AddStockMaid();
				data.ApplyStatus(maid.status, characterMgr.status.lockUserDraftMaid);
				data.ApplyPreset(maid, characterMgr.status.lockUserDraftMaid);
			}
		}
		else
		{
			NDebug.Assert(MaidStatus.Personal.IsEnabled(text), "CreateNewMaidで指定された対象名[" + text + "]は有効状態ではありません");
			MaidStatus.Personal.Data data2 = MaidStatus.Personal.GetData(text);
			GameMain.Instance.ScriptMgr.StopMotionScript();
			maid = characterMgr.AddStockMaid();
			maid.status.SetPersonal(data2);
		}
		if (maid != null)
		{
			characterMgr.SetActiveMaid(maid, 0);
			maid.Visible = true;
			maid.AllProcPropSeqStart();
		}
	}

	private void TJSFuncPresetLoad(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "PresetLoad args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (maid == null)
		{
			NDebug.Assert("PresetLoad\nmaid null.", false);
			return;
		}
		byte[] array = null;
		string text = tjs_param[1].AsString();
		if (text == "pre_maid_secretary")
		{
			CharacterMgr.Preset f_prest = GameMain.Instance.CharacterMgr.PresetLoadFromResources(text);
			GameMain.Instance.CharacterMgr.PresetSet(maid, f_prest);
		}
		else
		{
			if (this.file_system.IsExistentFile(text + ".preset"))
			{
				using (AFileBase afileBase = GameUty.FileOpen(text + ".preset", null))
				{
					if (afileBase != null && afileBase.IsValid())
					{
						array = afileBase.ReadAll();
					}
				}
			}
			if (array == null)
			{
				NDebug.Assert("PresetLoad\n[" + text + "] file not fund.", false);
				return;
			}
			using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(array), Encoding.UTF8))
			{
				CharacterMgr.Preset f_prest2 = GameMain.Instance.CharacterMgr.PresetLoad(binaryReader, text);
				GameMain.Instance.CharacterMgr.PresetSet(maid, f_prest2);
			}
			array = null;
		}
	}

	private void TJSFuncPresetLoadNPC(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert("未実装TJS関数[PresetLoadNPC]が呼ばれました", false);
	}

	private void TJSFuncAddMaidStatus(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(3 == tjs_param.Length, "AddMaidStatus args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Status status = maid.status;
		string a = tjs_param[1].AsString();
		int num = tjs_param[2].AsInteger();
		Action<int> action = null;
		if (a == "夜伽プレイ回数")
		{
			maid.status.playCountNightWork += num;
		}
		else if (a == "接客プレイ回数")
		{
			maid.status.playCountNightWork += num;
		}
		else if (a == "好感度")
		{
			maid.status.likability += num;
		}
		else if (a == "習得率")
		{
			maid.status.studyRate += num;
		}
		else if (a == "接待")
		{
			maid.status.baseReception += num;
		}
		else if (a == "お世話")
		{
			maid.status.baseCare += num;
		}
		else if (a == "可憐")
		{
			maid.status.baseLovely += num;
		}
		else if (a == "気品")
		{
			maid.status.baseElegance += num;
		}
		else if (a == "魅惑")
		{
			maid.status.baseCharm += num;
		}
		else if (a == "淫欲")
		{
			maid.status.baseInyoku += num;
		}
		else if (a == "M性")
		{
			maid.status.baseMvalue += num;
		}
		else if (a == "変態")
		{
			maid.status.baseHentai += num;
		}
		else if (a == "奉仕")
		{
			maid.status.baseHousi += num;
		}
		else if (a == "指導")
		{
			maid.status.baseTeachRate += num;
		}
		else if (a == "経験人数")
		{
			maid.status.sexPlayNumberOfPeople += num;
		}
		if (action != null)
		{
			action(num);
		}
	}

	private void TJSFuncIsMaidFeature(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "IsMaidFeature args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Status status = maid.status;
		string uniqueName = tjs_param[1].AsString();
		Feature.Data data = Feature.GetData(uniqueName);
		result.SetInteger(Convert.ToInt32(status.features.ContainsKey(data.id)));
	}

	private void TJSFuncIsMaidPropensity(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "IsMaidPropensity args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Status status = maid.status;
		string uniqueName = tjs_param[1].AsString();
		Propensity.Data data = Propensity.GetData(uniqueName);
		result.SetInteger(Convert.ToInt32(status.propensitys.ContainsKey(data.id)));
	}

	private void TJSFuncGetYotogiSkillLevel(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "GetYotogiSkillLevel args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		int skillId = tjs_param[1].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		MaidStatus.Status status = maid.status;
		result.SetInteger(0);
		if (status.yotogiSkill.Contains(skillId))
		{
			YotogiSkillData yotogiSkillData = status.yotogiSkill.Get(skillId);
			result.SetInteger(yotogiSkillData.level);
		}
	}

	private void TJSFuncIsYotogiSkill(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "IsYotogiSkill args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		int skillId = tjs_param[1].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		result.SetBool(maid.status.yotogiSkill.Contains(skillId));
	}

	private void TJSFuncGetStockMaidCount(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(GameMain.Instance.CharacterMgr.GetStockMaidCount());
	}

	private void TJSFuncSetSalonGrade(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetSalonGrade args count error.");
		GameMain.Instance.CharacterMgr.status.clubGrade = tjs_param[0].AsInteger();
	}

	private void TJSFuncGetSalonGrade(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(GameMain.Instance.CharacterMgr.status.clubGrade);
	}

	private void TJSFuncGetClubEvaluation(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(GameMain.Instance.CharacterMgr.status.clubEvaluation);
	}

	private void TJSFuncSetClubGauge(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetClubGauge args count error.");
		GameMain.Instance.CharacterMgr.status.clubGauge = tjs_param[0].AsInteger();
	}

	private void TJSFuncGetClubGauge(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(GameMain.Instance.CharacterMgr.status.clubGauge);
	}

	private void TJSFuncGetBGName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetString(GameMain.Instance.BgMgr.GetBGName());
	}

	private void TJSFuncIsItemParam(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(2 == tjs_param.Length, "IsItemParam args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		string f_strTag = tjs_param[1].AsString();
		result.SetInteger(Convert.ToInt32(!string.IsNullOrEmpty(maid.body0.GetPartsParam(f_strTag))));
	}

	private void TJSFuncIsItemSlot(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(2 == tjs_param.Length, "IsItemSlot args count error.");
		if (result == null)
		{
			return;
		}
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		string text = tjs_param[1].AsString();
		TBody.SlotID f_eSlot = TBody.SlotID.wear;
		try
		{
			f_eSlot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), text);
		}
		catch
		{
			NDebug.Assert("Parse error.[TBody.SlotID]\n" + text, false);
		}
		result.SetBool(maid.body0.GetSlotLoaded(f_eSlot));
	}

	private void OldTJSFuncIsMaidClass(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@IsMaidClassがよばれました");
		this.TJSFuncIsJobMaid(tjs_param, result);
	}

	private void TJSFuncIsJobMaid(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 2, "IsJobMaid args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger && tjs_param[1].type == TJSVariantRef.Type.tvtString, "error.");
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(tjs_param[0].AsInteger());
		string uniqueName = tjs_param[1].AsString();
		JobClass.Data data = JobClass.GetData(uniqueName);
		if (maid.status.jobClass.Contains(data.id))
		{
			result.SetInteger(1);
		}
		else
		{
			result.SetInteger(0);
		}
	}

	private void OldTJSFuncGetMaidClassLevel(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@GetMaidClassLevelがよばれました");
		this.TJSFuncGetJobMaidLevel(tjs_param, result);
	}

	private void TJSFuncGetJobMaidLevel(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 2, "GetJobMaidLevel args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger && tjs_param[1].type == TJSVariantRef.Type.tvtString, "error.");
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(tjs_param[0].AsInteger());
		string uniqueName = tjs_param[1].AsString();
		JobClass.Data data = JobClass.GetData(uniqueName);
		if (maid.status.jobClass.Contains(data.id))
		{
			result.SetInteger(maid.status.jobClass.Get(data.id).level);
		}
		else
		{
			result.SetInteger(0);
		}
	}

	private void TJSFuncIsYotogiClass(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 2, "IsYotogiClass args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger && tjs_param[1].type == TJSVariantRef.Type.tvtString, "error.");
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(tjs_param[0].AsInteger());
		string uniqueName = tjs_param[1].AsString();
		YotogiClass.Data data = YotogiClass.GetData(uniqueName);
		if (maid.status.yotogiClass.Contains(data.id))
		{
			result.SetInteger(1);
		}
		else
		{
			result.SetInteger(0);
		}
	}

	private void TJSFuncGetYotogiClassLevel(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 2, "GetYotogiClassLevel args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger && tjs_param[1].type == TJSVariantRef.Type.tvtString, "error.");
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(tjs_param[0].AsInteger());
		string uniqueName = tjs_param[1].AsString();
		YotogiClass.Data data = YotogiClass.GetData(uniqueName);
		if (maid.status.yotogiClass.Contains(data.id))
		{
			result.SetInteger(maid.status.yotogiClass.Get(data.id).level);
		}
		else
		{
			result.SetInteger(0);
		}
	}

	private void TJSFuncGetNoonScuccessLevel(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 1, "TJSFuncGetNoonScuccessLevel args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger, "error.");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		Maid maid = characterMgr.GetMaid(tjs_param[0].AsInteger());
		ScheduleData[] scheduleSlot = characterMgr.status.scheduleSlot;
		int integer = -1;
		for (int i = 0; i < scheduleSlot.Length; i++)
		{
			if (scheduleSlot[i] != null)
			{
				if (scheduleSlot[i].maid_guid == maid.status.guid)
				{
					integer = (int)scheduleSlot[i].noon_success_level;
					break;
				}
			}
		}
		result.SetInteger(integer);
	}

	private void TJSFuncIsMaid(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 1, "IsMaid args count error.");
		NDebug.Assert(tjs_param[0].type == TJSVariantRef.Type.tvtInteger, "error.");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		Maid maid = characterMgr.GetMaid(tjs_param[0].AsInteger());
		result.SetBool(maid != null);
	}

	private void TJSFuncIsOldPersonal(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(tjs_param.Length == 1, "IsOldPersonal args count error.");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		Maid maid = characterMgr.GetMaid(tjs_param[0].AsInteger());
		if (maid == null)
		{
			result.SetBool(false);
		}
		else
		{
			result.SetBool(maid.status.personal.oldPersonal);
		}
	}

	public void TJSFuncConGetSalonLoan(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(0);
	}

	public void TJSFuncConGetPhase(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(2);
	}

	public void TJSFuncGetDay(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		result.SetInteger(status.days);
	}

	public void TJSFuncCreateStockMaidLoopData(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		this.stock_maid_loop_list.Clear();
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
		{
			this.stock_maid_loop_list.Add(characterMgr.GetStockMaid(i));
		}
		List<Maid> list = this.stock_maid_loop_list;
		if (ScriptManager.<>f__mg$cache0 == null)
		{
			ScriptManager.<>f__mg$cache0 = new Comparison<Maid>(CharacterSelectManager.SortMaidStandard);
		}
		list.Sort(ScriptManager.<>f__mg$cache0);
		if (result != null)
		{
			result.SetInteger(this.stock_maid_loop_list.Count);
		}
	}

	public void TJSFuncCreateCompetitiveShowLoopData(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		this.stock_maid_loop_list.Clear();
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		if (CompetitiveShowMgr.is_effect_ones)
		{
			for (int i = 0; i < CompetitiveShowMgr.check_maid_list.Count; i++)
			{
				this.stock_maid_loop_list.Add(CompetitiveShowMgr.check_maid_list[i]);
			}
		}
		else if (0 < CompetitiveShowMgr.check_maid_list.Count)
		{
			this.stock_maid_loop_list.Add(CompetitiveShowMgr.check_maid_list[0]);
			CompetitiveShowMgr.check_maid_list.RemoveAt(0);
		}
		if (result != null)
		{
			result.SetInteger(this.stock_maid_loop_list.Count);
		}
	}

	public void TJSFuncGetCompetitiveShowLoopCount(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result != null)
		{
			result.SetInteger(CompetitiveShowMgr.check_maid_list.Count);
		}
	}

	public void TJSFuncSetActiveSlotFromStockMaidLoopData(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		GameMain.Instance.ScriptMgr.StopMotionScript();
		NDebug.Assert(tjs_param.Length == 1, "SetActiveSlotFromStockMaidLoopData args count error.");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		Maid maid = this.stock_maid_loop_list[tjs_param[0].AsInteger()];
		maid.Visible = false;
		characterMgr.SetActiveMaid(maid, 0);
	}

	private void TJSFuncClearCallStack(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		this.ClearCallStack();
	}

	private void OldTJSFuncIsCommunicationChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@IsCommunicationCharaeがよばれました");
		if (result == null)
		{
			return;
		}
		result.SetBool(false);
		result.SetBool(0 < ScheduleAPI.CanCommunicationMaids(GameMain.Instance.CharacterMgr.status.isDaytime).Count);
	}

	private void TJSFuncSetCommunicationChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
		Maid communicationMaid = ScheduleAPI.GetCommunicationMaid(isDaytime);
		if (communicationMaid == null)
		{
			if (result != null)
			{
				result.SetBool(false);
			}
			return;
		}
		GameMain.Instance.CharacterMgr.SetActiveMaid(communicationMaid, 0);
		communicationMaid.Visible = true;
		ScheduleCSVData.ScheduleBase schedule = ScheduleAPI.GetSchedule(communicationMaid, isDaytime);
		if (schedule.type == ScheduleTaskCtrl.TaskType.Training)
		{
			ScheduleCSVData.Training training = (ScheduleCSVData.Training)schedule;
			if (training.trainingType == ScheduleCSVData.TrainingType.Trainee)
			{
				Maid maid;
				if (isDaytime)
				{
					maid = ScheduleAPI.GetNoonTrainerMaid();
				}
				else
				{
					maid = ScheduleAPI.GetNightTrainerMaid();
				}
				if (maid != null)
				{
					GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 1);
					maid.Visible = true;
				}
			}
			if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
			{
				Maid maid2;
				if (isDaytime)
				{
					maid2 = ScheduleAPI.GetNoonTraineeMaid();
				}
				else
				{
					maid2 = ScheduleAPI.GetNightTraineeMaid();
				}
				if (maid2 != null)
				{
					GameMain.Instance.CharacterMgr.SetActiveMaid(maid2, 1);
					maid2.Visible = true;
				}
			}
		}
		if (result != null)
		{
			result.SetBool(true);
		}
	}

	private void TJSFuncSetRandomCommuChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		GameMain.Instance.ScriptMgr.StopMotionScript();
		Maid[] array = ScheduleAPI.CanCommunicationMaids(GameMain.Instance.CharacterMgr.status.isDaytime).ToArray();
		if (array.Length == 0)
		{
			GameMain.Instance.CharacterMgr.DeactivateMaid(0);
			return;
		}
		Maid maid = array[UnityEngine.Random.Range(0, array.Length)];
		NDebug.Assert(maid != null, "SetRandomCommuChara()\n選択されたメイドが空です");
		GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
		maid.Visible = true;
	}

	private void TJSFuncCreateYotogiCharaList(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		SceneCharacterSelect.CreateYotogiCharaList();
	}

	private void TJSFuncCreateVipCharaList(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		SceneCharacterSelect.CreateVipCharaList();
	}

	private void TJSFuncCreateFacilityCharaList(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		SceneCharacterSelect.CreateFacilityCharaList();
	}

	private void TJSFuncIsReceptionChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetBool(0 < ScheduleAPI.GetEntertainMaids().Count);
	}

	private void TJSFuncSetRandomReceptionChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		GameMain.Instance.ScriptMgr.StopMotionScript();
		Maid[] array = ScheduleAPI.GetEntertainMaids().ToArray();
		NDebug.Assert(0 < array.Length, "SetRandomReceptionChara()\nメイドリストが空です");
		Maid maid = array[UnityEngine.Random.Range(0, array.Length)];
		NDebug.Assert(maid != null, "SetRandomReceptionChara()\n選択されたメイドが空です");
		GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
		maid.Visible = true;
	}

	private void TJSFuncIsSelectChara(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetBool(SceneCharacterSelect.IsSelectChara());
	}

	private void TJSFuncGetDateYear(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(DateTime.Now.Year);
	}

	private void TJSFuncGetDateMonth(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(DateTime.Now.Month);
	}

	private void TJSFuncGetDateDay(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetInteger(DateTime.Now.Day);
	}

	private void TJSFuncUpdateMaidRanking(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		Maid.UpdateMaidRanking();
	}

	private void TJSFuncResetMaidRanking(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
		{
			Maid stockMaid = characterMgr.GetStockMaid(i);
			if (stockMaid != null)
			{
				stockMaid.status.popularRank = 0;
				stockMaid.status.evaluation = 0;
				stockMaid.status.sales = 0L;
			}
		}
		characterMgr.status.SetFlag("__ランキング日数", 0);
	}

	private void TJSFuncSetMaidRanking1st(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		GameMain.Instance.ScriptMgr.StopMotionScript();
		Maid maid = null;
		for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
		{
			maid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
			if (!(maid == null))
			{
				if (maid.status.popularRank == 1)
				{
					break;
				}
			}
		}
		if (maid == null)
		{
			maid = GameMain.Instance.CharacterMgr.GetStockMaid(0);
		}
		GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
		maid.Visible = true;
	}

	private void TJSFuncIsAvailableRanking(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetBool(GameMain.Instance.CharacterMgr.status.isAvailableRanking);
	}

	private void TJSFuncIsYotogiSubCharaSelect(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetBool(false);
		GameObject gameObject = GameObject.Find("UI Root/YotogiManager");
		if (gameObject == null)
		{
			return;
		}
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			YotogiOldManager component = gameObject.GetComponent<YotogiOldManager>();
			if (component == null)
			{
				return;
			}
			result.SetBool(component.IsCallShouldSubCharaSelect());
		}
		else
		{
			YotogiManager component2 = gameObject.GetComponent<YotogiManager>();
			if (component2 == null)
			{
				return;
			}
			result.SetBool(component2.IsCallShouldSubCharaSelect());
		}
	}

	private void TJSFuncGetYotogiSkillSpecialType(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		GameObject gameObject = GameObject.Find("UI Root/YotogiManager");
		if (result == null || gameObject == null)
		{
			return;
		}
		YotogiManager component = gameObject.GetComponent<YotogiManager>();
		if (component == null || component.play_skill_array == null || component.play_skill_array.Length == 0)
		{
			return;
		}
		result.SetString(component.play_skill_array[0].skill_pair.base_data.specialConditionType.ToString());
	}

	private void TJSFuncIsSelectedYotogiSkill(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length == 1, "IsSelectedYotogiSkill args count error.");
		GameObject gameObject = GameObject.Find("UI Root/YotogiManager");
		if (result == null || gameObject == null)
		{
			return;
		}
		YotogiManager component = gameObject.GetComponent<YotogiManager>();
		if (component == null || component.play_skill_array == null || component.play_skill_array.Length == 0)
		{
			return;
		}
		result.SetBool(false);
		int num = tjs_param[0].AsInteger();
		foreach (YotogiManager.PlayingSkillData playingSkillData in component.play_skill_array)
		{
			if (playingSkillData != null && playingSkillData.skill_pair != null && playingSkillData.skill_pair.skill_data != null)
			{
				if (playingSkillData.skill_pair.skill_data.data.id == num)
				{
					result.SetBool(true);
					break;
				}
			}
		}
	}

	private void TJSFuncIsExistentFile(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		if (this.compatibilityMode)
		{
			result.SetBool(false);
		}
		else
		{
			NDebug.Assert(1 == tjs_param.Length, "TJSFuncIsExistentFile args count error.");
			result.SetBool(this.file_system.IsExistentFile(tjs_param[0].AsString()));
		}
	}

	private void TJSFuncIsExistentFileLegacy(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "IsExistentFileLegacy args count error.");
		result.SetBool(GameUty.FileSystemOld.IsExistentFile(tjs_param[0].AsString()));
	}

	private void TJSFuncCheckClearVIP(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "CheckClearVIP args count error.");
		int key = tjs_param[0].AsInteger();
		ReadOnlyDictionary<int, NightWorkState> night_works_state_dic = GameMain.Instance.CharacterMgr.status.night_works_state_dic;
		bool @bool = false;
		if (night_works_state_dic.ContainsKey(key) && night_works_state_dic[key].finish)
		{
			@bool = true;
		}
		result.SetBool(@bool);
	}

	private void TJSFuncIsCBLVersion(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		result.SetBool(false);
	}

	private void OldTJSFuncGetRentalNPCName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@GetRentalNPCNameがよばれました");
		if (result == null)
		{
			return;
		}
		result.SetString(string.Empty);
	}

	private void OldTJSFuncIsMarriage(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@IsMarriageがよばれました");
		if (result == null)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "TJSFuncIsMarriage args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (maid != null && maid.status.OldStatus != null)
		{
			result.SetBool(maid.status.OldStatus.isMarriage);
		}
		else
		{
			result.SetBool(false);
		}
	}

	private void OldTJSFuncIsNewWifeFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(this.compatibilityMode || this.tjsLegacyMode, "互換モードではないの、互換モード用関数@IsNewWifeFlagがよばれました");
		if (result == null)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "TJSFuncIsMarriage args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (maid != null && maid.status.OldStatus != null)
		{
			result.SetBool(maid.status.OldStatus.isNewWife);
		}
		else
		{
			result.SetBool(false);
		}
	}

	private void TJSFuncIsMVPEvent(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		if (!status.isAvailableRanking)
		{
			result.SetBool(false);
		}
		else if (status.GetFlag("__ランキング日数") % 7 == 0)
		{
			bool @bool = false;
			for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
			{
				Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
				if (!(stockMaid == null))
				{
					if (stockMaid.status.popularRank == 1)
					{
						@bool = true;
						break;
					}
				}
			}
			result.SetBool(@bool);
		}
		else
		{
			result.SetBool(false);
		}
	}

	private void TJSFuncSetMaidCondition(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetMaidCondition args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		string a = tjs_param[1].AsString();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			if (a == "緊張")
			{
				maid.status.OldStatus.relation = MaidStatus.Old.Relation.Tonus;
			}
			else if (a == "お近づき")
			{
				maid.status.OldStatus.relation = MaidStatus.Old.Relation.Contact;
			}
			else if (a == "信頼")
			{
				maid.status.OldStatus.relation = MaidStatus.Old.Relation.Trust;
			}
			else if (a == "恋人")
			{
				maid.status.OldStatus.relation = MaidStatus.Old.Relation.Lover;
			}
			else if (a == "愛奴")
			{
				maid.status.OldStatus.relation = MaidStatus.Old.Relation.Slave;
			}
			else if (a == "酔い")
			{
				maid.status.OldStatus.condition = Condition.Drunk;
			}
			else if (a == "お仕置き")
			{
				maid.status.OldStatus.condition = Condition.Osioki;
			}
			else if (a == "酔い解除" || a == "お仕置き解除")
			{
				maid.status.OldStatus.condition = Condition.Null;
			}
		}
		else if (a == "お近づき")
		{
			maid.status.relation = MaidStatus.Relation.Contact;
		}
		else if (a == "信頼")
		{
			maid.status.relation = MaidStatus.Relation.Trust;
		}
		else if (a == "恋人")
		{
			maid.status.relation = MaidStatus.Relation.Lover;
		}
	}

	private void TJSFuncSetSeikeikenFront(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetSeikeikenFront args count error.");
		int num = tjs_param[0].AsInteger();
		bool seikeikenFront = tjs_param[1].AsBool();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
		Seikeiken seikeiken = maid.status.seikeiken;
		maid.status.SetSeikeikenFront(seikeikenFront);
		if (num == 0 && maid.status.seikeiken != seikeiken)
		{
			if ((this.compatibilityMode || this.tjsLegacyMode) && YotogiOldManager.instans != null)
			{
				YotogiOldManager.instans.OnChangeSeikeiken();
			}
			else if (YotogiManager.instans != null)
			{
				YotogiManager.instans.OnChangeSeikeiken();
			}
		}
	}

	private void TJSFuncSetSeikeikenBack(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetSeikeikenBack args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		bool seikeikenBack = tjs_param[1].AsBool();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		maid.status.SetSeikeikenBack(seikeikenBack);
	}

	private void TJSFuncSetInitSeikeiken(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetInitSeikeiken args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		string text = tjs_param[1].AsString();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		try
		{
			Seikeiken initSeikeiken = (Seikeiken)Enum.Parse(typeof(Seikeiken), text);
			maid.status.initSeikeiken = initSeikeiken;
		}
		catch (ArgumentException)
		{
			Debug.Log("MaidStatus.Seikeiken\nenum parse error.[" + text + "]");
		}
	}

	private void TJSFuncSetNewItem(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetNewItem args count error.");
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			return;
		}
		string itemName = tjs_param[0].AsString();
		GameMain.Instance.CharacterMgr.status.AddHavePartsItem(itemName);
	}

	private void TJSFuncIsGameInShopItemPurchased(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "IsGameInShopItemPurchased args count error.");
		if (result == null)
		{
			return;
		}
		int num = tjs_param[0].AsInteger();
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		if (!status.IsShopLineupItem(num))
		{
			result.SetBool(false);
		}
		result.SetBool(status.shopLineups.Get(num) == ShopItemStatus.Purchased);
	}

	private void TJSFuncSetContractType(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetContractType args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		string text = tjs_param[1].AsString();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (text == "育成中")
		{
			maid.status.contract = Contract.Trainee;
		}
		else if (text == "フリー")
		{
			maid.status.contract = Contract.Free;
		}
		else if (text == "専属")
		{
			maid.status.contract = Contract.Exclusive;
		}
		else
		{
			NDebug.Assert(text + "は不正です", false);
		}
	}

	private void TJSFuncSetFeature(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(3 == tjs_param.Length, "SetFeature args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		string uniqueName = tjs_param[1].AsString();
		bool flag = tjs_param[2].AsBool();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		Feature.Data data = Feature.GetData(uniqueName);
		maid.status.AddFeature(data);
	}

	private void TJSFuncSetPropensity(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(3 == tjs_param.Length, "SetPropensity args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		string uniqueName = tjs_param[1].AsString();
		bool flag = tjs_param[2].AsBool();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		Propensity.Data data = Propensity.GetData(uniqueName);
		maid.status.AddPropensity(data);
	}

	private void TJSFuncComSetSexualParam(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
	}

	private void TJSFuncSetNewTrophy(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "SetNewTrophy args count error.");
		int trophyId = tjs_param[0].AsInteger();
		GameMain.Instance.CharacterMgr.status.AddHaveTrophy(trophyId);
	}

	private void TJSFuncCheckTrophyContractType(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			return;
		}
		GameMain.Instance.CharacterMgr.status.CheckTrophyContractTypeAndrelation();
	}

	private void TJSFuncSetYotogiSelectStageName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetYotogiSelectStageName args count error.");
		this.debug_yotogi_stage_ = tjs_param[0].AsString();
	}

	private void TJSFuncGetYotogiSelectStageName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		if (this.compatibilityMode || this.tjsLegacyMode)
		{
			result.SetString(YotogiOldStageSelectManager.StageName);
		}
		else
		{
			result.SetString(YotogiStageSelectManager.SelectedStage.uniqueName);
		}
	}

	public void TJSFuncIsPluginPack(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			return;
		}
		NDebug.Assert(1 == tjs_param.Length, "IsPluginPack args count error.");
		if (this.compatibilityMode)
		{
			result.SetBool(false);
		}
		else
		{
			string text = tjs_param[0].AsString();
			if (!PluginData.Contains(text))
			{
				Debug.LogError("IsPluginPackで指定された[" + text + "]は設定されていないプラグイン名です");
			}
			result.SetBool(PluginData.IsEnabled(text));
		}
	}

	public void TJSFuncAddShopLineup(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "TJSFuncAddShopLineup args count error.");
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		int num = tjs_param[0].AsInteger();
		if (!status.shopLineups.ContainsKey(num))
		{
			status.AddShopLineup(num);
		}
	}

	public void TJSFuncSetEventItemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetEventItemFlag args count error.");
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		bool flag = tjs_param[1].AsInteger() != 0;
		if (flag)
		{
			status.AddHaveItem(tjs_param[0].AsString());
		}
		else
		{
			status.RemoveHaveItem(tjs_param[0].AsString());
		}
	}

	public void TJSFuncIsEventItemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error IsEventItemFlag", false);
		}
		NDebug.Assert(1 == tjs_param.Length, "IsEventItemFlag args count error.");
		PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
		result.SetBool(status.IsHaveItem(tjs_param[0].AsString()));
	}

	public void TJSFuncGetVRMode(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetVRMode", false);
		}
		result.SetInteger((int)GameMain.Instance.VRDeviceTypeID);
	}

	public void TJSFuncIsVRMode(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error IsVRMode", false);
		}
		result.SetInteger((!GameMain.Instance.VRMode) ? 0 : 1);
	}

	public void TJSFuncSetDanceData(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "TJSFuncAddShopLineup args count error.");
		string bgm_file_name = tjs_param[0].AsString();
		DanceMain.SelectDanceData = new DanceData
		{
			bgm_file_name = bgm_file_name,
			preset_name = new List<string>(),
			preset_name = 
			{
				string.Empty
			}
		};
		DanceMain.KaraokeMode = true;
		RhythmAction_Mgr.KaraokeRecet();
		GameMain.Instance.CMSystem.SetTmpGenericFlag("ダンスOVRカメラタイプ", 0);
	}

	public void TJSFuncGetEventAdded(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetEventAdded", false);
		}
		result.SetBool(GameMain.Instance.ScenarioSelectMgr.IsEventAdded());
	}

	public void TJSFuncGetLockNTRPlayFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetLockNTRPlayFlag", false);
		}
		result.SetBool(GameMain.Instance.CharacterMgr.status.lockNTRPlay);
	}

	public void TJSFuncGetLockUserDraftMaid(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetLockUserDraftMaid", false);
		}
		result.SetBool(GameMain.Instance.CharacterMgr.status.lockUserDraftMaid);
	}

	public void TJSFuncIsComPlayer(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error IsComPlayer", false);
		}
		result.SetBool(!GameMain.Instance.CharacterMgr.status.isOldPlayer);
	}

	public void TJSFuncSetPlayerMoney(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetPlayerMoney args count error.");
		int num = tjs_param[0].AsInteger();
		GameMain.Instance.CharacterMgr.status.money = (long)num;
	}

	public void TJSFuncGetPlayerMoney(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetPlayerMoney", false);
		}
		int integer = (2147483647L >= GameMain.Instance.CharacterMgr.status.money) ? ((int)GameMain.Instance.CharacterMgr.status.money) : int.MaxValue;
		result.SetInteger(integer);
	}

	public void TJSFuncSetMaidLeader(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(2 == tjs_param.Length, "SetMaidLeader args count error.");
		int nMaidNo = tjs_param[0].AsInteger();
		bool leader = tjs_param[1].AsBool();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(nMaidNo);
		if (maid != null)
		{
			maid.status.leader = leader;
		}
	}

	public void TJSFuncSetMaidCostumeFacility(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "UpdateMaidCostumeFacility args count error.");
		int num = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
		NDebug.Assert(maid != null, string.Format("UpdateMaidCostumeFacility()\nメイド[{0}]番が見つかりませんでした。", num));
		ScheduleMgr.ScheduleTime scheduleTime = (!GameMain.Instance.CharacterMgr.status.isDaytime) ? ScheduleMgr.ScheduleTime.Night : ScheduleMgr.ScheduleTime.DayTime;
		Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, scheduleTime);
		if (maidAssignedFacility != null)
		{
			Facility.CostumeType typeCostume = maidAssignedFacility.typeCostume;
			if (typeCostume == Facility.CostumeType.Edit)
			{
				maidAssignedFacility.UpdateMaidCostumeToEditCostume(maid, false);
			}
			else if (typeCostume == Facility.CostumeType.Default)
			{
				maidAssignedFacility.UpdateMaidCostumeToDefaultCostume(maid);
			}
			else if (typeCostume == Facility.CostumeType.Heroine)
			{
				MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
				for (int i = 0; i < facilityCostumeEnableMPN.Length; i++)
				{
					maid.ResetProp(facilityCostumeEnableMPN[i], false);
				}
			}
		}
		else
		{
			NDebug.Warning(string.Format("UpdateMaidCostumeFacility()\nメイド[{0}]番は、現在施設の仕事を持っていません。", num));
			Debug.LogWarningFormat("UpdateMaidCostumeFacility()\nメイド[{0}]番は、現在施設の仕事を持っていません。", new object[]
			{
				num
			});
		}
	}

	public void TJSFuncResetMaidCostumeFacility(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "UpdateMaidCostumeFacility args count error.");
		int num = tjs_param[0].AsInteger();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
		NDebug.Assert(maid != null, string.Format("UpdateMaidCostumeFacility()\nメイド[{0}]番が見つかりませんでした。", num));
		MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
		for (int i = 0; i < facilityCostumeEnableMPN.Length; i++)
		{
			maid.ResetProp(facilityCostumeEnableMPN[i], false);
		}
	}

	public void TJSFuncCallTitleBar(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "CallTitleBar args count error.");
		GameObject gameObject = GameObject.Find("__SceneADV__");
		if (gameObject == null)
		{
			return;
		}
		SceneADV component = gameObject.GetComponent<SceneADV>();
		component.CallTitleBar(tjs_param[0].AsString());
	}

	public void TJSFuncSetCompatibilityMode(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(1 == tjs_param.Length, "SetCompatibilityMode args count error.");
		this.compatibilityMode = tjs_param[0].AsBool();
		Debug.Log("スクリプトモード変更 : 互換モード[" + ((!this.compatibilityMode) ? "×]" : "〇]"));
		KagScript kag = this.adv_kag.kag;
		this.compatibilityCallStackDepth = kag.callStackDepth;
		this.compatibilityRCallStackDepth = kag.r_callStackDepth;
	}

	public void TJSFuncIsBuildingFacility(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(result != null, "error IsBuildingFacility");
		NDebug.Assert(1 == tjs_param.Length, "IsBuildingFacility args count error.");
		string text = tjs_param[0].AsString();
		FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(text, false);
		NDebug.Assert(facilityDefaultData != null, string.Format("{0} は存在しない情報です", text));
		if (!facilityDefaultData.isEnableData)
		{
			Debug.Log(text + " は有効ではありません");
			result.SetBool(false);
		}
		else
		{
			result.SetBool(GameMain.Instance.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID));
		}
	}

	public void TJSFuncIsBuildingFacilityUpward(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(result != null, "error IsBuildingFacilityUpward");
		NDebug.Assert(1 == tjs_param.Length, "IsBuildingFacilityUpward args count error.");
		string text = tjs_param[0].AsString();
		FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(text, false);
		NDebug.Assert(facilityDefaultData != null, string.Format("{0} は存在しない情報です", text));
		if (!facilityDefaultData.isEnableData)
		{
			Debug.Log(text + " は有効ではありません");
			result.SetBool(false);
		}
		if (facilityDefaultData.isExistUpwardFacility)
		{
			result.SetBool(GameMain.Instance.FacilityMgr.IsExistTypeFacility(facilityDefaultData.upwardFacility.ID));
		}
		else
		{
			result.SetBool(false);
		}
	}

	public void TJSCheckDanceType(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length != 0, "CheckDanceType:引数が何も指定されてません");
		bool flag = false;
		foreach (TJSVariantRef tjsvariantRef in tjs_param)
		{
			flag |= (RhythmAction_Mgr.NowDance == (RhythmAction_Mgr.DanceType)Enum.Parse(typeof(RhythmAction_Mgr.DanceType), tjsvariantRef.AsString()));
		}
		result.SetBool(flag);
	}

	public void TJSSetMusicRelease(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length == 1, "SetMusicRelease:指定できる引数は1つまでです");
		VsDanceDataMgr.Instance.MusicRelese(tjs_param[0].AsInteger());
	}

	public void TJSSetVsSetting(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length == 1, "SetVsSetting:指定できる引数は1つまでです");
		VsDanceDataMgr.Instance.SelectSetting(tjs_param[0].AsInteger());
	}

	public void TJSNeedDanceResult(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		bool flag = true;
		flag &= (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.VS_Skip);
		flag &= (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.Touch);
		flag &= (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.View);
		flag &= (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.Encore);
		result.SetBool(flag);
	}

	public void TJSGetChallengeRank(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length > 0, "GetChallengeRank:引数が指定されてません");
		bool flag = false;
		foreach (TJSVariantRef tjsvariantRef in tjs_param)
		{
			flag |= (tjsvariantRef.AsString() == Result_Display.GetData("Rank"));
		}
		result.SetBool(flag);
	}

	public void TJSBjDayFirst(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		int days = GameMain.Instance.CharacterMgr.status.days;
		int flag = GameMain.Instance.CharacterMgr.status.GetFlag("BJ最終プレイ日");
		bool @bool = days != flag;
		foreach (TJSVariantRef tjsvariantRef in tjs_param)
		{
			if (tjsvariantRef.AsString() == "ブラックジャック終了")
			{
				GameMain.Instance.CharacterMgr.status.SetFlag("BJ最終プレイ日", days);
				break;
			}
		}
		result.SetBool(@bool);
	}

	public void TJSCasinoShopBuy(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length != 0, "CasinoShopBuy:引数が指定されてません");
		bool flag = false;
		foreach (TJSVariantRef tjsvariantRef in tjs_param)
		{
			int num = tjsvariantRef.AsInteger();
			flag = false;
			foreach (CasinoShopItem casinoShopItem in CasinoDataMgr.Instance.GetShopItem())
			{
				if (casinoShopItem.ID == num && casinoShopItem.IsSoldOut)
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				break;
			}
		}
		result.SetBool(flag);
	}

	public void TJSSetEventEndFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		NDebug.Assert(tjs_param.Length == 3, "SetEventEndFlag:引数が3つ必要です");
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(tjs_param[0].AsInteger());
		if (!maid)
		{
			maid = GameMain.Instance.CharacterMgr.GetStockMaid(tjs_param[0].AsInteger());
			if (!maid)
			{
				return;
			}
		}
		if (!GameMain.Instance.ScenarioSelectMgr.ExistScenario(tjs_param[1].AsInteger()))
		{
			Debug.LogErrorFormat("選択シナリオ：{0}は存在しません", new object[]
			{
				tjs_param[1].AsInteger()
			});
			return;
		}
		maid.status.SetEventEndFlag(tjs_param[1].AsInteger(), tjs_param[2].AsBool());
	}

	public void TJSFuncIsKasizukiGuest(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error IsKasizukiGuest", false);
		}
		ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
		result.SetBool(nowManType != ManDataType.主人公);
	}

	public void TJSFuncGetKasizukiSelectRoomName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetKasizukiSelectRoomName", false);
		}
		RoomData.Data data = RoomData.GetData(GameMain.Instance.KasizukiMgr.GetSystemData<int>(SystemDataType.選択部屋));
		result.SetString(data.uniqueName);
	}

	public void TJSFuncGetKasizukiMaidLikability(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetKasizukiMaidLikability", false);
		}
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		ManDataType nowManType = (ManDataType)kasizukiMgr.GetNowManType();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		int integer = -1;
		if (nowManType == ManDataType.主人公)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, true);
		}
		else if (nowManType == ManDataType.傅き男１)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男１, true);
		}
		else if (nowManType == ManDataType.傅き男２)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男２, true);
		}
		else if (nowManType == ManDataType.傅き男３)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男３, true);
		}
		else if (nowManType == ManDataType.傅き男４)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男４, true);
		}
		else if (nowManType == ManDataType.傅き男５)
		{
			integer = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男５, true);
		}
		result.SetInteger(integer);
	}

	public void TJSFuncGetKasizukiMaidLikabilityName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetKasizukiMaidLikabilityName", false);
		}
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		ManDataType nowManType = (ManDataType)kasizukiMgr.GetNowManType();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		int likability = -1;
		if (nowManType == ManDataType.主人公)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, true);
		}
		else if (nowManType == ManDataType.傅き男１)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男１, true);
		}
		else if (nowManType == ManDataType.傅き男２)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男２, true);
		}
		else if (nowManType == ManDataType.傅き男３)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男３, true);
		}
		else if (nowManType == ManDataType.傅き男４)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男４, true);
		}
		else if (nowManType == ManDataType.傅き男５)
		{
			likability = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男５, true);
		}
		string likabilityName = LikabilityReplace.GetLikabilityName(likability);
		result.SetString(likabilityName);
	}

	public void TJSFuncGetKasizukiMaidWorkCount(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetKasizukiMaidWorkCount", false);
		}
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		int maidData = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.仕事回数, true);
		result.SetInteger(maidData);
	}

	public void TJSFuncGetKasizukiMaidWorkCountName(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetKasizukiMaidWorkCountName", false);
		}
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		int maidData = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.仕事回数, true);
		string workCountName = WorkCountReplace.GetWorkCountName(maidData);
		result.SetString(workCountName);
	}

	public void TJSFuncGetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncGetKasizukiSystemFlag(tjs_param, result);
	}

	public void TJSFuncSetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncSetKasizukiSystemFlag(tjs_param, result);
	}

	public void TJSFuncAddKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncAddKasizukiSystemFlag(tjs_param, result);
	}

	public void TJSFuncSetKasizukiPassFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncSetKasizukiPassFlag(tjs_param, result);
	}

	public void TJSFuncGetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncGetKasizukiMaidFlag(tjs_param, result);
	}

	public void TJSFuncSetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncSetKasizukiMaidFlag(tjs_param, result);
	}

	public void TJSFuncIsKasizukiCorrectSenarioFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
		kasizukiMgr.TJSFuncIsKasizukiCorrectSenarioFlag(tjs_param, result);
	}

	public void TJSFuncIsVRKaraokeMode(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error IsVRKaraokeMode", false);
		}
		result.SetInteger((!SceneVRCommunication.Instance.KaraokeMode) ? 0 : 1);
	}

	public void TJSFuncGetRemainingDanceTime(TJSVariantRef[] tjs_param, TJSVariantRef result)
	{
		if (result == null)
		{
			NDebug.Assert("error GetRemainingDanceTime", false);
		}
		float num;
		if (RhythmAction_Mgr.Instance != null)
		{
			num = RhythmAction_Mgr.Instance.RemainingTime;
		}
		else
		{
			string message = "リズムアクションマネージャのインスタンスが見つかりません。-1を返します。";
			Debug.LogWarning(message);
			num = -0.001f;
		}
		result.SetInteger(Mathf.RoundToInt(num * 1000f));
	}

	public void OnReturnEvent(string fileName, int line)
	{
		if (this.compatibilityMode)
		{
			KagScript kag = this.adv_kag.kag;
			int num = kag.callStackDepth - 1;
			int r_callStackDepth = kag.r_callStackDepth;
			if (this.compatibilityCallStackDepth == num && this.compatibilityRCallStackDepth == r_callStackDepth)
			{
				this.compatibilityMode = false;
			}
		}
	}

	public void OnRReturnEvent(string fileName, string labelName)
	{
		if (this.compatibilityMode)
		{
			KagScript kag = this.adv_kag.kag;
			int callStackDepth = kag.callStackDepth;
			int num = kag.r_callStackDepth - 1;
			if (this.compatibilityCallStackDepth == callStackDepth && this.compatibilityRCallStackDepth == num)
			{
				this.compatibilityMode = false;
			}
		}
	}

	public void Dispose()
	{
		this.Dispose(true);
		GC.SuppressFinalize(this);
	}

	protected void Dispose(bool is_release_managed_code)
	{
		if (this.is_disposed_)
		{
			return;
		}
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.Dispose();
		}
		this.kag_mot_dic_.Clear();
		if (this.adv_kag_ != null)
		{
			this.adv_kag_.Dispose();
		}
		if (this.yotogi_kag_ != null)
		{
			this.yotogi_kag_.Dispose();
		}
		if (this.tmp_kag_ != null)
		{
			this.tmp_kag_.Dispose();
		}
		if (this.tjs_ != null)
		{
			this.tjs_.Dispose();
		}
		this.is_disposed_ = true;
	}

	public void Serialize(BinaryWriter binary)
	{
		binary.Write("CM3D2_SCRIPT");
		binary.Write(1170);
		this.adv_kag_.Serialize(binary);
	}

	public void Deserialize(BinaryReader binary)
	{
		this.compatibilityMode = false;
		string a = binary.ReadString();
		NDebug.Assert(a == "CM3D2_SCRIPT", "SCRIPTのヘッダーが不正です。");
		int num = binary.ReadInt32();
		this.adv_kag_.Deserialize(binary);
		this.yotogi_kag_.Dispose();
		this.yotogi_kag_ = new YotogiKagManager(this.tjs_, this);
		this.yotogi_kag_.Initialize();
		foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
		{
			keyValuePair.Value.Dispose();
		}
		this.kag_mot_dic_.Clear();
		MotionKagManager motionKagManager = new MotionKagManager(this.tjs_, this);
		motionKagManager.Initialize();
		motionKagManager.SetSloatNo(0);
		this.kag_mot_dic_.Add(0, motionKagManager);
		this.ExecScript("global.tf = new Dictionary();");
		SubtitleMovieManager.DestroyGlobalInstance();
	}

	public bool compatibilityMode
	{
		get
		{
			return this.compatibilityMode_;
		}
		set
		{
			this.compatibilityMode_ = value;
			if (this.adv_kag_ != null && this.adv_kag_.kag != null)
			{
				this.adv_kag_.kag.SetFileSystem(this.file_system);
			}
			foreach (KeyValuePair<int, MotionKagManager> keyValuePair in this.kag_mot_dic_)
			{
				keyValuePair.Value.kag.SetFileSystem(this.file_system);
			}
			if (this.yotogi_kag_ != null && this.yotogi_kag_.kag != null)
			{
				this.yotogi_kag_.kag.SetFileSystem(this.file_system);
			}
			if (GameMain.Instance.SoundMgr != null)
			{
				GameMain.Instance.SoundMgr.compatibilityMode = value;
			}
			this.StopMotionScript();
		}
	}

	public bool tjsLegacyMode
	{
		get
		{
			return DailyMgr.IsLegacy;
		}
	}

	public bool is_motion_all_prop_seq { get; set; }

	public Maid motion_all_prop_seq_maid { get; set; }

	public bool is_motion_blend { get; set; }

	public TJSScript tjs
	{
		get
		{
			return this.tjs_;
		}
	}

	public ADVKagManager adv_kag
	{
		get
		{
			return this.adv_kag_;
		}
	}

	public YotogiKagManager yotogi_kag
	{
		get
		{
			return this.yotogi_kag_;
		}
	}

	public BaseKagManager tmp_kag
	{
		get
		{
			return this.tmp_kag_;
		}
	}

	public Dictionary<int, MotionKagManager> kag_mot_dic
	{
		get
		{
			return this.kag_mot_dic_;
		}
	}

	public AFileSystemBase file_system
	{
		get
		{
			return (!this.compatibilityMode) ? GameUty.FileSystem : GameUty.FileSystemOld;
		}
	}

	private TJSScript tjs_;

	private Dictionary<int, MotionKagManager> kag_mot_dic_ = new Dictionary<int, MotionKagManager>();

	private ADVKagManager adv_kag_;

	private YotogiKagManager yotogi_kag_;

	private BaseKagManager tmp_kag_;

	private MessageWindowMgr message_mgr_;

	private bool is_disposed_;

	private string debug_yotogi_stage_;

	private bool compatibilityMode_;

	private List<Maid> stock_maid_loop_list = new List<Maid>();

	private int compatibilityCallStackDepth;

	private int compatibilityRCallStackDepth;

	[CompilerGenerated]
	private static Comparison<Maid> <>f__mg$cache0;
}
