/// <summary> /// Dibuja los objetos que estan en el arreglo /// </summary> void DrawObjectList() { int x = 10; int y = 10; foreach (var obj in Objects) { GameObject temp = (GameObject)obj; if (temp == null || temp.tag == "RPG-CORE") { continue; } RPGElement ob = temp.GetComponent <RPGElement>(); Rect position = new Rect(x, y, 44, 44); if (ob.Icon != null) { GUI.DrawTextureWithTexCoords(position, ob.Icon.texture, GetTextureCoordinate(ob.Icon)); } if (ob.Name.Length > 6) { GUI.Label(new Rect(x, y + 54, 44, 20), ob.Name.Substring(0, 4) + "..."); } else { GUI.Label(new Rect(x, y + 54, 44, 20), ob.Name); } if (GUI.Button(position, "", new GUIStyle())) { Selection.activeGameObject = temp; RPGInspectorUI.ObjectBrowser = temp; Selection.activeObject = temp; GameEngine.inspectorRpg.Focus(); if (optionSelected == "Maps") { string OpenScene = temp.GetComponent <Map>().Data.MapPath; if (OpenScene != Directory.GetCurrentDirectory() + "\\" + EditorApplication.currentScene.Replace('/', '\\')) { EditorApplication.SaveScene(); EditorApplication.OpenScene(OpenScene); Map.ResetDoors(); } } } if (x + 84 + 64 < this.position.width) { x += 84; } else { GUILayout.Label("", GUILayout.Height(44 + 25), GUILayout.Width(x + 25)); y += 64; x = 10; } } }
public void DrawObject(GameObject gobj) { if (gobj == null) { return; } RPGElement element = gobj.GetComponent <RPGElement>(); if (element == null) { return; } EditorGUILayout.LabelField(element.Name); EditorGUILayout.LabelField(" (" + gobj.tag + ")"); GUI.DrawTextureWithTexCoords(new Rect(0, 55, Constant.INSPECTOR_IMAGE_WIDTH, Constant.INSPECTOR_IMAGE_HEIGTH), element.Icon.texture, Constant.GetTextureCoordinate(element.Icon)); }
/// <summary> /// Dibuja los objetos que estan en el arreglo /// </summary> void DrawObjectList(Rect area) { int x = 10; int y = 26; foreach (var obj in Objects) { GameObject temp = (GameObject)obj; if (temp.tag != "RPG-MAPOBJECT") { continue; } RPGElement comp = temp.GetComponent <RPGElement>(); Sprite sprite = comp.Icon; Rect position = new Rect(x, y, 64, 64); GUI.DrawTextureWithTexCoords(position, sprite.texture, Constant.GetTextureCoordinate(sprite)); if (comp.Name.Length > 8) { GUI.Label(new Rect(x, y + 74, 64, 20), comp.Name.Substring(0, 6) + "..."); } else { GUI.Label(new Rect(x, y + 74, 64, 20), comp.Name); } if (GUI.Button(position, "", new GUIStyle())) { Selected = temp; updateFields(); } if (x + 84 + 112 < area.width) { x += 84; } else { GUILayout.Label("", GUILayout.Height(64 + 25), GUILayout.Width(x + 60)); y += 94; x = 10; } } }
/// <summary> /// Dibuja los objetos que estan en el arreglo /// </summary> void DrawObjectList() { int x = 10; int y = 10; foreach (var obj in Maps) { GameObject temp = (GameObject)obj; if (temp.tag == "RPG-CORE") continue; RPGElement ob = temp.GetComponent<RPGElement>(); Rect position = new Rect(x, y, 44, 44); if (ob.Icon != null) { GUI.DrawTextureWithTexCoords(position, ob.Icon.texture, Constant.GetTextureCoordinate(ob.Icon)); } if (ob.Name.Length > 6) GUI.Label(new Rect(x, y + 54, 44, 20), ob.Name.Substring(0, 4) + "..."); else GUI.Label(new Rect(x, y + 54, 44, 20), ob.Name); if (GUI.Button(position, "", new GUIStyle())) { MapName = temp.GetComponent<Map>().Name; GameObject i = Instantiate(NewGame); i.GetComponent<MenuOptionScen>().SceneName = temp.GetComponent<Map>().Id; i.name = "FirstScene"; PrefabUtility.CreatePrefab("Assets/Resources/Menus/"+i.name+".prefab", i); NewGame = Resources.Load<GameObject>("Menus/FirstScene"); DestroyImmediate(i); } if (x + 84 + 64 < this.position.width) x += 84; else { GUILayout.Label("", GUILayout.Height(44 + 25), GUILayout.Width(x + 25)); y += 64; x = 10; } } }