using System;
using System.Collections.Generic;
using System.IO;
using MaidStatus;
using MaidStatus.Old;
using UnityEngine;
using wf;
using Yotogis;

public class YotogiOldPlayManager : WfScreenChildren
{
	public override void Awake()
	{
		base.Awake();
		this.yotogi_mgr_ = base.GetComponentInParent<YotogiOldManager>();
		UTY.GetChildObject(base.root_obj, "ParameterViewer", false).SetActive(true);
		UTY.GetChildObject(base.root_obj, "SkillSelectViewer", false).SetActive(true);
		this.common_buttons_ = UTY.GetChildObject(base.root_obj, "UndressingViewer/CommonPanel", false).GetComponent<YotogiCommonButtons>();
		this.command_factory_ = UTY.GetChildObject(base.root_obj, "CommandViewer/SkillViewer/MaskGroup/SkillGroup/CommandParent/CommandUnit", false).GetComponent<YotogiOldCommandFactory>();
		this.command_factory_.SetCommandCallback(new YotogiOldCommandFactory.CommandCallback(this.OnClickCommand));
		this.command_factory_.SetCommandEnabledCallBack(new YotogiOldCommandFactory.CommandEnabledCallBack(this.OnEnabledCommand));
		this.param_scroll_ = UTY.GetChildObject(base.root_obj, "CommandViewer/SkillViewer/MaskGroup/ParamView", false).GetComponent<YotogiParamScroll>();
		this.camera_move_support_ = base.gameObject.AddComponent<WfCameraMoveSupport>();
		this.man_alpha_slider_ = UTY.GetChildObject(base.root_obj, "UndressingViewer/UndressingViewer/MaskGroup/PlayerModelTransparency/SliderParent/Slider", false).GetComponent<UISlider>();
		this.control_mask_list_.Add(UTY.GetChildObject(base.root_obj, "CommandViewer/SkillViewer/ControlMaskt", false));
		this.control_mask_list_.Add(UTY.GetChildObject(base.root_obj, "UndressingViewer/UndressingViewer/ControlMaskt", false));
		this.undressing_mgr_ = UTY.GetChildObject(base.root_obj, "UndressingViewer/UndressingViewer/MaskGroup/UndressParent", false).GetComponent<UndressingManager>();
		this.undressing_mgr_.SetCallBackEvent(new UndressingManager.OnClickEventDelegate(this.OnUndressingEvent));
		this.btn_excite_lock_ = UTY.GetChildObject(base.root_obj, "StatusSlider/ParameterViewer/MaskGroup/Lock", false).GetComponent<UIWFSelectButton>();
		this.skill_group_parent_ = UTY.GetChildObject(base.root_obj, "CommandViewer/SkillViewer/MaskGroup/SkillGroup/SkillParent", false);
		NDebug.Assert(this.skill_group_parent_.transform.childCount == 7, "スロット数の不一致");
		Transform transform = this.skill_group_parent_.transform;
		for (int i = 0; i < transform.childCount; i++)
		{
			GameObject gameObject = transform.GetChild(i).gameObject;
			GameObject childObject = UTY.GetChildObject(gameObject, "Icon", false);
			UIButton component = childObject.GetComponent<UIButton>();
			component.onClick.Clear();
			UISprite component2 = UTY.GetChildObject(gameObject, "SkillName", false).GetComponent<UISprite>();
			UILabel componentInChildren = component2.GetComponentInChildren<UILabel>();
			UIRect uirect = component2;
			float alpha = 0f;
			componentInChildren.alpha = alpha;
			uirect.alpha = alpha;
			EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.OnSkillIconClick));
			UIEventTrigger component3 = childObject.GetComponent<UIEventTrigger>();
			int num = i;
			EventDelegate.Add(component3.onHoverOver, delegate()
			{
				this.VisibleSkillName(num, true);
			});
			EventDelegate.Add(component3.onHoverOut, delegate()
			{
				this.VisibleSkillName(num, false);
			});
			EventDelegate.Add(component3.onDragStart, delegate()
			{
				this.VisibleSkillName(num, false);
			});
		}
	}

	protected override void OnCall()
	{
		GameMain.Instance.ScriptMgr.compatibilityMode = true;
		this.maid_ = this.yotogi_mgr_.maid;
		this.is_swoon_flag_ = false;
		this.is_reset_item = false;
		string systemVers = GameMain.Instance.CMSystem.GetSystemVers("ExciteLock");
		this.is_excite_lock_ = (systemVers == "1");
		if (this.btn_excite_lock_.isSelected != this.is_excite_lock_)
		{
			this.btn_excite_lock_.SetSelect(this.is_excite_lock_);
		}
		if (!this.is_free_mode)
		{
			this.is_excite_lock_ = false;
		}
		GameObject childObject = UTY.GetChildObject(base.root_obj, "StatusViewer", false);
		GameObject childObject2 = UTY.GetChildObject(base.root_obj, "StatusSlider", false);
		if (!this.is_free_mode && !this.is_vr_mode && this.paramenter_viewer_ == null)
		{
			childObject.SetActive(true);
			childObject2.SetActive(false);
			this.param_basic_bar_ = UTY.GetChildObject(childObject, "ParameterViewer/MaskGroup/ParameterParent", false).GetComponent<YotogiOldParamBasicBar>();
			this.paramenter_viewer_ = Utility.CreatePrefab(UTY.GetChildObject(base.root_obj, "ParameterViewer/YotogiParameterViewer/MaskGroup", false), "SceneYotogi/Common/Prefab/Old/ParameterViewer", true).GetComponent<YotogiOldParameterViewer>();
			this.paramenter_viewer_.SetCostumeButtonVisible(false);
			this.paramenter_viewer_.SetAttributeViewer(UTY.GetChildObject(base.root_obj.transform.parent.gameObject, "AttributeViewer", false));
			UTY.GetChildObject(base.root_obj, "SkillSelectViewer", false).SetActive(false);
		}
		else if (this.is_free_mode)
		{
			this.param_basic_bar_ = UTY.GetChildObject(childObject2, "ParameterViewer/MaskGroup/ParameterParent", false).GetComponent<YotogiOldParamBasicBarPlusSlider>();
			childObject.SetActive(false);
			childObject2.SetActive(true);
			UTY.GetChildObject(base.root_obj, "ParameterViewer", false).SetActive(false);
			GameObject childObject3 = UTY.GetChildObject(base.root_obj, "SkillSelectViewer/YotogiSkillSelectViewer/MaskGroup/Parent", false);
			if (childObject3.transform.childCount == 0)
			{
				this.yotogi_mgr_.skill_select_prefab_object.transform.SetParent(childObject3.transform, false);
			}
			this.free_skill_select_ = childObject3.GetComponentInChildren<FreeSkillSelectOld>();
			this.common_buttons_.next_btn.gameObject.SetActive(false);
			UTY.GetChildObject(this.common_buttons_.gameObject, "UnderButtonGroup/End", false).SetActive(true);
			UIButton component = UTY.GetChildObject(base.root_obj, "SkillSelectViewer/YotogiSkillSelectViewer/MaskGroup/Next", false).GetComponent<UIButton>();
			component.onClick.Clear();
			EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.OnClickSkillSelectEnd));
			this.next_flag_ = false;
			this.free_mode_backup_data_.seikeiken = this.maid_.status.seikeiken;
			this.free_mode_backup_data_.condition_special = this.maid_.status.OldStatus.condition;
		}
		else if (this.is_vr_mode)
		{
			this.yotogi_mgr_.vr_select_menu.onEnterSkillEvent = new VRYotogiOldSelectMenu.EventOnEnterSkill(this.OnEnterSkillSelectVREnd);
			this.yotogi_mgr_.vr_select_menu.onCancelEvent = new Action(this.yotogi_mgr_.CallVRPlayEnd);
			this.param_basic_bar_ = UTY.GetChildObject(childObject, "ParameterViewer/MaskGroup/ParameterParent", false).GetComponent<YotogiOldParamBasicBar>();
			childObject.SetActive(false);
			childObject2.SetActive(false);
			UTY.GetChildObject(base.root_obj, "ParameterViewer", false).SetActive(false);
			UTY.GetChildObject(base.root_obj, "SkillSelectViewer", false).SetActive(false);
			UTY.GetChildObject(base.root_obj, "UndressingViewer", false).SetActive(false);
			UTY.GetChildObject(base.root_obj, "CommandViewer", false).SetActive(false);
			this.common_buttons_.next_btn.gameObject.SetActive(false);
			UTY.GetChildObject(this.common_buttons_.gameObject, "UnderButtonGroup/End", false).SetActive(true);
			GameObject childObject4 = UTY.GetChildObject(base.root_obj, "UndressingViewer/UndressingViewer", true);
			if (childObject4 != null)
			{
				Transform transform = childObject4.transform;
				HideScroll component2 = UTY.GetChildObject(base.root_obj, "UndressingViewer/Top", false).GetComponent<HideScroll>();
				UnityEngine.Object.DestroyImmediate(component2);
				GameObject childObject5 = UTY.GetChildObject(childObject4, "MaskGroup/BG", false);
				childObject5.SetActive(false);
				UnityEngine.Object.DestroyImmediate(transform.GetComponentInChildren<UIPanel>());
				transform.SetParent(this.yotogi_mgr_.vr_select_menu.skillSelectMgr.gameObject.transform);
				transform.localPosition = new Vector3(-467f, -465f, 0f);
				UTY.GetChildObject(childObject4, "MaskGroup/PlayerModelTransparency", false).SetActive(false);
				if (this.command_menu != null)
				{
					this.command_menu.SetOnEnterEvetn(new Action<Skill.Old.Data.Command.Data>(this.OnClickCommand));
				}
			}
			this.next_flag_ = false;
		}
		this.param_basic_bar_.SetMaid(this.maid_);
		this.player_state_ = YotogiOldPlay.PlayerState.Normal;
		if (!this.next_flag_)
		{
			this.ClearVoice();
			this.zettyo_count = 0;
			this.common_buttons_.viwe_reset_btn.onClick.Clear();
			EventDelegate.Add(this.common_buttons_.viwe_reset_btn.onClick, new EventDelegate.Callback(this.OnClickViweReset));
			this.script_mgr_ = GameMain.Instance.ScriptMgr;
			this.script_mgr_.EvalScript("global.__skill_command_file = new Array();");
			this.common_buttons_.next_btn.onClick.Clear();
			EventDelegate.Add(this.common_buttons_.next_btn.onClick, new EventDelegate.Callback(this.OnClickNext));
			UIButton component3 = UTY.GetChildObject(this.common_buttons_.gameObject, "UnderButtonGroup/End", false).GetComponent<UIButton>();
			component3.onClick.Clear();
			EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.OnClickNext));
			this.maid_status_ = this.maid_.status;
			this.bonusCorrectionStatus_ = this.maid_status_.GetBonusStatusAsFeatureAndPropensitys();
			if (!this.is_free_mode)
			{
				this.maid_status_.currentExcite = 0;
			}
			this.maid_.status.currentMind = this.maid_status_.maxMind;
			this.maid_.status.currentReason = this.maid_status_.maxReason;
			this.param_basic_bar_.SetMaxMind(this.maid_status_.maxMind);
			this.param_basic_bar_.SetMaxReason(this.maid_status_.maxReason);
			this.playing_skill_no_ = -1;
			this.man_alpha_slider_.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f;
			this.setting_man_alpha_ = GameMain.Instance.CMSystem.ManAlpha;
			this.man_alpha_slider_.onChange.Clear();
			EventDelegate.Add(this.man_alpha_slider_.onChange, new EventDelegate.Callback(this.ChangeSliderValue));
			if (this.maid_.status.OldStatus.condition == Condition.Drunk)
			{
				this.AddTrophy(420);
			}
			this.undressing_mgr_.SetMaid(this.maid_, null);
			this.undressing_mgr_.SetMaskMode(UndressingManager.UnitType.全着衣, UndressingManager.MaskStatus.On);
		}
		this.next_flag_ = false;
		this.script_mgr_.StopMotionScript();
		this.NextSkill();
		this.yotogi_mgr_.ResetWorld();
	}

	protected override bool IsCallFadeIn()
	{
		if (this.is_reset_item)
		{
			return !this.yotogi_mgr_.IsAllCharaBusy() && !(this.yotogi_mgr_.yotogi_kag.kag.GetCurrentLabel() != "*finish");
		}
		bool flag = this.yotogi_mgr_.IsAllCharaBusy();
		if (flag)
		{
			return false;
		}
		this.script_mgr_.is_motion_blend = true;
		this.is_reset_item = true;
		this.yotogi_mgr_.UnVisibleMaidAndMan(false, true);
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		if (this.skill_pair_.base_data != null && this.skill_pair_.base_data.start_call_file != string.Empty)
		{
			if (!this.is_vr_mode)
			{
				string str = this.CallNormalFile(this.skill_pair_.base_data.start_call_file, string.Empty);
				this.yotogi_mgr_.AddDebugLog("スキル開始ファイル[" + str + "]を呼び出しました");
			}
			else
			{
				string ft_file_name = YotogiOldManager.select_vr_skill_data.stage_data_dic[YotogiOldManager.select_vr_stage_data.stage].ft_file_name;
				string text = "*FT_" + (YotogiOldManager.select_vr_stage_spot_no + 1).ToString();
				string text2 = this.CallNormalFile(ft_file_name, text);
				this.yotogi_mgr_.AddDebugLog(string.Concat(new string[]
				{
					"スキル開始ファイル[",
					text2,
					":",
					text,
					"]を呼び出しました"
				}));
			}
		}
		this.camera_move_support_.SaveCameraPosition();
		Maid man = characterMgr.GetMan(0);
		if (man != null)
		{
			man.Visible = true;
		}
		if (this.skill_pair_.base_data != null && this.skill_pair_.base_data.start_call_file2 != string.Empty)
		{
			string label = "*" + YotogiOldPlay.GetRRType(this.maid_.status.currentExcite).ToString();
			string str2 = this.CallNormalFile(this.skill_pair_.base_data.start_call_file2, label);
			this.yotogi_mgr_.AddDebugLog("スキル開始ファイル2[" + str2 + "]を呼び出しました");
		}
		for (int i = 0; i < characterMgr.GetMaidCount(); i++)
		{
			Maid maid = characterMgr.GetMaid(i);
			if (maid != null && maid.Visible)
			{
				maid.AllProcPropSeqStart();
			}
		}
		for (int j = 0; j < characterMgr.GetManCount(); j++)
		{
			Maid man2 = characterMgr.GetMan(j);
			if (man2 != null && man2.Visible)
			{
				man2.AllProcPropSeqStart();
			}
		}
		return false;
	}

	public override void Update()
	{
		base.Update();
		if (GameMain.Instance.CMSystem.ManAlpha != this.setting_man_alpha_)
		{
			this.man_alpha_slider_.value = (float)GameMain.Instance.CMSystem.ManAlpha / 100f;
			this.setting_man_alpha_ = GameMain.Instance.CMSystem.ManAlpha;
		}
		if (base.fade_status != WfScreenChildren.FadeStatus.Wait)
		{
			return;
		}
		if (0 < this.control_mask_tick_count && this.control_mask_tick_count <= GameMain.tick_count)
		{
			this.SetControlMask(false, false);
		}
		if (!string.IsNullOrEmpty(this.repeat_voice_file_))
		{
			Maid maid;
			if (0 < this.repeat_voice_maid_no)
			{
				maid = GameMain.Instance.CharacterMgr.GetMaid(this.repeat_voice_maid_no);
			}
			else
			{
				maid = this.maid_;
			}
			if (!maid.AudioMan.isPlay())
			{
				this.repeat_time_ += (int)(Time.deltaTime * 1000f);
				if (this.kRepeatWaitTime <= this.repeat_time_)
				{
					this.repeat_time_ = 0;
					if (maid != null && maid.AudioMan != null)
					{
						maid.AudioMan.LoadPlay(this.repeat_voice_file_, 0f, false, true);
					}
				}
			}
		}
		if (this.is_swoon_flag_ && !GameMain.Instance.MainCamera.IsFadeProcNoUI())
		{
			this.AddTrophy(350);
			this.CallNormalFile("?_YOTOGI_SYSTEM_KIZETU.ks", string.Empty);
			GameMain.Instance.SysDlg.Show("気絶しました。\n夜伽を終了します。", SystemDialog.TYPE.OK, delegate
			{
				GameMain.Instance.SysDlg.Close();
				if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
				{
					this.Finish();
				}
				else
				{
					GameMain.Instance.MainCamera.FadeInNoUI(0f, true);
				}
			}, null);
			this.is_swoon_flag_ = false;
		}
	}

	public bool NextSkill()
	{
		if (!string.IsNullOrEmpty(YotogiOldStageSelectManager.StagePrefab))
		{
			GameMain.Instance.BgMgr.ChangeBg(YotogiOldStageSelectManager.StagePrefab);
		}
		this.ClearVoice();
		this.SetRepeatVoiceFile(string.Empty, 0);
		this.SetControlMask(false, false);
		this.play_command_id_.Clear();
		this.playing_skill_no_++;
		if (this.maid_status_.currentMind <= 0)
		{
			this.maid_.status.currentMind = this.maid_status_.maxMind / 2;
		}
		else
		{
			this.maid_.status.currentMind = this.maid_status_.maxMind;
		}
		this.param_basic_bar_.SetCurrentExcite(this.maid_status_.currentExcite, false);
		this.param_basic_bar_.SetCurrentMind(this.maid_status_.currentMind, false);
		this.param_basic_bar_.SetCurrentReason(this.maid_status_.currentReason, false);
		if (this.paramenter_viewer_ != null && this.paramenter_viewer_.gameObject.activeSelf)
		{
			this.paramenter_viewer_.SetMaid(this.maid_);
			this.paramenter_viewer_.UpdateTextCommon();
			this.paramenter_viewer_.UpdateTextParam();
		}
		this.param_scroll_.Init();
		if (!this.is_vr_mode)
		{
			if (this.yotogi_mgr_.play_skill_array[this.playing_skill_no_].skill_pair.base_data == null)
			{
				return false;
			}
			this.UpdateSkillTower();
			this.playing_skill_ = this.yotogi_mgr_.play_skill_array[this.playing_skill_no_];
			this.skill_pair_ = this.playing_skill_.skill_pair;
			if (this.is_free_mode)
			{
				if (this.skill_pair_.base_data.drunk_skill)
				{
					this.maid_.status.OldStatus.condition = Condition.Drunk;
				}
				else if (this.skill_pair_.base_data.osioki_skill)
				{
					this.maid_.status.OldStatus.condition = Condition.Osioki;
				}
			}
		}
		else
		{
			Skill.Old.Data[] playSkillArray = new Skill.Old.Data[]
			{
				YotogiOldManager.select_vr_skill_data.skill
			};
			this.yotogi_mgr_.SetPlaySkillArray(playSkillArray);
			this.playing_skill_ = this.yotogi_mgr_.play_skill_array[this.playing_skill_no_];
			this.skill_pair_ = this.playing_skill_.skill_pair;
			this.yotogi_mgr_.CallVRMenu();
		}
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int i = 1; i < characterMgr.GetMaidCount(); i++)
		{
			Maid maid = characterMgr.GetMaid(i);
			if (maid != null && maid.Visible)
			{
				maid.Visible = false;
			}
		}
		List<Maid> list = new List<Maid>();
		if (this.playing_skill_.skill_pair.base_data != null && 1 < this.playing_skill_.skill_pair.base_data.player_num)
		{
			for (int j = 1; j < this.playing_skill_.skill_pair.base_data.player_num; j++)
			{
				Maid maid2 = characterMgr.GetMaid(j);
				if (maid2 != null)
				{
					maid2.Visible = true;
					list.Add(maid2);
				}
			}
		}
		this.undressing_mgr_.SetMaid(this.maid_, list.ToArray());
		if (!this.maid_.Visible)
		{
			this.maid_.Visible = true;
		}
		this.replace_personal_target_maid_array_ = new Maid[1 + list.Count];
		this.replace_personal_target_maid_array_[0] = this.maid_;
		for (int k = 0; k < list.Count; k++)
		{
			this.replace_personal_target_maid_array_[k + 1] = list[k];
		}
		this.playing_skill_.is_play = true;
		this.command_factory_.ReserveSkillCommand(this.skill_pair_.base_data.command);
		if (this.command_menu != null)
		{
			this.command_menu.ReserveSkillCommand(this.skill_pair_.base_data.command);
		}
		this.valid_command_dic_.Clear();
		Skill.Old.Data.Command.Data[] data = this.skill_pair_.base_data.command.data;
		List<Skill.Old.Data.Command.Data> list2 = new List<Skill.Old.Data.Command.Data>();
		List<Skill.Old.Data.Command.Data> list3 = new List<Skill.Old.Data.Command.Data>();
		if (this.skill_pair_.param == null)
		{
			this.playing_skill_level_ = ((this.yotogi_mgr_.fix_skill_level != 0) ? this.yotogi_mgr_.fix_skill_level : 3);
		}
		else
		{
			this.playing_skill_level_ = ((this.yotogi_mgr_.fix_skill_level != 0) ? this.yotogi_mgr_.fix_skill_level : this.skill_pair_.param.level);
		}
		for (int l = 0; l < data.Length; l++)
		{
			if (this.playing_skill_level_ >= data[l].basic.request_skill_lv)
			{
				if (data[l].basic.command_type == YotogiOld.SkillCommandType.挿入)
				{
					list3.Add(data[l]);
					list2.Add(data[l]);
				}
				else if (data[l].basic.request_insert)
				{
					list3.Add(data[l]);
				}
				else
				{
					list2.Add(data[l]);
				}
			}
		}
		this.valid_command_dic_.Add(YotogiOldPlay.PlayerState.Normal, list2.ToArray());
		this.valid_command_dic_.Add(YotogiOldPlay.PlayerState.Insert, list3.ToArray());
		this.UpdateCommand(null);
		this.yotogi_mgr_.AddDebugLog("スキル[" + this.skill_pair_.base_data.name + "]を開始開始しました");
		return true;
	}

	public string CallNormalFile(string file, string label)
	{
		string text = ScriptManager.ReplacePersonal(this.replace_personal_target_maid_array_, file);
		GameMain.Instance.ScriptMgr.EvalScript("global.__skill_first_file = '" + text + "';");
		if (label == null)
		{
			label = string.Empty;
		}
		GameMain.Instance.ScriptMgr.EvalScript("global.__skill_first_file_label = '" + label + "';");
		GameMain.Instance.ScriptMgr.LoadYotogiScript("yotogi_skill_call_main.ks", string.Empty);
		return text;
	}

	public void ApplyExecCommandStatus(Maid maid, Skill.Old.Data.Command.Data cm)
	{
		Skill.Old.Data.Command.Data.Status status = cm.status;
		int skill_level = 1;
		if (!this.is_free_mode && !this.is_vr_mode)
		{
			skill_level = this.maid_.status.yotogiSkill.Get(cm.basic.skill_id).level;
		}
		MaidStatus.Status maid_status = maid.status;
		BonusStatus bonusStatus = this.bonusCorrectionStatus_;
		Func<float, int> feiling_func = (float ceiling_num) => (0f > ceiling_num) ? ((int)System.Math.Floor((double)ceiling_num)) : ((int)System.Math.Ceiling((double)ceiling_num));
		Func<int, int, int> func = delegate(int calc_a_command_num, int calc_a_correction_num)
		{
			float num2 = ((float)calc_a_command_num * (100f + (float)calc_a_correction_num) + (float)((skill_level - 1) * 10)) / 100f;
			int num3 = maid_status.studyRate / 10;
			float num4 = 100f - (float)((100 - num3) / 10 * 5);
			num2 *= num4 * 0.01f;
			return feiling_func(num2);
		};
		Func<int, int, int> func2 = delegate(int calc_b_command_num, int calc_a_correction_num)
		{
			float num2 = 0f;
			if (maid_status.currentReason <= 0)
			{
				num2 = 20f;
			}
			float arg = (float)calc_b_command_num * (100f + (float)calc_a_correction_num + (float)maid_status.OldStatus.frustration + num2) / 100f;
			return feiling_func(arg);
		};
		Func<int, int, int> func3 = delegate(int calc_a_command_num, int calc_a_correction_num)
		{
			if (0 < maid_status.currentReason)
			{
				return calc_a_command_num;
			}
			float arg = (float)calc_a_command_num * 1.5f + -2f;
			return feiling_func(arg);
		};
		int num = (!this.is_excite_lock_) ? func2(status.excitement, bonusStatus.excite) : 0;
		maid_status.currentExcite += num;
		if (this.is_free_mode || this.is_vr_mode)
		{
			return;
		}
		maid_status.baseLovely += func3(status.lovely, bonusStatus.lovely);
		maid_status.baseElegance += func3(status.elegance, bonusStatus.elegance);
		maid_status.baseCharm += func3(status.charm, bonusStatus.charm);
		maid_status.currentMind += func(status.mind, bonusStatus.mind);
		maid_status.currentReason += func(status.reason, bonusStatus.reason);
		maid_status.baseInyoku += func(status.inyoku, bonusStatus.inyoku);
		maid_status.baseMvalue += func(status.m_value, bonusStatus.mvalue);
		maid_status.baseHentai += func(status.hentai, bonusStatus.hentai);
		maid_status.baseHousi += func(status.housi, bonusStatus.housi);
		maid_status.baseReception += func(status.reception, bonusStatus.reception);
		maid_status.baseTeachRate += func(status.teach_rate, bonusStatus.teachRate);
		maid_status.OldStatus.frustration += status.frustration;
		if (maid_status.OldStatus.sexual.mouth != 1000)
		{
			maid_status.OldStatus.sexual.mouth = wf.Math.Round3(maid_status.OldStatus.sexual.mouth + status.sexual_mouth);
		}
		if (maid_status.OldStatus.sexual.throat != 1000)
		{
			maid_status.OldStatus.sexual.throat = wf.Math.Round3(maid_status.OldStatus.sexual.throat + status.sexual_throat);
		}
		if (maid_status.OldStatus.sexual.nipple != 1000)
		{
			maid_status.OldStatus.sexual.nipple = wf.Math.Round3(maid_status.OldStatus.sexual.nipple + status.sexual_nipple);
		}
		if (maid_status.OldStatus.sexual.front != 1000)
		{
			maid_status.OldStatus.sexual.front = wf.Math.Round3(maid_status.OldStatus.sexual.front + status.sexual_front);
		}
		if (maid_status.OldStatus.sexual.back != 1000)
		{
			maid_status.OldStatus.sexual.back = wf.Math.Round3(maid_status.OldStatus.sexual.back + status.sexual_back);
		}
		if (maid_status.OldStatus.sexual.curi != 1000)
		{
			maid_status.OldStatus.sexual.curi = wf.Math.Round3(maid_status.OldStatus.sexual.curi + status.sexual_curi);
		}
		this.playing_skill_.exp += status.skill_exp;
	}

	public void SetRepeatVoiceFile(string file_name, int maid_no)
	{
		this.repeat_voice_file_ = file_name;
		this.repeat_time_ = 200;
		this.repeat_voice_maid_no = maid_no;
	}

	public void ClearVoice()
	{
		GameMain.Instance.SoundMgr.VoiceStopAll();
		this.repeat_time_ = 0;
	}

	private void OnClickCommand(Skill.Old.Data.Command.Data command_data)
	{
		if (this.yotogi_mgr_.IsAllCharaBusy())
		{
			this.yotogi_mgr_.AddDebugLog("============================================");
			this.yotogi_mgr_.AddDebugLog("×コマンド[" + command_data.basic.name + "]が押されました");
			this.yotogi_mgr_.AddDebugLog("IsBusy状態なのでキャンセルしました");
			this.yotogi_mgr_.AddDebugLog("============================================");
			return;
		}
		this.yotogi_mgr_.AddDebugLog("============================================");
		this.yotogi_mgr_.AddDebugLog("■コマンド[" + command_data.basic.name + "]が押されました");
		this.play_command_id_.Add(command_data.basic.id);
		this.backup_maid_param_ = YotogiOldPlay.Param.Create(this.maid_);
		this.ApplyExecCommandStatus(this.maid_, command_data);
		if (this.paramenter_viewer_ != null && this.paramenter_viewer_.gameObject.activeSelf)
		{
			this.paramenter_viewer_.UpdateTextParam();
		}
		this.param_basic_bar_.SetCurrentMind(this.maid_status_.currentMind, true);
		this.param_basic_bar_.SetCurrentReason(this.maid_status_.currentReason, true);
		this.param_basic_bar_.SetCurrentExcite(this.maid_status_.currentExcite, true);
		YotogiOldPlay.Param param = YotogiOldPlay.Param.Create(this.maid_) - this.backup_maid_param_;
		Action<List<KeyValuePair<string, int>>, string, int> action = delegate(List<KeyValuePair<string, int>> list, string name, int num)
		{
			if (num == 0)
			{
				return;
			}
			list.Add(new KeyValuePair<string, int>(name, num));
		};
		List<KeyValuePair<string, int>> list2 = new List<KeyValuePair<string, int>>();
		action(list2, "興奮", param.cur_excite);
		action(list2, "精神", param.cur_mind);
		action(list2, "理性", param.cur_reason);
		action(list2, "淫欲", param.inyoku);
		action(list2, "M性", param.m_value);
		action(list2, "変態", param.hentai);
		action(list2, "奉仕", param.housi);
		action(list2, "可憐", param.lovely);
		action(list2, "気品", param.elegance);
		action(list2, "魅惑", param.charm);
		action(list2, "接待", param.reception);
		action(list2, "指導", param.teach_rate / 10);
		this.param_scroll_.CallFadeIn(list2);
		this.ClearCommandFile();
		this.ClearVoice();
		bool flag = true;
		bool flag2 = false;
		bool flag3 = false;
		bool flag4 = false;
		bool flag5 = false;
		bool flag6 = false;
		if (this.skill_pair_.base_data.drunk_skill)
		{
			flag2 = true;
			flag = false;
		}
		if (flag && command_data.basic.propensity_sabun != null)
		{
			Propensity.Data propensity_sabun = command_data.basic.propensity_sabun;
			if (this.maid_.status.propensitys.ContainsKey(propensity_sabun.id))
			{
				flag4 = true;
				flag = false;
			}
			else if (YotogiOldPropensity.IsGetPossiblePropensity(propensity_sabun, this.maid_.status))
			{
				flag = false;
				flag3 = true;
			}
		}
		if (flag && command_data.basic.sexual_type != YotogiOld.SexualType.Null && 200 <= this.maid_.status.currentExcite)
		{
			int num4 = 999;
			bool flag7 = false;
			YotogiOld.SexualType sexual_type = command_data.basic.sexual_type;
			if (sexual_type == YotogiOld.SexualType.Mouth)
			{
				if (this.maid_.status.OldStatus.sexual.mouth == num4)
				{
					this.maid_.status.OldStatus.sexual.mouth = 1000;
					flag7 = true;
					this.AddTrophy(430);
				}
				else if (this.maid_.status.OldStatus.sexual.mouth >= 1000)
				{
					flag6 = true;
				}
			}
			else if (sexual_type == YotogiOld.SexualType.Throat)
			{
				if (this.maid_.status.OldStatus.sexual.throat == num4)
				{
					this.maid_.status.OldStatus.sexual.throat = 1000;
					flag7 = true;
					this.AddTrophy(440);
				}
				else if (this.maid_.status.OldStatus.sexual.throat >= 1000)
				{
					flag6 = true;
				}
			}
			else if (sexual_type == YotogiOld.SexualType.Nipple)
			{
				if (this.maid_.status.OldStatus.sexual.nipple == num4)
				{
					this.maid_.status.OldStatus.sexual.nipple = 1000;
					flag7 = true;
					this.AddTrophy(450);
				}
				else if (this.maid_.status.OldStatus.sexual.nipple >= 1000)
				{
					flag6 = true;
				}
			}
			else if (sexual_type == YotogiOld.SexualType.Front)
			{
				if (this.maid_.status.OldStatus.sexual.front == num4)
				{
					this.maid_.status.OldStatus.sexual.front = 1000;
					flag7 = true;
				}
				else if (this.maid_.status.OldStatus.sexual.front >= 1000)
				{
					flag6 = true;
				}
			}
			else if (sexual_type == YotogiOld.SexualType.Back)
			{
				if (this.maid_.status.OldStatus.sexual.back == num4)
				{
					this.maid_.status.OldStatus.sexual.back = 1000;
					flag7 = true;
				}
				else if (this.maid_.status.OldStatus.sexual.back >= 1000)
				{
					flag6 = true;
				}
			}
			else if (sexual_type == YotogiOld.SexualType.Curi)
			{
				if (this.maid_.status.OldStatus.sexual.curi == num4)
				{
					this.maid_.status.OldStatus.sexual.curi = 1000;
					flag7 = true;
					this.AddTrophy(480);
				}
				else if (this.maid_.status.OldStatus.sexual.curi >= 1000)
				{
					flag6 = true;
				}
			}
			if (flag7)
			{
				flag5 = true;
			}
		}
		Maid maid = this.maid_;
		if (0 < command_data.basic.ref_maid_no)
		{
			Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(command_data.basic.ref_maid_no);
			if (maid2 != null)
			{
				maid = maid2;
			}
			int num2 = -1;
			for (int i = 1; i < this.replace_personal_target_maid_array_.Length; i++)
			{
				if (this.replace_personal_target_maid_array_[i] == maid)
				{
					num2 = i;
					break;
				}
			}
			if (0 < num2)
			{
				this.replace_personal_target_maid_array_[0] = maid;
				this.replace_personal_target_maid_array_[num2] = this.maid_;
			}
		}
		YotogiOld.SkillCommandType command_type = command_data.basic.command_type;
		if (flag3)
		{
			this.yotogi_mgr_.AddDebugLog("プレイ 性癖-覚醒");
			this.SetControlMask(true, false);
			this.maid_.status.AddPropensity(command_data.basic.propensity_sabun.id);
			this.CallCommandFile(command_data.basic.propensity_arousal_file, string.Empty);
		}
		else if (flag5)
		{
			this.yotogi_mgr_.AddDebugLog("プレイ 性感帯-覚醒");
			this.SetControlMask(true, false);
			this.CallCommandFile(command_data.basic.seikan_arousal_file, string.Empty);
		}
		else if (command_type == YotogiOld.SkillCommandType.挿入 || command_type == YotogiOld.SkillCommandType.継続)
		{
			if (flag2)
			{
				this.PlayDrunkContinue(command_data, maid);
			}
			else if (flag4 || flag6)
			{
				this.PlayProclivityContinue(command_data);
			}
			else
			{
				this.PlayNormalContinue(command_data, maid);
			}
			this.PlayRRFile(command_data);
		}
		else if (command_type == YotogiOld.SkillCommandType.単発 || command_type == YotogiOld.SkillCommandType.単発_挿入)
		{
			if (flag2)
			{
				this.PlayDrunkSingle(command_data, maid);
			}
			else if (flag4 || flag6)
			{
				this.PlayProclivitySingle(command_data);
			}
			else
			{
				this.PlayNormalSingle(command_data, maid);
			}
			this.PlayRRFile(command_data);
		}
		else if (command_type == YotogiOld.SkillCommandType.絶頂)
		{
			this.PlayNormalClimax(command_data);
			this.zettyo_count++;
			if (10 <= this.zettyo_count)
			{
				this.AddTrophy(410);
			}
		}
		else if (command_type == YotogiOld.SkillCommandType.止める)
		{
			this.PlayNormalStop(command_data);
			this.PlayRRFile(command_data);
		}
		if (command_type == YotogiOld.SkillCommandType.挿入 || command_type == YotogiOld.SkillCommandType.単発_挿入)
		{
			this.player_state_ = YotogiOldPlay.PlayerState.Insert;
		}
		else if (command_type == YotogiOld.SkillCommandType.止める)
		{
			this.player_state_ = YotogiOldPlay.PlayerState.Normal;
		}
		else if (command_type == YotogiOld.SkillCommandType.絶頂 && command_data.basic.insert_release)
		{
			this.player_state_ = YotogiOldPlay.PlayerState.Normal;
		}
		this.UpdateCommand(maid);
		this.yotogi_mgr_.AddDebugLog("============================================");
		if (0 < command_data.basic.ref_maid_no && maid != this.maid_)
		{
			int num3 = -1;
			for (int j = 1; j < this.replace_personal_target_maid_array_.Length; j++)
			{
				if (this.replace_personal_target_maid_array_[j] == this.maid_)
				{
					num3 = j;
					break;
				}
			}
			if (0 < num3)
			{
				this.replace_personal_target_maid_array_[0] = this.maid_;
				this.replace_personal_target_maid_array_[num3] = maid;
			}
		}
	}

	private void PlayRRFile(Skill.Old.Data.Command.Data command_data)
	{
		string label = "*" + YotogiOldPlay.GetRRType(this.maid_.status.currentExcite).ToString();
		this.CallCommandFile(command_data.basic.rr_file, label);
	}

	private void PlayNormalContinue(Skill.Old.Data.Command.Data command_data, Maid target_maid)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 通常-挿入,継続系");
		if (this.player_state_ != YotogiOldPlay.PlayerState.Insert)
		{
			this.PlayInsert(command_data);
		}
		MaidStatus.Old.Relation relation = target_maid.status.OldStatus.relation;
		string text = string.Empty;
		string label = string.Empty;
		YotogiOld.RCType rctype = YotogiOldPlay.GetRCType(this.backup_maid_param_.cur_excite, this.maid_.status.currentExcite);
		if (rctype != YotogiOld.RCType.RCNull)
		{
			string str = rctype.ToString();
			this.yotogi_mgr_.AddDebugLog("RC HIT!! " + str);
			text = command_data.basic.rc_file;
			if (relation == MaidStatus.Old.Relation.Slave)
			{
				label = "*愛奴" + str;
			}
			else if (this.playing_skill_level_ == 3)
			{
				if (relation == MaidStatus.Old.Relation.Lover)
				{
					label = "*慣れ恋人" + str;
				}
				else
				{
					label = "*緊張orお近づきor信頼" + str;
				}
			}
			else if (this.playing_skill_level_ == 2 || relation == MaidStatus.Old.Relation.Trust)
			{
				label = "*フラット、変化進行" + str;
			}
			else if (relation != MaidStatus.Old.Relation.Tonus)
			{
				if (relation != MaidStatus.Old.Relation.Contact)
				{
					if (relation == MaidStatus.Old.Relation.Lover)
					{
						label = "*不慣れ恋人" + str;
					}
				}
				else
				{
					label = "*不慣れお近づき" + str;
				}
			}
			else
			{
				label = "*不慣れ緊張" + str;
			}
		}
		else
		{
			if (this.player_state_ == YotogiOldPlay.PlayerState.Insert)
			{
				this.PlayInsert2(command_data);
			}
			YotogiOld.RRCType rrctype = YotogiOldPlay.GetRRCType(this.backup_maid_param_.cur_excite, this.maid_.status.currentExcite);
			if (rrctype != YotogiOld.RRCType.RRCNull)
			{
				string str2 = rrctype.ToString();
				text = command_data.basic.rrc_file;
				this.yotogi_mgr_.AddDebugLog("RRC HIT!! " + str2);
				if (this.playing_skill_level_ == 1 || this.playing_skill_level_ == 2)
				{
					label = "*不慣れ" + str2;
				}
				else
				{
					label = "*慣れ" + str2;
				}
			}
		}
		if (text != string.Empty)
		{
			this.CallCommandFile(text, label);
		}
	}

	private void PlayNormalClimax(Skill.Old.Data.Command.Data command_data)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 通常-絶頂系");
		YotogiOld.ExcitementStatus excitementStatus = YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite);
		YotogiOld.ExcitementStatus excitementStatus2 = YotogiOldPlay.GetExcitementStatus(this.maid_.status.currentExcite);
		if (excitementStatus == YotogiOld.ExcitementStatus.Minus)
		{
			excitementStatus = YotogiOld.ExcitementStatus.Small;
		}
		string file = command_data.basic.normal_file;
		if (excitementStatus == YotogiOld.ExcitementStatus.Small)
		{
			this.CallCommandFile(file, "*SYA1");
		}
		else if (excitementStatus == YotogiOld.ExcitementStatus.Medium)
		{
			this.CallCommandFile(file, "*SYA2");
		}
		else if (excitementStatus == YotogiOld.ExcitementStatus.Large)
		{
			this.CallCommandFile(file, "*SYA3");
		}
		file = command_data.basic.rr_file;
		if (excitementStatus2 == YotogiOld.ExcitementStatus.Minus || excitementStatus2 == YotogiOld.ExcitementStatus.Small)
		{
			this.CallCommandFile(file, "*ZIG1");
		}
		else if (excitementStatus2 == YotogiOld.ExcitementStatus.Medium)
		{
			this.CallCommandFile(file, "*ZIG2");
		}
		else if (excitementStatus2 == YotogiOld.ExcitementStatus.Large)
		{
			this.CallCommandFile(file, "*ZIG3");
		}
	}

	private void PlayNormalStop(Skill.Old.Data.Command.Data command_data)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 通常-止める系");
		YotogiOld.ExcitementStatus excitementStatus = YotogiOldPlay.GetExcitementStatus(this.maid_.status.currentExcite);
		string normal_file = command_data.basic.normal_file;
		string label = string.Empty;
		switch (excitementStatus)
		{
		case YotogiOld.ExcitementStatus.Minus:
			label = "*YAM1";
			break;
		case YotogiOld.ExcitementStatus.Small:
			label = "*YAM2";
			break;
		case YotogiOld.ExcitementStatus.Medium:
			label = "*YAM3";
			break;
		case YotogiOld.ExcitementStatus.Large:
			label = "*YAM4";
			break;
		}
		this.CallCommandFile(normal_file, label);
	}

	private void PlayNormalSingle(Skill.Old.Data.Command.Data command_data, Maid target_maid)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 通常-単発系");
		YotogiOld.ExcitementStatus excitementStatus = YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite);
		if (this.is_free_mode && command_data.basic.active_command && 0 <= command_data.basic.expression.IndexOf("興奮値") && !command_data.EvalExpression())
		{
			excitementStatus = YotogiOldPlay.GetExcitementStatus(this.free_mode_backup_excitement_);
		}
		string normal_file = command_data.basic.normal_file;
		string label = string.Empty;
		MaidStatus.Old.Relation relation = target_maid.status.OldStatus.relation;
		if (relation == MaidStatus.Old.Relation.Slave)
		{
			switch (excitementStatus)
			{
			case YotogiOld.ExcitementStatus.Minus:
				label = "*SA21";
				break;
			case YotogiOld.ExcitementStatus.Small:
				label = "*SA22";
				break;
			case YotogiOld.ExcitementStatus.Medium:
				label = "*SA23";
				break;
			case YotogiOld.ExcitementStatus.Large:
				label = "*SA24";
				break;
			}
		}
		else if (this.playing_skill_level_ == 1 || this.playing_skill_level_ == 2)
		{
			if (relation == MaidStatus.Old.Relation.Lover)
			{
				switch (excitementStatus)
				{
				case YotogiOld.ExcitementStatus.Minus:
					label = "*SA5";
					break;
				case YotogiOld.ExcitementStatus.Small:
					label = "*SA6";
					break;
				case YotogiOld.ExcitementStatus.Medium:
					label = "*SA7";
					break;
				case YotogiOld.ExcitementStatus.Large:
					label = "*SA8";
					break;
				}
			}
			else if (this.playing_skill_level_ == 2 || relation == MaidStatus.Old.Relation.Trust)
			{
				switch (excitementStatus)
				{
				case YotogiOld.ExcitementStatus.Minus:
					label = "*SA9";
					break;
				case YotogiOld.ExcitementStatus.Small:
					label = "*SA10";
					break;
				case YotogiOld.ExcitementStatus.Medium:
					label = "*SA11";
					break;
				case YotogiOld.ExcitementStatus.Large:
					label = "*SA12";
					break;
				}
			}
			else
			{
				switch (excitementStatus)
				{
				case YotogiOld.ExcitementStatus.Minus:
					label = "*SA1";
					break;
				case YotogiOld.ExcitementStatus.Small:
					label = "*SA2";
					break;
				case YotogiOld.ExcitementStatus.Medium:
					label = "*SA3";
					break;
				case YotogiOld.ExcitementStatus.Large:
					label = "*SA4";
					break;
				}
			}
		}
		else if (this.playing_skill_level_ == 3)
		{
			if (relation == MaidStatus.Old.Relation.Lover)
			{
				switch (excitementStatus)
				{
				case YotogiOld.ExcitementStatus.Minus:
					label = "*SA17";
					break;
				case YotogiOld.ExcitementStatus.Small:
					label = "*SA18";
					break;
				case YotogiOld.ExcitementStatus.Medium:
					label = "*SA19";
					break;
				case YotogiOld.ExcitementStatus.Large:
					label = "*SA20";
					break;
				}
			}
			else
			{
				switch (excitementStatus)
				{
				case YotogiOld.ExcitementStatus.Minus:
					label = "*SA13";
					break;
				case YotogiOld.ExcitementStatus.Small:
					label = "*SA14";
					break;
				case YotogiOld.ExcitementStatus.Medium:
					label = "*SA15";
					break;
				case YotogiOld.ExcitementStatus.Large:
					label = "*SA16";
					break;
				}
			}
		}
		this.CallCommandFile(normal_file, label);
	}

	private void PlayInsert(Skill.Old.Data.Command.Data command_data)
	{
		string normal_file = command_data.basic.normal_file;
		string label = string.Empty;
		this.yotogi_mgr_.AddDebugLog(" 挿入中ではないのでファイルコール");
		switch (YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite))
		{
		case YotogiOld.ExcitementStatus.Minus:
			label = "*SOU1";
			break;
		case YotogiOld.ExcitementStatus.Small:
			label = "*SOU2";
			break;
		case YotogiOld.ExcitementStatus.Medium:
			label = "*SOU3";
			break;
		case YotogiOld.ExcitementStatus.Large:
			label = "*SOU4";
			break;
		}
		this.CallCommandFile(normal_file, label);
	}

	private void PlayInsert2(Skill.Old.Data.Command.Data command_data)
	{
		string insert_file = command_data.basic.insert_file;
		string label = string.Empty;
		this.yotogi_mgr_.AddDebugLog(" 挿入中のファイルコール");
		switch (YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite))
		{
		case YotogiOld.ExcitementStatus.Minus:
			label = "*SOC1";
			break;
		case YotogiOld.ExcitementStatus.Small:
			label = "*SOC2";
			break;
		case YotogiOld.ExcitementStatus.Medium:
			label = "*SOC3";
			break;
		case YotogiOld.ExcitementStatus.Large:
			label = "*SOC4";
			break;
		}
		this.CallCommandFile(insert_file, label);
	}

	private void PlayDrunkContinue(Skill.Old.Data.Command.Data command_data, Maid target_maid)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 酔い-挿入,継続系");
		if (this.player_state_ != YotogiOldPlay.PlayerState.Insert)
		{
			this.PlayInsert(command_data);
		}
		MaidStatus.Old.Relation relation = target_maid.status.OldStatus.relation;
		string text = string.Empty;
		string label = string.Empty;
		YotogiOld.RCType rctype = YotogiOldPlay.GetRCType(this.backup_maid_param_.cur_excite, this.maid_.status.currentExcite);
		if (rctype != YotogiOld.RCType.RCNull)
		{
			string str = rctype.ToString();
			this.yotogi_mgr_.AddDebugLog("RC HIT!! " + str);
			text = command_data.basic.rc_file;
			switch (relation)
			{
			case MaidStatus.Old.Relation.Tonus:
				label = "*酔い緊張" + str;
				break;
			case MaidStatus.Old.Relation.Contact:
				label = "*酔いお近づき" + str;
				break;
			case MaidStatus.Old.Relation.Trust:
				label = "*酔い信頼" + str;
				break;
			case MaidStatus.Old.Relation.Lover:
				label = "*酔い恋人" + str;
				break;
			case MaidStatus.Old.Relation.Slave:
				label = "*酔い愛奴" + str;
				break;
			}
		}
		else if (this.player_state_ == YotogiOldPlay.PlayerState.Insert)
		{
			this.PlayInsert2(command_data);
		}
		if (text != string.Empty)
		{
			this.CallCommandFile(text, label);
		}
	}

	private void PlayProclivityContinue(Skill.Old.Data.Command.Data command_data)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 性癖-挿入,継続系");
		if (this.player_state_ != YotogiOldPlay.PlayerState.Insert)
		{
			this.PlayInsert(command_data);
		}
		string text = string.Empty;
		string label = string.Empty;
		YotogiOld.RCType rctype = YotogiOldPlay.GetRCType(this.backup_maid_param_.cur_excite, this.maid_.status.currentExcite);
		if (rctype != YotogiOld.RCType.RCNull)
		{
			string str = rctype.ToString();
			this.yotogi_mgr_.AddDebugLog("RC HIT!! " + str);
			text = command_data.basic.rc_file;
			label = "*性癖" + str;
		}
		else
		{
			if (this.player_state_ == YotogiOldPlay.PlayerState.Insert)
			{
				this.PlayInsert2(command_data);
			}
			YotogiOld.RRCType rrctype = YotogiOldPlay.GetRRCType(this.backup_maid_param_.cur_excite, this.maid_.status.currentExcite);
			if (rrctype != YotogiOld.RRCType.RRCNull)
			{
				string str2 = rrctype.ToString();
				this.yotogi_mgr_.AddDebugLog("RRC HIT!! " + str2);
				text = command_data.basic.rrc_file;
				label = "*性癖" + str2;
			}
		}
		if (text != string.Empty)
		{
			this.CallCommandFile(text, label);
		}
	}

	private void PlayDrunkSingle(Skill.Old.Data.Command.Data command_data, Maid target_maid)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 酔い-単発系");
		YotogiOld.ExcitementStatus excitementStatus = YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite);
		MaidStatus.Old.Relation relation = target_maid.status.OldStatus.relation;
		if (this.is_free_mode && command_data.basic.active_command && 0 <= command_data.basic.expression.IndexOf("興奮値") && !command_data.EvalExpression())
		{
			excitementStatus = YotogiOldPlay.GetExcitementStatus(this.free_mode_backup_excitement_);
		}
		string normal_file = command_data.basic.normal_file;
		string label = string.Empty;
		if (relation == MaidStatus.Old.Relation.Tonus || relation == MaidStatus.Old.Relation.Contact)
		{
			switch (excitementStatus)
			{
			case YotogiOld.ExcitementStatus.Minus:
				label = "*酔いSA1";
				break;
			case YotogiOld.ExcitementStatus.Small:
				label = "*酔いSA2";
				break;
			case YotogiOld.ExcitementStatus.Medium:
				label = "*酔いSA3";
				break;
			case YotogiOld.ExcitementStatus.Large:
				label = "*酔いSA4";
				break;
			}
		}
		else if (relation == MaidStatus.Old.Relation.Trust)
		{
			switch (excitementStatus)
			{
			case YotogiOld.ExcitementStatus.Minus:
				label = "*酔いSA5";
				break;
			case YotogiOld.ExcitementStatus.Small:
				label = "*酔いSA6";
				break;
			case YotogiOld.ExcitementStatus.Medium:
				label = "*酔いSA7";
				break;
			case YotogiOld.ExcitementStatus.Large:
				label = "*酔いSA8";
				break;
			}
		}
		else if (relation == MaidStatus.Old.Relation.Lover || relation == MaidStatus.Old.Relation.Slave)
		{
			switch (excitementStatus)
			{
			case YotogiOld.ExcitementStatus.Minus:
				label = "*酔いSA9";
				break;
			case YotogiOld.ExcitementStatus.Small:
				label = "*酔いSA10";
				break;
			case YotogiOld.ExcitementStatus.Medium:
				label = "*酔いSA11";
				break;
			case YotogiOld.ExcitementStatus.Large:
				label = "*酔いSA12";
				break;
			}
		}
		this.CallCommandFile(normal_file, label);
	}

	private void PlayProclivitySingle(Skill.Old.Data.Command.Data command_data)
	{
		this.yotogi_mgr_.AddDebugLog("プレイ 性癖-単発系");
		YotogiOld.ExcitementStatus excitementStatus = YotogiOldPlay.GetExcitementStatus(this.backup_maid_param_.cur_excite);
		string normal_file = command_data.basic.normal_file;
		string label = string.Empty;
		switch (excitementStatus)
		{
		case YotogiOld.ExcitementStatus.Minus:
			label = "*性癖SA1";
			break;
		case YotogiOld.ExcitementStatus.Small:
			label = "*性癖SA2";
			break;
		case YotogiOld.ExcitementStatus.Medium:
			label = "*性癖SA3";
			break;
		case YotogiOld.ExcitementStatus.Large:
			label = "*性癖SA4";
			break;
		}
		this.CallCommandFile(normal_file, label);
	}

	private bool OnEnabledCommand(Skill.Old.Data.Command.Data command_data)
	{
		return true;
	}

	private void UpdateCommand(Maid target_maid)
	{
		this.command_factory_.ClearCommand();
		if (this.command_menu != null)
		{
			this.command_menu.ClearCommand();
		}
		if (this.maid_.status.currentMind <= 0)
		{
			return;
		}
		this.free_mode_backup_excitement_ = 0;
		for (int i = 0; i < this.valid_command_dic_[this.player_state_].Length; i++)
		{
			Skill.Old.Data.Command.Data data = this.valid_command_dic_[this.player_state_][i];
			if (data.basic.command_type != YotogiOld.SkillCommandType.絶頂 || this.maid_.status.currentExcite >= 80)
			{
				if (data.basic.active_command)
				{
					if (!data.EvalExpression())
					{
						goto IL_16D;
					}
					if (!this.is_free_mode && this.play_command_id_.Contains(data.basic.id))
					{
						goto IL_16D;
					}
					if (this.is_free_mode && 0 <= data.basic.expression.IndexOf("興奮値"))
					{
						if (target_maid == null)
						{
							goto IL_16D;
						}
						this.free_mode_backup_excitement_ = target_maid.status.currentExcite;
					}
				}
				this.command_factory_.AddCommand(this.valid_command_dic_[this.player_state_][i]);
				if (this.command_menu != null)
				{
					this.command_menu.AddCommand(this.valid_command_dic_[this.player_state_][i]);
				}
			}
			IL_16D:;
		}
		if (this.command_menu != null)
		{
			this.command_menu.FixCommand();
		}
	}

	private void UpdateSkillTower()
	{
		Transform transform = this.skill_group_parent_.transform;
		if (this.skill_icon_default_color_.a == 0f)
		{
			this.skill_icon_default_color_ = UTY.GetChildObject(transform.GetChild(0).gameObject, "Icon", false).GetComponent<UIButton>().defaultColor;
		}
		for (int i = 0; i < this.yotogi_mgr_.play_skill_array.Length; i++)
		{
			YotogiOldManager.PlayingSkillData playingSkillData = this.yotogi_mgr_.play_skill_array[i];
			GameObject gameObject = transform.GetChild(i).gameObject;
			GameObject childObject = UTY.GetChildObject(gameObject, "Icon", false);
			UI2DSprite component = childObject.GetComponent<UI2DSprite>();
			GameObject childObject2 = UTY.GetChildObject(gameObject, "Arrow", false);
			BoxCollider component2 = childObject.GetComponent<BoxCollider>();
			UIButton component3 = childObject.GetComponent<UIButton>();
			UISprite component4 = UTY.GetChildObject(gameObject, "SkillName", false).GetComponent<UISprite>();
			UILabel componentInChildren = component4.GetComponentInChildren<UILabel>();
			UIRect uirect = component4;
			float alpha = 0f;
			componentInChildren.alpha = alpha;
			uirect.alpha = alpha;
			childObject2.SetActive(false);
			if (playingSkillData.skill_pair.base_data == null)
			{
				childObject.SetActive(false);
			}
			else
			{
				componentInChildren.text = playingSkillData.skill_pair.base_data.name;
				componentInChildren.width = 0;
				componentInChildren.MakePixelPerfect();
				component4.width = componentInChildren.width + 20;
				childObject.SetActive(true);
				childObject.GetComponent<UIWidget>().depth = childObject2.GetComponent<UIWidget>().depth;
				if (playingSkillData.is_play || this.playing_skill_no_ == i)
				{
					component3.enabled = false;
					if (this.playing_skill_no_ != i)
					{
						component.color = new Color(0.4f, 0.4f, 0.4f, 0.4f);
					}
					else
					{
						component.color = new Color(1f, 1f, 1f, 1f);
						childObject2.SetActive(true);
					}
					childObject.GetComponent<UIPlayAnimation>().enabled = false;
				}
				else
				{
					component.color = this.skill_icon_default_color_;
					component3.enabled = true;
					childObject.GetComponent<UIPlayAnimation>().enabled = true;
				}
				YotogiOldSkillIcon component5 = childObject.GetComponent<YotogiOldSkillIcon>();
				component5.SetSkillData(this.yotogi_mgr_.play_skill_array[i].skill_pair.base_data);
			}
		}
	}

	private void OnSkillIconClick()
	{
		if (this.yotogi_mgr_.IsAllCharaBusy())
		{
			this.yotogi_mgr_.AddDebugLog("============================================");
			this.yotogi_mgr_.AddDebugLog("×スキルアイコンがクリックされました");
			this.yotogi_mgr_.AddDebugLog("IsBusy状態なのでキャンセルしました");
			this.yotogi_mgr_.AddDebugLog("============================================");
			return;
		}
		Transform transform = this.skill_group_parent_.transform;
		UIButton current = UIButton.current;
		int num = -1;
		for (int i = 0; i < this.yotogi_mgr_.play_skill_array.Length; i++)
		{
			GameObject gameObject = transform.GetChild(i).gameObject;
			GameObject childObject = UTY.GetChildObject(gameObject, "Icon", false);
			if (childObject.GetComponent<UIButton>() == current)
			{
				num = i - 1;
				break;
			}
		}
		if (num == -1)
		{
			return;
		}
		this.playing_skill_no_ = num;
		this.OnNextSkillMove();
	}

	public void VisibleSkillName(int icon_no, bool val)
	{
		GameObject gameObject = this.skill_group_parent_.transform.GetChild(icon_no).gameObject;
		UISprite component = UTY.GetChildObject(gameObject, "SkillName", false).GetComponent<UISprite>();
		UILabel componentInChildren = component.GetComponentInChildren<UILabel>();
		float num = 0f;
		if (val)
		{
			num = 1f;
		}
		UIRect uirect = component;
		float alpha = num;
		componentInChildren.alpha = alpha;
		uirect.alpha = alpha;
	}

	private void ClearCommandFile()
	{
		this.script_mgr_.EvalScript("global.__skill_command_file.clear();");
	}

	private void CallCommandFile(string file, string label)
	{
		if (string.IsNullOrEmpty(file) || file == ".ks")
		{
			return;
		}
		file = ScriptManager.ReplacePersonal(this.replace_personal_target_maid_array_, file);
		file = Path.ChangeExtension(file, ".ks");
		bool flag = false;
		using (TJSVariant tjsvariant = new TJSVariant())
		{
			this.script_mgr_.EvalScript("global.__skill_command_file.count;", tjsvariant);
			if (0 < tjsvariant.AsInteger())
			{
				flag = true;
			}
		}
		if (!flag)
		{
			this.ClearCommandFile();
			this.script_mgr_.EvalScript(string.Concat(new string[]
			{
				"global.__skill_command_file.add(%['file'=>'",
				file,
				"','label'=>'",
				label,
				"']);"
			}));
			this.script_mgr_.LoadYotogiScript("yotogi_skill_command_call_main.ks", string.Empty);
			this.yotogi_mgr_.AddDebugLog(string.Concat(new string[]
			{
				"コマンドファイル[",
				file,
				"][",
				label,
				"]を呼び出しました"
			}));
		}
		else
		{
			this.script_mgr_.EvalScript(string.Concat(new string[]
			{
				"global.__skill_command_file.add(%['file'=>'",
				file,
				"','label'=>'",
				label,
				"']);"
			}));
		}
	}

	public void OnClickReleaseSeieki()
	{
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int i = 0; i < characterMgr.GetMaidCount(); i++)
		{
			Maid maid = characterMgr.GetMaid(i);
			if (maid != null)
			{
				maid.body0.MulTexRemove("body", 0, "_MainTex", 18);
				maid.body0.MulTexRemove("body", 0, "_ShadowTex", 18);
				maid.body0.MulTexRemove("head", 5, "_MainTex", 18);
				maid.body0.MulTexRemove("head", 5, "_ShadowTex", 18);
				maid.body0.MulTexProc("body");
				maid.body0.MulTexProc("head");
			}
		}
	}

	private void OnClickSkillSelectEnd()
	{
		this.free_skill_select_.FixSkill();
		this.playing_skill_no_ = 0;
		this.OnNextSkillMove();
	}

	private void OnEnterSkillSelectVREnd(YotogiOld.StageData stage, int spot_no, YotogiOld.VRSkillData skill_data)
	{
		Skill.Old.Data[] playSkillArray = new Skill.Old.Data[]
		{
			YotogiOldManager.select_vr_skill_data.skill
		};
		this.yotogi_mgr_.SetPlaySkillArray(playSkillArray);
		this.playing_skill_no_ = 0;
		this.OnNextSkillMove();
	}

	public void OnClickNext()
	{
		if (this.yotogi_mgr_.IsAllCharaBusy())
		{
			this.yotogi_mgr_.AddDebugLog("============================================");
			this.yotogi_mgr_.AddDebugLog("×スキルアイコンがクリックされました");
			this.yotogi_mgr_.AddDebugLog("IsBusy状態なのでキャンセルしました");
			this.yotogi_mgr_.AddDebugLog("============================================");
			return;
		}
		this.playing_skill_no_ = -1;
		if (!this.is_free_mode && !this.is_vr_mode)
		{
			for (int i = 0; i < this.yotogi_mgr_.play_skill_array.Length; i++)
			{
				if (this.yotogi_mgr_.play_skill_array[i].skill_pair.base_data != null)
				{
					if (!this.yotogi_mgr_.play_skill_array[i].is_play)
					{
						this.playing_skill_no_ = i - 1;
						break;
					}
				}
			}
		}
		this.OnNextSkillMove();
	}

	private void OnNextSkillMove()
	{
		if (this.is_swoon_flag_)
		{
			return;
		}
		if (this.is_free_mode)
		{
			this.maid_.status.seikeiken = this.free_mode_backup_data_.seikeiken;
			this.maid_.status.OldStatus.condition = this.free_mode_backup_data_.condition_special;
		}
		GameMain.Instance.SoundMgr.StopSe();
		this.yotogi_mgr_.yotogi_kag.enabled = false;
		this.is_swoon_flag_ = this.IsSwoon();
		if (this.is_swoon_flag_ || this.playing_skill_no_ == -1)
		{
			if (this.maid_.status.currentHp <= 0)
			{
				this.is_swoon_flag_ = true;
			}
			if (this.is_swoon_flag_)
			{
				this.SetControlMask(true, true);
				GameMain.Instance.MainCamera.FadeOutNoUI(base.fade_time, true);
			}
			else
			{
				this.ClearCommandFile();
				this.repeat_voice_file_ = string.Empty;
				this.ClearVoice();
				if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
				{
					this.Finish();
				}
			}
		}
		else
		{
			this.next_flag_ = true;
			this.Finish();
		}
	}

	private void OnClickViweReset()
	{
		this.camera_move_support_.ResetCamera();
	}

	protected override void OnFinish()
	{
		if (!this.next_flag_)
		{
			if (this.is_free_mode || this.is_vr_mode)
			{
				GameMain.Instance.SoundMgr.VoiceStopAll();
				GameMain.Instance.SoundMgr.StopSe();
				CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
				GameMain.Instance.ScriptMgr.ClearForcExecWaitEvent();
				for (int i = 0; i < characterMgr.GetMaidCount(); i++)
				{
					Maid maid = characterMgr.GetMaid(i);
					if (maid != null)
					{
						maid.FaceAnime("通常", 0f, 0);
						maid.FaceBlend("無し");
						maid.body0.SetMaskMode(TBody.MaskMode.None);
						for (int j = 10; j <= 20; j++)
						{
							maid.body0.MulTexRemove("body", 0, "_MainTex", j);
							maid.body0.MulTexRemove("body", 0, "_ShadowTex", j);
							maid.body0.MulTexRemove("head", 5, "_MainTex", j);
							maid.body0.MulTexRemove("head", 5, "_ShadowTex", j);
						}
						maid.body0.MulTexProc("body");
						maid.body0.MulTexProc("head");
					}
				}
				this.yotogi_mgr_.ResetWorld();
				characterMgr.DeactivateCharaAll();
			}
			else
			{
				this.yotogi_mgr_.ApplyStatus();
				this.maid_.status.OldStatus.condition = Condition.Null;
				if (this.IsSwoon())
				{
					GameMain.Instance.MainCamera.FadeInNoUI(0f, true);
				}
			}
			if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
			{
				this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Null.ToString());
			}
		}
		else
		{
			GameMain.Instance.CharacterMgr.SetCharaAllPos(Vector3.zero);
			GameMain.Instance.CharacterMgr.SetCharaAllRot(Vector3.zero);
			this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Play.ToString());
		}
	}

	protected override void OnFadeEnd()
	{
		if (!this.next_flag_ && (this.is_free_mode || this.is_vr_mode))
		{
			GameMain.Instance.MainLight.Reset();
			GameMain.Instance.CharacterMgr.ResetCharaPosAll();
			GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
			GameMain.Instance.SoundMgr.VoiceStopAll();
			this.yotogi_mgr_.UnVisibleMaidAndMan(true, true);
			this.maid_.Visible = true;
		}
	}

	public void SetControlMask(bool val, bool is_endless = false)
	{
		if (!val)
		{
			this.control_mask_tick_count = -1;
			for (int i = 0; i < this.control_mask_list_.Count; i++)
			{
				this.control_mask_list_[i].SetActive(false);
			}
		}
		else
		{
			this.control_mask_tick_count = GameMain.tick_count + 3000;
			if (is_endless)
			{
				this.control_mask_tick_count = int.MaxValue;
			}
			for (int j = 0; j < this.control_mask_list_.Count; j++)
			{
				this.control_mask_list_[j].SetActive(true);
			}
		}
	}

	public void OnUndressingEvent(string call_file)
	{
		if (string.IsNullOrEmpty(call_file))
		{
			return;
		}
		if (this.maid_.status.OldStatus.condition != Condition.Drunk)
		{
			this.CallCommandFile(call_file, string.Empty);
		}
	}

	public void ChangeSliderValue()
	{
		float value = UIProgressBar.current.value;
		int manAlpha = (int)System.Math.Ceiling((double)(value * 100f));
		GameMain.Instance.CMSystem.ManAlpha = manAlpha;
		this.setting_man_alpha_ = manAlpha;
		GameMain.Instance.CharacterMgr.ManAlphaUpdate();
	}

	public void OnClickExciteLock()
	{
		this.is_excite_lock_ = !this.is_excite_lock_;
		GameMain.Instance.CMSystem.SetSystemVers("ExciteLock", (!this.is_excite_lock_) ? "0" : "1");
		this.btn_excite_lock_.SetSelect(this.is_excite_lock_);
	}

	public bool IsSwoon()
	{
		return !this.is_free_mode && !this.is_vr_mode && this.maid_.status.currentMind <= 0 && this.maid_.status.currentHp <= 0;
	}

	private void AddTrophy(int trophy_id)
	{
		if (this.is_free_mode || this.is_vr_mode)
		{
			return;
		}
	}

	private bool is_free_mode
	{
		get
		{
			return this.yotogi_mgr_.is_free_mode;
		}
	}

	private bool is_vr_mode
	{
		get
		{
			return this.yotogi_mgr_.is_vr_mode;
		}
	}

	private YotogiOldCommandMenuOVR command_menu
	{
		get
		{
			return this.yotogi_mgr_.command_menu;
		}
	}

	public int kRepeatWaitTime = 200;

	private Maid maid_;

	private ScriptManager script_mgr_;

	private MaidStatus.Status maid_status_;

	private YotogiOldManager yotogi_mgr_;

	private YotogiOldManager.PlayingSkillData playing_skill_;

	private YotogiOld.SkillDataPair skill_pair_;

	private YotogiOldParameterViewer paramenter_viewer_;

	private YotogiOldCommandFactory command_factory_;

	private YotogiParamScroll param_scroll_;

	private YotogiOldParamBasicBar param_basic_bar_;

	private YotogiCommonButtons common_buttons_;

	private FreeSkillSelectOld free_skill_select_;

	private WfCameraMoveSupport camera_move_support_;

	private GameObject skill_group_parent_;

	private UISlider man_alpha_slider_;

	private UndressingManager undressing_mgr_;

	private List<GameObject> control_mask_list_ = new List<GameObject>();

	private int setting_man_alpha_;

	private bool next_flag_;

	private HashSet<int> play_command_id_ = new HashSet<int>();

	private int control_mask_tick_count = -1;

	private Color skill_icon_default_color_;

	private Maid[] replace_personal_target_maid_array_;

	private YotogiOldPlayManager.FreeModeBackUpData free_mode_backup_data_;

	private UIWFSelectButton btn_excite_lock_;

	private bool is_excite_lock_;

	private bool is_reset_item;

	private int zettyo_count;

	private bool is_swoon_flag_;

	private string repeat_voice_file_ = string.Empty;

	private int repeat_time_;

	private int repeat_voice_maid_no;

	private int playing_skill_level_;

	private int playing_skill_no_;

	private YotogiOldPlay.PlayerState player_state_;

	private YotogiOldPlay.Param backup_maid_param_;

	private BonusStatus bonusCorrectionStatus_;

	private Dictionary<YotogiOldPlay.PlayerState, Skill.Old.Data.Command.Data[]> valid_command_dic_ = new Dictionary<YotogiOldPlay.PlayerState, Skill.Old.Data.Command.Data[]>();

	private int free_mode_backup_excitement_;

	private struct FreeModeBackUpData
	{
		public Seikeiken seikeiken;

		public Condition condition_special;
	}
}
