void Start() { LearningSysInfo.LoadSavedLinkOfSL(); situationtxt = AllStatics.CurrentUser + "girlpos";//获取当前账户名用于设置此账户的角色位置信息存储 thegirl = GameObject.FindGameObjectWithTag("Local Player"); FileInfo file = new FileInfo(Application.dataPath + "/" + situationtxt + ".txt"); if (file.Exists) { PosRead = true; PosSettled = false; mystringget = mytxtIO.GetmyStringList(situationtxt); Savedpos.x = float.Parse(mystringget[0]); Savedpos.y = float.Parse(mystringget[1]); Savedpos.z = float.Parse(mystringget[2]); transform.position = Savedpos; PosSettled = true; GameObject.Find("NavDesAwakeSettings").GetComponent <SetNavDesButton>().NavDesSet(this.name); AllStatics.NeedShowIntroduce = false; file.Delete(); } else { CoverImage.GetComponent <LoadingControl>().ActiveThis();//关闭加载界面 Destroy(gameObject, 0f); } }
private void Start()//加载时应读取三种类型的课程中各自的课程列表,等待DataLoad调用设置课程函数 { LearningSysInfo.LoadLocalClasses(); //下面按顺序读取课程中的三类课程 for (int i = 0; i < LearningSysInfo.Lessons.ToArray().Length; i++) { if (LearningSysInfo.Lessons[i].CourseType == 1 && !LearningSysInfo.Lessons[i].Learnt) { LearningSysInfo.CurrentAllNeedLesson = LearningSysInfo.Lessons[i]; break; } } for (int i = 0; i < LearningSysInfo.Lessons.ToArray().Length; i++) { if (LearningSysInfo.Lessons[i].CourseType == 2 && !LearningSysInfo.Lessons[i].Learnt) { LearningSysInfo.CurrentMajorNeedLesson = LearningSysInfo.Lessons[i]; break; } } for (int i = 0; i < LearningSysInfo.Lessons.ToArray().Length; i++) { if (LearningSysInfo.Lessons[i].CourseType == 3 && !LearningSysInfo.Lessons[i].Learnt) { LearningSysInfo.CurrentElectLesson = LearningSysInfo.Lessons[i]; break; } } }
private void SaveCurrentInfo() { switch (SceneManager.GetActiveScene().name)//离开某个界面时,存储属于该界面的信息 { case "Start Menu": break; case "NewGame": LocalInformation.RebuildData(); //删除已存储的信息 LocalInformation.SaveData(); //重建本地文件进行存储 LocalInformation.ClearCurrents(); break; case "InGaming": GameObject.Find("DataSaving").GetComponent <DataSet>().SaveSituation(); //存储玩家位置 LearningSysInfo.SaveLinkOfStuLes(); //存储当前已学完的课程 LearningSysInfo.SetLocalClasses(); //存储所有课程信息并方便后续修改 break; default: break; } }