Exemplo n.º 1
0
        static void UpdateColors(Apk apk, CustomColors colors, InvocationResult res)
        {
            SerializedAssets colorAssets = SerializedAssets.FromBytes(
                apk.ReadEntireEntry(apk.ColorsFile()), apk.version);
            // There should only be one color manager
            var colorManager = colorAssets.FindScript <ColorManager>(cm => true);

            colorManager.UpdateColor(colorAssets, colors.colorA, ColorManager.ColorSide.A);
            colorManager.UpdateColor(colorAssets, colors.colorB, ColorManager.ColorSide.B);
            apk.ReplaceAssetsFile(apk.ColorsFile(), colorAssets.ToBytes());
            res.newColors = new CustomColors()
            {
                colorA = colorManager.colorA.FollowToScript <SimpleColor>(colorAssets),
                colorB = colorManager.colorB.FollowToScript <SimpleColor>(colorAssets),
            };
        }