package pylos.view;

import pylos.model.Model;
import pylos.model.Player;

import com.jme3.material.Material;
import com.jme3.texture.Texture;

public class PlayerGraphics {
	public Material ballMaterial;
	Player model;

	public PlayerGraphics(Player model) {
		this.model = model;
	}

	public void create(View view) {
		if (ballMaterial == null) {
			if (model == Model.player1) {
				ballMaterial = new Material(view.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
				Texture tex_ml = view.getAssetManager().loadTexture("Models/Board/Texture/marbrenoir.jpg");
				ballMaterial.setTexture("DiffuseMap", tex_ml);
				ballMaterial.setFloat("Shininess", 55f);
			} else {
				ballMaterial = new Material(view.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
				Texture tex_ml = view.getAssetManager().loadTexture("Models/Board/Texture/verre4.jpg");
				ballMaterial.setTexture("DiffuseMap", tex_ml);
				ballMaterial.setFloat("Shininess", 55f);
			}
		}
	}
}

@@ -346,42 +346,8 @@
 ) %7B%0A
-%09%09%09if (model == Model.player1) %7B%0A%09
 %09%09%09b
@@ -431,33 +431,32 @@
 ting.j3md%22);%0A%09%09%09
-%09
 Texture tex_ml =
@@ -517,307 +517,63 @@
 ure/
-marbrenoir.jpg%22);%0A%09%09%09%09ballMaterial.setTexture(%22DiffuseMap%22, tex_ml);%0A%09%09%09%09ballMaterial.setFloat(%22Shininess%22, 55f);%0A%09%09%09%7D else %7B%0A%09%09%09%09ballMaterial = new Material(view.getAssetManager(), %22Common/MatDefs/Light/Lighting.j3md%22);%0A%09%09%09%09Texture tex_ml = view.getAssetManager().loadTexture(%22Models/Board/Texture/
+%22 +%0A%09%09%09%09%09(model == Model.player1 ? %22marbrenoir.jpg%22 : %22
 verr
@@ -580,19 +580,19 @@
 e4.jpg%22)
+)
 ;%0A
-%09
 %09%09%09ballM
@@ -633,17 +633,16 @@
 ex_ml);%0A
-%09
 %09%09%09ballM
@@ -681,13 +681,8 @@
 f);%0A
-%09%09%09%7D%0A
 %09%09%7D%0A

refactor common code for both players material