Beispiel #1
0
        internal static ComponentInfo GetComponentInfo(IComponent com)
        {
            lock (componentTable)
            {
                ComponentInfo ci = (ComponentInfo)componentTable [com];
                if (ci == null)
                {
                    if (onDispose == null)
                    {
                        onDispose = new EventHandler(OnComponentDisposed);
                    }

                    com.Disposed        += onDispose;
                    ci                   = new ComponentInfo(com);
                    componentTable [com] = ci;
                }
                return(ci);
            }
        }
	internal static ComponentInfo GetComponentInfo (IComponent com)
	{
		lock (componentTable)
		{
			ComponentInfo ci = (ComponentInfo) componentTable [com];
			if (ci == null) {
				if (onDispose == null)
					onDispose = new EventHandler (OnComponentDisposed);

				com.Disposed += onDispose;
				ci = new ComponentInfo (com);
				componentTable [com] = ci;
			}
			return ci;
		}
	}
Beispiel #3
0
			private void UpdateTable(Type type)
			{
				if (_componentInfoTable[type] == null)
				{
					ComponentInfo ci = new ComponentInfo();
					RandomUtil ru = new RandomUtil();

					ci.Type = type;
					ci.Color = ru.GetColor();
					ci.Count = 1;
					_componentInfoTable.Add(type, ci);
					_totalComponents++;
				}
				else
				{
					ComponentInfo ci = (ComponentInfo)_componentInfoTable[type];
					_componentInfoTable.Remove(type);
					ci.Count++;
					_componentInfoTable.Add(type, ci);
				}
			}
        //add property to the GUI
        /*
        public void addPropertyForComponent(String component, String property, String value)
        {
            for(int i = 0; i < componentTreeView.Nodes.Count; ++i)
            {
                if(componentTreeView.Nodes[i].Text == component)
                {
                    //Found the correct component! Give it the property

                    componentTreeView.Invoke((MethodInvoker)(() => componentTreeView.Nodes[i].Nodes.Add(property)));
                    componentTreeView.Invoke((MethodInvoker)(() => componentTreeView.Nodes[i].Nodes[0].Nodes.Add(value)));
                    return;
                }
            }
        }
        */
        /*
        public void updatePropertyValueForComponent(String component, String property, String value)
        {
            for (int i = 0; i < componentTreeView.Nodes.Count; ++i)
            {
                if(componentTreeView.Nodes[i].Text == component)
                {
                    //Found the correct component!

                    var propertyNodes = componentTreeView.Nodes[i].Nodes;

                    //Lets find the property to be updated...
                    for (int x = 0; x < propertyNodes.Count; ++x )
                    {
                        if(propertyNodes[x].Text == property)
                        {
                            componentTreeView.Invoke((MethodInvoker)(() => componentTreeView.Nodes[i].Nodes[x].Nodes[0].Text = property));
                            return;
                        }
                    }

                }
            }

            Console.WriteLine("Could not update value of a property for component in the EntityEditor GUI");
        }
        */
        public void addComponentClassNameToList(ComponentInfo component)
        {
            componentAddComboBox.Items.Add(component.componentName);
        }
 public void ApplyTo(ComponentInfo componentInfo)
 {
     componentInfo.Parameters.Add(key, value);
 }