示例#1
0
        private bool CorruptEntityAnimations_Func()
        {
            List<string> tocorrupt = new List<string>();

            if (!LoadXMLAndModify("./entities2.xml", delegate (XmlDocument XML)
            {
                tocorrupt.AddRange(from XmlNode n in XML.LastChild.ChildNodes select n.Attributes["anm2path"].Value);
            }))
            { return false; }

            tocorrupt.RemoveAll(x => x.Length == 0);
            tocorrupt.RemoveAll(x => x.Contains("Fireworks") == true);

            if (!tocorrupt.Select(corruptfile => "./gfx/" + corruptfile)
                .All(toopen => LoadXMLAndModify(toopen, delegate (XmlDocument XML)
                {
                    AnimCont A = new AnimCont();
                    foreach (XmlNode frame in XML.GetElementsByTagName("Frame"))
                    {
                        CorruptFrame(frame, A);
                    }
                })))
            { return false; }

            List<string> itemfiles = Safe.GetFiles("./gfx/characters");
            return itemfiles.All(file => LoadXMLAndModify(file, delegate (XmlDocument XML)
            {
                AnimCont A = new AnimCont();
                foreach (XmlNode frame in XML.GetElementsByTagName("Frame"))
                {
                    CorruptFrame(frame, A);
                }
            }));
        }
示例#2
0
        private bool CorruptUI_Func()
        {
            List<string> uifiles = Safe.GetFiles("./gfx/ui/");
            if (uifiles == null)
            {
                return false;
            }

            return !uifiles.Any(file => !LoadXMLAndModify(file, delegate (XmlDocument XML)
            {
                AnimCont A = new AnimCont();
                foreach (XmlNode frame in XML.GetElementsByTagName("Frame"))
                {
                    CorruptFrame(frame, A);
                }
            }));
        }
示例#3
0
 private void CorruptFrame(XmlNode frame, AnimCont context)
 {
     var culture = CultureInfo.InvariantCulture;
     if (frame.Attributes["XPosition"] != null)
         frame.Attributes["XPosition"].Value =
             (double.Parse(frame.Attributes["XPosition"].Value, culture) + ((!FixInvisibleEntities) ? (context.context[0]) : (context.context[0] % 8))).ToString();
     if (frame.Attributes["YPosition"] != null)
         frame.Attributes["YPosition"].Value =
             (double.Parse(frame.Attributes["YPosition"].Value, culture) + ((!FixInvisibleEntities) ? (context.context[1]) : (context.context[1] % 8))).ToString();
     if (frame.Attributes["Delay"] != null)
         frame.Attributes["Delay"].Value =
             ((int)(Math.Abs(double.Parse(frame.Attributes["Delay"].Value, culture) + context.context[2]))).ToString();
     if (frame.Attributes["XScale"] != null)
         frame.Attributes["XScale"].Value =
             (double.Parse(frame.Attributes["XScale"].Value, culture) + ((!FixInvisibleEntities) ? (context.context[3]) : (context.context[3] % 8))).ToString();
     if (frame.Attributes["YScale"] != null)
         frame.Attributes["YScale"].Value =
             (double.Parse(frame.Attributes["YScale"].Value, culture) + ((!FixInvisibleEntities) ? (context.context[4]) : (context.context[4] % 8))).ToString();
     if (frame.Attributes["RedTint"] != null)
         frame.Attributes["RedTint"].Value =
             ((double.Parse(frame.Attributes["RedTint"].Value, culture) + context.context[5]) % 256).ToString();
     if (frame.Attributes["GreenTint"] != null)
         frame.Attributes["GreenTint"].Value =
             ((double.Parse(frame.Attributes["GreenTint"].Value, culture) + context.context[6]) % 256).ToString();
     if (frame.Attributes["BlueTint"] != null)
         frame.Attributes["BlueTint"].Value =
            ((double.Parse(frame.Attributes["BlueTint"].Value, culture) + context.context[7]) % 256).ToString();
     if (frame.Attributes["RedOffset"] != null)
         frame.Attributes["RedOffset"].Value =
             ((double.Parse(frame.Attributes["RedOffset"].Value, culture) + context.context[8]) % 256).ToString();
     if (frame.Attributes["GreenOffset"] != null)
         frame.Attributes["GreenOffset"].Value =
             ((double.Parse(frame.Attributes["GreenOffset"].Value, culture) + context.context[9]) % 256).ToString();
     if (frame.Attributes["BlueOffset"] != null)
         frame.Attributes["BlueOffset"].Value =
             ((double.Parse(frame.Attributes["BlueOffset"].Value, culture) + context.context[10]) % 256).ToString();
     if (frame.Attributes["AlphaTint"] != null)
         frame.Attributes["AlphaTint"].Value =
             ((double.Parse(frame.Attributes["AlphaTint"].Value, culture) + context.context[11]) % 256 + 144).ToString();
     if (frame.Attributes["Rotation"] != null)
         frame.Attributes["Rotation"].Value =
             (double.Parse(frame.Attributes["Rotation"].Value, culture) + context.context[12]).ToString();
     context.Mod();
 }
    private Player player; // The Rewired Player


    private void Start()
    {
        animCont = GetComponent <AnimCont>();
        _rb      = GetComponent <Rigidbody>();
        StartCoroutine(Initialize());
    }