/// <summary> /// 加载预设位的信息 /// </summary> void LoadPresetPosition() { Logger.Instance.WriteLog("加载预设位的信息"); BtnConfirm.SetActive(false); PresetPosItems = new List <GameObject> (); PresetPositionDao ppDao = new PresetPositionDao(); ppDao.Select001(cameraId.ToString()); PresetPosInfos = ppDao.Result; if (PresetPosInfos.Count <= 0) { CreatePresetPosition(); ppDao.Select001(cameraId.ToString()); PresetPosInfos = ppDao.Result; } for (int i = 0; i < PresetPosInfos.Count; i++) { GameObject go = PresetPosItemContainer.GetChild(i).gameObject; UIEventListener.Get(go).onClick = OnPresetPosItemSelected; PresetPosItems.Add(go); } defaultSprite = PresetPosItems [0].GetComponent <UIButton> ().normalSprite; OnPresetPosItemSelected(PresetPosItems[0]); }
/// <summary> /// 保存修改后的预设位的信息 /// </summary> public void SavePresetPosition() { Logger.Instance.WriteLog("保存修改后的预设位的信息"); PresetPositionDao ppDao = new PresetPositionDao(); ppDao.Update004(SelectedPresetPosInfo.Id, Description.value); CMSManageInstance.SetPresetPosition(cameraId, guid, ushort.Parse(SelectedPresetPosInfo.Name)); LoadPresetPosition(); }
/// <summary> /// 创建默认预设位信息 /// </summary> private void CreatePresetPosition() { Logger.Instance.WriteLog("创建默认预设位信息"); PresetPositionDao ppDao = new PresetPositionDao(); for (int i = 0; i < PresetPosItemContainer.GetChildList().Count; i++) { if (i == 0) { ppDao.Insert(cameraId.ToString(), (i + 1) + "", "请重新设定守望位的信息", "是"); CMSManageInstance.SetPresetPosition(cameraId, guid, (ushort)(i + 1)); } else { ppDao.Insert(cameraId.ToString(), (i + 1) + "", "请重新设定预设位" + i + "的信息"); CMSManageInstance.SetPresetPosition(cameraId, guid, (ushort)(i + 1)); } } }