private void OnEnable() { myTarget = (DiscManager)target; //myTarget.allDiscs.Clear(); /*foreach (Transform child in myTarget.transform) * { * myTarget.allDiscs.Add(child.GetComponent<DiscScript>()); * }*/ }
// Use this for initialization void Start() { myDM = GetComponent(typeof(DiscManager)) as DiscManager; TouchZoneLeft = new Rect(0, Text_Up.height, Screen.width * 0.33f, Screen.height - Text_Up.height); TouchZoneMiddle = new Rect(Screen.width * 0.33f, Text_Up.height, Screen.width * 0.33f, Screen.height - Text_Up.height); TouchZoneRight = new Rect(Screen.width * 0.66f, Text_Up.height, Screen.width * 0.34f, Screen.height - Text_Up.height); nbMoves = PlayerPrefs.GetInt("CurrentScore"); int myStyle = PlayerPrefs.GetInt("LastSkinChoosen"); CreateSet(myStyle); myDM.Initialize(); switch (PlayerPrefs.GetInt("LastDifficultyChoosen")) { case 0: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore5"); break; case 1: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore6"); break; case 2: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore7"); break; case 3: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore8"); break; case 4: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore9"); break; case 5: bestScoreForThatDifficulty = PlayerPrefs.GetInt("BestScore10"); break; default: break; } }
public ActionResult Delete(string id) { if (!DiscManager.Exist(id)) { return(RedirectToAction("NotFound", "Error")); } else { string image = Server.MapPath("~/Content/Discovery/" + _db.tbl_Discovery.SingleOrDefault(s => s.disc_Id == id).disc_Image); if (System.IO.File.Exists(image)) { System.IO.File.Delete(image); } } DiscManager.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Create(ManageDiscViewModel model, System.Web.HttpPostedFileBase file) { if (!ModelState.IsValid) { return(View(model)); } if (!MovieManager.Exist(model.Movie)) { ModelState.AddModelError("", "输入的电影不存在,请输入正确的电影编号"); return(View()); } if (file != null && file.ContentLength > 0) { var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Discovery/"), System.IO.Path.GetFileName(file.FileName)); file.SaveAs(fileName); model.Image = System.IO.Path.GetFileName(file.FileName); } DiscManager.Create(model); return(RedirectToAction("Index")); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } SetUpPools(); #region TEST DiscScript[] alreadyInGameDiscs = FindObjectsOfType <DiscScript>(); foreach (DiscScript disc in alreadyInGameDiscs) { inGameDiscs.Add(disc); } #endregion }