convert unity game class into phaser js 3 typescript module:

// gameState
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class gameState : MonoBehaviour
{
	public enum GAMESTATE
	{
		menu,
		game
	}

	public enum LOCALIZATION
	{
		en,
		ru
	}

	public enum HEROTYPE_ENUM
	{
		paladin,
		vampire,
		brewer,
		assassin,
		alchemist
	}

	public struct heroStatueStruct
	{
		public string spriteID;

		public int hp;

		public int at;

		public int coins;

		public heroStatueStruct(HEROTYPE_ENUM hType, int hp, int at, int coins)
		{
			spriteID = "statue_" + hType;
			this.hp = hp;
			this.at = at;
			this.coins = coins;
			MonoBehaviour.print(spriteID);
		}
	}

	public float verNum = 1.5f;

	public pauseHandeler tempPauseHandler;

	private string _userID = "Traveler";

	private int _stuff = 1;

	public int firstTime = 1;

	public int continueGame;

	public GameObjectPool audioPool;

	public LOCALIZATION _localization;

	public GAMESTATE _gameState;

	private static gameState instance;

	public Dictionary<string, item_loot> questObjects_loot = new Dictionary<string, item_loot>();

	private int _chestOpenedNum;

	private int _monstersKilledNum;

	private int _currentDungeonLevel = 1;

	private int _str;

	private int _hp;

	private int _initiative;

	private int _critChance;

	private int _coins;

	public bool resManaged;

	public int antidotBottles;

	public int blueCrystalls;

	public int redCrystalls;

	public int yellowCrystalls;

	public int tempBlueCrystalls;

	public int tempRedCrystalls;

	public int tempYellowCrystalls;

	public Dictionary<int, bool> monsterDescriptionCheck = new Dictionary<int, bool>();

	public float CRIT_RATE = 2f;

	public int startDungeon = 1;

	public int lastDungeon = 1;

	public int monstersKilled;

	public int cellsOpened;

	public int trapsFallen;

	public int goldBonus;

	public int salvageNum;

	public int looterNum;

	public int questCompleted;

	public int allyFind;

	public int masterArena;

	public int scrollsUsed;

	public int tempDungeonNum = 1;

	public int tempHp;

	public int tempStr;

	public int price_shop = 20;

	public int _modifier_buyAmount;

	public int moodVal;

	public int modifier_buyTax = 10;

	public bool ressurected;

	public List<InventoryCell> actionBarCells = new List<InventoryCell>();

	public btn_mood moodButton;

	public heroRes playerHero;

	public hero hScript;

	public HEROTYPE_ENUM heroType;

	public heroStatueStruct heroStatue;

	public Dictionary<string, string[]> enemyBiomList = new Dictionary<string, string[]>();

	public bool isGamePaused;

	public List<btn_spellLoot> inventory_spells = new List<btn_spellLoot>();

	public List<inv_loot> inventory_loot = new List<inv_loot>();

	public item_loot _itemWeapon;

	public string userID
	{
		get
		{
			return _userID;
		}
		set
		{
			_userID = value;
			if (_gameState == GAMESTATE.menu)
			{
				mainMenu.use.welcomText.text = "^1Welcome back,\n^0" + _userID;
				mainMenu.use.welcomText.Commit();
			}
		}
	}

	public int stuff
	{
		get
		{
			return _stuff;
		}
		set
		{
			_stuff = value;
		}
	}

	public int currentDungeonLevel
	{
		get
		{
			return _currentDungeonLevel;
		}
		set
		{
			_currentDungeonLevel = value;
		}
	}

	public int monstersKilledNum
	{
		get
		{
			return _monstersKilledNum;
		}
		set
		{
			_monstersKilledNum = value;
		}
	}

	public int chestOpenedNum
	{
		get
		{
			return _chestOpenedNum;
		}
		set
		{
			_chestOpenedNum = value;
		}
	}

	public int critChance
	{
		get
		{
			return _critChance;
		}
		set
		{
			_critChance = value;
		}
	}

	public int initiative
	{
		get
		{
			return _initiative;
		}
		set
		{
			_initiative = value;
		}
	}

	public int str
	{
		get
		{
			return _str;
		}
		set
		{
			_str = value;
		}
	}

	public int hp
	{
		get
		{
			return _hp;
		}
		set
		{
			_hp = value;
		}
	}

	public int coins
	{
		get
		{
			return _coins;
		}
		set
		{
			_coins = value;
			if (Messenger.eventTable.ContainsKey("UpdateCoinText"))
			{
				Messenger.Broadcast("UpdateCoinText");
			}
		}
	}

	public static gameState Instance
	{
		get
		{
			if (instance == null)
			{
				instance = new GameObject("gameState").AddComponent("gameState") as gameState;
			}
			return instance;
		}
	}

	public void closePauseHandeler()
	{
		tempPauseHandler = null;
		Messenger.Broadcast("gamePaused", arg1: false);
	}

	public void OnApplicationPause()
	{
	}

	public void OnApplicationQuit()
	{
	}

	public IEnumerator startGameGromTutorial()
	{
		_gameState = GAMESTATE.game;
		soundManager.Instance.alarmKill = true;
		StartCoroutine(soundManager.Instance.playSound(res.music["horn"]));
		StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 1f, 1.1f));
		if (soundManager.Instance._audioSorce.clip != res.music["dungelotost_soundtrack1"])
		{
			yield return StartCoroutine(soundManager.Instance.fadeMusic(0f, 0.5f));
		}
		yield return new WaitForSeconds(0.85f);
		yield return 0;
		GameObject loadingMenu = UnityEngine.Object.Instantiate(res.menus["loadingSplash"], new Vector3(320f, 640f, -5f), Quaternion.identity) as GameObject;
		Transform ct = GameObject.Find("mainCamera").transform;
		ct.position = new Vector3(0f, ct.position.y, ct.position.z);
		yield return StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 0f, 0.1f));
		UnityEngine.Object.DontDestroyOnLoad(loadingMenu);
		actionBarCells.Clear();
		tempHp = hp;
		tempStr = str;
		tempDungeonNum = 1;
		resManaged = true;
		StartCoroutine(LoadLevelWithProgress(2));
	}

	public IEnumerator _continueGame()
	{
		string desc = PlayerPrefs.GetString("saveData_vars", "paladin_1_0_none_80_1");
		string[] descArray = desc.Split('_');
		heroType = (HEROTYPE_ENUM)(int)Enum.Parse(typeof(HEROTYPE_ENUM), descArray[0]);
		Instance.playerHero = heroContainer.use.heroes[heroType.ToString()];
		Instance.tempDungeonNum = Convert.ToInt32(descArray[1]);
		Instance.moodVal = Convert.ToInt32(descArray[2]);
		playerHero.UpdateSkill();
		hp = Convert.ToInt32(descArray[4]);
		str = Convert.ToInt32(descArray[5]);
		antidotBottles = Convert.ToInt32(descArray[6]);
		Messenger.Broadcast("gamePaused", arg1: true);
		PlayerPrefs.SetInt("continueGame", 0);
		_gameState = GAMESTATE.game;
		soundManager.Instance.alarmKill = true;
		StartCoroutine(soundManager.Instance.playSound(res.music["horn"]));
		StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 1f, 1.1f));
		if (soundManager.Instance._audioSorce.clip != res.music["dungelotost_soundtrack1"])
		{
			yield return StartCoroutine(soundManager.Instance.fadeMusic(0f, 0.5f));
		}
		yield return new WaitForSeconds(0.85f);
		yield return 0;
		GameObject loadingMenu = UnityEngine.Object.Instantiate(res.menus["loadingSplash"], new Vector3(320f, 640f, -5f), Quaternion.identity) as GameObject;
		Transform ct = GameObject.Find("mainCamera").transform;
		ct.position = new Vector3(0f, ct.position.y, ct.position.z);
		yield return StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 0f, 0.1f));
		UnityEngine.Object.DontDestroyOnLoad(loadingMenu);
		actionBarCells.Clear();
		tempHp = hp;
		tempStr = str;
		initiative = Convert.ToInt32(playerHero.stateInitiative);
		resManaged = true;
		StartCoroutine(LoadLevelWithProgress(2, isContinue: true));
	}

	public IEnumerator LoadLevelWithProgress(int num, bool isContinue)
	{
		AsyncOperation async = Application.LoadLevelAsync(num);
		while (!async.isDone)
		{
			yield return 0;
		}
		if (isContinue)
		{
			StartCoroutine(iniGAME_continue());
		}
	}

	private void Addquestloot(string name)
	{
		if (!Instance.questObjects_loot.ContainsKey(name))
		{
			questObjects_loot.Add(name, res.items_loot[name]);
		}
	}

	private IEnumerator iniGAME_continue()
	{
		MonoBehaviour.print("LOADED");
		MonoBehaviour.print("======PREPARE GAME======");
		Messenger.AddListener<bool>("gamePaused", pauseHandler);
		GameObject manager = GameObject.Find("manager");
		dungeonManager dm = manager.GetComponent<dungeonManager>();
		guiController guiM = manager.GetComponent<guiController>();
		dungeonGenerator dgM = manager.GetComponent<dungeonGenerator>();
		playerManager pM = manager.GetComponent<playerManager>();
		runes rM = manager.GetComponent<runes>();
		rM.enabled = true;
		Transform guiParent = GameObject.Find("mainCamera").transform;
		GameObject guiBar = UnityEngine.Object.Instantiate(res.menus["fullGUI"], new Vector3(327f, 420f, -1f), Quaternion.identity) as GameObject;
		guiBar.transform.parent = guiParent;
		guiBar.name = "!gui";
		guiM.enabled = true;
		yield return StartCoroutine(guiM.StartGUI());
		dm.enabled = true;
		dgM.createDungeon();
		pM.enabled = true;
		MonoBehaviour.print("---CREATING HERO---");
		yield return StartCoroutine(pM.createHERO());
		MonoBehaviour.print("---HERO CREATED---");
		hScript.weaponAction = hScript.nullAction;
		GameObject _guiBar = GameObject.Find("!gui");
		btn_weaponLoot cell = _guiBar.transform.Find("inv_weapon").GetComponent<btn_weaponLoot>();
		if (cell._item != null)
		{
			cell.INI();
		}
		moodButton = _guiBar.transform.Find("inv_mood").GetComponent<btn_mood>();
		moodButton.calcMood(moodVal);
		dungeonManager.use.heartAmount = hp;
		dungeonManager.use.swordAmount = str;
		dungeonManager.use.calcAttack();
		dungeonManager.use.goldAmount = coins;
		dungeonManager.use.initiativeChance = initiative;
		dungeonManager.use.CRIT_RATE = CRIT_RATE;
		MonoBehaviour.print("---SETING EXIT---");
		yield return StartCoroutine(dgM.SetExit());
		MonoBehaviour.print("---GENERATING DUNGEON---");
		yield return StartCoroutine(dgM.generateDungeon());
		string desc4 = PlayerPrefs.GetString("saveData_spells", string.Empty);
		if (Instance.inventory_spells.Count != 0 && desc4 != string.Empty)
		{
			string[] descArray3 = desc4.Split('_');
			for (int k = 0; k < descArray3.Length - 1; k++)
			{
				string[] lArray = descArray3[k].Split('|');
				Instance.inventory_spells[k]._item = res.items_loot[lArray[0]];
				Instance.inventory_spells[k].state = btn_baseLoot.STATE.filled;
				Instance.inventory_spells[k].amount = Convert.ToInt32(lArray[1]);
				Instance.inventory_spells[k].selfSprite.spriteId = Instance.inventory_spells[k].selfSprite.GetSpriteIdByName(Instance.inventory_spells[k]._item.sprID);
			}
		}
		desc4 = PlayerPrefs.GetString("saveData_loot", string.Empty);
		if (Instance.inventory_loot.Count != 0 && desc4 != string.Empty)
		{
			string[] descArray2 = desc4.Split('_');
			for (int j = 0; j < descArray2.Length - 1; j++)
			{
				Instance.inventory_loot[j]._item = res.items_loot[descArray2[j]];
				Instance.inventory_loot[j].state = btn_baseLoot.STATE.filled;
				Instance.inventory_loot[j].amount = 1;
				Instance.inventory_loot[j].selfSprite.spriteId = Instance.inventory_loot[j].selfSprite.GetSpriteIdByName(Instance.inventory_loot[j]._item.sprID);
			}
		}
		desc4 = PlayerPrefs.GetString("saveData_questLoot", string.Empty);
		if (Instance.questObjects_loot.Count == 0 && desc4 != string.Empty)
		{
			string[] descArray = desc4.Split('_');
			for (int i = 0; i < descArray.Length - 1; i++)
			{
				Addquestloot(descArray[i]);
			}
		}
		desc4 = PlayerPrefs.GetString("saveData_vars", "paladin_1_0_none_80_1");
		string[] wA = desc4.Split('_');
		if (wA[3] != "none")
		{
			guiController.use.AddWeapon(res.items_loot[wA[3]]);
		}
		Messenger.Broadcast("gameIsLoaded");
		yield return StartCoroutine(dm.GameStartHandler());
		yield return new WaitForSeconds(1.2f);
		if (Messenger.eventTable.ContainsKey("QuestNotify_Relic"))
		{
			Messenger.Broadcast("QuestNotify_Relic");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_Enemies"))
		{
			Messenger.Broadcast("QuestNotify_Enemies");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_boss"))
		{
			Messenger.Broadcast("QuestNotify_boss");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_findPeople"))
		{
			Messenger.Broadcast("QuestNotify_findPeople");
		}
		yield return 0;
	}

	public IEnumerator startGame()
	{
		Instance.continueGame = 0;
		PlayerPrefs.SetInt("continueGame", 0);
		if (firstTime == 1)
		{
			yield return new WaitForSeconds(0.15f);
			UnityEngine.Object.Instantiate(res.menus["notify_littleTut"], new Vector3(960f, 480f, -2f), Quaternion.identity);
			yield break;
		}
		_gameState = GAMESTATE.game;
		soundManager.Instance.alarmKill = true;
		StartCoroutine(soundManager.Instance.playSound(res.music["horn"]));
		StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 1f, 1.1f));
		if (soundManager.Instance._audioSorce.clip != res.music["dungelotost_soundtrack1"])
		{
			yield return StartCoroutine(soundManager.Instance.fadeMusic(0f, 0.5f));
		}
		yield return new WaitForSeconds(0.85f);
		yield return 0;
		GameObject loadingMenu = UnityEngine.Object.Instantiate(res.menus["loadingSplash"], new Vector3(320f, 640f, -5f), Quaternion.identity) as GameObject;
		Transform ct = GameObject.Find("mainCamera").transform;
		ct.position = new Vector3(0f, ct.position.y, ct.position.z);
		yield return StartCoroutine(tween.use.alpha(mainMenu.use.bgBlack, 0f, 0.1f));
		UnityEngine.Object.DontDestroyOnLoad(loadingMenu);
		actionBarCells.Clear();
		tempHp = hp;
		tempStr = str;
		tempDungeonNum = 1;
		resManaged = true;
		StartCoroutine(LoadLevelWithProgress(2));
	}

	public IEnumerator LoadLevelWithProgress(int num)
	{
		AsyncOperation async = Application.LoadLevelAsync(num);
		while (!async.isDone)
		{
			yield return 0;
		}
		StartCoroutine(iniGAME());
	}

	public IEnumerator NextLevel()
	{
		AsyncOperation async = Application.LoadLevelAsync(2);
		while (!async.isDone)
		{
			yield return 0;
		}
		StartCoroutine(iniGAME());
	}

	private IEnumerator iniGAME()
	{
		MonoBehaviour.print("LOADED");
		MonoBehaviour.print("======PREPARE GAME======");
		Messenger.AddListener<bool>("gamePaused", pauseHandler);
		GameObject manager = GameObject.Find("manager");
		dungeonManager dm = manager.GetComponent<dungeonManager>();
		guiController guiM = manager.GetComponent<guiController>();
		dungeonGenerator dgM = manager.GetComponent<dungeonGenerator>();
		playerManager pM = manager.GetComponent<playerManager>();
		runes rM = manager.GetComponent<runes>();
		rM.enabled = true;
		Transform guiParent = GameObject.Find("mainCamera").transform;
		GameObject guiBar = UnityEngine.Object.Instantiate(res.menus["fullGUI"], new Vector3(327f, 420f, -1f), Quaternion.identity) as GameObject;
		guiBar.transform.parent = guiParent;
		guiBar.name = "!gui";
		guiM.enabled = true;
		yield return StartCoroutine(guiM.StartGUI());
		dm.enabled = true;
		dgM.createDungeon();
		pM.enabled = true;
		MonoBehaviour.print("---CREATING HERO---");
		yield return StartCoroutine(pM.createHERO());
		MonoBehaviour.print("---HERO CREATED---");
		hScript.weaponAction = hScript.nullAction;
		GameObject _guiBar = GameObject.Find("!gui");
		btn_weaponLoot cell = _guiBar.transform.Find("inv_weapon").GetComponent<btn_weaponLoot>();
		if (cell._item != null)
		{
			cell.INI();
		}
		moodButton = _guiBar.transform.Find("inv_mood").GetComponent<btn_mood>();
		moodButton.calcMood(moodVal);
		dungeonManager.use.heartAmount = hp;
		dungeonManager.use.swordAmount = str;
		dungeonManager.use.calcAttack();
		dungeonManager.use.goldAmount = coins;
		dungeonManager.use.initiativeChance = initiative;
		dungeonManager.use.CRIT_RATE = CRIT_RATE;
		MonoBehaviour.print("---SETING EXIT---");
		yield return StartCoroutine(dgM.SetExit());
		MonoBehaviour.print("---GENERATING DUNGEON---");
		yield return StartCoroutine(dgM.generateDungeon());
		Messenger.Broadcast("gameIsLoaded");
		yield return StartCoroutine(dm.GameStartHandler());
		yield return new WaitForSeconds(1.2f);
		if (Messenger.eventTable.ContainsKey("QuestNotify_Relic"))
		{
			Messenger.Broadcast("QuestNotify_Relic");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_Enemies"))
		{
			Messenger.Broadcast("QuestNotify_Enemies");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_boss"))
		{
			Messenger.Broadcast("QuestNotify_boss");
		}
		else if (Messenger.eventTable.ContainsKey("QuestNotify_findPeople"))
		{
			Messenger.Broadcast("QuestNotify_findPeople");
		}
		yield return 0;
	}

	public IEnumerator GAMEINI()
	{
		MonoBehaviour.print("GAME STARTED");
		yield return 0;
	}

	public bool checkForGameUpgrade()
	{
		if (stuff == 1)
		{
			return true;
		}
		return false;
	}

	private void OnEnable()
	{
	}

	private void OnDisable()
	{
	}

	public void failedToLogFacebook(string er)
	{
		StartCoroutine(tempPauseHandler.prepareToClose("An error occurred!"));
	}

	public bool checkInternetConnectionForIOS()
	{
		if (Application.internetReachability == NetworkReachability.NotReachable)
		{
			return false;
		}
		return true;
	}

	public void Start()
	{
		GetCheckMonsterDescriptions();
		float @float = PlayerPrefs.GetFloat("gameVersion", 1.2f);
		if (@float < verNum)
		{
			PlayerPrefs.SetFloat("gameVersion", verNum);
			Messenger.Broadcast("NewVersion");
		}
		redCrystalls = 30;
		tempRedCrystalls = redCrystalls;
		audioPool = new GameObjectPool(Resources.Load("prefabs/audioPrefab") as GameObject, 0u, initPrefab, setActiveRecursively: true);
	}

	public IEnumerator upgradeGame()
	{
		yield return 0;
	}

	public void initPrefab(GameObject temp)
	{
	}

	public void eraseProfile()
	{
		chestOpenedNum = 0;
		mainMenu.use.chestOpenedNum = chestOpenedNum;
	}

	public void LoadRes()
	{
		ManageResources();
	}

	public void startState()
	{
		SetLanguage(LOCALIZATION.en);
		MonoBehaviour.print("Creating a new game state");
		Messenger.AddListener<bool>("gamePaused", pauseHandler);
		Messenger.AddListener("eraseProfile", eraseProfile);
		Messenger.CoAddListener("startGame", startGame);
		Messenger.Broadcast("gamePaused", arg1: false);
		heroContainer.use.heroCollectionINI();
		GetPrefs();
		new resManager();
	}

	public void SetLanguage(LOCALIZATION _localization)
	{
		this._localization = _localization;
		switch (_localization)
		{
		case LOCALIZATION.en:
			xmlParser.Instance.currentPath = "localization/eng";
			break;
		case LOCALIZATION.ru:
			xmlParser.Instance.currentPath = "localization/ru";
			break;
		}
	}

	public void pauseHandler(bool val)
	{
		isGamePaused = val;
	}

	public void ManageResources()
	{
		if (!resManaged)
		{
			res.facebookHero_dict.Add("paladin", new heroFacebookContainer("faceBook_hero_paladin.png", "paladin"));
			res.facebookHero_dict.Add("vampire", new heroFacebookContainer("faceBook_hero_vampire.png", "vampire"));
			res.facebookHero_dict.Add("brewer", new heroFacebookContainer("faceBook_hero_brewer.png", "brewer"));
			res.facebookHero_dict.Add("assassin", new heroFacebookContainer("faceBook_hero_assassin.png", "assassin"));
			res.facebookHero_dict.Add("alchemist", new heroFacebookContainer("faceBook_hero_alchemist.png", "alchemist"));
			res.menus.Add("noteMenu_eraseProfile", Resources.Load("noteMenus/notifyMenu_eraseProfile") as GameObject);
			res.menus.Add("noteMenu_message", Resources.Load("noteMenus/notifyMenu_message") as GameObject);
			res.menus.Add("loadingSplash", Resources.Load("prefabs/loadingSplash") as GameObject);
			res.menus.Add("fullGUI", Resources.Load("prefabs/fullGUI") as GameObject);
			res.menus.Add("tip_anvil", Resources.Load("tips/tip_anvil") as GameObject);
			res.menus.Add("tip_fish", Resources.Load("tips/tip_fish") as GameObject);
			res.menus.Add("miniGame_anvil", Resources.Load("prefabs/miniGame_anvil") as GameObject);
			res.menus.Add("miniGame_fish", Resources.Load("prefabs/miniGame_fishing") as GameObject);
			res.menus.Add("quest_end", Resources.Load("noteMenus/questEnd") as GameObject);
			res.menus.Add("quest_message", Resources.Load("noteMenus/questMessage") as GameObject);
			res.menus.Add("menu_greedyDoor", Resources.Load("noteMenus/menu_greedyDoor") as GameObject);
			res.menus.Add("menu_challengeDoor", Resources.Load("noteMenus/menu_challengeDoor") as GameObject);
			res.menus.Add("menu_arenaFinished", Resources.Load("noteMenus/menu_arenaFinished") as GameObject);
			res.menus.Add("arenaMenu", Resources.Load("noteMenus/menu_arena") as GameObject);
			res.menus.Add("notify_wantToQuit", Resources.Load("noteMenus/notify_wantToQuit") as GameObject);
			res.menus.Add("menu_weaponUpgrade", Resources.Load("noteMenus/menu_weaponUpgrade") as GameObject);
			res.menus.Add("helpMenu_crystalls", Resources.Load("noteMenus/helpMenu_crystalls") as GameObject);
			res.menus.Add("loadHandler", Resources.Load("prefabs/loadHandler") as GameObject);
			res.menus.Add("notifyMenu_transact", Resources.Load("noteMenus/notify_restoreBuyMenu") as GameObject);
			res.menus.Add("notifyMenu_inGameUpgrade", Resources.Load("noteMenus/notifyMenu_inGameUpgrade") as GameObject);
			res.menus.Add("notify_littleTut", Resources.Load("noteMenus/notify_littleTut") as GameObject);
			res.menus.Add("notify_rate_app", Resources.Load("noteMenus/notify_rate_app") as GameObject);
			res.menus.Add("notify_loginFacebook", Resources.Load("noteMenus/notify_loginFacebook") as GameObject);
			res.menus.Add("notify_statue", Resources.Load("noteMenus/notify_statue") as GameObject);
			res.menus.Add("notifyMenu_messageWithSprite", Resources.Load("noteMenus/notifyMenu_messageWithSprite") as GameObject);
			res.menus.Add("notifyMenu_monsterHandbook", Resources.Load("noteMenus/notifyMenu_monsterHandbook") as GameObject);
			res.menus.Add("notifyMenu_weaponInfo", Resources.Load("noteMenus/notifyMenu_weaponInfo") as GameObject);
			res.menus.Add("achievement", Resources.Load("noteMenus/achievementPrefab") as GameObject);
			res.heroes.Add("paladinHero", Resources.Load("!heroes/paladin") as GameObject);
			res.heroes.Add("vampireHero", Resources.Load("!heroes/vampire") as GameObject);
			res.heroes.Add("brewerHero", Resources.Load("!heroes/brewer") as GameObject);
			res.heroes.Add("assassinHero", Resources.Load("!heroes/assassin") as GameObject);
			res.heroes.Add("alchemistHero", Resources.Load("!heroes/alchemist") as GameObject);
			res.enemies.Add("meatman", Resources.Load("!mobs/meatman") as GameObject);
			res.enemies.Add("bat", Resources.Load("!mobs/bat") as GameObject);
			res.enemies.Add("skeleton", Resources.Load("!mobs/skeleton") as GameObject);
			res.enemies.Add("rogue", Resources.Load("!mobs/rogue") as GameObject);
			res.enemies.Add("spirit_fire", Resources.Load("!mobs/spirit_fire") as GameObject);
			res.enemies.Add("sheep", Resources.Load("!mobs/sheep") as GameObject);
			res.enemies.Add("spirit_shield", Resources.Load("!mobs/spirit_shield") as GameObject);
			res.enemies.Add("zombie", Resources.Load("!mobs/zombie") as GameObject);
			res.enemies.Add("goblin", Resources.Load("!mobs/goblin") as GameObject);
			res.enemies.Add("goblinArcher", Resources.Load("!mobs/goblinArcher") as GameObject);
			res.enemies.Add("skeletonMage", Resources.Load("!mobs/skeletonMage") as GameObject);
			res.enemies.Add("sliz", Resources.Load("!mobs/sliz") as GameObject);
			res.enemies.Add("black_knight", Resources.Load("!mobs/black_knight") as GameObject);
			res.enemies.Add("golem_stone", Resources.Load("!mobs/golem_stone") as GameObject);
			res.enemies.Add("zombieCow", Resources.Load("!mobs/zombieCow") as GameObject);
			res.enemies.Add("spirit_healer", Resources.Load("!mobs/spirit_healer") as GameObject);
			res.enemies.Add("demonPig", Resources.Load("!mobs/demonPig") as GameObject);
			res.enemies.Add("enemySpirit", Resources.Load("!mobs/spirit") as GameObject);
			res.enemies.Add("pet_mob", Resources.Load("!mobs/pet_mob") as GameObject);
			res.enemies.Add("evilMushroom", Resources.Load("!mobs/evilMushroom") as GameObject);
			res.enemiesUnique.Add("ogreKing", Resources.Load("!mobs/ogre") as GameObject);
			res.enemiesUnique.Add("goblinKing", Resources.Load("!mobs/gobKing") as GameObject);
			res.enemiesUnique.Add("pesant", Resources.Load("!mobs/pesant") as GameObject);
			res.fxs.Add("hero_levelUp", Resources.Load("fx/fx_levelUp") as GameObject);
			res.fxs.Add("holyStrike", Resources.Load("fx/fx_holyStrike") as GameObject);
			res.fxs.Add("holyShield", Resources.Load("fx/fx_shield") as GameObject);
			res.fxs.Add("ressurection", Resources.Load("fx/fx_ressurection") as GameObject);
			res.fxs.Add("bloodDrain", Resources.Load("fx/fx_bloodDrain") as GameObject);
			res.fxs.Add("undeadSympathy", Resources.Load("fx/fx_undeadSympathy") as GameObject);
			res.fxs.Add("batSwarm", Resources.Load("fx/fx_batman") as GameObject);
			res.fxs.Add("skull", Resources.Load("fx/fx_skull") as GameObject);
			res.fxs.Add("fx_fireAOE", Resources.Load("fx/fx_fireAOE") as GameObject);
			res.fxs.Add("fx_thunder", Resources.Load("fx/fx_thunder") as GameObject);
			res.fxs.Add("fx_wreck", Resources.Load("fx/fx_wreck") as GameObject);
			res.fxs.Add("fx_hp", Resources.Load("fx/fx_hp") as GameObject);
			res.fxs.Add("fx_berseker", Resources.Load("fx/fx_berseker") as GameObject);
			res.fxs.Add("fx_key", Resources.Load("fx/fx_key") as GameObject);
			res.tempObjects.Add("goblinAxe", Resources.Load("prefabs/goblinAxe") as GameObject);
			res.tempObjects.Add("mageSkeletonBolt", Resources.Load("prefabs/mageSkeletonBolt") as GameObject);
			res.tempObjects.Add("challengeDoor", Resources.Load("prefabs/challengeDoor") as GameObject);
			res.tempObjects.Add("greedyDoor", Resources.Load("prefabs/greedyDoor") as GameObject);
			res.tempObjects.Add("arenaDoor", Resources.Load("prefabs/arenaDoor") as GameObject);
			res.tempObjects.Add("particle", Resources.Load("prefabs/particle") as GameObject);
			res.tempObjects.Add("splashEffect", Resources.Load("prefabs/splashEffect") as GameObject);
			res.tempObjects.Add("AdMobAdapter", Resources.Load("prefabs/AdMobAdapter") as GameObject);
			res.tempObjects.Add("spell_inventoryCell", Resources.Load("prefabs/inv_spell") as GameObject);
			res.tempObjects.Add("loot_inventoryCell", Resources.Load("prefabs/inv_loot") as GameObject);
			manageBioms();
			res.music.Add("titleMusic", Resources.Load("sounds/dungelot_ost_titles") as AudioClip);
			res.music.Add("horn", Resources.Load("sounds/Start 3") as AudioClip);
			res.music.Add("dungelotost_soundtrack1", Resources.Load("sounds/soundtrack2") as AudioClip);
			res.music.Add("chestOpen", Resources.Load("sounds/chestOpen") as AudioClip);
			res.music.Add("chestOpen2", Resources.Load("sounds/chestOpen2") as AudioClip);
			res.music.Add("block1", Resources.Load("sounds/Blok1") as AudioClip);
			res.music.Add("block2", Resources.Load("sounds/Blok2") as AudioClip);
			res.music.Add("axeThrow", Resources.Load("sounds/axeThrow") as AudioClip);
			res.music.Add("hit_meat1", Resources.Load("sounds/hit_meat1") as AudioClip);
			res.music.Add("hit_meat2", Resources.Load("sounds/hit_meat2") as AudioClip);
			res.music.Add("Vzmah", Resources.Load("sounds/Vzmah") as AudioClip);
			res.music.Add("armorHit1", Resources.Load("sounds/armorHit1") as AudioClip);
			res.music.Add("armorHit2", Resources.Load("sounds/armorHit2") as AudioClip);
			res.music.Add("closeDoor", Resources.Load("sounds/close_door") as AudioClip);
			res.music.Add("Vorota_close", Resources.Load("sounds/Vorota_close") as AudioClip);
			res.music.Add("Vorota_open", Resources.Load("sounds/Vorota_open") as AudioClip);
			res.music.Add("coins_1", Resources.Load("sounds/coins_1") as AudioClip);
			res.music.Add("coin_drop2", Resources.Load("sounds/coin_drop2") as AudioClip);
			res.music.Add("scroll", Resources.Load("sounds/scroll") as AudioClip);
			res.music.Add("DropKey", Resources.Load("sounds/Drop_Gem_01") as AudioClip);
			res.music.Add("Pickup_Key_01", Resources.Load("sounds/Pickup_Key_01") as AudioClip);
			res.music.Add("shade", Resources.Load("sounds/shade15") as AudioClip);
			res.music.Add("Drop_Gem_01", Resources.Load("sounds/Drop_Gem_01") as AudioClip);
			res.music.Add("Drop_Gem_02", Resources.Load("sounds/Drop_Gem_02") as AudioClip);
			res.music.Add("sword-unsheathe", Resources.Load("sounds/sword-unsheathe") as AudioClip);
			res.music.Add("clik", Resources.Load("sounds/clik") as AudioClip);
			res.music.Add("noteQ", Resources.Load("sounds/noteQ") as AudioClip);
			res.music.Add("anvil1", Resources.Load("sounds/blacksmith1") as AudioClip);
			res.music.Add("anvil2", Resources.Load("sounds/blacksmith2") as AudioClip);
			res.music.Add("fishing", Resources.Load("sounds/fishing") as AudioClip);
			res.music.Add("cast", Resources.Load("sounds/cast") as AudioClip);
			res.music.Add("Pfuh", Resources.Load("sounds/Pfuh") as AudioClip);
			res.music.Add("heartBeat", Resources.Load("sounds/heartBeat") as AudioClip);
			res.music.Add("ressurection", Resources.Load("sounds/ressurection") as AudioClip);
			res.ma_description.Add("explorer", new miniAchievement("explorer", 25, "explorer"));
			res.ma_description.Add("adventurer", new miniAchievement("adventurer", 40, "adventurer"));
			res.ma_description.Add("hero", new miniAchievement("hero", 80, "hero"));
			res.ma_description.Add("legend", new miniAchievement("legend", 150, "legend"));
			res.ma_description.Add("unlucky", new miniAchievement("unlucky", 15, "unlucky"));
			res.ma_description.Add("salvager", new miniAchievement("salvager", 25, "salvager"));
			res.ma_description.Add("looter", new miniAchievement("looter", 40, "looter"));
			res.ma_description.Add("armed&dangerous", new miniAchievement("dangerous", 75, "armed&dangerous"));
			res.ma_description.Add("masterLooter", new miniAchievement("master looter", 80, "masterLooter"));
			res.ma_description.Add("masterQuest", new miniAchievement("helpful", 100, "masterQuest"));
			res.ma_description.Add("ally", new miniAchievement("ally", 50, "ally"));
			res.ma_description.Add("masterArena", new miniAchievement("gladiator", 150, "masterArena"));
			res.ma_description.Add("lucky", new miniAchievement("lucky", 150, "lucky"));
			res.ma_description.Add("appertience", new miniAchievement("apprentice", 35, "appertience"));
			res.ma_description.Add("disciple", new miniAchievement("disciple", 50, "disciple"));
			res.ma_description.Add("mage", new miniAchievement("mage", 75, "mage"));
			res.ma_description.Add("archimage", new miniAchievement("archimage", 100, "archimage"));
			res.ma_description.Add("peasant", new miniAchievement("peasant", 15, "peasant"));
			res.ma_description.Add("squire", new miniAchievement("squire", 30, "squire"));
			res.ma_description.Add("warrior", new miniAchievement("warrior", 60, "warrior"));
			res.ma_description.Add("knight", new miniAchievement("knight", 90, "knight"));
			res.ma_description.Add("berseker", new miniAchievement("berserker", 120, "berseker"));
			res.ma_description.Add("monster_slayer", new miniAchievement("monster slayer", 160, "monster_slayer"));
		}
		MonoBehaviour.print("Resorces Loaded.....gameState.cs");
	}

	private void changeLayer(GameObject g, int layerVal)
	{
		g.layer = layerVal;
		foreach (Transform item in g.transform)
		{
			item.gameObject.layer = layerVal;
			changeLayer(item.gameObject, layerVal);
		}
	}

	public IEnumerator showObject(item_loot _item, Vector3 p)
	{
		Vector3 pos = p;
		GameObject o = UnityEngine.Object.Instantiate(guiController.use.miskObjects["icon"], new Vector3(pos.x, pos.y, pos.z - 1f), Quaternion.identity) as GameObject;
		Transform tr = o.transform;
		tk2dSprite iconSprite = o.GetComponent<tk2dSprite>();
		changeLayer(o, 15);
		iconSprite.SwitchCollectionAndSprite(dungeonManager.use.sprDatas[6], 0);
		iconSprite.color = new Color(0f, 0f, 0f, 1f);
		iconSprite.spriteId = iconSprite.GetSpriteIdByName(_item.sprID);
		if (pos.y < 900f)
		{
			yield return StartCoroutine(tween.use.SlideOffSet(tr, 80f, 0.4f, tween.SIDE.VERT));
		}
		else
		{
			yield return StartCoroutine(tween.use.SlideOffSet(tr, 100f, 0.1f, tween.SIDE.VERT));
			yield return StartCoroutine(tween.use.SlideOffSet(tr, -110f, 0.1f, tween.SIDE.VERT));
			yield return StartCoroutine(tween.use.SlideOffSet(tr, 30f, 0.1f, tween.SIDE.VERT));
			yield return StartCoroutine(tween.use.SlideOffSet(tr, -35f, 0.1f, tween.SIDE.VERT));
		}
		yield return new WaitForSeconds(0.2f);
		for (int t = 4; t > 0; t--)
		{
			iconSprite.color = new Color(0f, 0f, 0f, 0f);
			yield return new WaitForSeconds((float)t * 0.02f);
			iconSprite.color = new Color(0f, 0f, 0f, 1f);
			yield return new WaitForSeconds((float)t * 0.02f);
		}
		iconSprite.color = new Color(0f, 0f, 0f, 0f);
		yield return new WaitForSeconds(0.2f);
		UnityEngine.Object.Destroy(o);
	}

	public void showDescription(int id, string descID, GameObject objPrefab)
	{
		GameObject gameObject = UnityEngine.Object.Instantiate(res.menus["notifyMenu_monsterHandbook"], new Vector3(320f, 480f, 0f), Quaternion.identity) as GameObject;
		notifyMenu_monsterBook component = gameObject.GetComponent<notifyMenu_monsterBook>();
		component.SetMessageMob(res.monstersDescriptionsText_ENG[descID][1], res.monstersDescriptionsText_ENG[descID][0], objPrefab);
		monsterDescriptionCheck[id] = true;
		saveMonsterDescription(id);
	}

	private void manageBioms()
	{
		enemyBiomList.Add("start", new string[3] { "bat", "goblin", "skeleton" });
		enemyBiomList.Add("mid", new string[5] { "bat", "goblin", "skeleton", "sliz", "demonPig" });
		enemyBiomList.Add("mid2", new string[9] { "goblin", "skeleton", "goblinArcher", "sliz", "meatman", "zombie", "demonPig", "enemySpirit", "evilMushroom" });
		enemyBiomList.Add("mid3", new string[11]
		{
			"goblin", "skeleton", "goblinArcher", "sliz", "meatman", "zombie", "skeletonMage", "rogue", "enemySpirit", "demonPig",
			"evilMushroom"
		});
		enemyBiomList.Add("high", new string[14]
		{
			"skeleton", "goblinArcher", "sliz", "meatman", "zombie", "skeletonMage", "rogue", "zombieCow", "black_knight", "golem_stone",
			"goblin", "enemySpirit", "demonPig", "evilMushroom"
		});
	}

	public IEnumerator counter(int amount, tk2dTextMesh curText, int currentValue, Vector2 scaleSize)
	{
		float timer = 0f;
		int _a = 0;
		while (timer < 0.5f)
		{
			timer += Time.deltaTime * 1f;
			curText.text = string.Concat(arg1: Mathf.CeilToInt(Mathf.Lerp(currentValue, amount, timer * 2f)), arg0: string.Empty);
			curText.Commit();
			yield return 0;
		}
		yield return StartCoroutine(tween.use.tk2dScaleText(curText, scaleSize.y, 0.1f));
		yield return StartCoroutine(tween.use.tk2dScaleText(curText, scaleSize.x, 0.1f));
	}

	public void ClearData()
	{
		Instance.monstersKilled = 0;
		Instance.trapsFallen = 0;
		Instance.cellsOpened = 0;
		instance.moodVal = 0;
		Instance.goldBonus = 0;
		Instance.salvageNum = 0;
		Instance.looterNum = 0;
		Instance.questCompleted = 0;
		Instance.allyFind = 0;
		Instance.masterArena = 0;
		Instance.scrollsUsed = 0;
		Instance.ressurected = false;
		antidotBottles = 0;
		_itemWeapon = null;
		inventory_spells.Clear();
		inventory_loot.Clear();
		questObjects_loot.Clear();
	}

	public void SavePrefs()
	{
		PlayerPrefs.SetInt("coins", Instance.coins);
		PlayerPrefs.SetInt("dungeonLevel", Instance.currentDungeonLevel);
		PlayerPrefs.SetInt("monstersKilledNum", Instance.monstersKilledNum);
		PlayerPrefs.SetInt("startDungeon", Instance.startDungeon);
		Debug.Log("SAVED");
	}

	public void SaveSkills(int sk1, int sk2, int sk3, int sk4, string ID)
	{
		string value = sk1 + "_" + sk2 + "_" + sk3 + "_" + sk4;
		PlayerPrefs.SetString(ID + "H_skills", value);
	}

	public void eraseSkills()
	{
		PlayerPrefs.SetString("paladinH_skills", "1_1_1_1");
		PlayerPrefs.SetString("vampireH_skills", "1_1_1_1");
		PlayerPrefs.SetString("brewerH_skills", "1_1_1_1");
		PlayerPrefs.SetString("assassinH_skills", "1_1_1_1");
		PlayerPrefs.SetString("alchemistH_skills", "1_1_1_1");
	}

	public void SaveHeroToContinue(int curLevel)
	{
		string empty = string.Empty;
		empty = heroType.ToString() + "_" + curLevel;
		PlayerPrefs.SetString("cGS", empty);
	}

	public void LoadHeroToContinue()
	{
		string @string = PlayerPrefs.GetString("cGS", "paladin_1");
		string[] array = @string.Split('_');
		heroType = (HEROTYPE_ENUM)(int)Enum.Parse(typeof(HEROTYPE_ENUM), array[0]);
		Instance.tempDungeonNum = Convert.ToInt32(array[1]);
	}

	public void saveMonsterDescription(int num)
	{
		string @string = PlayerPrefs.GetString("_monsterDescription", "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0");
		string[] array = @string.Split('_');
		array[num] = "1";
		string text = string.Empty;
		for (int i = 0; i < array.Length; i++)
		{
			text = ((i != array.Length - 1) ? (text + array[i] + "_") : (text + array[i]));
		}
		PlayerPrefs.SetString("_monsterDescription", text);
	}

	public void GetCheckMonsterDescriptions()
	{
		string @string = PlayerPrefs.GetString("_monsterDescription", "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0");
		string[] array = @string.Split('_');
		for (int i = 0; i < array.Length; i++)
		{
			monsterDescriptionCheck.Add(i, Convert.ToBoolean(Convert.ToInt32(array[i])));
		}
	}

	public void SetErasedCheckMonsterDescriptions()
	{
		string @string = PlayerPrefs.GetString("_monsterDescription", "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0");
		string[] array = @string.Split('_');
		for (int i = 0; i < array.Length; i++)
		{
			monsterDescriptionCheck[i] = Convert.ToBoolean(Convert.ToInt32(array[i]));
		}
	}

	public bool returnMonsterDescriptionVal(int num)
	{
		bool flag = false;
		string @string = PlayerPrefs.GetString("_monsterDescription", "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0");
		string[] array = @string.Split('_');
		return Convert.ToBoolean(Convert.ToInt32(array[num]));
	}

	public int[] LoadSkills(string ID)
	{
		string key = ID + "H_skills";
		string @string = PlayerPrefs.GetString(key, "1_1_1_1");
		string[] array = @string.Split('_');
		int[] array2 = new int[4]
		{
			Convert.ToInt32(array[0]),
			Convert.ToInt32(array[1]),
			Convert.ToInt32(array[2]),
			Convert.ToInt32(array[3])
		};
		checkAchieve(array2);
		return array2;
	}

	public void checkAchieve(int[] nums)
	{
		int num = 0;
		for (int i = 0; i < nums.Length; i++)
		{
			num += nums[i];
		}
		if (num == 16)
		{
			achieveState.Instance.updateAchieve(1, 1f, "grp.SexedUp");
		}
	}

	public void GetPrefs()
	{
		Instance.coins = PlayerPrefs.GetInt("coins", 0);
		Instance.currentDungeonLevel = PlayerPrefs.GetInt("dungeonLevel", 1);
		Instance.monstersKilledNum = PlayerPrefs.GetInt("monstersKilledNum", 0);
		instance.startDungeon = PlayerPrefs.GetInt("startDungeon", 1);
		Instance.firstTime = PlayerPrefs.GetInt("firstTime", 1);
		Instance.continueGame = PlayerPrefs.GetInt("continueGame", 0);
		Debug.Log("Loaded");
	}

	public void ErasePrefs()
	{
		PlayerPrefs.SetInt("coins", 0);
		PlayerPrefs.SetInt("dungeonLevel", 1);
		PlayerPrefs.SetInt("monstersKilledNum", 0);
		PlayerPrefs.SetInt("startDungeon", 1);
		if (instance.continueGame == 1)
		{
			mainMenu.use.buttonContinue.SetActiveRecursively(state: false);
		}
		PlayerPrefs.SetInt("continueGame", 0);
		PlayerPrefs.SetString("_monsterDescription", "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0");
		SetErasedCheckMonsterDescriptions();
		instance.startDungeon = 1;
		coins = 0;
		currentDungeonLevel = 1;
		monstersKilledNum = 0;
		firstTime = 1;
		eraseSkills();
		Debug.Log("Erased");
	}
}