Search in sources :

Example 1 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class EditorControlPanel method handleFunction.

public void handleFunction(MAP_EDITOR_FUNCTION function) {
    switch(function) {
        case ADD_ROUTE:
            break;
        case ADD_INNER:
            break;
        case OPTIONS:
            break;
        case VIEW:
            break;
        case SCRIPTS:
            break;
        case EDIT:
            // type? create local type
            break;
        case SAVE:
            MacroManager.saveTheWorld();
            EditorMapView.getInstance().getEditorParticles().saveAll();
            MacroManager.getPointMaster().save();
            // data into World/Campaign type?
            break;
        case ALL_TIMES:
            MacroGame.getGame().prepareSetTime(null);
            break;
        case NEXT_TIME:
            int i = EnumMaster.getEnumConstIndex(DAY_TIME.class, MacroGame.getGame().getTime());
            i++;
            if (DAY_TIME.values().length <= i)
                i = 0;
            DAY_TIME time = DAY_TIME.values()[i];
            MacroGame.getGame().prepareSetTime(time);
            break;
        case UNDO:
            EditorManager.undo();
            // Stack<EDITOR_OPERATION> operationStack;
            break;
        case REFRESH:
            break;
    }
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)

Example 2 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class EditorParticleMaster method clicked.

public void clicked(int x, int y) {
    String path = EditorMapView.getInstance().getGuiStage().getEmitterPalette().getSelectedEmitterPath();
    EmitterActor last = particles.create(path, x, y);
    last.start();
    stack.push(last);
    final DAY_TIME time = this.time;
    last.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (button == 1) {
                removeEmitter(last, time);
            }
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    MapMaster.addToListMap(map, time, last);
    // layer
    // centering? emitters probably self-center...
    last.setPosition(x, y);
    layers.get(time).addActor(last);
    GuiEventManager.trigger(MapEvent.EMITTER_CREATED, last);
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class LightLayer method init.

@Override
protected void init() {
    for (LIGHT_LAYER sub : LIGHT_LAYER.values()) {
        MapMaster.addToFloatMap(timerMap, sub, 0f);
        MapMaster.addToFloatMap(triggerMap, sub, 0f);
    }
    // randomize?
    for (LIGHT_LAYER sub : LIGHT_LAYER.values()) {
        // random position?
        for (int i = 0; i < sub.maxCount; i++) {
            LightContainer container = new LightContainer(getPath() + sub.name().replace("_", " ") + ".png", sub);
            container.setAlphaTemplate(sub.alphaTemplate);
            for (DAY_TIME time : sub.times) MapMaster.addToListMap(map, time, container);
        }
    }
    initialized = true;
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) LightContainer(eidolons.libgdx.screens.map.layers.LightLayer.LightContainer)

Example 4 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class MapMoveLayers method act.

@Override
public void act(float delta) {
    if (MacroGame.getGame() == null)
        return;
    // spawn();
    for (MAP_MOVING_LAYER sub : MAP_MOVING_LAYER.values()) {
        MapMaster.addToFloatMap(timerMap, sub, delta);
        for (DAY_TIME day_time : sub.times) {
            if (time != day_time) {
                continue;
            }
            if (triggerMap.get(sub) == null || timerMap.get(sub) > triggerMap.get(sub)) {
                spawn(sub);
                float willSpawnOn = RandomWizard.getRandomFloatBetween(sub.delay, 2 * sub.delay);
                willSpawnOn = applyLayerDelayMods(sub, day_time, willSpawnOn);
                triggerMap.put(sub, willSpawnOn);
                timerMap.put(sub, 0f);
            }
        }
    }
    for (Actor actor : getChildren()) {
        if (!(actor instanceof MapMoveLayer))
            continue;
        MapMoveLayer sub = (MapMoveLayer) actor;
        MAP_MOVING_LAYER type = sub.getType();
        // if (Math.abs(sub.getSpeed() )> 0) {
        // }
        float x = sub.getContent().getX() + sub.getSpeed() * delta * getModX(type.direction);
        float y = sub.getContent().getY() + sub.getSpeed() * delta * getModY(type.direction);
        sub.getContent().setPosition(x, y);
        float distance = new Vector2(sub.getContent().getX(), sub.getContent().getY()).dst(new Vector2(sub.getOriginalX(), sub.getOriginalY()));
        float maxDistance = sub.getMaxDistance();
        if (x > getWidth() || x < -sub.getWidth() && (y > getHeight() + sub.getHeight() || y < 0))
            remove(sub);
        else // center to edge? direction? better check sumis <> maxWidth or 0
        if (distance > maxDistance) {
            remove(sub);
        }
        if (type.rotation != 0) {
            sub.setOrigin(Align.center);
            sub.setRotation(sub.getRotation() + (type.rotation * delta) * sub.rotationMod);
        }
    // ++ shakiness
    // checkRemove or reset
    }
    super.act(delta);
}
Also used : MAP_MOVING_LAYER(eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_MOVING_LAYER) Vector2(com.badlogic.gdx.math.Vector2) DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) Actor(com.badlogic.gdx.scenes.scene2d.Actor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 5 with DAY_TIME

use of main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME in project Eidolons by IDemiurge.

the class MapParticles method init.

public void init() {
    map.put(null, new ArrayList<>());
    for (DAY_TIME sub : DAY_TIME.values()) {
        map.put(sub, new ArrayList<>());
    }
    load();
    for (MAP_EMITTER_GROUP sub : MAP_EMITTER_GROUP.values()) {
        boolean displayed = false;
        for (DAY_TIME time : sub.times) {
            if (time == this.time) {
                displayed = true;
                break;
            }
        // same check for weather perhaps
        }
        if (sub.points != null)
            for (MAP_POINTS point : sub.points) {
                for (int i = 0; i < sub.number; i++) {
                    int mod = (i % 2 == 0) ? 1 : -1;
                    int offsetX = mod * sub.distance * i;
                    mod = (i % 3 == 0) ? 1 : -1;
                    int offsetY = mod * sub.distance * i;
                    EmitterActor emitter = create(sub.sfxPath, point.x + offsetX, point.y + offsetY, time);
                    if (displayed) {
                        this.displayed.add(emitter);
                    }
                }
            }
    }
    initialized = true;
}
Also used : MAP_POINTS(eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS) DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Aggregations

DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)8 EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)3 Vector2 (com.badlogic.gdx.math.Vector2)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 ImageContainer (eidolons.libgdx.bf.generic.ImageContainer)1 LightContainer (eidolons.libgdx.screens.map.layers.LightLayer.LightContainer)1 MAP_MOVING_LAYER (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_MOVING_LAYER)1 MAP_POINTS (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS)1 File (java.io.File)1 Coordinates (main.game.bf.Coordinates)1