Ejemplo n.º 1
0
        internal void SetupMount(Mount.MountData mountData)
        {
            ModMountData newMountData = (ModMountData)MemberwiseClone();

            newMountData.mountData = mountData;
            mountData.modMountData = newMountData;
            newMountData.mod       = mod;
            newMountData.SetDefaults();
        }
Ejemplo n.º 2
0
        internal void SetupMount(Mount.MountData mountData)
        {
            ModMountData newMountData = (ModMountData)Activator.CreateInstance(GetType());

            newMountData.mountData = mountData;
            mountData.modMountData = newMountData;
            newMountData.mod       = mod;
            newMountData.SetDefaults();
        }
Ejemplo n.º 3
0
        public int MountType(string name)
        {
            ModMountData mountData = GetMount(name);

            if (mountData == null)
            {
                return(0);
            }
            return(mountData.Type);
        }
Ejemplo n.º 4
0
        private void AutoloadMountData(Type type)
        {
            ModMountData mount = (ModMountData)Activator.CreateInstance(type);

            mount.mod = this;
            string name          = type.Name;
            string texture       = (type.Namespace + "." + type.Name).Replace('.', '/');
            var    extraTextures = new Dictionary <MountTextureType, string>();

            foreach (MountTextureType textureType in Enum.GetValues(typeof(MountTextureType)))
            {
                extraTextures[textureType] = texture + "_" + textureType.ToString();
            }
            if (mount.Autoload(ref name, ref texture, extraTextures))
            {
                AddMount(name, mount, texture, extraTextures);
            }
        }
Ejemplo n.º 5
0
        public void AddMount(string name, ModMountData mount, string texture,
			IDictionary<MountTextureType, string> extraTextures = null)
        {
            int id;
            if (Mount.mounts == null || Mount.mounts.Length == MountID.Count)
            {
                Mount.Initialize();
            }
            id = MountLoader.ReserveMountID();
            mount.Name = name;
            mount.Type = id;
            mountDatas[name] = mount;
            MountLoader.mountDatas[id] = mount;
            mount.texture = texture;
            mount.mod = this;
            if (extraTextures != null)
            {
                foreach (MountTextureType textureType in Enum.GetValues(typeof(MountTextureType)))
                {
                    if (extraTextures.ContainsKey(textureType) && ModLoader.TextureExists(extraTextures[textureType]))
                    {
                        Texture2D extraTexture = ModLoader.GetTexture(extraTextures[textureType]);
                        switch (textureType)
                        {
                            case MountTextureType.Back:
                                mount.mountData.backTexture = extraTexture;
                                break;
                            case MountTextureType.BackGlow:
                                mount.mountData.backTextureGlow = extraTexture;
                                break;
                            case MountTextureType.BackExtra:
                                mount.mountData.backTextureExtra = extraTexture;
                                break;
                            case MountTextureType.BackExtraGlow:
                                mount.mountData.backTextureExtraGlow = extraTexture;
                                break;
                            case MountTextureType.Front:
                                mount.mountData.frontTexture = extraTexture;
                                break;
                            case MountTextureType.FrontGlow:
                                mount.mountData.frontTextureGlow = extraTexture;
                                break;
                            case MountTextureType.FrontExtra:
                                mount.mountData.frontTextureExtra = extraTexture;
                                break;
                            case MountTextureType.FrontExtraGlow:
                                mount.mountData.frontTextureExtraGlow = extraTexture;
                                break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void AddMount(string name, ModMountData mount, string texture,
                             IDictionary <MountTextureType, string> extraTextures = null)
        {
            int id;

            if (Mount.mounts == null || Mount.mounts.Length == MountID.Count)
            {
                Mount.Initialize();
            }
            id                         = MountLoader.ReserveMountID();
            mount.Name                 = name;
            mount.Type                 = id;
            mountDatas[name]           = mount;
            MountLoader.mountDatas[id] = mount;
            mount.texture              = texture;
            mount.mod                  = this;
            if (extraTextures != null)
            {
                foreach (MountTextureType textureType in Enum.GetValues(typeof(MountTextureType)))
                {
                    if (extraTextures.ContainsKey(textureType) && ModLoader.TextureExists(extraTextures[textureType]))
                    {
                        Texture2D extraTexture = ModLoader.GetTexture(extraTextures[textureType]);
                        switch (textureType)
                        {
                        case MountTextureType.Back:
                            mount.mountData.backTexture = extraTexture;
                            break;

                        case MountTextureType.BackGlow:
                            mount.mountData.backTextureGlow = extraTexture;
                            break;

                        case MountTextureType.BackExtra:
                            mount.mountData.backTextureExtra = extraTexture;
                            break;

                        case MountTextureType.BackExtraGlow:
                            mount.mountData.backTextureExtraGlow = extraTexture;
                            break;

                        case MountTextureType.Front:
                            mount.mountData.frontTexture = extraTexture;
                            break;

                        case MountTextureType.FrontGlow:
                            mount.mountData.frontTextureGlow = extraTexture;
                            break;

                        case MountTextureType.FrontExtra:
                            mount.mountData.frontTextureExtra = extraTexture;
                            break;

                        case MountTextureType.FrontExtraGlow:
                            mount.mountData.frontTextureExtraGlow = extraTexture;
                            break;
                        }
                    }
                }
            }
        }