Package transientlibs.bindedobjects.gamecontent

Source Code of transientlibs.bindedobjects.gamecontent.Effects

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package transientlibs.bindedobjects.gamecontent;

import transientlibs.objects.general.Node;
import transientlibs.tex.ReqList;
import transientlibs.tex.StringAnalyst;
import java.util.ArrayList;


import transientlibs.slick2d.util.Log;

import transientlibs.bindedobjects.core.Binding;
import transientlibs.preui.objects.gui.interfaces.IAnimation;
import transientlibs.preui.objects.gui.interfaces.IImage;
import transientlibs.processors.misc.Detonator;


/**
*
* @author kibertoad
*/
public class Effects extends Node {

    public String LName;
    public String desc;
    public IImage image = null;
    public IAnimation animation = null;

    public boolean isMoveable; //can be the final destination
    public boolean isPasseable; //can move through it

public static ArrayList<Effects> effects = new ArrayList<Effects>();

    public static Effects lastEffect;




public static void loadEffects (){

        StringAnalyst reader = new StringAnalyst();

        if (StringAnalyst.isFileExist("effects.dat")) {

        reader.openFile("effects.dat");

        while (!reader.eof) {


        reader.readRow();
        analyzeStringForEffects (reader);
        }

        reader.closeFile();
        }
    }

          public static void analyzeStringForEffects (StringAnalyst analyst) {
        analyzeStringForEffects ("-NO-", analyst);
    }

public static void analyzeStringForEffects (String getString, StringAnalyst analyst) {

   if (!"-NO-".equals(getString)) {analyst.fullStr = getString;}

        analyst.getNextString();
        String nowStr = analyst.lastStr;

        boolean withResult = false;

        if (nowStr.equals("effect")) {

            effects.add (new Effects ());
            lastEffect = effects.get(effects.size()-1);
            lastEffect.ID = analyst.getBinding (Binding.effectBinding);

            lastEffect.isMoveable  = true;
            lastEffect.isPasseable = true;

            //ReqList.lastReqList = lastEffect.trainReqs;

            withResult = true;

        }

    if (nowStr.equals("name")) {
            lastEffect.LName = analyst.getNextString();
            withResult = true;
        }

        if (nowStr.equals("desc")) {
            lastEffect.desc = analyst.restOfRow();
            withResult = true;
        }

        if (nowStr.equals("movable")) {
            lastEffect.isMoveable = analyst.getNextBoolean();
            withResult = true;
        }

        if (nowStr.equals("passable")) {
            lastEffect.isPasseable = analyst.getNextBoolean();
            withResult = true;
        }

      if (nowStr.equals("image")) {
            Log.info(nowStr);
            lastEffect.image = Detonator.INSTANCE.imageProvider.getImage(Binding.readBinding(Binding.transientImageBinding, analyst.getNextString()));

            withResult = true;
        }

      if (nowStr.equals("animation")) {
            Log.info(nowStr);
            //lastEffect.animation = Animations.getAnimationByCode(analyst.getNextString()).animation;
            Log.notImplemented();

            withResult = true;
        }



        if ((withResult == false) && (nowStr.length()>2) && (!nowStr.startsWith("//"))) {
            Log.error("Unknown string: "+nowStr);        }

}

  @Override
    public String name (){
        return LName;
    }

}
TOP

Related Classes of transientlibs.bindedobjects.gamecontent.Effects

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.