private static void LoadActionsFromFile() { if (!File.Exists(APIActionsListFilePath)) { return; } try { string apiActionsJson = File.ReadAllText(APIActionsListFilePath); if (string.IsNullOrEmpty(apiActionsJson)) { return; } else { APIActions apiActions = JsonConvert.DeserializeObject <APIActions>(apiActionsJson); restrictedActions = apiActions.RestrictedMethods; } } catch (JsonException jex) { log.Error($"Method LoadActionsFromFile FilePath : {APIActionsListFilePath} | Error {jex} occured while reading restricted actions file"); } catch (System.Exception ex) { log.Error($"Method LoadActionsFromFile FilePath : {APIActionsListFilePath} | Error {ex} occured while reading restricted actions file"); } }
// Use this for initialization void Start() { ReturnObject result = APIActions.getSave(); bool status = result.retStatus; SwitchScenes.popupText = result.text; if (status == false) { SwitchScenes.showPopup = true; print("Show popup"); SwitchScenes.GENSTAGE = true; } if (currentSpeed > 0) { int speedo; speedo = (int)GetComponent <PlayerC> ().speed; //print (speedo); //This confirmed the value gotten int addSpeed; addSpeed = (int)((speedSlider.value / 100) * currentSpeed); //print (addSpeed); newSpeed = speedo + addSpeed; //print (newSpeed); } //score = (int)GetComponent<EnemyHealthManager> ().scoreCnt; //print (score); }
public void GetResponseTest() { const string cityString = "Tel aviv"; APIActions apiResponse = new APIActions(); ApiUrlString = String.Format(Base.ApiUrlString + "{0}", cityString + "&appid=" + Base.apiToken); apiResponse.GetResponAndValid(ApiUrlString, "name"); apiResponse.assertJson("Tel aviv", "Tel aviv"); }
// Update is called once per frame void Update() { if (postSave && Time.frameCount == frameCount + 10) { print("posting"); LoadingScreen loadingScreen = FindObjectOfType(typeof(LoadingScreen)) as LoadingScreen; APIActions.postSave(); System.Threading.Thread.Sleep(1000); loadingScreen.show = false; postSave = false; } }
void Death() { isDead = true; print("DEAD ggez"); nextLevel = 1; currentHealth = defaultHealth; currentSpeed = defaultSpeed; currentDamage = defaultDamage; currentDefense = defaultDefense; APIActions.postSave(); SceneManager.LoadScene("GameOver"); }
private void createUser() { ReturnObject result = APIActions.createUser(username, email, password); bool status = result.retStatus; popupText = result.text; if (status == true) { GENSTAGE = true; frameCount = Time.frameCount; APIActions.login(username, password); } else { showPopup = true; } }
private void loadGame() { ReturnObject result = APIActions.login(username, password); bool status = result.retStatus; popupText = result.text; if (status == true) { //SceneManager.LoadScene ("Ana'esNEWLevel"); GENSTAGE = true; frameCount = Time.frameCount; } else { showPopup = true; } }
// Update is called once per frame void Update() { if (GENSTAGE && Time.frameCount == frameCount + 30) { print("Generating..."); try { Player player = FindObjectOfType(typeof(Player)) as Player; if (SceneManager.GetActiveScene().name == "HUBWorld") { fromHub = true; } else { player.nextLevel += 1; } ReturnObject result = APIActions.postSave(); bool status = result.retStatus; popupText = result.text; if (status == false) { showPopup = true; } } catch (Exception ex) { print(ex); } LoadingScreen loadingScreen = FindObjectOfType(typeof(LoadingScreen)) as LoadingScreen; loadingScreen.show = true; Time.timeScale = 0; //SceneManager.LoadScene("Ana'esNEWLevel"); GENSTAGE = false; LOADSTAGE = true; frameCount = Time.frameCount; } if (LOADSTAGE && Time.frameCount == frameCount + 30) { SceneManager.LoadScene("Ana'esNEWLevel"); LOADSTAGE = false; GENPLAYER = true; frameCount = Time.frameCount; } if (GENPLAYER && Time.frameCount == frameCount + 30) { print("player time..."); Instantiate(prePlayer); ui = GameObject.Find("HUDCanvas"); ui.SetActive(false); GENPLAYER = false; SETSTAGE = true; frameCount = Time.frameCount; } if (SETSTAGE && Time.frameCount == frameCount + 30) { print("Setting..."); Player player = FindObjectOfType(typeof(Player)) as Player; if (player.nextLevel == 1 && !fromHub) { SceneManager.LoadScene("HUBWorld"); } else { stageHeight = player.nextLevel + 1; stageWidth = player.nextLevel + 1; print("Width " + stageWidth + " Hight " + stageHeight); StageGeneratorScript stageGen = FindObjectOfType(typeof(StageGeneratorScript)) as StageGeneratorScript; stageGen.stageHeight = stageHeight; stageGen.stageWidth = stageWidth; SETSTAGE = false; stageGen.GenerateStage(); fromHub = false; ui.SetActive(true); } LoadingScreen loadingScreen = FindObjectOfType(typeof(LoadingScreen)) as LoadingScreen; loadingScreen.show = false; //ui.SetActive (true); Time.timeScale = 1; } }