Exemple #1
0
        public static EntityDefinition GetTypeDef(HologramMode mode, object objLiteral)
        {
            if (!ReflectionHelpers.Get(objLiteral, "mod", out string mod))
            {
                return(null);
            }
            if (!ReflectionHelpers.Get(objLiteral, "name", out string name))
            {
                return(null);
            }

            switch (mode)
            {
            case HologramMode.NPC:
                return(new NPCDefinition(mod, name));

            case HologramMode.Item:
                return(new ItemDefinition(mod, name));

            case HologramMode.Projectile:
                return(new ProjectileDefinition(mod, name));

            case HologramMode.Gore:
                return(new GoreDefinition(mod, name));

            default:
                throw new NotImplementedException("No such mode..");
            }
        }
        ////////////////

        public void SetHologramMode(HologramMode mode)
        {
            if (this.IsModeBeingSet)
            {
                return;
            }
            this.IsModeBeingSet = true;

            if (mode != HologramMode.NPC && this.ModeNpcChoice.Selected)
            {
                this.ModeNpcChoice.Selected = false;
                this.ModeNpcChoice.Recalculate();
            }
            if (mode != HologramMode.Item && this.ModeItemChoice.Selected)
            {
                this.ModeItemChoice.Selected = false;
                this.ModeItemChoice.Recalculate();
            }
            if (mode != HologramMode.Projectile && this.ModeProjectileChoice.Selected)
            {
                this.ModeProjectileChoice.Selected = false;
                this.ModeProjectileChoice.Recalculate();
            }
            if (mode != HologramMode.Gore && this.ModeGoreChoice.Selected)
            {
                this.ModeGoreChoice.Selected = false;
                this.ModeGoreChoice.Recalculate();
            }


            this.CurrentMode = mode;

            this.IsModeBeingSet = false;
        }
Exemple #3
0
        public static bool IsBadType(HologramMode mode, int type)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                if (type < NPCLoader.NPCCount)
                {
                    return(false);
                }                                                                   //type < Main.npcTexture.Length
                return(NPCLoader.GetNPC(type) == null);

            case HologramMode.Item:
                if (type < ItemLoader.ItemCount)
                {
                    return(false);
                }                                                                   //type < Main.itemTexture.Length
                return(ItemLoader.GetItem(type) == null);

            case HologramMode.Projectile:
                if (type < ProjectileLoader.ProjectileCount)
                {
                    return(false);
                }                                                                               //type < Main.projectileTexture.Length
                return(ProjectileLoader.GetProjectile(type) == null);

            case HologramMode.Gore:
                return(type < 0 || type >= ModGore.GoreCount);

            //return Main.goreTexture[type] == null;
            default:
                throw new ModHelpersException("Invalid hologram type");
            }
        }
 private void SetValid()
 {
     _mode = HologramMode.Valid;
     for (int i = 0; i < _meshes.Length; i++)
     {
         _meshes[i].material.color = _hologramColorValid;
     }
 }
Exemple #5
0
        public void Output(
            out HologramMode mode,
            out int type,
            out float scale,
            out byte colorR,
            out byte colorG,
            out byte colorB,
            out byte alpha,
            out int direction,
            out float rotation,
            out int offsetX,
            out int offsetY,
            out int frameStart,
            out int frameEnd,
            out int frameRateTicks,
            out bool worldLight,
            out HologramShaderMode shaderMode,
            out float shaderTime,
            out int shaderType,
            out bool isActivated)
        {
            Color color;

            this.Output(
                mode: out mode,
                type: out type,
                scale: out scale,
                color: out color,
                alpha: out alpha,
                direction: out direction,
                rotation: out rotation,
                offsetX: out offsetX,
                offsetY: out offsetY,
                frameStart: out frameStart,
                frameEnd: out frameEnd,
                frameRateTicks: out frameRateTicks,
                worldLight: out worldLight,
                shaderMode: out shaderMode,
                shaderTime: out shaderTime,
                shaderType: out shaderType,
                isActivated: out isActivated
                );
            colorR = color.R;
            colorG = color.G;
            colorB = color.B;
        }
        public static EntityDefinition GetEntDef(HologramMode mode, int type)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                return(new NPCDefinition(type));

            case HologramMode.Item:
                return(new ItemDefinition(type));

            case HologramMode.Projectile:
                return(new ProjectileDefinition(type));

            default:
                throw new NotImplementedException("No such mode.");
            }
        }
        public static EntityDefinition GetEntDef(HologramMode mode, string rawDef)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                return(NPCDefinition.FromString(rawDef));

            case HologramMode.Item:
                return(ItemDefinition.FromString(rawDef));

            case HologramMode.Projectile:
                return(ProjectileDefinition.FromString(rawDef));

            default:
                throw new NotImplementedException("No such mode..");
            }
        }
        public static int GetFrameCount(HologramMode mode, int type)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                return(Main.npcFrameCount[type]);

            case HologramMode.Item:
                return(1);

            case HologramMode.Projectile:
                return(Main.projFrames[type]);

            case  HologramMode.Gore:
                return(1);

            default:
                throw new ModHelpersException("Invalid hologram type");
            }
        }
        ////

        public static Texture2D GetTexture(HologramMode mode, int type)
        {
            switch (mode)
            {
            case HologramMode.NPC:
                return(Main.npcTexture[type]);

            case HologramMode.Item:
                return(Main.itemTexture[type]);

            case HologramMode.Projectile:
                return(Main.projectileTexture[type]);

            case HologramMode.Gore:
                return(Main.goreTexture[type]);

            default:
                throw new ModHelpersException("Invalid hologram type");
            }
        }
        public void SetHologramMode(HologramMode mode)
        {
            if (mode == _mode)
            {
                return;
            }

            switch (mode)
            {
            case (HologramMode.Valid):
                SetValid();
                break;

            case (HologramMode.Invalid):
                SetInvalid();
                break;

            case (HologramMode.Disabled):
                _mode = HologramMode.Disabled;
                gameObject.SetActive(false);
                break;
            }
        }
