void Start() { FingerGestures.OnFingerTap += FingerGestures_OnFingerTap; bool noError; noError = PListManager.ParsePListFile(gameData.text, ref gameDataTable); if (noError) { allPositions = (Hashtable)gameDataTable["positions"]; availableAnimals = (ArrayList)gameDataTable["availableAnimals"]; } else { //next game AGGameState.loadNextGameInLoop(AGGameIndex.k_MemoryAnimal); } dataManager = new MADataManager(AGGameIndex.k_MemoryAnimal, 0, progression.text); ickyAnimations = ickyModel.GetComponent <MAIckyAnimations>(); nextQuestion(); }
public IEnumerator LoadPList() { //Load plist WWW www = new WWW(PListStaticURL); yield return(www); if (www.error != null) { Debug.Log(www.error); return(false); } //Parse plist Hashtable hashTable = new Hashtable(); PListManager.ParsePListText(www.text, ref hashTable); Debug.Log("start parse"); foreach (object key in hashTable.Keys) { if (key.Equals(CurrentStaticVersionNumber)) { Debug.Log("found PLIST version..." + key); Hashtable adTable = (Hashtable)hashTable[key]; adOnLoad1 = (AdValue)(adTable["AD_ON_LOAD1"]); adOnLoad2 = (AdValue)(adTable["AD_ON_LOAD2"]); adOnLoadFail = (AdValue)(adTable["AD_ON_LOAD_FAIL"]); adOnPause1 = (AdValue)(adTable["AD_ON_PAUSE1"]); adOnPause2 = (AdValue)(adTable["AD_ON_PAUSE2"]); adOnPauseFail = (AdValue)(adTable["AD_ON_PAUSE_FAIL"]); adOnReturn1 = (AdValue)(adTable["AD_ON_RETURN1"]); adOnReturn2 = (AdValue)(adTable["AD_ON_RETURN2"]); adOnReturnFail = (AdValue)(adTable["AD_ON_RETURN_FAIL"]); adOnGameOver1 = (AdValue)(adTable["AD_ON_GAMEOVER1"]); adOnGameOver2 = (AdValue)(adTable["AD_ON_GAMEOVER2"]); adOnGameOverFail = (AdValue)(adTable["AD_ON_GAMEOVER_FAIL"]); adBanner1 = (AdValue)(adTable["AD_BANNER1"]); adBanner2 = (AdValue)(adTable["AD_BANNER2"]); adBannerFail = (AdValue)(adTable["AD_BANNER_FAIL"]); adMoreGames1 = (AdValue)(adTable["AD_MORE_GAMES1"]); adMoreGames2 = (AdValue)(adTable["AD_MORE_GAMES2"]); adMoreGamesFail = (AdValue)(adTable["AD_MORE_GAMES_FAIL"]); adInReview = (AdValue)(adTable["AD_IN_REVIEW"]); Debug.Log("loaded PLIST complete"); break; //found version...exit loop } } Debug.Log(adInReview); Debug.Log("End of plist loading..."); }
public void loadDataForAllGames(string file) { progressionData = null; bool noError = PListManager.ParsePListFile(file, ref progressionData); if (noError) { allCateriesData = (ArrayList)progressionData["PreSchoolGames"]; } else { Debug.Log("cannot access progression data"); } }
public void loadCategoryResources(string _resourcesData) { Hashtable localData = null; bool noError = PListManager.ParsePListFile(_resourcesData, ref localData); if (noError) { resourcesData = (Hashtable)localData["Resources"]; } else { Debug.Log("cannot access progression data"); } categoryDataResources = (Hashtable)resourcesData[catergoryName]; }
// -------- read plist data void parsePlist() { allPositionsHashTable = new ArrayList(); bool noError; noError = PListManager.ParsePListFile(gameData.text, ref gameDataTable); if (noError) { allHidingSpots = (ArrayList)gameDataTable["AllHidingSpots"]; } Debug.Log("AllHidingSpots: " + allHidingSpots); for (int i = 0; i < allHidingSpots.Count; i++) { allPositionsHashTable.Add(allHidingSpots[i]); Debug.Log("Hiding Spot: " + allHidingSpots[i]); } }
// ----------------- LOAD PLIST INTO MEMORY ------------------- public IEnumerator LoadPList() { //Load plist WWW www = new WWW(PListStaticURL); yield return(www); if (www.error != null) { Debug.Log(www.error); yield break; } //Parse plist Hashtable hashTable = new Hashtable(); PListManager.ParsePListText(www.text, ref hashTable); Debug.Log("start parse"); foreach (object key in hashTable.Keys) { if (key.Equals(CurrentStaticVersionNumber)) { Debug.Log("found PLIST version..." + key); Hashtable adTable = (Hashtable)hashTable[key]; //NEW AD_BOOT_UP_ON = (AdValue)(adTable["AD_BOOT_UP_ON"]); AD_BOOT_UP_1 = (AdValue)(adTable["AD_BOOT_UP_1"]); AD_BOOT_UP_2 = (AdValue)(adTable["AD_BOOT_UP_2"]); AD_BOOT_UP_3 = (AdValue)(adTable["AD_BOOT_UP_3"]); AD_BOOT_UP_4 = (AdValue)(adTable["AD_BOOT_UP_4"]); AD_BOOT_UP_5 = (AdValue)(adTable["AD_BOOT_UP_5"]); AD_PAUSE_ON = (AdValue)(adTable["AD_PAUSE_ON"]); AD_PAUSE_1 = (AdValue)(adTable["AD_PAUSE_1"]); AD_PAUSE_2 = (AdValue)(adTable["AD_PAUSE_2"]); AD_PAUSE_3 = (AdValue)(adTable["AD_PAUSE_3"]); AD_PAUSE_4 = (AdValue)(adTable["AD_PAUSE_4"]); AD_PAUSE_5 = (AdValue)(adTable["AD_PAUSE_5"]); AD_GAMEOVER_ON = (AdValue)(adTable["AD_GAMEOVER_ON"]); AD_GAMEOVER_1 = (AdValue)(adTable["AD_GAMEOVER_1"]); AD_GAMEOVER_2 = (AdValue)(adTable["AD_GAMEOVER_2"]); AD_GAMEOVER_3 = (AdValue)(adTable["AD_GAMEOVER_3"]); AD_GAMEOVER_4 = (AdValue)(adTable["AD_GAMEOVER_4"]); AD_GAMEOVER_5 = (AdValue)(adTable["AD_GAMEOVER_5"]); AD_RETURN_ON = (AdValue)(adTable["AD_RETURN_ON"]); AD_RETURN_1 = (AdValue)(adTable["AD_RETURN_1"]); AD_RETURN_2 = (AdValue)(adTable["AD_RETURN_2"]); AD_RETURN_3 = (AdValue)(adTable["AD_RETURN_3"]); AD_RETURN_4 = (AdValue)(adTable["AD_RETURN_4"]); AD_RETURN_5 = (AdValue)(adTable["AD_RETURN_5"]); AD_BANNER_ON = (AdValue)(adTable["AD_BANNER_ON"]); AD_BANNER_1 = (AdValue)(adTable["AD_BANNER_1"]); AD_BANNER_2 = (AdValue)(adTable["AD_BANNER_2"]); AD_BANNER_3 = (AdValue)(adTable["AD_BANNER_3"]); AD_BANNER_4 = (AdValue)(adTable["AD_BANNER_4"]); AD_BANNER_5 = (AdValue)(adTable["AD_BANNER_5"]); AD_MOREGAMES_ON = (AdValue)(adTable["AD_MOREGAMES_ON"]); AD_MOREGAMES_1 = (AdValue)(adTable["AD_MOREGAMES_1"]); AD_MOREGAMES_2 = (AdValue)(adTable["AD_MOREGAMES_2"]); AD_MOREGAMES_3 = (AdValue)(adTable["AD_MOREGAMES_3"]); AD_MOREGAMES_4 = (AdValue)(adTable["AD_MOREGAMES_4"]); AD_MOREGAMES_5 = (AdValue)(adTable["AD_MOREGAMES_5"]); Debug.Log("loaded PLIST complete"); break; //found version...exit loop } } Debug.Log("End of plist loading..."); }
public void ParsePolygonsFromFile() { this.ClearBodiesList(); if (PlistPath == null) { return; } Hashtable plistData = new Hashtable(); PListManager.ParsePListFile(PlistPath.text, ref plistData); Hashtable bodies = plistData["bodies"] as Hashtable; if (bodies == null) { Debug.Log("Bodies not found"); } ArrayList keyNames = new ArrayList(bodies.Keys); _totalPolygonsinFile = new PolygonObject[keyNames.Count]; if (keyNames != null) { for (int i = 0; i < keyNames.Count; i++) { _totalPolygonsinFile[i] = new PolygonObject(); _totalPolygonsinFile[i].bodyname = keyNames[i] as String; Hashtable bodyDic = bodies[keyNames[i]] as Hashtable; ArrayList fixtures = bodyDic["fixtures"] as ArrayList; var totalPaths = new List <PolygonPath>(); for (var f = 0; f < fixtures.Count; f++) { var fixture = fixtures[f] as Hashtable; if (fixture == null) { continue; } var polygonsArray = fixture["polygons"] as ArrayList; if (polygonsArray == null) { continue; } for (int j = 0; j < polygonsArray.Count; j++) { ArrayList pointArray = polygonsArray[j] as ArrayList; PolygonPath tempPath = new PolygonPath(); Vector2[] pointsVector = new Vector2[pointArray.Count]; for (int k = 0; k < pointsVector.Length; k++) { string pointInString = pointArray[k] as String; pointsVector[k] = this.ConvertToVector2FromString(pointInString); } tempPath.points = pointsVector; totalPaths.Add(tempPath); } } _totalPolygonsinFile[i].paths = totalPaths.ToArray(); } Array.Sort(_totalPolygonsinFile); this.setPolygonOfIndex(selectedIndex); } else { Debug.Log("Keys not found"); } }
public void ParsePolygonsFromFile() { this.ClearBodiesList(); if (PlistPath == null) { return; } Hashtable plistData = new Hashtable(); PListManager.ParsePListFile(PlistPath.text, ref plistData); Hashtable bodies = plistData["bodies"] as Hashtable; if (bodies == null) { Debug.Log("Bodies not found"); } ArrayList keyNames = new ArrayList(bodies.Keys); _totalPolygonsinFile = new PolygonObject[keyNames.Count]; if (keyNames != null) { for (int i = 0; i < keyNames.Count; i++) { _totalPolygonsinFile[i] = new PolygonObject(); _totalPolygonsinFile[i].bodyname = keyNames[i] as String; Hashtable bodyDic = bodies[keyNames[i]] as Hashtable; /*Using single fixture because unity support single fixture*/ ArrayList fixtures = bodyDic["fixtures"] as ArrayList; Hashtable fixture1 = fixtures[0] as Hashtable; ArrayList polygonsArray = fixture1["polygons"] as ArrayList; PolygonPath[] totalPaths = new PolygonPath[polygonsArray.Count]; for (int j = 0; j < totalPaths.Length; j++) { ArrayList pointArray = polygonsArray[j] as ArrayList; PolygonPath tempPath = new PolygonPath(); Vector2[] pointsVector = new Vector2[pointArray.Count]; for (int k = 0; k < pointsVector.Length; k++) { string pointInString = pointArray[k] as String; pointsVector[k] = this.ConvertToVector2FromString(pointInString); } tempPath.points = pointsVector; totalPaths[j] = tempPath; } _totalPolygonsinFile[i].paths = totalPaths; } Array.Sort(_totalPolygonsinFile); this.setPolygonOfIndex(selectedIndex); } else { Debug.Log("Keys not found"); } }