Beispiel #1
0
        public void loadFromXML(XmlNode node, string parent_string)
        {
            base.loadFromXML(node);
            Console.WriteLine("loading character");
            Console.WriteLine(parent_string);
            this.parent      = parent_string;
            this.displayType = "Character";
            this.actualType  = "Character";
            CharacterModel   = node.SelectSingleNode("CharacterModel").InnerText;
            Console.WriteLine("got model");
            Inventory = node.SelectSingleNode("Inventory").InnerXml;
            Console.WriteLine("got inventory");
            Battery = node.SelectSingleNode("Battery").InnerXml;
            Console.WriteLine("got battery");
            LightEnabled = node.SelectSingleNode("LightEnabled").InnerText;
            Console.WriteLine("got light");
            JetpackMode = node.SelectSingleNode("JetpackMode").InnerText;
            XmlNode trynode = node.SelectSingleNode("HeadAngle");

            if (trynode != null)
            {
                HeadAngle.loadFromXML(trynode);
            }
            trynode = node.SelectSingleNode("LinearVelocity");
            if (trynode != null)
            {
                LinearVelocity.loadFromXML(trynode);
            }
            trynode = node.SelectSingleNode("AutoenableJetpackDelay");
            if (trynode != null)
            {
                AutoenableJetPackDelay = trynode.InnerText;
            }
            Console.WriteLine("Character Loaded");
        }
Beispiel #2
0
        public void loadFromXML(XmlNode node, bool quick = false)
        {
            base.loadFromXML(node);
            this.GridSizeEnum = node.SelectSingleNode("GridSizeEnum").InnerText;
            this.quick_loaded = quick;
            XmlNodeList blocks = node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock");

            if (quick == false)
            {
                Console.WriteLine("Loading blocks...");
                foreach (XmlNode block in blocks)
                {
                    CubeBlock new_block = new CubeBlock(this.parent_sector);
                    new_block.loadFromXML(block);
                    if (new_block.SubTypeName == "LargeBlockCockpit" || new_block.SubTypeName == "SmallBlockCockpit")
                    {
                        this.cockpit = new_block;
                        if (new_block.hasPilot == true)
                        {
                            Console.WriteLine("Grid has pilot");
                            this.hasPilot          = true;
                            new_block.Pilot.parent = this.EntityId;
                            this.Pilot             = new_block.Pilot;
                        }
                    }
                    CubeBlocks.Add(new_block);
                }
            }
            else
            {
                this.raw = node.SelectSingleNode("CubeBlocks").OuterXml;
                Console.WriteLine("Quick loaded");
                this.quick_count = blocks.Count;
            }
            try
            {
                IsStatic = node.SelectSingleNode("IsStatic").InnerText;
                LinearVelocity.loadFromXML(node.SelectSingleNode("LinearVelocity"));
                AngularVelocity.loadFromXML(node.SelectSingleNode("AngularVelocity"));
            }
            catch (NullReferenceException) { }
            if (this.GridSizeEnum == "Large")
            {
                if (this.IsStatic == "true")
                {
                    this.displayType = "Station";
                }
                else
                {
                    this.displayType = "Large Ship";
                }
            }
            if (this.GridSizeEnum == "Small")
            {
                this.displayType = "Small Ship";
            }
            if (this.hasPilot == true)
            {
                this.displayType = "[*] " + this.displayType;
            }
            this.actualType = "Ship";
            Console.WriteLine("Loaded");
            //Console.WriteLine("Loaded "+displayType+" with "+CubeBlocks.Count +" blocks");
        }