Exemple #11
0
        ////////////////

        public void Output(
            out HologramMode mode,
            out int type,
            out float scale,
            out Color color,
            out byte alpha,
            out int direction,
            out float rotation,
            out int offsetX,
            out int offsetY,
            out int frameStart,
            out int frameEnd,
            out int frameRateTicks,
            out bool worldLight,
            out HologramShaderMode shaderMode,
            out float shaderTime,
            out int shaderType,
            out bool isActivated)
        {
            mode           = this.Mode;
            type           = this.Type;
            scale          = this.Scale;
            color          = this.Color;
            alpha          = this.Alpha;
            direction      = this.Direction;
            rotation       = this.Rotation;
            offsetX        = this.OffsetX;
            offsetY        = this.OffsetY;
            frameStart     = this.FrameStart;
            frameEnd       = this.FrameEnd;
            frameRateTicks = this.FrameRateTicks;
            worldLight     = this.WorldLighting;
            shaderMode     = this.ShaderMode;
            shaderTime     = this.ShaderTime;
            shaderType     = this.ShaderType;
            isActivated    = this.IsActivated;
        }
 public void SetHologramMode(HologramMode mode)
 {
     _hologram.SetHologramMode(mode);
 }
Exemple #13
0
        ////////////////

        public void SetHologramMode(HologramMode mode)
        {
            if (this.IsModeBeingSet)
            {
                return;
            }
            this.IsModeBeingSet = true;

            if (mode != HologramMode.NPC && this.ModeNpcChoice.Selected)
            {
                this.ModeNpcChoice.Selected = false;
                this.ModeNpcChoice.Recalculate();
            }
            if (mode != HologramMode.Item && this.ModeItemChoice.Selected)
            {
                this.ModeItemChoice.Selected = false;
                this.ModeItemChoice.Recalculate();
            }
            if (mode != HologramMode.Projectile && this.ModeProjectileChoice.Selected)
            {
                this.ModeProjectileChoice.Selected = false;
                this.ModeProjectileChoice.Recalculate();
            }
            if (mode != HologramMode.Gore && this.ModeGoreChoice.Selected)
            {
                this.ModeGoreChoice.Selected = false;
                this.ModeGoreChoice.Recalculate();
            }

            switch (mode)
            {
            case HologramMode.NPC:
                this.ModeNpcChoice.Selected = true;
                this.ModeNpcChoice.Recalculate();
                this.TypeSlider.SetRange(1f, NPCLoader.NPCCount - 1);
                break;

            case HologramMode.Item:
                this.ModeItemChoice.Selected = true;
                this.ModeItemChoice.Recalculate();
                this.TypeSlider.SetRange(1f, ItemLoader.ItemCount - 1);
                break;

            case HologramMode.Projectile:
                this.ModeProjectileChoice.Selected = true;
                this.ModeProjectileChoice.Recalculate();
                this.TypeSlider.SetRange(1f, ProjectileLoader.ProjectileCount - 1);
                break;

            case HologramMode.Gore:
                this.ModeGoreChoice.Selected = true;
                this.ModeGoreChoice.Recalculate();
                this.TypeSlider.SetRange(1f, ModGore.GoreCount - 1);
                break;
            }
            this.TypeSlider.Recalculate();

            this.CurrentMode = mode;

            this.IsModeBeingSet = false;
        }