示例#1
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_CUBE_TYPE", (int)properties.cubeType));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_DROPPER_ENABLED", properties.dropperVisible));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_AUTO_DROP_CUBE", properties.autoDrop));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_AUTO_RESPAWN_CUBE", properties.autoRespawn));

            base.AddProperties(node);
        }
示例#2
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_CUBE_TYPE", (int)properties.cubeType));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_DROPPER_ENABLED", properties.dropperVisible));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_DROPPER_FALL_STRAIGHT_DOWN", true));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_AUTO_DROP_CUBE", properties.autoDrop));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_AUTO_RESPAWN_CUBE", properties.autoRespawn));
            node.Nodes.Add(ConnectionReceiver.GetConnectionCount());

            base.AddProperties(node);
        }
示例#3
0
        /// <summary>
        /// Derived classes should add all non-default item properties to the node here.
        /// </summary>
        internal virtual void AddProperties(P2CNode node)
        {
            if (properties == null)
                return;

            foreach (KeyValuePair<string, string> prop in properties)
            {
                node.Nodes.Add(new P2CProperty(prop.Key, prop.Value));
            }
        }
示例#4
0
        /// <summary>
        /// Gets a P2CNode for saving.
        /// </summary>
        internal P2CNode GetNode()
        {
            PrepareGetNode();

            P2CNode node = new P2CNode("Item");

            node.Nodes.Add(new P2CProperty("Index", index));
            node.Nodes.Add(new P2CProperty("Type", Type));
            node.Nodes.Add(new P2CProperty("Deletable", deletable));
            node.Nodes.Add(new P2CProperty("VoxelPos", VoxelPosition));
            node.Nodes.Add(new P2CProperty("LocalPos", localPosition));
            node.Nodes.Add(new P2CProperty("Angles", ToAngleProperty(angles)));
            node.Nodes.Add(new P2CProperty("Facing", facing));

            AddProperties(node);

            return node;
        }
示例#5
0
        /// <summary>
        /// Reads the properties in the node into the item.
        /// </summary>
        private static void ReadProperties(P2CNode node, Item item)
        {
            foreach (IP2CNode child in node.Nodes)
            {
                P2CProperty property = child as P2CProperty;

                // TODO: handle child nodes?
                if (property == null)
                    continue;

                switch (property.Key)
                {
                    case "Index":
                        item.index = property.GetInt32();
                        break;
                    case "Type":
                        item.Type = property.Value;
                        break;
                    case "Deletable":
                        item.deletable = property.GetBool();
                        break;
                    case "VoxelPos":
                        item.VoxelPosition = property.GetPoint3();
                        break;
                    case "LocalPos":
                        item.localPosition = property.GetFPoint3();
                        break;
                    case "Angles":
                        item.angles = FromAngleProperty(property.GetPoint3());
                        break;
                    case "Facing": // TODO: this needs to be doubles instead of ints
                        item.facing = property.GetPoint3();
                        break;
                    default:
                        item.ReadProperty(property);
                        break;
                }
            }
        }
示例#6
0
        /// <summary>
        /// Reads a P2CNode for an item.
        /// </summary>
        internal static Item ReadItem(Puzzle owner, P2CNode node)
        {
            if (node.Key != "Item")
                throw new ArgumentException("Specified node is not a Item");

            Item item = CreateInstance(owner, node.GetProperty("Type").Value);
            ReadProperties(node, item);

            return item;
        }
示例#7
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_TIMER_DELAY", timerDelay));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_TIMER_SOUND", timerSound));

            base.AddProperties(node);
        }
示例#8
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_BARRIER_TYPE", (int)BarrierType));

            base.AddProperties(node);
        }
示例#9
0
        internal override void AddProperties(P2CNode node)
        {
            string animation = "";
            switch (ExtendAngle)
            {
                case AngledPanelExtendAngle.Angle30:
                    animation = "ramp_30_deg_open";
                    break;
                case AngledPanelExtendAngle.Angle45:
                    animation = "ramp_45_deg_open";
                    break;
                case AngledPanelExtendAngle.Angle60:
                    animation = "ramp_60_deg_open";
                    break;
                case AngledPanelExtendAngle.Angle90:
                    animation = "ramp_90_deg_open";
                    break;
            }

            node.Nodes.Add(ConnectionReceiver.GetConnectionCount());
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_ANGLED_PANEL_TYPE", (int)ExtendAngle));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_START_DEPLOYED", StartDeployed));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_PORTALABLE", IsPortalable));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_ANGLED_PANEL_ANIMATION", animation));
            
            base.AddProperties(node);
        }
示例#10
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_PAINT_TYPE", (int)properties.paintType));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_DROPPER_ENABLED", properties.dropperVisible));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_ALLOW_STREAK_PAINT", properties.allowStreaks));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_PAINT_FLOW_TYPE", (int)properties.flowType));
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_START_ENABLED", properties.startEnabled));

            // TODO: determine what this property is for
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_PAINT_EXPORT_TYPE", 0));

            base.AddProperties(node);
        }
示例#11
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_START_ENABLED", StartEnabled));
            node.Nodes.Add(ConnectionReceiver.GetConnectionCount());

            base.AddProperties(node);
        }
示例#12
0
 internal P2CFile(P2CNode root)
 {
     Root = root;
 }
示例#13
0
        internal override void AddProperties(P2CNode node)
        {
            node.Nodes.Add(new P2CProperty("ITEM_PROPERTY_BUTTON_TYPE", (int)ButtonType));

            base.AddProperties(node);
        }