public HexMap(EditorActivity context) { HexPrefab = context.HexPrefab; HexMaterials = context.HexMaterials; go = GameObject.Find("HexMap"); map = new Dictionary <GameObject, HexModel>(); createHexModels(context.em); drawMap(context.em); StaticBatchingUtility.Combine(go); }
private void populateTerrainDropdown(EditorActivity context) { GameObject terrainDropdownGO = go.transform.Find("TerrainDropdown").gameObject; terrainDropdown = terrainDropdownGO.GetComponent <Dropdown>(); List <string> dropdownOptions = new List <string>(); foreach (Material mat in context.HexMaterials) { dropdownOptions.Add(mat.name); } terrainDropdown.AddOptions(dropdownOptions); }
private void populateWidthAndHeight(EditorActivity context) { GameObject widthInputFieldGO = go.transform.Find("WidthInputField").gameObject; GameObject heightInputFieldGO = go.transform.Find("HeightInputField").gameObject; widthInputField = widthInputFieldGO.GetComponent <InputField>(); heightInputField = heightInputFieldGO.GetComponent <InputField>(); widthValue = context.em.width; widthInputField.text = widthValue.ToString(); heightValue = context.em.height; heightInputField.text = heightValue.ToString(); }
public Toolbar(EditorActivity context) { go = GameObject.Find("Toolbar"); populateToolbar(context); terrainValue = terrainDropdown.value; terrainDropdown.onValueChanged.AddListener(delegate { terrainValue = terrainDropdown.value; context.em.notifyObservers(); }); widthInputField.onEndEdit.AddListener(delegate { if (widthInputField.text != "") //TODO add more restrictions so its only numbers are acceppted { widthValue = int.Parse(widthInputField.text); } Debug.Log("WIDTH CHANGED"); context.em.notifyObservers(); }); heightInputField.onEndEdit.AddListener(delegate { if (heightInputField.text != "") //TODO add more restrictions so its only numbers are acceppted { heightValue = int.Parse(heightInputField.text); } context.em.notifyObservers(); }); GameObject loadButtonGO = go.transform.Find("LoadButton").gameObject; loadButton = loadButtonGO.GetComponent <Button>(); loadButton.onClick.AddListener(delegate { context.loadMap(context.em); }); GameObject saveButtonGO = go.transform.Find("SaveButton").gameObject; saveButton = saveButtonGO.GetComponent <Button>(); saveButton.onClick.AddListener(delegate { context.saveMap(context.em); }); }
public Editor(EditorActivity activity) { _activity = activity;
public EditorModel(EditorActivity ea, int width, int height) { this.width = width; this.height = height; }
private void populateToolbar(EditorActivity context) { populateWidthAndHeight(context); populateTerrainDropdown(context); }