public void Restart() { ChangeMethod("Print"); indiceLinea = 0; methodToModify = null; modify = false; }
public void OpenNew(MetodoBase metodo) { base.Open(); GetButton("Ejecutar").gameObject.SetActive(true); menuActual = menus.Find(x => x.nombre == metodo.nombre); menuActual.gameObject.SetActive(true); metodoActual = metodo; }
public void OpenModify(MetodoBase var, int i) { Open(); Restart(); methodToModify = var; indiceLinea = i; modify = true; ChangeMethod(var.nombre); }
public void Create() { MetodoBase metodo = Instantiate(Manager.Instance.metodosPrefab[method], new Vector3(999, 999, 999), Quaternion.identity); if (!modify) { c.metodos.Add(metodo.nombre, metodo); p.AddMetodo(metodo.nombre); c.NumberMethods++; } else { c.metodos.Remove(methodToModify.nombre); Destroy(methodToModify.gameObject); c.metodos.Add(metodo.nombre, metodo); p.AddMetodo(indiceLinea, metodo.nombre); } }
public void Load(string nombre) { MetodoBase metodo = Instantiate(Manager.Instance.metodosPrefab[nombre], new Vector3(999, 999, 999), Quaternion.identity); c.metodos.Add(metodo.nombre, metodo); }
// Start is called before the first frame update void Start() { if (Instance == null) { Instance = this; } else { Destroy(this.gameObject); } languageControl.selectedLanguage = 1; languageControl.UpdateTextTranslation(); prefabsPivot = GameObject.FindGameObjectWithTag("PrefabPivot").transform; AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "objeto")); objetoBasePrefab = Instantiate(bundle.LoadAsset <GameObject>("ObjetoBasico"), new Vector3(400, 400, 400), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <ObjetoBase>(); bundle.Unload(false); bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "variable_objeto")); variableObjetoPrefab = Instantiate(bundle.LoadAsset <GameObject>("VariableObjeto"), new Vector3(500, 500, 500), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <VariableObjeto>(); bundle.Unload(false); bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "variables")); intVariablePrefab = Instantiate(bundle.LoadAsset <GameObject>("IntVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <IntVariable>(); floatVariablePrefab = Instantiate(bundle.LoadAsset <GameObject>("FloatVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <FloatVariable>(); boolVariablePrefab = Instantiate(bundle.LoadAsset <GameObject>("BoolVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <BoolVariable>(); bundle.Unload(false); bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "metodos")); List <GameObject> metodos = bundle.LoadAllAssets <GameObject>().ToList(); foreach (GameObject g in metodos) { MetodoBase m = Instantiate(g, new Vector3(800, 800, 800), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <MetodoBase>(); metodosPrefab.Add(m.nombre, m); } bundle.Unload(false); menus = new Dictionary <string, CustomMenu>(); List <CustomMenu> menusList = FindObjectsOfType <CustomMenu>().ToList(); foreach (CustomMenu c in menusList) { menus.Add(c.name, c); } foreach (CustomMenu c in menus.Values) { c.Init(); } StringExtension.Init(); mg = (MenuGrid)GetMenu("MenuGrid"); mc = (MenuClases)GetMenu("MenuClases"); c = (Consola)GetMenu("Consola"); co = (CreadorObjetos)GetMenu("CreadorObjetos"); ca = (CreadorAtributos)GetMenu("CreadorAtributos"); cm = (CreadorMetodos)GetMenu("CreadorMetodos"); ini = (MenuInicio)GetMenu("MenuInicio"); aud = GetComponent <AudioSource>(); string path = Path.Combine(Application.streamingAssetsPath, "save.sv"); if (!File.Exists(path)) { ini.GetButton("Cargar").Blocked = true; } }