/// <summary>Default constructor.</summary>
 /// <param name="tileset">Tileset type and data.</param>
 /// <param name="control">Where the grid will be attached.</param>
 /// <param name="tilesetImage">Image of the tileset.</param>
 /// <param name="preview">PictureBox where the selectedImage is shown.</param>
 public TilesetEditorIntput(ITileset tileset, Control control, Image tilesetImage, PictureBox preview) : base(tileset, control)
 {
     this.preview      = preview;
     this.tilesetImage = tilesetImage;
     this.mode         = SpriteMode.ALIGN_TOP_LEFT;
     SetUpGrid();
 }
Example #2
0
        public SceneOW(OverworldEditor f, Overworld ow, DungeonMain mform)
        {
            owForm   = f;
            mainForm = mform;
            this.ow  = ow;
            //graphics = Graphics.FromImage(scene_bitmap);
            //this.Image = new Bitmap(4096, 4096);
            this.MouseUp          += new MouseEventHandler(onMouseUp);
            this.MouseMove        += new MouseEventHandler(onMouseMove);
            this.MouseDoubleClick += new MouseEventHandler(onMouseDoubleClick);
            this.MouseWheel       += SceneOW_MouseWheel;
            tilesgfxBitmap         = new Bitmap(512, 512, 512, PixelFormat.Format8bppIndexed, temptilesgfxPtr);
            tilemode       = new TileMode(this);
            exitmode       = new ExitMode(this);
            doorMode       = new DoorMode(this);
            entranceMode   = new EntranceMode(this);
            selectedMode   = ObjectMode.Tile;
            itemMode       = new ItemMode(this);
            spriteMode     = new SpriteMode(this);
            transportMode  = new TransportMode(this);
            overlayMode    = new OverlayMode(this);
            gravestoneMode = new GravestoneMode(this);

            //this.Width = 8192;
            //this.Height = 8192;
            //this.Size = new Size(8192, 8192);
            //this.Refresh();
        }
Example #3
0
 /// <summary>Default constructor.</summary>
 /// <param name="inputMaker">Tileset type to be converted</param>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag to ignore empty sprites.</param>
 public TilesetConverterBase(ITileset inputMaker, SpriteMode mode, bool ignoreAlpha)
 {
     this.mode         = mode;
     this.inputTileset = inputMaker;
     this.ignoreAlpha  = ignoreAlpha;
     SetOutputTileset();
 }
 /// <summary>Default constructor.</summary>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag toFlag to ignore ignore empty sprites.</param>
 /// <param name="spriteSize">Tile width.</param>
 public TilesetConverterCustom(SpriteMode mode, bool ignoreAlpha, int spriteSize = 0) : base(new Maker.Custom(), mode, ignoreAlpha)
 {
     if (spriteSize > 0)
     {
         Maker.Custom.SPRITE_SIZE = spriteSize;
     }
 }
        private TilesetConverterBase GetTilesetConverter(SpriteMode mode)
        {
            TilesetConverterBase con;
            string name = tileset.TilesetName();

            if (name == Tileset.Alpha.Name)
            {
                con = new TilesetConverterVerticalApha(tileset, mode, false);
            }
            else if (name == Tileset.R95.Name || name == Tileset.S97.Name || name == Tileset.XP_Tile.Name)
            {
                con = new TilesetConverterVertical(tileset, mode, false);
            }
            else if (name == Tileset.XP_Auto.Name)
            {
                con = new TilesetConverterAutotileXP(tileset, mode, false);
            }
            else if (Tileset.IsR2k_2k3((Tileset)tileset) && name != Tileset.R2k_2k3_AnimObj.Name)
            { // all 2000/2003 tilesets but not an animated object
                con = new TilesetConverterVerticalRM2K3(tileset, mode, false);
            }
            else if (name == Tileset.Custom(0).Name)
            {
                con = new TilesetConverterCustom(tileset, mode, false);
            }
            else
            {
                con = new TilesetConverterVX(tileset, mode, false);
            }

            return(con);
        }
Example #6
0
 public static bool SpriteHasMulticolorEnabled(SpriteMode Mode)
 {
     if ((Mode == SpriteMode.COMMODORE_24_X_21_MULTICOLOR) ||
         (Mode == SpriteMode.MEGA65_64_X_21_16_MULTICOLOR))
     {
         return(true);
     }
     return(false);
 }
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.name == "Player")
     {
         currentAttack = backOff;
         currentMode   = SpriteMode.idle;
         attackCount   = 2;
         Debug.Log("backOff");
     }
 }
