private ComboBox CreateByTypeObj(AutoTileMapSerializeData map, eSlotAonTypeObj typeObj) { if (typeObj == eSlotAonTypeObj.House) { var count = map.OverlayCountAt(typeObj); var g = new GUIContent[count]; for (int i = 0; i < count; ++i) { var t = map.GetOverlayByIdxRef(i, typeObj); g[i] = new GUIContent(string.Format("({0}) {1}", i, t.Name())); } var c = new ComboBox(new Rect(0, 0, 150, 20), g); return(c); } else { var count = map.TriggerCountAt(typeObj); var g = new GUIContent[count]; for (int i = 0; i < count; ++i) { var t = map.GetTriggerByIdxRef(i, typeObj); g[i] = new GUIContent(string.Format("({0}) {1}", i, t.Name())); } var c = new ComboBox(new Rect(0, 0, 150, 20), g); return(c); } }
private void OnGUITriggerList(TilesetAON tilesetAON, AutoTileMapSerializeData d, eSlotAonTypeObj e, int idSlotTrigger, ref float yGui, Rect rect) { float W_ScopeList = 200; AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, W_ScopeList, DefineAON.GUI_Height_Label), e.ToString() + " list :"); yGui += 32f; d.TriggerCountAt(e); var comboBoxTrigger = ComboBoxHelper.Instance.TypeObj(d, e); comboBoxTrigger.Rect.x = rect.x; comboBoxTrigger.Rect.y = yGui; comboBoxTrigger.Rect.width = W_ScopeList; comboBoxTrigger.Rect.height = 32f; comboBoxTrigger.SelectedItemIndex = currentIdxTrigger; comboBoxTrigger.Show(rect.height - yGui - 32f, "defause", true, false, (int idxTrigger) => { currentIdxTrigger = comboBoxTrigger.SelectedItemIndex; refTrigger = null; }); var autoTileMap = AutoTileMap_Editor.Instance; if (autoTileMap == null || autoTileMap.MapSelect != d) { return; } if (comboBoxTrigger.IsDropDownListVisible) { //Create new AONGUI.Button(new Rect(rect.x, rect.y + rect.height - 32f, W_ScopeList, DefineAON.GUI_Height_Button), "Create new " + e.ToString(), () => { autoTileMap.MapSelect.CreateNewTrigger(e); }); } Trigger trigger = d.GetTriggerByIdxRef(currentIdxTrigger, e); if (trigger == null) { return; } yGui = 4f; rect.x = rect.x + W_ScopeList + 10; if (string.IsNullOrEmpty(trigger.Name())) { AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32), "Name: NULL"); } else { AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32), "Name: " + trigger.Name()); } yGui += 32f; if (refTrigger == null) { refTrigger = new List <AutoTile>(); var triggerLink = d.TriggerLink; var tileMapWidth = autoTileMap.MapTileWidth; var tileMapHeight = autoTileMap.MapTileHeight; int layerTrigger = (int)eSlotAonTypeLayer.Trigger; for (int x = 0; x < tileMapWidth; x++) { for (int y = 0; y < tileMapHeight; y++) { var a = autoTileMap.GetAutoTile(x, y, layerTrigger); if (a == null) { continue; } if (a.Id < 0) { continue; } int idSlot = a.Id; if (idSlot != idSlotTrigger) { continue; } if (currentIdxTrigger != d.GetTriggerRef(x, y)) { continue; } refTrigger.Add(a); } } } AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32), "Reference on map: " + refTrigger.Count); yGui += 32f; AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32), "----Edit----"); yGui += 32f; if (e == eSlotAonTypeObj.Script) { yGui += 16f; AONGUI.Button(new Rect(rect.x, yGui, 100, DefineAON.GUI_Height_Label), "Edit", () => { tilesetAON.TriggerShowMoreInfo = trigger; }); } else { bool isShowMoreInfo = true; trigger.ShowGUI(new Rect(rect.x, yGui, rect.width, rect.y + rect.height - yGui), AutoTileMap_Editor.Instance, tilesetAON, ref isShowMoreInfo, null); } }