void OnSelectGeneral() { if (state != 0) { return; } int count = objsList.GetCount(); int gIdx = (int)generalsInfoList.GetSelectItem().GetItemData(); GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(gIdx); for (int i = 0; i < count; i++) { ListItem item = objsList.GetListItem(i); CityObjectsData cityData = (CityObjectsData)item.GetItemData(); int data = cityData.code; if (data == -1) { continue; } int code = data & 0xFFFF; int type = data >> 16; bool flag = true; switch (type) { case 1: if (gInfo.equipment == code) { flag = false; } break; case 2: if ((gInfo.arms & code) != 0) { flag = false; } break; case 3: if ((gInfo.formation & code) != 0) { flag = false; } break; } item.SetSelectEnable(flag); } if (count > 0 && ((CityObjectsData)objsList.GetListItem(count - 1).GetItemData()).code == -1) { if (gInfo.equipment == -1) { objsList.DeleteItem(count - 1); } } else { if (gInfo.equipment != -1) { ListItem li = objsList.AddItem(ZhongWen.Instance.xiexia); CityObjectsData data = new CityObjectsData(0, -1); li.SetItemData(data); } } }