/// <summary> /// 設座位位置至列表座位資訊。 /// </summary> public void SetAllSeatPos(List <Vector3> seatPos, bool ignoreCustomPos) { for (int i = 0; i < seatPos.Count; i++) { if (i <= seatingPlan.seats.Count - 1)//規劃的座位位置,尚未超出目前座位數量 { if (!ignoreCustomPos) { if (!seatingPlan.seats[i].isCustomPos) { seatingPlan.seats[i].seatPos = seatPos[i]; } } else { seatingPlan.seats[i].seatPos = seatPos[i]; } } else { //增加座位 seatingPlan.seats.Add(new Seat(seatPos[i])); } } OnSeatsRefreshed?.Invoke(seatingPlan.seats); Save(); }
/// <summary> /// 資料讀出。 /// </summary> public void Load() { JsonUtility.FromJsonOverwrite(PlayerPrefs.GetString(seatingPlanName), seatingPlan); OnSeatsRefreshed?.Invoke(seatingPlan.seats); }