示例#1
0
 private static void readConnectionInfos(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.ip = node.Attributes["ip"].Value;
     if (node.Attributes["port"] != null)
     {
         configurationNode.port = Convert.ToInt32(node.Attributes["port"].Value);
     }
 }
示例#2
0
        private static void SpawnScreenplane(Transform parent, ConfigurationNode configurationNode)
        {
            GameObject screenPlane = new GameObject(configurationNode.ip);

            screenPlane.transform.parent        = parent;
            screenPlane.transform.localScale    = configurationNode.screenplaneScale;
            screenPlane.transform.eulerAngles   = configurationNode.screenplaneRotation;
            screenPlane.transform.localPosition = configurationNode.screenplanePosition;
            configurationNode.screenPlane       = screenPlane.transform;
        }
示例#3
0
        private static void readNodeInformation()
        {
            XmlNode node_Config = xmlDocument.GetElementsByTagName("config")[0];

            foreach (XmlNode node in node_Config.ChildNodes)
            {
                if (node.Name.Equals("slave") || node.Name.Equals("master"))
                {
                    ConfigurationNode configurationNode = new ConfigurationNode();
                    readConnectionInfos(node, configurationNode);

                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        switch (childNode.Name)
                        {
                        case "origin":
                            readOrigin(childNode, configurationNode);
                            break;

                        case "camera":
                            readCamera(childNode, configurationNode);
                            break;

                        case "screenplane":
                            readScreenplane(childNode, configurationNode);
                            break;
                        }
                    }

                    switch (node.Name)
                    {
                    case "master":
                        master = configurationNode;
                        break;

                    case "slave":
                        slaves.Add(configurationNode);
                        break;
                    }
                }
            }

            if (developmentMode || isOwnIP(master.ip))
            {
                own = master;
            }
            else
            {
                foreach (ConfigurationNode slave in slaves)
                {
                    if (isOwnIP(slave.ip))
                    {
                        own = slave;
                    }
                }
            }

            if (own == null)
            {
                throw new Exception("Own configuration node could not be found.");
            }
            else
            {
                Debug.Log("Config loaded (" + (master != null ? "1" : "0") + " master, " + slaves.Count + " slaves, own type: " + (isMaster() ? "master" : "slave") + (developmentMode ? ", Development mode!" : "") + ")");
            }
        }
示例#4
0
 private static void readCamera(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.cameraRoation = readVector(node, "rotation");
     configurationNode.cameraEye     = node.Attributes["eye"].Value;
 }
示例#5
0
 private static void readOrigin(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.originPosition = readVector(node, "position");
 }
示例#6
0
 private static void readScreenplane(XmlNode node, ConfigurationNode configurationNode)
 {
     configurationNode.screenplanePosition = readVector(node, "position");
     configurationNode.screenplaneRotation = readVector(node, "rotation");
     configurationNode.screenplaneScale    = readVector(node, "scale");
 }