Example #8
0
    void _GUIHandler()
    {
        GUILayout.Label("Setting", EditorStyles.boldLabel);

        isUse = EditorGUILayout.Toggle("Use", isUse);

        offsetX      = EditorGUILayout.FloatField("Offset X", offsetX);
        sortingOrder = EditorGUILayout.IntField("Sorting Order", sortingOrder);

        currentSprite = (Sprite)EditorGUILayout.ObjectField(currentSprite, typeof(Sprite), true);

        currentMode = (EditMode)EditorGUILayout.EnumPopup("Edit Mode", currentMode);
        spriteMode  = (SpriteMode)EditorGUILayout.EnumPopup("Sprite Mode", spriteMode);

        isBeginPlot = EditorGUILayout.Toggle("Begin Plot", isBeginPlot);

        if (isBeginPlot)
        {
            isOverrideSprite = EditorGUILayout.Toggle("Override Sprite", isOverrideSprite);
            isUseSnap        = EditorGUILayout.Toggle("Use Snap", isUseSnap);
        }

        if (EditMode.Multiple == currentMode && SpriteMode.Simple == spriteMode)
        {
            isUsePreset = EditorGUILayout.Toggle("Use Preset", isUsePreset);

            if (isUsePreset)
            {
                presetLength = EditorGUILayout.IntField("Preset Length", presetLength);

                if (GUILayout.Button("Create new Preset"))
                {
                    spritePresets = new Sprite[presetLength];
                }

                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);

                for (int i = 0; i < spritePresets.Length; i++)
                {
                    spritePresets[i] = (Sprite)EditorGUILayout.ObjectField(
                        new GUIContent("Sprite"),
                        spritePresets[i],
                        typeof(Sprite),
                        false);
                }

                EditorGUILayout.EndScrollView();
            }
        }
    }
        //public float		baseProbability;

        public void SetDefaults()
        {
            SetNewGuid();

            name       = "<No name>";
            textureSet = string.Empty;

            textureAlbedoTint                     = Color.white;
            uvScaleOffset                         = new Vector4(1f, 1f, 0f, 0f);
            widthMinMaxMedian                     = new Vector3(0.3f, 0.8f, 0.6f);
            heightMinMaxMedian                    = new Vector3(0.2f, 0.5f, 0.4f);
            groundColorFactorBottomTopMid         = new Vector3(0.6f, 0.4f, 0.5f);
            groundColorFactorScaleBottomTopMid    = new Vector3(1.0f, 1.0f, 1.0f);
            groundWetnessDarkenFactorBottomTopMid = new Vector3(0.3f, 0.1f, 0.1f);
            growsInWater = true;
            mode         = SpriteMode.Oriented;
            //baseProbability						= 1f;
        }
Example #10
0
        internal static GraphicTileMode GraphicTileModeFromSpriteMode(SpriteMode Mode)
        {
            switch (Mode)
            {
            case SpriteMode.COMMODORE_24_X_21_HIRES:
                return(GraphicTileMode.COMMODORE_HIRES);

            case SpriteMode.COMMODORE_24_X_21_MULTICOLOR:
                return(GraphicTileMode.COMMODORE_MULTICOLOR);

            case SpriteMode.MEGA65_16_X_21_16_COLORS:
            case SpriteMode.MEGA65_8_X_21_16_COLORS:
                return(GraphicTileMode.MEGA65_FCM_16_COLORS);

            default:
                return(GraphicTileMode.COMMODORE_HIRES);
            }
        }
        /// <summary>Update the sprite of the preview.</summary>
        /// <param name="mode">Mode of the sprite.</param>
        public void UpdateSelectedImage(SpriteMode mode)
        {
            selectedImage = selectedImageRaw;
            this.mode     = mode;

            if (selectedImage == null)
            {
                return;
            }

            TilesetConverterBase con;

            con           = GetTilesetConverter(mode);
            selectedImage = con.SetModeInSprite(selectedImage, Tileset.MV_A12.Size); // must not be mv sprite size, add param to set this
            if (preview != null)
            {
                preview.Image = selectedImage;
            }
        }
