public void AddNewPlan() { Logger.Instance.WriteLog("新建疏散预案"); EvacuationPlanDao epDao = new EvacuationPlanDao(); for (int i = 1; i < int.MaxValue; i++) { //如果预案名称不存在者用此名称创建一个新的预案 if (epDao.Select004(NewPlanName + i).Count <= 0) { epDao.Insert003(NewPlanName + i); List <EvacuatePlan> result = epDao.Select004(NewPlanName + i); if (result.Count == 1) { AddItemToEvacuatePlanItemGrid(epDao.Select004(NewPlanName + i)[0]); if (EvacuatePlanItemGrid.transform.childCount == 1) { EvacuateAreaOfPlanPanel.SetActive(true); } EvacuatePlanItemGrid.GetChild(EvacuatePlanItemGrid.transform.childCount - 1).GetComponent <EditedEvacuatePlanListItem>().Selected(); } break; } } }
public void StartEvacuationPlan() { if (Popuplist.GetComponent <UIPopupList>().items.Count == 0) { Logger.Instance.WriteLog("执行疏散预案失败,没有可执行的疏散预案"); return; } if (Popuplist.GetComponent <UIPopupList>().value.Trim() == "") { Logger.Instance.WriteLog("执行疏散预案失败,没有可执行的疏散预案"); return; } Logger.Instance.WriteLog("开始执行疏散预案"); if (HasEvacuationPlanExcute) { Logger.Instance.WriteLog("已经有疏散预案正在执行"); return; } MainMenuController.canNotOpen = true; Popuplist.GetComponent <BoxCollider>().enabled = false; EvacuationPlanBtn.GetComponent <BoxCollider>().enabled = false; EvacuationPlanBtnSprite = EvacuationPlanBtn.normalSprite; EvacuationPlanBtn.normalSprite = EvacuationPlanBtn.pressedSprite; HasEvacuationPlanExcute = true; EvacuationPlanDao ePlanDao = new EvacuationPlanDao(); EvacuatePlan evacuatePlan = ePlanDao.Select004(Popuplist.GetComponent <UIPopupList>().value)[0]; PrivateStartEvacuationPlan(evacuatePlan); }
//改变名称时调用 public void OnNameChanged(string newName) { Logger.Instance.WriteLog("更改疏散预案名称"); if (string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(newName.Trim())) { newName = evacuatePlan.name; areaOfPlanPanel.GetComponent <EvacuateAreaOfPlanEdit>().nameLabel.value = evacuatePlan.name; return; } if (evacuatePlan.name == newName) { return; } EvacuationPlanDao epDao = new EvacuationPlanDao(); if (epDao.Select004(newName).Count > 0) { newName = evacuatePlan.name; areaOfPlanPanel.GetComponent <EvacuateAreaOfPlanEdit>().nameLabel.value = evacuatePlan.name; //WarnWindow.Instance.Show(WarnWindow.WarnType.SameName); return; } epDao.Update001(evacuatePlan.id, newName); evacuatePlan.name = newName; Name.text = newName; }