예제 #1
0
 public void Initialize(CompileInfo info)
 {
     buttonName = null;
     info.RegisterVJoyButton(Button);
     IfFalseMappings.Initialize(info);
     IfTrueMappings.Initialize(info);
 }
예제 #2
0
        public void Feed(CompileInfo info, System.IO.StreamWriter file)
        {
            if (String.IsNullOrEmpty(Joystick))
            {
                return;
            }

            file.Write(new string(' ', info.IndentLevel * 4));
            file.Write("if ("); file.Write(buttonName); file.Write(".Check("); file.Write(Joystick.Replace("joystick", "state")); file.Write(".Buttons["); file.Write(Button - 1); file.WriteLine("]))");
            file.Write(new string(' ', info.IndentLevel * 4));
            file.WriteLine("{");

            info.IndentLevel++;
            IfTrueMappings.Feed(info, file);
            info.IndentLevel--;
            file.Write(new string(' ', info.IndentLevel * 4));
            file.WriteLine("}");
            file.Write(new string(' ', info.IndentLevel * 4));
            file.WriteLine("else");
            file.Write(new string(' ', info.IndentLevel * 4));
            file.WriteLine("{");

            info.IndentLevel++;
            IfFalseMappings.Feed(info, file);
            info.IndentLevel--;
            file.Write(new string(' ', info.IndentLevel * 4));
            file.WriteLine("}");
        }
예제 #3
0
        public void ToXml(System.Xml.XmlNode parentNode)
        {
            var node = parentNode.AddElement("Switch");

            node.SetAttribute("button", (Button - 1).ToString());
            node.SetAttribute("offText", IfFalseSayText);
            IfFalseMappings.ToXml(node.AddElement("Off"));
            node.SetAttribute("onText", IfTrueSayText);
            IfTrueMappings.ToXml(node.AddElement("On"));
        }
예제 #4
0
        public void ToXml(System.Xml.XmlNode parentNode)
        {
            var node = parentNode.AddElement(TagName);

            node.SetAttribute("joystick", Joystick);
            node.SetAttribute("button", (Button - 1).ToString());
            node.SetAttribute("deactivatedText", IfFalseSayText);
            IfFalseMappings.ToXml(node.AddElement("Deactivated"));
            node.SetAttribute("activatedText", IfTrueSayText);
            IfTrueMappings.ToXml(node.AddElement("Activated"));
        }
예제 #5
0
        public void FromXml(System.Xml.XmlNode node)
        {
            int value;

            if (Int32.TryParse(node.GetAttribute("button"), out value))
            {
                Button = value + 1;
            }

            IfFalseSayText = node.GetAttribute("offText");
            IfFalseMappings.FromXml(node.SelectSingleNode("Off"));
            IfTrueSayText = node.GetAttribute("onText");
            IfTrueMappings.FromXml(node.SelectSingleNode("On"));
        }
예제 #6
0
        public void FromXml(System.Xml.XmlNode node)
        {
            Joystick = node.GetAttribute("joystick");
            int value;

            if (Int32.TryParse(node.GetAttribute("button"), out value))
            {
                Button = value + 1;
            }

            IfFalseSayText = node.GetAttribute("deactivatedText");
            IfFalseMappings.FromXml(node.SelectSingleNode("Deactivated"));
            IfTrueSayText = node.GetAttribute("activatedText");
            IfTrueMappings.FromXml(node.SelectSingleNode("Activated"));
        }