private void InitGroupBoxes() { List <GroupBox> boxes = new List <GroupBox>(); foreach (var info in DeviceInfos) { boxes.AddRange(info.GroupBoxes); } if (boxes.Count != 3) { Debug.LogError("ThreePieceDevice needs 3 GroupBoxes!"); return; } leftHolder = new GroupBoxHolder() { groupBoxId = boxes[0].Uid, transform = gameObject.transform.Find("LeftDevice/LeftGroup") }; middleHolder = new GroupBoxHolder() { groupBoxId = boxes[1].Uid, transform = gameObject.transform.Find("MiddleDevice/MiddleGroup") }; rightHolder = new GroupBoxHolder() { groupBoxId = boxes[2].Uid, transform = gameObject.transform.Find("RightDevice/RightGroup") }; }
private void AddButtonsToGroup(IGrouping <string, DeviceFunctionality> funcs) { GroupBoxHolder holder = GetHolderById(funcs.Key); List <DeviceFunctionality> onOffUpDown = GetOffUpDownFunctionalities(funcs.ToList()); if (onOffUpDown.Count > 0) { AddOnOffUpDownCombination(holder.transform, onOffUpDown); } DeviceFunctionality colorFunc = funcs.Where(f => FUNC_TYPE_COLOR_CONTROL == f.FunctionalityType).FirstOrDefault(); if (colorFunc != null) { AddColorButtons(colorFunc, holder.transform); } //foreach (var func in funcs) //{ // if (onOffUpDown.Contains(func)) continue; // if (func.Commands == null) continue; // foreach (var cmd in func.Commands) // { // SpawnButton(func, cmd, holder.transform); // } //} }
private void UpdateStateAndSetValues(GroupBoxHolder holder) { if (holder != null) { if (DeviceManager.IsInitialized) { string realStateValue = DeviceManager.Instance.GetItemState(holder.deviceState.ItemId); if (realStateValue != null) { holder.deviceState.RealStateValue = realStateValue; } } SetDeviceState(holder.transform, holder.deviceState); } }