Esempio n. 1
0
        private void ComponentWindow_Update()
        {
            if (ScrollView_components_event.ItemID != -1 && ScrollView_components_event.MouseButton == 0)
            {
                showAddComponentWindow = false;

                selected_component = ScrollView_components_event.ItemID;

                int componentID = components[selected_component].GetInstanceID();

                if (!componentInfos.ContainsKey(componentID))
                {
                    componentInfos.Add(componentID, new ComponentInfo(components[selected_component]));
                }

                Type componentType = components[selected_component].GetType();

                if (IsSupportedCollider(components[selected_component]))
                {
                    isColliderSelected = true;
                    GetColliderInfo();
                    DrawColliderControl dcc = selectedObject.GetComponentInChildren <DrawColliderControl>();
                    dcc.DrawSelectedCollider(componentID, true);
                    RefreshEditModeList();
                }
                else
                {
                    isColliderSelected = false;
                    RefreshEditModeList();
                }

                if (IsSupportedRenderer(components[selected_component]))
                {
                    showComponentInfoWindow = false;
                    RendererWindow_Awake();
                }
                else
                {
                    showRendererWindow = false;
                    ComponentInfoWindow_Awake(components[selected_component]);
                    showComponentInfoWindow = true;
                }

                if (IsComponentInBlacklist(components[selected_component]))
                {
                    changeEnabledproperty = null;
                    return;
                }

                changeEnabledproperty = components[selected_component].GetType().GetProperty("enabled");

                if (changeEnabledproperty != null)
                {
                    enabledValue = (bool)changeEnabledproperty.GetValue(components[selected_component], BindingFlags.Instance | BindingFlags.Public, null, null, null);
                }
            }
        }
        private void ComponentWindow_Update()
        {
            if (ScrollView_components_event.ItemID != -1 && ScrollView_components_event.MouseButton == 0)
            {
                showAddComponentWindow = false;

                selected_component = ScrollView_components_event.ItemID;

                Type componentType = objects[selected_component].GetType();

                if (IsSupportedCollider(objects[selected_component]))
                {
                    isColliderSelected = true;
                    GetColliderInfo();
                    DrawColliderControl dcc = selectedObject.GetComponentInChildren <DrawColliderControl>();
                    int componentID         = objects[selected_component].GetInstanceID();
                    dcc.DrawSelectedCollider(componentID, true);
                    RefreshEditModeList();
                }
                else
                {
                    isColliderSelected = false;
                    RefreshEditModeList();
                }

                if (IsSupportedRenderer(objects[selected_component]))
                {
                    showObjectInfoWindow = false;
                    RendererWindow_Awake();
                }
                else
                {
                    showRendererWindow = false;
                    ObjectInfoWindow_Awake(objects[selected_component]);
                    showObjectInfoWindow = true;
                }

                if (IsRectTransform(objects[selected_component]))
                {
                    isRectTransform      = true;
                    showObjectInfoWindow = true;
                    RefreshEditModeList();
                }
                else
                {
                    isRectTransform = false;
                    RefreshEditModeList();
                }

                if (objects[selected_component].GetType() == typeof(ColorCustomizer))
                {
                    DebugColorCustomizer(objects[selected_component] as ColorCustomizer);
                }

                if (objects[selected_component].GetType() == typeof(SkyApplier))
                {
                    DebugSkyApplier(objects[selected_component] as SkyApplier);
                }

                if (IsComponentInBlacklist(objects[selected_component]))
                {
                    changeEnabledproperty = null;
                    return;
                }

                changeEnabledproperty = objects[selected_component].GetType().GetProperty("enabled");

                if (changeEnabledproperty != null)
                {
                    enabledValue = (bool)changeEnabledproperty.GetValue(objects[selected_component], BindingFlags.Instance | BindingFlags.Public, null, null, null);
                }
            }
        }