/// <summary> /// 绘制辅助器选择框 /// </summary> private void DrawHelperSelect() { m_HelperTypeName = m_HelperTypeNames[0]; if (RuleHelper != null) { m_HelperTypeName = RuleHelper.GetType().Name; for (int i = 0; i < m_HelperTypeNames.Length; i++) { if (m_HelperTypeName == m_HelperTypeNames[i]) { m_HelperTypeNameIndex = i; } } } else { IAutoBindRuleHelper helper = (IAutoBindRuleHelper)CreateHelperInstance(m_HelperTypeName, s_AssemblyNames); RuleHelper = helper; } int selectedIndex = EditorGUILayout.Popup("AutoBindRuleHelper", m_HelperTypeNameIndex, m_HelperTypeNames); if (selectedIndex != m_HelperTypeNameIndex) { m_HelperTypeNameIndex = selectedIndex; m_HelperTypeName = m_HelperTypeNames[selectedIndex]; IAutoBindRuleHelper helper = (IAutoBindRuleHelper)CreateHelperInstance(m_HelperTypeName, s_AssemblyNames); RuleHelper = helper; } }
/// <summary> /// 绑定组件辅助器选择框 /// </summary> private void DrawHelperSelect() { if (string.IsNullOrEmpty(m_Target.m_SelRuleName)) { m_Target.m_SelRuleName = m_HelperTypeNames[0]; } m_HelperTypeIndex = m_HelperTypeNames.ToList().IndexOf(m_Target.m_SelRuleName); if (m_HelperTypeIndex < 0) { m_HelperTypeIndex = 0; } m_Target.m_SelRuleName = m_HelperTypeNames[m_HelperTypeIndex]; RuleHelper = (IAutoBindRuleHelper)CreateHelperInstance(m_Target.m_SelRuleName, s_AssemblyNames); int selectedIndex = EditorGUILayout.Popup(m_HelperTypeIndex, m_HelperTypeNames); if (selectedIndex != m_HelperTypeIndex) { m_HelperTypeIndex = selectedIndex; m_Target.m_SelRuleName = m_HelperTypeNames[selectedIndex]; RuleHelper = (IAutoBindRuleHelper)CreateHelperInstance(m_Target.m_SelRuleName, s_AssemblyNames); } if (string.IsNullOrEmpty(m_PrefixesShowStr)) { m_PrefixesShowStr = RuleHelper.GetBindTips(); } }
/// <summary> /// 绘制辅助器选择框 /// </summary> private void DrawHelperSelect() { m_HelperTypeName = m_HelperTypeNames[0]; if (m_Target.RuleHelper != null) { m_HelperTypeName = m_Target.RuleHelper.GetType().Name; for (int i = 0; i < m_HelperTypeNames.Length; i++) { if (m_HelperTypeName == m_HelperTypeNames[i]) { m_HelperTypeNameIndex = i; } } } else { IAutoBindRuleHelper helper = (IAutoBindRuleHelper)CreateHelperInstance(m_HelperTypeName, s_AssemblyNames); m_Target.RuleHelper = helper; } foreach (GameObject go in Selection.gameObjects) { ComponentAutoBindTool autoBindTool = go.GetComponent <ComponentAutoBindTool>(); if (autoBindTool.RuleHelper == null) { IAutoBindRuleHelper helper = (IAutoBindRuleHelper)CreateHelperInstance(m_HelperTypeName, s_AssemblyNames); autoBindTool.RuleHelper = helper; } } int selectedIndex = EditorGUILayout.Popup("AutoBindRuleHelper", m_HelperTypeNameIndex, m_HelperTypeNames); if (selectedIndex != m_HelperTypeNameIndex) { m_HelperTypeNameIndex = selectedIndex; m_HelperTypeName = m_HelperTypeNames[selectedIndex]; IAutoBindRuleHelper helper = (IAutoBindRuleHelper)CreateHelperInstance(m_HelperTypeName, s_AssemblyNames); m_Target.RuleHelper = helper; } }