Example #12
0
 //int selectedMode = 0;
 public SceneOW(Form1 f)
 {
     //graphics = Graphics.FromImage(scene_bitmap);
     //this.Image = new Bitmap(4096, 4096);
     this.MouseUp          += new MouseEventHandler(onMouseUp);
     this.MouseMove        += new MouseEventHandler(onMouseMove);
     this.MouseDoubleClick += new MouseEventHandler(onMouseDoubleClick);
     this.MouseWheel       += SceneOW_MouseWheel;
     mainForm       = f;
     tilesgfxBitmap = new Bitmap(512, 512, 512, PixelFormat.Format8bppIndexed, temptilesgfxPtr);
     tilemode       = new TileMode(this);
     exitmode       = new ExitMode(this);
     doorMode       = new DoorMode(this);
     entranceMode   = new EntranceMode(this);
     selectedMode   = ObjectMode.Tile;
     itemMode       = new ItemMode(this);
     spriteMode     = new SpriteMode(this);
     transportMode  = new TransportMode(this);
     //this.Refresh();
 }
Example #13
0
        private TilesetConverterBase GetTilesetConverter(SpriteMode mode)
        {
            TilesetConverterBase con;

            switch (tileset.TilesetName())
            {
            case Maker.Alpha.NAME:
                con = new TilesetConverterVerticalApha(tileset, mode, false);
                break;

            case Maker.R95.NAME:
            case Maker.S97.NAME:
            case Maker.XP_Tile.NAME:
                con = new TilesetConverterVertical(tileset, mode, false);
                break;

            case Maker.XP_Auto.NAME:
                con = new TilesetConverterAutotileXP(tileset, mode, false);
                break;

            case Maker.R2k_2k3_A.NAME:
            case Maker.R2k_2k3_B.NAME:
            case Maker.R2k_2k3_AB.NAME:
            case Maker.R2k_2k3_Auto.NAME:
                con = new TilesetConverterVerticalRM2K3(tileset, mode, false);
                break;

            case Maker.Custom.NAME:
                con = new TilesetConverterCustom(mode, false);
                break;

            default:
                con = new TilesetConverterVX(tileset, mode, false);
                break;
            }

            return(con);
        }
 public override Attack chooseAttack()
 {
     CheckAttackChange();
     if (changeAttack)
     {
         if (attackCount == 1)
         {
             currentMode = SpriteMode.charging;
             StartDelay();
             currentAttack = charge;
             changeAttack  = false;
             attackCount++;
             return(charge);
         }
         else if (attackCount == 2)
         {
             currentMode = SpriteMode.fire;
             StartDelay();
             currentAttack = fire;
             findFacing();
             fire.dir = facingdir;
             Invoke("Fire", 1);
             changeAttack = false;
             attackCount  = 1;
             bleep.Play();
             return(fire);
         }
         else
         {
             StartDelay();
             currentAttack = backOff;
             changeAttack  = false;
             attackCount   = 1;
             return(backOff);
         }
     }
     return(currentAttack);
 }
 public TileResourcePath(string spriteId, string path, SpriteMode mode)
 {
     this.spriteId = spriteId;
     this.path     = path;
     this.mode     = mode;
 }
Example #16
0
 /// <summary>Default constructor.</summary>
 /// <param name="inputMaker">Tileset type to be converted</param>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag to ignore empty sprites.</param>
 public TilesetConverterVerticalRM2K3(ITileset inputMaker, SpriteMode mode, bool ignoreAlpha) : base(inputMaker, mode, ignoreAlpha)
 {
 }
 public SpriteData(SpriteData Other)
 {
     Mode = Other.Mode;
     Tile = new GraphicTile(Other.Tile);
 }
Example #18
0
 /// <summary>Default constructor.</summary>
 /// <param name="inputTilesetImpl">Tileset type to be converted</param>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag to ignore empty sprites.</param>
 public TilesetConverterVX(ITileset inputTilesetImpl, SpriteMode mode, bool ignoreAlpha) : base(inputTilesetImpl, mode, ignoreAlpha)
 {
 }
 /// <summary>Default constructor.</summary>
 /// <param name="inputMaker">Tileset type to be converted</param>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag to ignore empty sprites.</param>
 public TilesetConverterAutotileXP(ITileset inputMaker, SpriteMode mode, bool ignoreAlpha) : base(inputMaker, mode, ignoreAlpha)
 {
 }
Example #20
0
 /// <summary>Default constructor.</summary>
 /// <param name="mode">Mode how sprites should be pasted into the converted image.</param>
 /// <param name="ignoreAlpha">Flag toFlag to ignore ignore empty sprites.</param>
 /// <param name="spriteSize">Tile width.</param>
 public TilesetConverterCustom(ITileset tileset, SpriteMode mode, bool ignoreAlpha) : base(tileset, mode, ignoreAlpha)
 {
 }
