Exemplo n.º 1
0
        // This function is run after all mods are loaded.
        protected override void OnPostInitialize()
        {
            var form = (Form)Control.FromHandle(MonoMain.instance.Window.Handle);

            form.FormClosing += FormClosed;
            (typeof(Game).GetField("updateableComponents", flags).GetValue(MonoMain.instance) as List <IUpdateable>).Add(this);

            UpdateNetmessageTypes();
            Reskin.InitializeReskins();
        }
Exemplo n.º 2
0
        void HatChange(Profile pro, Tex2D customHat = null)
        {
            Tex2D hat = customHat ?? pro?.team?.hat?.texture;

            resetReskin(pro);

            if (pro?.duck == null || hat == null || hat.height <= ReskinFile.HatHeight || hat.width != 64)
            {
                return;
            }


            ReskinFile file = Reskin.tryLoadReskin(hat, false);


            if (file == null)
            {
                DevConsole.Log("Error loading reskin", Color.Red);
                return;
            }


            string md5 = (file.getChunk("MD5") as TextChunk)?.Text;
            string dir;

            if (Network.isActive && md5 != null && !pro.localPlayer)
            {
                if (Reskin.Exists(md5))
                {
                    dir = reskinMod.ReskinPath + md5;
                }
                else
                {
                    requestReskin(pro, md5);

                    return;
                }
            }
            else
            {
                dir = Reskin.CreateReskinFiles(file);
            }

            Reskin r = Reskin.GetReskin(dir);

            if (!Reskin.IsValid(r))
            {
                DevConsole.Log("something is wrong with that reskin!", Color.Red); return;
            }

            DevConsole.Log("skin appied to " + pro.name, Color.Green);
            ActiveReskins.Add(pro, r);
            r.Apply(pro.duck);
        }
Exemplo n.º 3
0
        public override void Activate()
        {
            Profile pro = DuckNetwork.profiles[profile];

            if (!Reskin.Exists(md5))
            {
                DevConsole.Log("recieved request for non existing md5", Color.Red);
                return;
            }

            DataTransferManager.SendLotsOfData(Reskin.hatData[md5], "reskin", connection);
        }
 public NoQuackTextureQuackComponent(Reskin skin) : base(skin)
 {
 }
Exemplo n.º 5
0
 public ReskinComponent(Reskin reskin)
 {
     skin = reskin;
 }
Exemplo n.º 6
0
 public ItemRetextureComponent(Reskin reskin) : base(reskin)
 {
 }
Exemplo n.º 7
0
 public CapeComponent(Reskin reskin) : base(reskin)
 {
 }
Exemplo n.º 8
0
 public static bool IsValid(Reskin skin)
 {
     return(skin.Textures.ContainsKey("Duck Texture"));
 }