Пример #1
0
        public void AddToEnd(NetComponent fsm)
        {
            if (fsm == null)
            {
                throw new ArgumentNullException("fsm");
            }
            if (componentFSMs.ContainsKey(fsm.FiniteStateMachine.OrderNumber))
            {
                throw new ArgumentException();
            }

            componentFSMs.Add(fsm.FiniteStateMachine.OrderNumber, fsm);
        }
Пример #2
0
        public ClientComponent(ClientGameObject parent, NetComponent component, IUnityData unityData)
        {
            this.parent     = parent;
            this.type       = component.type;
            this.unityData  = unityData;
            this.instanceID = component.instanceID;
            this.togglable  = component.togglable;
            this.deletable  = component.deletable;
            this.name       = component.name;

            ClientComponent.reuseFields.Clear();

            this.enabledFieldIndex = -1;

            for (int i = 0; i < component.fields.Length; i++)
            {
                if (component.fields[i].name.Equals("enabled") == true)
                {
                    this.enabledFieldIndex = i;
                }

                ClientComponent.reuseFields.Add(new ClientField(this, i, component.fields[i], this.unityData));
            }

            this.fields = ClientComponent.reuseFields.ToArray();

            this.methods     = new ClientMethod[component.methods.Length];
            this.methodNames = new string[this.methods.Length];

            for (int i = 0; i < this.methods.Length; i++)
            {
                try
                {
                    this.methods[i] = new ClientMethod(this, component.methods[i]);

                    StringBuilder buffer = Utility.GetBuffer();

                    if (component.methods[i].returnType != null)
                    {
                        buffer.Append(component.methods[i].returnType.Name);
                    }
                    else
                    {
                        buffer.Append(component.methods[i].returnTypeRaw);
                    }
                    buffer.Append('	');
                    buffer.Append(component.methods[i].name);
                    buffer.Append('(');

                    string comma = string.Empty;

                    for (int j = 0; j < component.methods[i].argumentTypes.Length; j++)
                    {
                        buffer.Append(comma);
                        buffer.Append(component.methods[i].argumentTypes[j].Name);

                        comma = ", ";
                    }

                    buffer.Append(')');

                    this.methodNames[i] = Utility.ReturnBuffer(buffer);
                }
                catch (Exception ex)
                {
                    InternalNGDebug.LogException("Method " + i + " " + component.methods[i] + " in Component " + this.name + " (" + this.type + ") failed.", ex);
                }
            }

            this.booleanHandler = TypeHandlersManager.GetTypeHandler <bool>();
            this.animEnable     = new BgColorContentAnimator(null, 1F, 0F);

            if (this.type != null)
            {
                this.icon = AssetPreview.GetMiniTypeThumbnail(this.type);
            }
            if (this.icon == null)
            {
                this.icon = UtilityResources.CSharpIcon;
            }
        }
Пример #3
0
 public void     AddComponent(NetComponent netComponent)
 {
     this.components.Add(new ClientComponent(this, netComponent, this.unityData));
 }