Example #21
0
    /// <summary>
    /// Display precise variables for StP different modes
    /// </summary>
    public override void OnInspectorGUI()
    {
        SpriteToParticles StP = (SpriteToParticles)target;

        showHelp = EditorPrefs.GetBool("SpriteToParticles.ShowTools");
        //showWarnings = EditorPrefs.GetBool("SpriteToParticles.ShowWarnings");

        GUIStyle Title = new GUIStyle(EditorStyles.textArea);

        Title.normal.textColor = Color.white;
        Title.fontStyle        = FontStyle.Bold;

        serializedObject.Update();

        RenderSystemUsing renderType    = (RenderSystemUsing)renderSystemType.intValue;
        SpriteMode        _emissionMode = (SpriteMode)spriteMode.intValue;

        GUILayout.Space(5f);
        EditorGUILayout.LabelField("Main Config", Title);
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(spriteMode);

        EditorGUILayout.PropertyField(renderSystemType);
        EditorGUI.indentLevel--;
        GUILayout.Space(5f);

        EditorGUILayout.LabelField("References", Title);
        EditorGUI.indentLevel++;

        if (renderType == RenderSystemUsing.SpriteRenderer)
        {
            EditorGUILayout.PropertyField(spriteRenderer);
        }
        if (renderType == RenderSystemUsing.ImageRenderer)
        {
            EditorGUILayout.PropertyField(imageRenderer);
        }
        EditorGUILayout.PropertyField(particlesSystem);
        if (showHelp)
        {
            CheckValidations();
        }
        EditorGUI.indentLevel--;
        GUILayout.Space(5f);

        EditorGUILayout.LabelField("Emission Options", Title);
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(PlayOnAwake);
        EditorGUILayout.PropertyField(EmissionRate);

        if (_emissionMode != SpriteMode.Static)
        {
            EditorGUILayout.PropertyField(borderEmission);
        }

        EditorGUILayout.PropertyField(UsePixelSourceColor);
        GUILayout.Space(5f);
        EditorGUILayout.PropertyField(UseEmissionFromColor);
        if (UseEmissionFromColor.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(EmitFromColor);
            EditorGUILayout.PropertyField(RedTolerance);
            EditorGUILayout.PropertyField(GreenTolerance);
            EditorGUILayout.PropertyField(BlueTolerance);
            EditorGUI.indentLevel--;
        }
        EditorGUI.indentLevel--;
        GUILayout.Space(5f);

        if (IsRendererInAnotherGameObject(StP))
        {
            EditorGUILayout.LabelField("Renderer in different GameObject specifics", Title);
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(matchTargetGOPostionData);
            EditorGUILayout.PropertyField(matchTargetGOScale);
            EditorGUI.indentLevel--;
            GUILayout.Space(5f);
        }

        EditorGUILayout.LabelField("Advanced Options", Title);
        EditorGUI.indentLevel++;
        //advancedOptions = EditorGUILayout.Foldout(advancedOptions, "Show");
        //if (advancedOptions)
        {
            //EditorGUI.indentLevel++;
            if (_emissionMode == SpriteMode.Dynamic)
            {
                EditorGUILayout.PropertyField(CacheSprites);
            }
            else
            {
                EditorGUILayout.PropertyField(CacheOnAwake);
            }

            EditorGUILayout.PropertyField(useSpritesSharingCache);
            EditorGUILayout.PropertyField(useBetweenFramesPrecision);
            if (showHelp && useBetweenFramesPrecision.boolValue)
            {
                #if UNITY_5_5_OR_NEWER
                if (StP.particlesSystem && StP.particlesSystem.main.simulationSpace != ParticleSystemSimulationSpace.World)
                {
                    EditorGUILayout.HelpBox("Between frames precision is only to be use with ParticleSystem's simulation space set to world.", MessageType.Warning);
                }
                #endif
            }

            GUILayout.Space(5f);

            EditorGUILayout.PropertyField(verboseDebug);

            showHelp = EditorGUILayout.Toggle("Show Inspector Help", showHelp);
            EditorPrefs.SetBool("SpriteToParticles.ShowTools", showHelp);

            //showWarnings = EditorGUILayout.Toggle("Show Inspector Warnings", showWarnings);
            //EditorPrefs.SetBool("SpriteToParticles.ShowWarnings", showWarnings);
            //EditorGUI.indentLevel--;
        }
        if (GUILayout.Button("Emit All"))
        {
            StP.particlesSystem.Play();
            StP.EmitAll(false);
        }

        if (GUILayout.Button("Reset Cache"))
        {
            StP.ResetAllCache();
        }

        EditorGUI.indentLevel--;
        serializedObject.ApplyModifiedProperties();
    }