// Use this for initialization void Start() { element = elementGO.GetComponent<BaseActivityElement> (); StartCoroutine (UpdateConnectionView ()); }
void PrepareFunctionsInfoSlots(BaseActivityElement _be) { Transform[] tr = functionsInfoTable.gameObject.GetComponentsInChildren<Transform> (); for (int i = 1; i < tr.Length; i++) { Destroy(tr[i].gameObject); } funcInfoSlots.Clear (); for (int i = 0; i < _be.functions.Count; i++) { GameObject _slot = Instantiate(functionInfoPrefab, Vector3.zero, Quaternion.identity) as GameObject; _slot.transform.SetParent(functionsInfoTable.transform); _slot.GetComponent<RectTransform>().localScale = Vector3.one; BaseSlot _bs = _slot.GetComponent<BaseSlot>(); funcInfoSlots.Add(_bs); _bs.GetSlotElement(SlotElemetType.Title).text.text = GlobalData.inst.GetDataBlock(_be.functions[i].functionType).name; } }
void PrepareFunctionButtons(BaseActivityElement _be) { for (int i = 0; i < funcButtons.Count; i++) { if(i < _be.functions.Count){ funcButtons[i].gameObject.SetActive(true); funcButtons[i].GetSlotElement(SlotElemetType.Icon).image.sprite = GlobalData.inst.GetDataBlock(_be.functions[i].functionType).icon; funcButtons[i].GetSlotElement(SlotElemetType.Icon).image.color = GlobalData.inst.GetDataBlock(_be.functions[i].functionType).color; } else{ funcButtons[i].gameObject.SetActive(false); } } }
void PrepareFunctionsEditSlots(BaseActivityElement _be) { Transform[] tr = functionsEditTable.gameObject.GetComponentsInChildren<Transform> (); for (int i = 1; i < tr.Length; i++) { Destroy(tr[i].gameObject); } funcEditSlots.Clear (); //show already available properties for (int i = 0; i < _be.functions.Count; i++) { GameObject _slot = Instantiate(functionEditPrefab, Vector3.zero, Quaternion.identity) as GameObject; _slot.transform.SetParent(functionsEditTable.transform); _slot.GetComponent<RectTransform>().localScale = Vector3.one; BaseSlot _bs = _slot.GetComponent<BaseSlot>(); funcEditSlots.Add(_bs); _bs.GetSlotElement(SlotElemetType.Title).text.text = GlobalData.inst.GetDataBlock(_be.functions[i].functionType).name; } //now list other properties that can be edited FunctionType[] funcTypes = (FunctionType[])System.Enum.GetValues (typeof(FunctionType)); for (int i = 0; i < funcTypes.Length; i++) { if(!processActivityElement.functionsDict.ContainsKey(funcTypes[i])){ GameObject _slot = Instantiate(functionAddEditPrefab, Vector3.zero, Quaternion.identity) as GameObject; _slot.transform.SetParent(functionsEditTable.transform); _slot.GetComponent<RectTransform>().localScale = Vector3.one; BaseSlot _bs = _slot.GetComponent<BaseSlot>(); funcEditSlots.Add(_bs); _bs.GetSlotElement(SlotElemetType.Title).text.text = GlobalData.inst.GetDataBlock(funcTypes[i]).name; EditedOnjectIdentificator editedObj = _slot.GetComponent<EditedOnjectIdentificator>(); BaseElementFunction newFunc = new BaseElementFunction(); newFunc.functionType = funcTypes[i]; editedObj.SetIdentificator(newFunc); } } }
public void ProcessElement(BaseActivityElement _baseElement) { if ((processActivityElement == null) || (processActivityElement != null && _baseElement != processActivityElement)) { processActivityElement = _baseElement; ElementEditor.inst.processActivityElement = _baseElement; processElement = _baseElement; ShowInfoSlots(); } }