using System.Collections; using System.Collections.Generic; using UnityEngine; public class TextureChangeCommand : ICommand { string _selected; string _paintSelected; string _namePanel; string _global; List _beforeTextureCodes; List _afterTextureCodes; public TextureChangeCommand(string namePanel, string beforeTextureCode, string afterTextureCode) { _selected = SceneModeManager.SelectedName; _paintSelected = PAINT.SEL; _namePanel = namePanel; _beforeTextureCodes = new List() { beforeTextureCode }; _afterTextureCodes = new List() { afterTextureCode }; } public TextureChangeCommand(string namePanel, List beforeTextureCodes, List afterTextureCodes) { _selected = SceneModeManager.SelectedName; // TODO for non-AWAL paint.sel _paintSelected = PAINT.SEL; _namePanel = namePanel; _beforeTextureCodes = new List(); _beforeTextureCodes.AddRange(beforeTextureCodes); _afterTextureCodes = new List(); _afterTextureCodes.AddRange(afterTextureCodes); } public TextureChangeCommand(string namePanel, List beforeTextureCodes, string afterTextureCode) { _selected = SceneModeManager.SelectedName; // TODO for non-AWAL paint.sel _paintSelected = PAINT.SEL; _namePanel = namePanel; _beforeTextureCodes = new List(); _beforeTextureCodes.AddRange(beforeTextureCodes); _afterTextureCodes = new List() { afterTextureCode }; } public void Execute() { CallTexture(_afterTextureCodes); } public string GetAction() { return "Change Texture"; } public void Undo() { CallTexture(_beforeTextureCodes); } public void UpdateCommand() { return; } private void CallTexture(List textureCodes) { if (_selected == "" && _paintSelected == "" && _G.PNL!="TexturesSplashPNL" && _G.PNL!="TexturesCounterPNL") { return; } string tempSelected = _selected; string tempPaintSelected = _paintSelected; SceneModeManager.SelectedName = _selected; PAINT.SEL = _paintSelected; if (_namePanel == "TexturesFloorPNL" ) { TextureCall.TextureFloor(textureCodes[0]); } if (_namePanel == "TexturesWallPNL") { if (_paintSelected == "AWAL") { if (textureCodes.Count > 1) { TextureCall.TextureWall(textureCodes); } else { //TextureCall.TextureWall(textureCodes[0]); TextureCall.TextureWall(textureCodes); } } else { TextureCall.TextureWall(textureCodes[0]); } } if (_namePanel == "TexturesBlocPNL") { TextureCall.TextureBloc(textureCodes[0], "Block"); }//TextureCall.TextureBloc(textureCodes[0]); if (_namePanel == "TexturesSplashPNL") { TextureCall.TextureSplash(textureCodes[0], _global); }// if (_namePanel == "TexturesCounterPNL") { TextureCall.TextureCounter(textureCodes); }// SceneModeManager.SelectedName = tempSelected; PAINT.SEL = tempPaintSelected; } }