/// <summary> /// 生产信息标签点击监听:改变当前工序段 /// </summary> /// <param name="isSelected"></param> private void OnProductionTabClick(bool isSelected) { if (isSelected) { int i = ToggleUtil.CurrentToggleIndex(pdtTabs); productionFlow = i + 1; ProductionInfoForm._instance.InitProductionInfoList(productionFlow, brand); } }
/// <summary> /// 设备信息标签点击监听 /// 按照顺序,分别是:叶片回潮段、叶片加料段、叶丝处理、混丝加香、梗预处理段、烘梗丝加香料 /// </summary> /// <param name="isSelected"></param> private void OnDeviceTabClick(bool isSelected) { if (isSelected) { int index = ToggleUtil.CurrentToggleIndex(deviceTabs); deviceIndex = index; SkipToDevice(deviceIndex); DeviceInfoForm._instance.InitDeviceInfoList(deviceIndex); } }
private void InitTable() { int itemCount = brands.Count; //总数量 int rowCount = Mathf.CeilToInt((float)itemCount / columnCount); //总行数 //计算整个背景的宽高 Vector3 vec = parentBg.sizeDelta; vec.x = itemWidth * 2 + spacing * 3; vec.y = rowCount * itemHeight + (rowCount + 1) * spacing; parentBg.sizeDelta = vec; for (int i = 0; i < itemCount; i++) { GameObject item = Instantiate(itemPrefab); item.transform.parent = this.transform; int rowIndex = Mathf.CeilToInt(i / columnCount); //哪一行 if (i % columnCount == 0) //第一列 { float leftX = itemWidth / 2 + spacing; float leftY = -((itemHeight / 2) + (rowIndex * itemHeight) + (spacing * (rowIndex + 1))); item.transform.localPosition = new Vector3(leftX, leftY, 0); } //第二列 else { float rightX = itemWidth * 1.5f + spacing * 2; float rightY = -((itemHeight / 2) + (rowIndex * itemHeight) + (spacing * (rowIndex + 1))); item.transform.localPosition = new Vector3(rightX, rightY, 0); } } for (int i = 0; i < this.transform.childCount; i++) { Brand brand = brands[i]; Transform item = this.transform.GetChild(i); Text label = item.Find("Label").GetComponent <Text>(); label.text = brand.name; //设置文字 Toggle toggle = item.GetComponent <Toggle>(); toggle.group = group; //if (i == 0) { toggle.isOn = true; } //默认第一个被选中 toggle.onValueChanged.AddListener((bool isSelected) => //点击事件 { int index = ToggleUtil.CurrentToggleIndex(gameObject); ToggleUtil.CurrentToggleHighlight(gameObject, normal, selected); btnText.text = brands[index].name; //获取品牌名,设置给按钮 ListManager._instance.OnBrandChanged(brands[index].job_num); //获取品牌号,传递到ListManager,更新界面 }); } btnText.text = "选择品牌"; //默认空 ToggleUtil.CurrentToggleHighlight(gameObject, normal, selected); transform.localPosition += Vector3.up * vec.y; //设置位置 gameObject.SetActive(false); //默认隐藏 }
private void OnTabClick(bool isSelected) { if (isSelected) { int index = ToggleUtil.CurrentToggleIndex(tabs); if (index == 0) { alarmInfo.SetActive(true); alarm_processed.SetActive(false); } if (index == 1) { alarmInfo.SetActive(false); alarm_processed.SetActive(true); } } }
/// <summary> /// 顶部UI面板tab点击事件 /// </summary> /// <param name="isSelected"></param> private void OnTopTabClick(bool isSelected) { if (isSelected) { int index = ToggleUtil.CurrentToggleIndex(topTabs.gameObject); ListManager._instance.ShowInfoList(index + 1); currentTab = index + 1; //if (currentTab == 4) //{ // GlobalManager._instance.StartCheck(); //} //else //{ // GlobalManager._instance.StopCheck(); //} } }
public void SetCurrentTab(int index) { ToggleUtil.SetCurrentTab(topTabs, index); currentTab = index + 1; }
/// <summary> /// 切换列表显示 /// </summary> /// <param name="index"></param> public void ShowInfoList(int index) { //初始化参数 productionFlow = 1; deviceFlow = 1; deviceIndex = 0; //生产信息 if (index == 1) { if (part1) { part1.SetActive(true); } if (item_deviceInfo) { item_deviceInfo.SetActive(false); } if (item_cameraInfo) { item_cameraInfo.SetActive(false); } if (item_alarmInfo) { item_alarmInfo.SetActive(false); } item_productionInfo.SetActive(true); ToggleUtil.SetCurrentTab(pdtTabs, 0); if (brands) { brands.SetActive(true); } ProductionInfoForm._instance.InitProductionInfoList(productionFlow, brand); } //设备信息 if (index == 2) { if (part1) { part1.SetActive(true); } if (item_productionInfo) { item_productionInfo.SetActive(false); } if (item_cameraInfo) { item_cameraInfo.SetActive(false); } if (item_alarmInfo) { item_alarmInfo.SetActive(false); } item_deviceInfo.SetActive(true); ToggleUtil.SetCurrentTab(deviceTabs, 0); if (brands) { brands.SetActive(true); } SkipToDevice(0); DeviceInfoForm._instance.InitDeviceInfoList(deviceIndex); } //监控信息 if (index == 3) { if (part1) { part1.SetActive(false); } if (item_alarmInfo) { item_alarmInfo.SetActive(false); } item_cameraInfo.SetActive(true); if (brands) { brands.SetActive(false); } } //故障报警 if (index == 4) { if (part1) { part1.SetActive(false); } if (item_cameraInfo) { item_cameraInfo.SetActive(false); } item_alarmInfo.SetActive(true); if (brands) { brands.SetActive(false); } GlobalManager._instance.InitAlarmInfoList(); } }
/// <summary> /// 设置当前选中的生产段 /// </summary> /// <param name="index"></param> public void SetCurrentProductionTab(int index) { ToggleUtil.SetCurrentTab(pdtTabs, index); productionFlow = index + 1; ProductionInfoForm._instance.InitProductionInfoList(productionFlow, brand); }