コード例 #1
0
        public override IModifier Clone(int cloneFlags = 0)
        {
            var m = new LinkModifier();

            CopyTo(m, cloneFlags);
            return(m);
        }
コード例 #2
0
        private void CopyTo(LinkModifier m, int cloneFlags)
        {
            base.CopyTo(m, cloneFlags);

            m.controllers_.Clear();
            foreach (var c in controllers_)
            {
                m.controllers_.Add(c.Clone(cloneFlags));
            }
        }
コード例 #3
0
        public override void AddToTopUI(IModifier m)
        {
            var changed = (m != modifier_);

            modifier_ = m as LinkModifier;
            if (modifier_ == null)
            {
                return;
            }

            AddAtomWidgets(m);
            base.AddToTopUI(m);

            if (modifier_.Controllers.Count != controllers_.Count)
            {
                changed = true;
            }

            if (changed)
            {
                controllers_.Clear();

                foreach (var c in modifier_.Controllers)
                {
                    controllers_.Add(new LinkModifierControllerUI(modifier_, c));
                }
            }

            widgets_.AddToUI(new SmallSpacer(Widget.Right));
            widgets_.AddToUI(add_);

            if (controllers_.Count > 0)
            {
                widgets_.AddToUI(new SmallSpacer(Widget.Right));

                foreach (var c in controllers_)
                {
                    widgets_.AddToUI(c.Collapsible);
                }

                widgets_.AddToUI(new LargeSpacer(Widget.Right));
                widgets_.AddToUI(new LargeSpacer(Widget.Right));
            }
        }
コード例 #4
0
        public LinkModifierControllerUI(
            LinkModifier m, LinkModifierController mc)
        {
            modifier_ = m;
            mc_       = mc;

            collapsible_ = new Collapsible(mc_.Name, null, Widget.Right);

            delete_ = new ConfirmableButton("Delete", Delete, Widget.Right);

            controller_ = new FreeControllerList(
                "Controller", mc_.ControllerName,
                ControllerChanged, Widget.Right);

            atom_ = new AtomList(
                "Link to atom", mc_.AtomName, AtomChanged, null,
                Widget.Right | Widget.AllowNone);

            rb_ = new LinkTargetList(
                "Link to", mc_.RigidbodyName, RigidbodyChanged,
                Widget.Right | Widget.AllowNone);

            position_ = new PositionStateList(
                "Position", "", PositionChanged,
                Widget.Right | Widget.AllowNone);

            rotation_ = new RotationStateList(
                "Rotation", "", RotationChanged,
                Widget.Right | Widget.AllowNone);

            Update();

            collapsible_.Add(delete_);
            collapsible_.Add(controller_);
            collapsible_.Add(atom_);
            collapsible_.Add(rb_);
            collapsible_.Add(position_);
            collapsible_.Add(rotation_);
            collapsible_.Add(new SmallSpacer(Widget.Right));
        }