public bool loadItem(int saveID = 0) //0,1,2号码的存档 { if (saveID > 9 || saveID < 0) { return(false); } string thePath = getPath(saveID); if (!File.Exists(thePath)) { //print ("The path is not right : " + thePath); return(false); } string informationGet = loadInformation(thePath); if (string.IsNullOrEmpty(informationGet)) { //读取的信息不能用 return(false); } //int theItemID = Convert.ToInt32 (informationGet); //更丰富的独挡方式 int theItemID = getLoadInformation(informationGet); int thePlotID = theItemID / 100000; //销毁并且重新建立一棵树 thePlot controller = this.GetComponent <thePlot> (); for (int i = 0; i < controller.roots.Count; i++) { DestroyImmediate(controller.roots [i].gameObject); } controller.roots = new List <thePlotItem> (); controller.thePlotNow = Resources.Load <TextAsset>("thePlots/thePlot" + thePlotID); controller.makeAllStart(); // //根据ID查找对应的item thePlotItem [] allItemNow = controller.GetComponentsInChildren <thePlotItem>(); thePlotItem nowUse = null; //print ("loadAll = " + allItemNow.Length); for (int i = 0; i < allItemNow.Length; i++) { //print ("----" + allItemNow [i].ThePlotItemID + "------" + theItemID); if (allItemNow [i].ThePlotItemID == theItemID) { nowUse = allItemNow [i]; break; } } if (nowUse != null) { controller.GetComponent <choiceController> ().shutSelect(); controller.playTheItem(nowUse); } return(true); }
//注意这个按钮的代码需要与startButton的代码同步 //这是前期设计上的一个问题,后期还需要修正 void Start() { theDataController = theAllController.GetComponent <saveLoadController> (); thePlotController = theAllController.GetComponent <thePlot> (); pictureMaker = theAllController.GetComponent <saveLoadPicture> (); theShowTimeText = this.GetComponentInChildren <Text> (); if (theShowTimeText) { theShowTimeText.text = "空档"; } //saveLoadPicture名字是固定的 theSavePicture = this.transform.Find("saveLoadPicture").GetComponent <Image>(); pictureMaker.getCamera(); makeFlash(); }
//这个用于强制跳转 public void loadItemForSkip(int aimID) //0,1,2号码的存档 { //print ("dddd"); int theItemID = aimID; int thePlotID = theItemID / 100000; //print ("the name is thePlot"+ thePlotID); //销毁并且重新建立一棵树 thePlot controller = this.GetComponent <thePlot> (); for (int i = 0; i < controller.roots.Count; i++) { DestroyImmediate(controller.roots [i].gameObject); } controller.roots = new List <thePlotItem> (); controller.thePlotNow = Resources.Load <TextAsset>("thePlots/thePlot" + thePlotID); if (controller.thePlotNow == null) { return; } //print ("---------\n"+controller .thePlotNow .text); controller.makeAllStart(); // //根据ID查找对应的item thePlotItem [] allItemNow = controller.GetComponentsInChildren <thePlotItem>(); thePlotItem nowUse = null; //print ("loadAll = " + allItemNow.Length); for (int i = 0; i < allItemNow.Length; i++) { //print ("----" + allItemNow [i].ThePlotItemID + "------" + theItemID); if (allItemNow [i].ThePlotItemID == theItemID) { nowUse = allItemNow [i]; break; } } if (nowUse != null) { controller.playTheItem(nowUse); } }
void Start() { theDataController = theAllController.GetComponent <saveLoadController> (); thePlotController = theAllController.GetComponent <thePlot> (); }