fix: correction de bogues sur la selection des menus changement du système de gestion des sprites pour simplifier la création (plus d'id, plus de tile maitre...) ajout de plusieurs transmuteurs

This commit is contained in:
Nicolas Hordé 2016-01-04 19:10:38 +01:00
parent d43c4fc632
commit bba8260d15
20 changed files with 2832 additions and 383 deletions

View File

@ -11,7 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.Align;
import com.badlogic.gdx.utils.Align;
import fr.evolving.assets.AssetLoader;
import fr.evolving.automata.Level;
@ -50,14 +50,14 @@ public class ButtonLevel extends ImageTextButton {
this.setBounds(level.X, level.Y*AssetLoader.ratio, 111*scale, 125*scale);
Thelabel.setPosition(level.X+54*scale, level.Y*AssetLoader.ratio+20*scale, Align.bottom | Align.center);
stylelabel=Thelabel.getStyle();
stylelabel.font.setScale(scale);
//stylelabel.font.setScale(scale);
Thelabel.setStyle(stylelabel);
style= this.getStyle();
style.pressedOffsetX=style.pressedOffsetX*scale;
style.pressedOffsetY=style.pressedOffsetY*scale;
style.unpressedOffsetX=style.unpressedOffsetX*scale;
style.unpressedOffsetY=style.unpressedOffsetY*scale;
style.font.setScale(scale);
//style.font.setScale(scale);
this.setStyle(this.style);
}

View File

@ -14,6 +14,9 @@ import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.ObjectMap.Entries;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import com.badlogic.gdx.utils.OrderedMap;
import fr.evolving.assets.AssetLoader;
import fr.evolving.automata.Level;
@ -85,13 +88,12 @@ public void setMenuTransmuterSurtile(int x,int y,Transmuter transmuter)
{
if (transmuter!=null) {
Cell cell=((TiledMapTileLayer)map.getLayers().get(1)).getCell(x,y);
HashMap<Vector2,CaseType> tiles=transmuter.getTiles();
Iterator<Vector2> keySetIterator = transmuter.getTiles().keySet().iterator();
cell.setTile(AssetLoader.tileSet.getTile(83));
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
Cell subcell=((TiledMapTileLayer)map.getLayers().get(1)).getCell((int)(x+key.x),(int)(y+key.y));
subcell.setTile(AssetLoader.tileSet.getTile(tiles.get(key).ordinal()+80));
OrderedMap<Vector2, Integer> tiles=transmuter.getTilesidrotated();
Entries<Vector2, Integer> iterator=tiles.iterator();
while(iterator.hasNext()){
Entry<Vector2, Integer> all = iterator.next();
Cell subcell=((TiledMapTileLayer)map.getLayers().get(1)).getCell((int)(x+all.key.x),(int)(y+all.key.y));
subcell.setTile(AssetLoader.tileSet.getTile(transmuter.getTilestype(tiles.keys().toArray().indexOf(all.key, false)).ordinal()+80));
}
}
@ -121,17 +123,14 @@ public void setMenuTransmuter(int x,int y,String Name,Transmuter.Angular Angle)
if (transmuter!=null) {
Gdx.app.debug(getClass().getSimpleName(),"Transmuter find:"+transmuter.getName()+" Angle:"+Angle+" coords"+x+","+y);
transmuter.setRotation(Angle);
Iterator<Vector2> keySetIterator = transmuter.getTiles().keySet().iterator();
int MainTile=transmuter.getMainTile();
cell.setTile(AssetLoader.tileSet.getTile(MainTile++));
cell.setRotation(Angle.ordinal());
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter.getTilesidrotated().iterator();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
Cell subcell=((TiledMapTileLayer)map.getLayers().get(0)).getCell((int)(x+key.x),(int)(y+key.y));
subcell.setTile(AssetLoader.tileSet.getTile(MainTile++));
Entry<Vector2, Integer> all = keySetIterator.next();
Cell subcell=((TiledMapTileLayer)map.getLayers().get(0)).getCell((int)(x+all.key.x),(int)(y+all.key.y));
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
subcell.setRotation(Angle.ordinal());
subcell.getTile().getProperties().put("movetox",(int) -key.x);
subcell.getTile().getProperties().put("movetoy",(int) -key.y);
subcell.getTile().getProperties().put("movetox",(int) -all.key.x);
subcell.getTile().getProperties().put("movetoy",(int) -all.key.y);
}
}

View File

@ -5,7 +5,6 @@ import java.util.Collections;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Actor;

View File

@ -1,11 +1,15 @@
package fr.evolving.assets;
import java.util.Iterator;
import java.util.Locale;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.assets.loaders.SkinLoader;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
@ -27,11 +31,23 @@ import com.badlogic.gdx.maps.tiled.tiles.AnimatedTiledMapTile;
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TooltipManager;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.I18NBundle;
import com.badlogic.gdx.utils.ObjectMap.Values;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.ScalingViewport;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import fr.evolving.automata.Inverter_I;
import fr.evolving.automata.Inverter_II;
import fr.evolving.automata.Negativer;
import fr.evolving.automata.Negativer_I;
import fr.evolving.automata.Negativer_II;
import fr.evolving.automata.Negativer_III;
import fr.evolving.automata.Neutraliser_I;
import fr.evolving.automata.Neutraliser_II;
import fr.evolving.automata.Positiver;
import fr.evolving.automata.Positiver_I;
import fr.evolving.automata.Positiver_II;
import fr.evolving.automata.Positiver_III;
@ -60,7 +76,9 @@ public class AssetLoader {
public static NinePatch full;
public static AssetManager manager;
public static TiledMapTileSet tileSet;
public static Transmuter[] allTransmuter;
public static Array<Transmuter> allTransmuter;
public static TooltipManager Tooltipmanager;
public static I18NBundle french,usa,language;
public static void addstyle(TextureAtlas Atlas_level,String Name) {
AtlasRegion AnAtlasRegion = Atlas_level.findRegion(Name);
@ -162,27 +180,36 @@ public class AssetLoader {
}
}
}
allTransmuter=new Transmuter[3];
allTransmuter[0]=new Positiver_I(null);
allTransmuter[1]=new Positiver_II(null);
allTransmuter[2]=new Positiver_III(null);
for(int i=0;i<allTransmuter.length;i++) {
int[] result;
result=allTransmuter[i].getallTiles();
for (int j=0;j<result.length;j++) {
AssetLoader.tileSet.getTile(result[j]).getProperties().put("transmuter", allTransmuter[i]);
AssetLoader.tileSet.getTile(result[j]).getProperties().put("name", allTransmuter[i].getName());
Gdx.app.debug("AssetLoader","Ajustement données Tiles N°:"+String.valueOf(result[j])+" Nom:"+allTransmuter[i].getName());
}
}
}
public static Transmuter getTransmuter(int Id) {
allTransmuter=new Array<Transmuter>();
allTransmuter.add(new Positiver(null));
allTransmuter.add(new Positiver_I(null));
allTransmuter.add(new Positiver_II(null));
allTransmuter.add(new Positiver_III(null));
allTransmuter.add(new Negativer(null));
allTransmuter.add(new Negativer_I(null));
allTransmuter.add(new Negativer_II(null));
allTransmuter.add(new Negativer_III(null));
allTransmuter.add(new Inverter_I(null));
allTransmuter.add(new Inverter_II(null));
allTransmuter.add(new Neutraliser_I(null));
allTransmuter.add(new Neutraliser_II(null));
for(Transmuter transmuter:allTransmuter) {
if (transmuter.isTransmuter(Id))
return transmuter;
Values<Integer> allTiles=transmuter.getTilesid().iterator();
while(allTiles.hasNext()) {
Integer atile=allTiles.next();
Gdx.app.debug("AssetLoader","Ajustement données Tiles N°:"+String.valueOf(atile)+" Nom:"+transmuter.getName());
AssetLoader.tileSet.getTile(atile).getProperties().put("transmuter", transmuter);
AssetLoader.tileSet.getTile(atile).getProperties().put("name", transmuter.getName());
}
return null;
}
Gdx.app.debug("AssetLoader","Ajout de la gestion des tooltips");
Tooltipmanager= new TooltipManager();
Gdx.app.debug("AssetLoader","Ajout de la gestion des locales");
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
language=usa;
I18NBundle.setExceptionOnMissingKey(true);
}
public static Transmuter getTransmuter(String Name) {
@ -193,14 +220,6 @@ public class AssetLoader {
return null;
}
public static Vector2 resolveTransmuterMain(int Id) {
Transmuter transmuter=getTransmuter(Id);
if (transmuter!=null)
return transmuter.getPostitionMainTile(Id);
else
return null;
}
public static int setpref() {
prefs = Gdx.app.getPreferences("WireWorld - Evolving Games");
if (prefs.contains("log"))

View File

@ -6,6 +6,7 @@ import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import fr.evolving.automata.Transmuter.CaseType;
@ -33,14 +34,12 @@ public class Grid implements Serializable{
Transmuter transmuter=getTransmuter(x,y);
if (transmuter!=null)
{
Iterator<Vector2> keySetIterator = transmuter.getTiles().keySet().iterator();
int MainTile=transmuter.getMainTile();
GetXY(x,y).Transmuter_calc=(1<<16)*transmuter.getRotation().ordinal()+MainTile++;
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
GetXY(x+key.x,y+key.y).Transmuter_calc=(1<<16)*transmuter.getRotation().ordinal()+MainTile++;
GetXY(x+key.x,y+key.y).Transmuter_movex=(int)-key.x;
GetXY(x+key.x,y+key.y).Transmuter_movey=(int)-key.y;
Iterator<Entry<Vector2, Integer>> tiles = transmuter.getTilesidrotated().iterator();
while(tiles.hasNext()){
Entry<Vector2, Integer> all=tiles.next();
GetXY(x+all.key.x,y+all.key.y).Transmuter_calc=(1<<16)*transmuter.getRotation().ordinal()+all.value;
GetXY(x+all.key.x,y+all.key.y).Transmuter_movex=(int)-all.key.x;
GetXY(x+all.key.x,y+all.key.y).Transmuter_movey=(int)-all.key.y;
}
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Inverter_I extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Inverter_I(Level level) {
super(level);
this.Name="Inverseur I";
this.Desc="Inverseur de degré 1 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=new Inverter_II(level);
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre_seul);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 112);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Inverter_II extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Inverter_II(Level level) {
super(level);
this.Name="Inverseur II";
this.Desc="Inverseur de degré 2 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 113);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Negativer extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Negativer(Level level) {
super(level);
this.Name="Negativeur non activable";
this.Desc="Negativeur avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Nimporte);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 101);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,280 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Negativer_I extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Negativer_I(Level level) {
super(level);
this.Name="Negativeur I";
this.Desc="Negativeur de degré 1 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=new Negativer_II(level);
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre_seul);
this.Tilestype.put(new Vector2(1,0), CaseType.Fibre_seul);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 108);
this.Tilesid.put(new Vector2(1,0), 105);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,280 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Negativer_II extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Negativer_II(Level level) {
super(level);
this.Name="Negativeur II";
this.Desc="Negativeur de degré 3 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=new Negativer_III(level);
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre);
this.Tilestype.put(new Vector2(1,0), CaseType.Fibre);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 109);
this.Tilesid.put(new Vector2(1,0), 107);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,279 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Negativer_III extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Negativer_III(Level level) {
super(level);
this.Name="Negativeur III";
this.Desc="Negativeur de degré 3 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Tout);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 103);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Neutraliser_I extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Neutraliser_I(Level level) {
super(level);
this.Name="Neutraliseur I";
this.Desc="Neutraliseur de degré 1 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=new Neutraliser_II(level);
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre_seul);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 110);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Neutraliser_II extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Neutraliser_II(Level level) {
super(level);
this.Name="Neutraliseur II";
this.Desc="Neutraliseur de degré 2 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 111);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -0,0 +1,278 @@
package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
public class Positiver extends Transmuter {
private static String Name,Desc;
private static Class theClass;
private static int Price;
private static int Technology;
private static int Research;
private static Transmuter Upgrade;
private static Transmuter Unlock;
private static boolean showed;
private static boolean CanUpgradeTemp;
private static boolean CanUpgradeCycle;
private static boolean CanUpgradeRayon;
private static boolean CanUpgradeNrj;
private static float UpgradedTemp;
private static float UpgradedCycle;
private static float UpgradedRayon;
private static float UpgradedNrj;
private static float UsedTemp;
private static float UsedRayon;
private static float UsedNrj;
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Positiver(Level level) {
super(level);
this.Name="Positiveur non activable";
this.Desc="Positiveur ...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
this.CanUpgradeTemp=true;
this.CanUpgradeCycle=true;
this.CanUpgradeRayon=false;
this.CanUpgradeNrj=false;
this.UpgradedTemp=1f;
this.UpgradedCycle=1f;
this.UpgradedRayon=1f;
this.UpgradedNrj=1f;
this.UsedTemp=0.5f;
this.UsedRayon=0f;
this.UsedNrj=0f;
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Activable=true;
this.ActivationLevel=0;
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Nimporte);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 100);
}
public String getName() {
return this.Name;
}
public String getDesc() {
return this.Desc;
}
public String getaClass() {
return this.theClass.toString();
}
public void ProcessCycle() {
this.level.Temp+=TurnTemp*UpgradedTemp;
this.level.Rayon+=TurnRayon*UpgradedRayon;
this.level.Nrj+=TurnNrj*UpgradedNrj;
if (this.Activable)
this.ActivationLevel-=1;
}
public void Run() {
this.level.Temp+=UsedTemp*UpgradedTemp;
this.level.Rayon+=UsedRayon*UpgradedRayon;
this.level.Nrj+=UsedNrj*UpgradedNrj;
}
public void Unlock() {
if (this.Unlock==null)
return;
this.Unlock.SetShowed(true);
}
public void Upgrade() {
if (this.Upgrade==null)
return;
this.Unlock.SetShowed(true);
this.SetShowed(false);
}
public void Activate() {
if (this.Activable)
ActivationLevel=this.getMaxActivationLevel();
}
public void UpgradeTemp() {
if (isUpgradableTemp())
UpgradedTemp+=-0.2f;
}
public void UpgradeNrj() {
if (isUpgradableNrj())
UpgradedNrj+=-0.2f;
}
public void UpgradeRayon() {
if (isUpgradableRayon())
UpgradedRayon+=-0.2f;
}
public void UpgradeCycle() {
if (isUpgradableCycle())
UpgradedCycle+=0.2f;
}
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
public boolean isActivable() {
return this.Activable;
}
public int getMaxActivationLevel() {
return ActivationLevel=(int)(10*this.UpgradedCycle);
}
public int getActivationLevel() {
if (this.Activable)
return ActivationLevel;
else
return -1;
}
public boolean getActivation() {
if (this.Activable)
return ActivationLevel>0;
else
return true;
}
public int getPrice() {
return Price;
}
public int getSize() {
return (Tilesid.size);
}
public int getTechnology() {
return Technology;
}
public int getResearch() {
return Research;
}
public boolean isUpgradable() {
return this.Upgrade!=null && this.Upgrade.isShowed();
}
public boolean isUnlockable() {
return this.Unlock!=null && this.Unlock.isShowed();
}
public boolean isShowed() {
return this.showed;
}
public void SetShowed(boolean value) {
this.showed=value;
}
public boolean isUpgradableTemp() {
return CanUpgradeTemp && getUpgradeTemp()<3;
}
public boolean isUpgradableCycle() {
return CanUpgradeCycle && getUpgradeCycle()<3;
}
public boolean isUpgradableRayon() {
return CanUpgradeRayon && getUpgradeRayon()<3;
}
public boolean isUpgradableNrj() {
return CanUpgradeNrj && getUpgradeNrj()<3;
}
public int getUpgradeTemp() {
return Math.abs((int)((10*UpgradedTemp-10)/2f));
}
public int getUpgradeCycle() {
return Math.abs((int)((10*UpgradedCycle-10)/2f));
}
public int getUpgradeRayon() {
return Math.abs((int)((10*UpgradedRayon-10)/2f));
}
public int getUpgradeNrj() {
return Math.abs((int)((10*UpgradedNrj-10)/2f));
}
public float getUsedTemp() {
return UsedTemp*UpgradedTemp;
}
public float getUsedRayon() {
return UsedRayon*UpgradedRayon;
}
public float getUsedNrj() {
return UsedNrj*UpgradedNrj;
}
public float getTurnTemp() {
return TurnTemp*UpgradedTemp;
}
public float getTurnRayon() {
return TurnRayon*UpgradedRayon;
}
public float getTurnNrj() {
return TurnNrj*UpgradedNrj;
}
public Transmuter getUpgrade() {
return this.Upgrade;
}
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -5,6 +5,8 @@ import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectMap.Values;
import com.badlogic.gdx.utils.OrderedMap;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
@ -32,11 +34,11 @@ public class Positiver_I extends Transmuter {
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static int Id;
private static boolean Activable;
private int ActivationLevel;
private int Rotation;
private static HashMap<Vector2,CaseType> Tiles;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Positiver_I(Level level) {
super(level);
@ -63,11 +65,14 @@ public class Positiver_I extends Transmuter {
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Id=0;
this.Activable=true;
this.ActivationLevel=0;
this.Tiles= new HashMap<Vector2,CaseType>();
this.Tiles.put(new Vector2(1,0), CaseType.Fibre);
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre_seul);
this.Tilestype.put(new Vector2(1,0), CaseType.Fibre_seul);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 104);
this.Tilesid.put(new Vector2(1,0), 105);
}
public String getName() {
@ -134,53 +139,22 @@ public class Positiver_I extends Transmuter {
UpgradedCycle+=0.2f;
}
public int getMainTile() {
return this.getSize()*100+Id*this.getSize();
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public int FindMainTile(int Id) {
int thesize=(Id & 0xFFFF)/100;
int deltaid=(Id & 0xFFFF)-thesize*100;
return thesize*100+((int)(deltaid/thesize))*thesize;
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public int[] getallTiles() {
int thesize=Tiles.size()+1;
int[] result;
result=new int[thesize];
for(int i=0;i<thesize;i++)
result[i]=thesize*100+this.Id*thesize+i;
return result;
}
public Vector2[] getallSize() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
Vector2[] vector=new Vector2[2];
vector[0]=new Vector2();
vector[1]=new Vector2();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> tiles = this.Tilesid.keys();
while(tiles.hasNext()){
Vector2 key = tiles.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
float x=(float)Math.round(delta*Math.cos(alpha));
float y=(float)Math.round(delta*Math.sin(alpha));
vector[0].x=Math.min(vector[0].x, x);
vector[0].y=Math.min(vector[0].y, y);
vector[1].x=Math.max(vector[1].x, x);
vector[1].y=Math.max(vector[1].y, y);
}
return vector;
}
public HashMap<Vector2,CaseType> getTiles() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tiles.get(key));
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
@ -212,7 +186,7 @@ public class Positiver_I extends Transmuter {
}
public int getSize() {
return (Tiles.size()+1);
return (Tilesid.size);
}
public int getTechnology() {

View File

@ -3,7 +3,10 @@ package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
@ -31,19 +34,20 @@ public class Positiver_II extends Transmuter {
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static int Id;
private static boolean Activable;
private int ActivationLevel;
private static HashMap<Vector2,CaseType> Tiles;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Positiver_II(Level level) {
super(level);
this.Name="Positiveur II";
this.Desc="Positiveur de degré 2 avec...blabla";
this.Desc="Positiveur de degré 2222222 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=40;
this.Research=0;
this.Upgrade=new Positiver_III(level);
this.Unlock=null;
this.showed=true;
@ -61,11 +65,14 @@ public class Positiver_II extends Transmuter {
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Id=1;
this.Activable=true;
this.ActivationLevel=0;
this.Tiles= new HashMap<Vector2,CaseType>();
this.Tiles.put(new Vector2(1,0), CaseType.Fibre);
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Cuivre);
this.Tilestype.put(new Vector2(1,0), CaseType.Fibre);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 106);
this.Tilesid.put(new Vector2(1,0), 107);
}
public String getName() {
@ -132,53 +139,22 @@ public class Positiver_II extends Transmuter {
UpgradedCycle+=0.2f;
}
public int getMainTile() {
return this.getSize()*100+Id*this.getSize();
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public int FindMainTile(int Id) {
int thesize=(Id & 0xFFFF)/100;
int deltaid=(Id & 0xFFFF)-thesize*100;
return thesize*100+((int)(deltaid/thesize))*thesize;
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public int[] getallTiles() {
int thesize=Tiles.size()+1;
int[] result;
result=new int[thesize];
for(int i=0;i<thesize;i++)
result[i]=thesize*100+this.Id*thesize+i;
return result;
}
public Vector2[] getallSize() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
Vector2[] vector=new Vector2[2];
vector[0]=new Vector2();
vector[1]=new Vector2();
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
float x=(float)Math.round(delta*Math.cos(alpha));
float y=(float)Math.round(delta*Math.sin(alpha));
vector[0].x=Math.min(vector[0].x, x);
vector[0].y=Math.min(vector[0].y, y);
vector[1].x=Math.max(vector[1].x, x);
vector[1].y=Math.max(vector[1].y, y);
}
return vector;
}
public HashMap<Vector2,CaseType> getTiles() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tiles.get(key));
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
@ -210,7 +186,7 @@ public class Positiver_II extends Transmuter {
}
public int getSize() {
return (Tiles.size()+1);
return (Tilesid.size);
}
public int getTechnology() {
@ -300,4 +276,5 @@ public class Positiver_II extends Transmuter {
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -3,7 +3,10 @@ package fr.evolving.automata;
import java.util.HashMap;
import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.ObjectMap.Values;
import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Transmuter.Class;
@ -31,19 +34,20 @@ public class Positiver_III extends Transmuter {
private static float TurnTemp;
private static float TurnRayon;
private static float TurnNrj;
private static int Id;
private static boolean Activable;
private int ActivationLevel;
private static HashMap<Vector2,CaseType> Tiles;
private int Rotation;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> Tilesid;
public Positiver_III(Level level) {
super(level);
this.Name="Positiveur III";
this.Desc="Positiveur de degré 3 avec...blabla";
this.Desc="Positiveur de degré 3 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
this.theClass=Class.Charge;
this.Price=50;
this.Technology=2;
this.Research=120;
this.Research=0;
this.Upgrade=null;
this.Unlock=null;
this.showed=true;
@ -61,11 +65,12 @@ public class Positiver_III extends Transmuter {
this.TurnTemp=0f;
this.TurnRayon=0f;
this.TurnNrj=0f;
this.Id=2;
this.Activable=true;
this.ActivationLevel=0;
this.Tiles= new HashMap<Vector2,CaseType>();
this.Tiles.put(new Vector2(1,0), CaseType.Fibre);
this.Tilestype= new OrderedMap<Vector2, CaseType>();
this.Tilestype.put(new Vector2(0,0), CaseType.Tout);
this.Tilesid= new OrderedMap<Vector2, Integer>();
this.Tilesid.put(new Vector2(0,0), 102);
}
public String getName() {
@ -132,53 +137,22 @@ public class Positiver_III extends Transmuter {
UpgradedCycle+=0.2f;
}
public int getMainTile() {
return this.getSize()*100+Id*this.getSize();
public Values<Integer> getTilesid() {
return Tilesid.values();
}
public int FindMainTile(int Id) {
int thesize=(Id & 0xFFFF)/100;
int deltaid=(Id & 0xFFFF)-thesize*100;
return thesize*100+((int)(deltaid/thesize))*thesize;
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public int[] getallTiles() {
int thesize=Tiles.size()+1;
int[] result;
result=new int[thesize];
for(int i=0;i<thesize;i++)
result[i]=thesize*100+this.Id*thesize+i;
return result;
}
public Vector2[] getallSize() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
Vector2[] vector=new Vector2[2];
vector[0]=new Vector2();
vector[1]=new Vector2();
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2,Integer> newTiles= new OrderedMap<Vector2,Integer>();
Iterator<Vector2> keySetIterator = this.Tilesid.keys();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
float x=(float)Math.round(delta*Math.cos(alpha));
float y=(float)Math.round(delta*Math.sin(alpha));
vector[0].x=Math.min(vector[0].x, x);
vector[0].y=Math.min(vector[0].y, y);
vector[1].x=Math.max(vector[1].x, x);
vector[1].y=Math.max(vector[1].y, y);
}
return vector;
}
public HashMap<Vector2,CaseType> getTiles() {
HashMap<Vector2,CaseType> newTiles= new HashMap<Vector2,CaseType>();
Iterator<Vector2> keySetIterator = this.Tiles.keySet().iterator();
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
double delta=key.len();
double alpha=key.angleRad()+this.getRotation().ordinal()*Math.PI/2;
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tiles.get(key));
newTiles.put(new Vector2((float)Math.round(delta*Math.cos(alpha)),(float)Math.round(delta*Math.sin(alpha))), this.Tilesid.get(key));
}
return newTiles;
}
@ -210,7 +184,7 @@ public class Positiver_III extends Transmuter {
}
public int getSize() {
return (Tiles.size()+1);
return (Tilesid.size);
}
public int getTechnology() {
@ -300,4 +274,5 @@ public class Positiver_III extends Transmuter {
public Transmuter getUnlock() {
return this.Unlock;
}
}

View File

@ -5,10 +5,14 @@ import java.util.Iterator;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectMap.Entries;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import com.badlogic.gdx.utils.ObjectMap.Values;
import com.badlogic.gdx.utils.OrderedMap;
public abstract class Transmuter implements Cloneable {
public enum CaseType{Rien,Cuivre_seul,Fibre_seul,Cuivre,Fibre,Tout,Nimporte};
public enum Class{Structure,Charge,Direction,Filtrage,Synthèse,Détection,Divers,Scénario};
public enum Class{Structure,Charge,Direction,Filtrage,Synthese,Detection,Divers,Scenario};
public enum Angular{A00,A90,A180,A270};
protected Level level;
protected Angular Rotation;
@ -57,45 +61,19 @@ public abstract class Transmuter implements Cloneable {
public void UpgradeCycle() {
}
public int getMainTile() {
return 0;
}
public int FindMainTile(int Id) {
return 0;
}
public boolean isTransmuter(int Id) {
return (FindMainTile(Id)==getMainTile());
}
public boolean isTransmuter(String Name) {
return Name.equals(this.getName());
}
public Vector2 getPostitionMainTile(int Id) {
if (!isTransmuter(Id))
return null;
HashMap<Vector2,CaseType> tiles=this.getTiles();
Iterator<Vector2> keySetIterator = tiles.keySet().iterator();
int Idrec=this.getMainTile();
if ((Id & 0xFFFF)==Idrec)
return new Vector2();
Transmuter.Angular oldrotation=this.getRotation();
this.setRotation(Transmuter.Angular.values()[Id>>16]);
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
Idrec++;
if ((Id & 0xFFFF)==Idrec) {
this.setRotation(oldrotation);
return new Vector2().sub(key);
}
}
this.setRotation(oldrotation);
public CaseType getTilestype(int order) {
return null;
}
public HashMap<Vector2,CaseType> getTiles() {
public OrderedMap<Vector2, Integer> getTilesidrotated() {
return null;
}
public Values<Integer> getTilesid() {
return null;
}
@ -210,29 +188,17 @@ public abstract class Transmuter implements Cloneable {
return 0;
}
public int[] getallTiles() {
return null;
}
public Vector2[] getallSize() {
return null;
}
public String getInformations() {
HashMap<Vector2,CaseType> tiles=this.getTiles();
Iterator<Vector2> keySetIterator = tiles.keySet().iterator();
OrderedMap<Vector2, Integer> tiles=this.getTilesidrotated();
Entries<Vector2, Integer> iterator=tiles.iterator();
String result;
result="**********************************\n"+"Name:"+this.getName()+"\nClass:"+this.getaClass()+" Id:"+this.getMainTile()+" Rotation:"+this.getRotation()+"\nPrice:"+this.getPrice()+" Tech:"+this.getTechnology()+"\nResearch:"+this.getResearch()+" Size:"+this.getSize()+"\nActivable:"+this.isActivable()+" Activation:"+this.getActivationLevel()+" Visible:"+this.isShowed()+"\nUpgradable:"+((this.isUpgradable())?this.getUpgrade().getName():this.isUpgradable())+" Unlockable:"+((this.isUnlockable())?this.getUnlock().getName():this.isUnlockable())+"\nUpgrade Cycle:"+this.getUpgradeCycle()+" upgrade:"+this.isUpgradableCycle()+"\nUpgrade Temperature:"+this.getUpgradeTemp()+" upgrade:"+this.isUpgradableTemp()+"\nUpgrade Nrj:"+this.getUpgradeNrj()+" upgrade:"+this.isUpgradableNrj()+"\nUpgrade Rayon:"+this.getUpgradeRayon()+" upgrade:"+this.isUpgradableRayon()+"\nTemperature /turn:"+this.getTurnTemp()+" Rayon /turn:"+this.getTurnRayon()+" Nrj /turn:"+this.getTurnNrj()+"\nTemperature /use:"+this.getUsedTemp()+" Rayon /use:"+this.getUsedRayon()+" Nrj /use:"+this.getUsedNrj()+"\nTiles:";
int[] allTiles;
Vector2[] allSize;
allTiles=this.getallTiles();
for(int i=0;i<allTiles.length;i++)
result+=allTiles[i]+" ";
allSize=this.getallSize();
result+="Size x&y:"+allSize[0].x+","+allSize[0].y+" to "+ allSize[1].x+","+allSize[1].y+"\n *Placement*\n";
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
result+="\ncoords:" + key.x+","+key.y + " type: " + tiles.get(key);
result="**********************************\n"+"Name:"+this.getName()+"\nClass:"+this.getaClass()+" Rotation:"+this.getRotation()+"\nPrice:"+this.getPrice()+" Tech:"+this.getTechnology()+"\nResearch:"+this.getResearch()+" Size:"+this.getSize()+"\nActivable:"+this.isActivable()+" Activation:"+this.getActivationLevel()+" Visible:"+this.isShowed()+"\nUpgradable:"+((this.isUpgradable())?this.getUpgrade().getName():this.isUpgradable())+" Unlockable:"+((this.isUnlockable())?this.getUnlock().getName():this.isUnlockable())+"\nUpgrade Cycle:"+this.getUpgradeCycle()+" upgrade:"+this.isUpgradableCycle()+"\nUpgrade Temperature:"+this.getUpgradeTemp()+" upgrade:"+this.isUpgradableTemp()+"\nUpgrade Nrj:"+this.getUpgradeNrj()+" upgrade:"+this.isUpgradableNrj()+"\nUpgrade Rayon:"+this.getUpgradeRayon()+" upgrade:"+this.isUpgradableRayon()+"\nTemperature /turn:"+this.getTurnTemp()+" Rayon /turn:"+this.getTurnRayon()+" Nrj /turn:"+this.getTurnNrj()+"\nTemperature /use:"+this.getUsedTemp()+" Rayon /use:"+this.getUsedRayon()+" Nrj /use:"+this.getUsedNrj()+"\nTiles:";
Values<Integer> allTiles=this.getTilesid().iterator();
while(allTiles.hasNext())
result+=String.valueOf(allTiles.next())+" ";
while(iterator.hasNext()){
Entry<Vector2, Integer> all = iterator.next();
result+="\ncoords:" + all.key.x+","+all.key.y + " type: " + this.getTilestype(tiles.keys().toArray().indexOf(all.key, false)) +" id:"+all.value;
}
result+="\n**********************************";
return result;

View File

@ -36,12 +36,15 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.badlogic.gdx.scenes.scene2d.utils.Align;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap.Entries;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import com.badlogic.gdx.utils.OrderedMap;
import fr.evolving.UI.Menu;
import fr.evolving.worlds.GameRenderer;
@ -65,7 +68,7 @@ public class GameScreen implements Screen {
private Array<InputProcessor> processors;
private Timer ScrollTimer;
private TimerTask ScrollTask;
private Stage stage,stage_menu,stage_info;
private Stage stage,stage_menu,stage_info,stage_tooltip;
private HorizontalGroup table;
private VerticalGroup table2;
private GameWorld world;
@ -74,7 +77,7 @@ public class GameScreen implements Screen {
public Level level;
private ImageButton[] Barre;
private ImageButton info_up_nrj,info_up_temp,info_up_rayon,info_up_cycle,info_up_nrjval,info_up_tempval,info_up_rayonval,info_up_cycleval;
private ImageTextButton cycle,temp,nrj,rayon,cout,tech,info_cout,info_tech,info_research,info_activation;
private ImageTextButton cycle,temp,nrj,rayon,cout,tech,research,info_cout,info_tech,info_research,info_activation;
private ImageTextButton[] Barre2;
String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","infos","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"};
public Actor selected;
@ -86,7 +89,7 @@ public class GameScreen implements Screen {
private Actor menuactor;
private float oldx,oldy;
private Label fpsLabel,info_nom;
private TextArea info_desc;
private TextArea info_desc,tooltip;
public boolean unroll,mapexit;
public enum calling{mouseover,mouseclick,mousedrag,longpress,tap,taptap,zoom,fling,pan,pinch};
GestureDetector gesturedetector;
@ -108,6 +111,7 @@ public class GameScreen implements Screen {
stage = new Stage(AssetLoader.viewport);
stage_menu = new Stage(AssetLoader.viewport);
stage_info = new Stage(AssetLoader.viewport);
stage_tooltip = new Stage(AssetLoader.viewport);
this.level=alevel;
oldx=0;
oldy=0;
@ -127,13 +131,15 @@ public class GameScreen implements Screen {
};
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
Gdx.app.debug(getClass().getSimpleName(),"Création des barres");
tooltip=new TextArea("tooltip:x\r\n tooltip:y", AssetLoader.Skin_level, "info_tooltip") ;
tooltip.setBounds(541, 27, 100, 50);
Barre=new ImageButton[tocreate.length];
int i=0;
Gdx.app.debug(getClass().getSimpleName(),"Barre bas:"+Barre.length+" elements");
for (String tocreateitem: tocreate) {
Barre[i]= new ImageButton(AssetLoader.Skin_level,tocreateitem);
Barre[i].setName(tocreateitem);
Barre[i++].addListener(new ClickListener(){
Barre[i].addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
Actor caller=event.getListenerActor();
@ -141,11 +147,12 @@ public class GameScreen implements Screen {
preparebarre(caller, this.getTapCount());
}
});
Barre[i++].addListener(new Tooltip(tooltip, AssetLoader.Tooltipmanager));
}
Barre2=new ImageTextButton[Transmuter.Class.values().length];
Gdx.app.debug(getClass().getSimpleName(),"Menu:"+Barre2.length+" elements");
for (i=0;i<Barre2.length;i++) {
Barre2[i]= new ImageTextButton(Transmuter.Class.values()[i].toString(),AssetLoader.Skin_level);
Barre2[i]= new ImageTextButton(AssetLoader.language.get(Transmuter.Class.values()[i].toString()),AssetLoader.Skin_level);
Barre2[i].setName(String.valueOf(i));
Barre2[i].addListener(new ClickListener(){
@Override
@ -156,10 +163,9 @@ public class GameScreen implements Screen {
}
});
}
if (Gdx.graphics.isFullscreen())
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("windows"));
if (AssetLoader.intro.getVolume()==0)
Barre[16].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("nosound"));
Barre[15].setChecked(Gdx.graphics.isFullscreen());
Barre[16].setChecked(AssetLoader.intro.getVolume()>0);
Barre[17].setChecked(AssetLoader.Tooltipmanager.enabled==true);
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut");
cycle=new ImageTextButton(String.valueOf(level.Cycle),AssetLoader.Skin_level,"cycle2");
cycle.setPosition(10,AssetLoader.height-74);
@ -173,6 +179,8 @@ public class GameScreen implements Screen {
tech.setPosition(1345,AssetLoader.height-74);
cout=new ImageTextButton(String.valueOf(level.Cout),AssetLoader.Skin_level,"cout2");
cout.setPosition(1445,AssetLoader.height-74);
research=new ImageTextButton(String.valueOf(0),AssetLoader.Skin_level,"research2");
research.setPosition(1545,AssetLoader.height-74);
objectives=new Objectives();
objectives.setVictory(level.Victory);
objectives.setPosition(890,AssetLoader.height-95);
@ -282,31 +290,30 @@ public class GameScreen implements Screen {
{
menu.EraseMenuTransmuterSurtile();
map.tempclear();
Gdx.app.debug("menu","Coordonnées:"+x+"x"+y+" Coordonnées deprojettée:"+coords.x+"x"+coords.y+" type:"+tile.get("type")+" name:"+tile.get("name").toString());
if (menuactor==null)
menuactor=new Actor();
Vector2 coords2=menu.worldtoscreen((int)coords.x,(int)coords.y);
menuactor.setBounds(coords2.x, coords2.y, 60, 60);
selected=menuactor;
map.fillempty(60);
selected=menuactor;
if (tile.get("type").toString().startsWith("transmuter"))
{
selected.setName("transmuter");
selected_transmuter=(Transmuter) ((Transmuter) tile.get("transmuter")).clone();
if (selected_transmuter!=null) {
showInfo(selected_transmuter);
if (tile.containsKey("movetox")) {
coords2=menu.worldtoscreen((int)coords.x+(Integer) tile.get("movetox"),(int)(coords.y+(Integer) tile.get("movetoy")));
menuactor.setPosition(coords2.x, coords2.y);
Gdx.app.debug("menu","transmuter deplacement vers origine:"+tile.get("movetox").toString()+","+tile.get("movetoy").toString()+" coords:"+coords2.x+"x"+coords2.y);
menu.setMenuTransmuterSurtile((int)coords.x+(Integer) tile.get("movetox"),(int) coords.y+(Integer) tile.get("movetoy"),selected_transmuter);
coords.x+=(Integer) tile.get("movetox");
coords.y+=(Integer) tile.get("movetoy");
}
else
MapProperties tilenew=menu.getMenubyTile((int)coords.x,(int)coords.y);
selected_transmuter=(Transmuter) ((Transmuter) tilenew.get("transmuter")).clone();
if (selected_transmuter!=null) {
selected.setName("transmuter");
showInfo(selected_transmuter);
menu.setMenuTransmuterSurtile((int)coords.x,(int) coords.y,selected_transmuter);
Gdx.app.debug("menu","Choix transmuter:"+selected_transmuter.getName());
}
}
else
selected.setName(tile.get("name").toString());
Vector2 coords2=menu.worldtoscreen((int)coords.x,(int)coords.y);
Gdx.app.debug("menu","Coordonnées:"+x+"x"+y+" Menu:"+coords.x+","+coords.y+" Ecran :"+coords2.x+"x"+coords2.y+" type:"+tile.get("type"));
menuactor.setBounds(coords2.x, coords2.y, 60, 60);
}
}
});
@ -360,23 +367,19 @@ public class GameScreen implements Screen {
}
map.tempclear();
boolean positionisgood=true;
HashMap<Vector2,CaseType> tiles=selected_transmuter.getTiles();
Iterator<Vector2> keySetIterator = selected_transmuter.getTiles().keySet().iterator();
int MainTile=selected_transmuter.getMainTile();
int color=63;
if (level.Grid.getCopper(x,y) && level.Grid.getTransmutercalc(x,y)==0)
color=0;
else
positionisgood=false;
map.tempdraw(x, y, MainTile, selected_transmuter.getRotation().ordinal(),color);
while(keySetIterator.hasNext()){
Vector2 key = keySetIterator.next();
int color=0;
OrderedMap<Vector2, Integer> tiles=selected_transmuter.getTilesidrotated();
Entries<Vector2, Integer> iterator=tiles.iterator();
while(iterator.hasNext()){
Entry<Vector2, Integer> all = iterator.next();
color=63;
if (((!level.Grid.getFiber(x+key.x, y+key.y) && !level.Grid.getCopper(x+key.x, y+key.y) && tiles.get(key)==CaseType.Rien) || (level.Grid.getFiber(x+key.x, y+key.y) && level.Grid.getCopper(x+key.x, y+key.y) && tiles.get(key)==CaseType.Tout) || (level.Grid.getCopper(x+key.x, y+key.y) && tiles.get(key)==CaseType.Cuivre) || (level.Grid.getFiber(x+key.x, y+key.y) && tiles.get(key)==CaseType.Fibre) || (level.Grid.getFiber(x+key.x, y+key.y) && !level.Grid.getCopper(x+key.x, y+key.y) && tiles.get(key)==CaseType.Fibre_seul) || (level.Grid.getCopper(x+key.x, y+key.y) && !level.Grid.getFiber(x+key.x, y+key.y) && tiles.get(key)==CaseType.Cuivre_seul)) && (level.Grid.getTransmutercalc(x+key.x, y+key.y)==0))
int index=tiles.keys().toArray().indexOf(all.key, false);
if (((selected_transmuter.getTilestype(index)==CaseType.Nimporte) || (!level.Grid.getFiber(x+all.key.x, y+all.key.y) && !level.Grid.getCopper(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Rien) || (level.Grid.getFiber(x+all.key.x, y+all.key.y) && level.Grid.getCopper(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Tout) || (level.Grid.getCopper(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Cuivre) || (level.Grid.getFiber(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Fibre) || (level.Grid.getFiber(x+all.key.x, y+all.key.y) && !level.Grid.getCopper(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Fibre_seul) || (level.Grid.getCopper(x+all.key.x, y+all.key.y) && !level.Grid.getFiber(x+all.key.x, y+all.key.y) && selected_transmuter.getTilestype(index)==CaseType.Cuivre_seul)) && (level.Grid.getTransmutercalc(x+all.key.x, y+all.key.y)==0))
color=0;
else
positionisgood=false;
map.tempdraw(x+key.x, y+key.y, ++MainTile, selected_transmuter.getRotation().ordinal(),color);
map.tempdraw(x+all.key.x, y+all.key.y, all.value, selected_transmuter.getRotation().ordinal(),color);
}
if ((call==calling.longpress && button==0) && positionisgood)
{
level.Grid.GetXY(x,y).Transmuter=(Transmuter) selected_transmuter.clone();
@ -385,7 +388,6 @@ public class GameScreen implements Screen {
Gdx.input.vibrate(new long[] { 0, 400, 500, 400}, -1);
}
}
}
void map_infos(float realx, float realy,int x, int y,boolean alone,int button,calling call) {
@ -526,6 +528,7 @@ public class GameScreen implements Screen {
if (unroll)
stage_info.draw();
Renderer.render(delta, runTime,2);
stage_tooltip.draw();
}
@Override
@ -555,6 +558,7 @@ public class GameScreen implements Screen {
stage_info.addActor(info_cout);
stage_info.addActor(info_desc);
stage_menu.addActor(map);
//stage_tooltip.addActor(tooltip);
stage.addActor(objectives);
stage.addActor(buttonlevel);
stage.addActor(rayon);
@ -566,11 +570,12 @@ public class GameScreen implements Screen {
stage.addActor(table);
stage.addActor(tech);
stage.addActor(cout);
stage.addActor(research);
stage.addActor(menu);
//gesturedetector=new GestureDetector(null);
//processors.add(gesturedetector);
processors.add(stage);
processors.add(stage_menu);
gesturedetector=new GestureDetector(null);
processors.add(gesturedetector);
multiplexer.setProcessors(processors);
Gdx.input.setInputProcessor(multiplexer);
preparemenu(0);
@ -582,6 +587,7 @@ public class GameScreen implements Screen {
menu.EraseMenuTransmuterSurtile();
hideInfo();
if (caller.getName()=="run") {
}
else if (caller.getName()=="stop") {
}
@ -622,34 +628,54 @@ public class GameScreen implements Screen {
{
Gdx.app.debug("Barre","vers fenetre.");
Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, false);
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("screen"));
}
else
{
Gdx.app.debug("Barre","vers plein ecran.");
Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, true);
Barre[15].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("windows"));
}
((ImageButton)caller).setChecked(Gdx.graphics.isFullscreen());
}
else if (caller.getName()=="sound") {
if (AssetLoader.intro.getVolume()>0)
{
Gdx.app.debug("Barre","arret son.");
AssetLoader.intro.setVolume(0f);
Barre[16].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("nosound"));
}
else
{
Gdx.app.debug("Barre","marche son.");
AssetLoader.intro.setVolume(1f);
Barre[16].getStyle().up =new TextureRegionDrawable(AssetLoader.Atlas_level.findRegion("sound"));
}
((ImageButton)caller).setChecked(AssetLoader.intro.getVolume()>0);
}
else if (caller.getName()=="tuto") {
if (AssetLoader.Tooltipmanager.enabled)
{
Gdx.app.debug("Barre","arret tuto.");
AssetLoader.Tooltipmanager.enabled=false;
}
else
{
Gdx.app.debug("Barre","marche tuto.");
AssetLoader.Tooltipmanager.enabled=true;
}
((ImageButton)caller).setChecked(AssetLoader.Tooltipmanager.enabled);
}
else if (caller.getName()=="settings") {
}
else if (caller.getName()=="separator") {
else if (caller.getName()=="flag") {
if (AssetLoader.language.getLocale().getDisplayName().contains("français"))
{
Gdx.app.debug("Barre","Langue USA");
AssetLoader.language=AssetLoader.usa;
}
else
{
Gdx.app.debug("Barre","Langue FR");
AssetLoader.language=AssetLoader.french;
}
((ImageButton)caller).setChecked(AssetLoader.language.getLocale().getDisplayName().contains("français"));
}
else if (caller.getName()=="stat") {
}
@ -677,8 +703,15 @@ public class GameScreen implements Screen {
}
else if (menuitem==1) {
menu.setMenuTransmuter(0,7,"Positiveur I",Angular.A00);
menu.setMenuTransmuter(2,7,"Negativeur I",Angular.A00);
menu.setMenuTransmuter(0,6,"Positiveur II",Angular.A00);
menu.setMenuTransmuter(2,6,"Positiveur III",Angular.A90);
menu.setMenuTransmuter(2,6,"Negativeur II",Angular.A00);
menu.setMenuTransmuter(0,5,"Positiveur III",Angular.A00);
menu.setMenuTransmuter(1,5,"Negativeur III",Angular.A00);
menu.setMenuTransmuter(0,4,"Inverseur I",Angular.A00);
menu.setMenuTransmuter(1,4,"Inverseur II",Angular.A00);
menu.setMenuTransmuter(0,3,"Neutraliseur I",Angular.A00);
menu.setMenuTransmuter(1,3,"Neutraliseur II",Angular.A00);
}
else if (menuitem==2) {
@ -696,7 +729,8 @@ public class GameScreen implements Screen {
}
else if (menuitem==7) {
menu.setMenuTransmuter(0,7,"Positiveur non activable",Angular.A00);
menu.setMenuTransmuter(1,7,"Negativeur non activable",Angular.A00);
}
}

View File

@ -85,7 +85,7 @@ public class LevelRenderer {
batcher2.draw(Texture_logobig,120, AssetLoader.height-Texture_logobig.getRegionHeight());
font.draw(batcher2, LevelScreen.selected.level.Name, 15, 145);
if (LevelScreen.selected!=null && LevelScreen.selected.level.Tech>0)
font.draw(batcher2, "Récompenses", 1215, AssetLoader.height-15);
font.draw(batcher2, "Recompenses", 1215, AssetLoader.height-15);
if (LevelScreen.selected!=null && LevelScreen.selected.level.Cout>0) {
font.draw(batcher2, "Ressources", 1215, 145);
font.draw(batcher2, "Objectifs", 1215, 295);