//---------- SET CURRENT -------------- //set outside of this file - usually with a level initializer public static void setCurrentLevel(string id) { foreach (LevelObj i in allLevelsData) { if (id == i.key) { currentLevelKey = i.key; currentLevelDataFilePath = i.filePath; currentLevelData = i.data; } } initializeLevelItems(); }
public static void setLevelDataToDefault() { currentLevelData = null; currentLevelKey = null; currentLevelDataFilePath = null; allLevelsData = new List <LevelObj>();; l1 = new LevelObj(); l2 = new LevelObj(); l3 = new LevelObj(); gameData = new GameDataObj(); gameData.defaultAchievementsMisssions(); gameLog = ""; initLevelDataDefaults(); saveAllLevelDataFiles(); }
// Use this for initialization void Start() { //set references countryMapOriginalLoc = countryPanel.transform.position; countryMapOriginalRot = countryPanel.transform.eulerAngles; countryDeployButton.GetComponent <RectTransform>().transform.localScale = new Vector3(0, 0, 0); countryDetailsLocShow = countryDetails.transform.localPosition.x; countryDetailsLocHidden = countryDetailsLocShow + 8500; Vector3 tmp = countryDetails.transform.localPosition; tmp.x = countryDetailsLocHidden; countryDetails.transform.localPosition = tmp; ccBones = countryCompletedBones.GetComponent <UnityEngine.UI.Text> (); LeanTween.scale(countryDeployButton.GetComponent <RectTransform>(), new Vector3(0, 0, 0), 1.0f); //data country_data = GameManager.getLevelData(data_key); //logic countryLocked = !unlockedCheck(); ui_setCountryState(); ui_lockButtonOff(); //GameManager.log ("country lock: " + countryLocked); UI_boneCountObj = UI_boneCount.GetComponent <UnityEngine.UI.Text> (); purchPan = purchasePanel.GetComponent <PanelPurchase> (); }
//------------ LOADING DATA --------------- public static void loadLevelDataFile(string lvl) { foreach (LevelObj i in allLevelsData) { if (i.key == lvl) { if (File.Exists(i.filePath)) { BinaryFormatter bf = new BinaryFormatter(); FileStream fs = File.Open(i.filePath, FileMode.Open); BasicLevelDataSerializable tmp = (BasicLevelDataSerializable)bf.Deserialize(fs); i.data = tmp; fs.Close(); } else { //log ("loadLevelDataFile() - file does not exist for: " + lvl); } } } }