public Trigger CreateNewTrigger(eSlotAonTypeObj typeObj) { Trigger trigger = null; int idGen = -1; if (typeObj == eSlotAonTypeObj.Warps) { idGen = WarpsData.Count; WarpsData.Add(new Warps()); trigger = WarpsData[idGen]; } else if (typeObj == eSlotAonTypeObj.Signposts) { idGen = SignpostsData.Count; SignpostsData.Add(new Signposts()); trigger = SignpostsData[idGen]; } else if (typeObj == eSlotAonTypeObj.Person) { idGen = NPCData.Count; NPCData.Add(new NPC()); trigger = NPCData[idGen]; // ComboBoxHelper.Instance.ResetDataNPCList(); } else if (typeObj == eSlotAonTypeObj.Script) { idGen = ScriptData.Count; ScriptData.Add(new Script()); trigger = ScriptData[idGen]; // ComboBoxHelper.Instance.ResetDataScriptList(); } return(trigger); }
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); } }
public void ResetTypeObj(eSlotAonTypeObj typeObj) { if (_CacheCType.ContainsKey(typeObj) == true) { _CacheCType[typeObj] = null; } }
public int OverlayCountAt(eSlotAonTypeObj typeObj) { if (typeObj == eSlotAonTypeObj.House) { return(HouseData.Count); } return(0); }
public ComboBox TypeObj(AutoTileMapSerializeData map, eSlotAonTypeObj typeObj) { if (_CacheCType.ContainsKey(typeObj) == false || _CacheCType[typeObj] == null) { ComboBox c = CreateByTypeObj(map, typeObj); _CacheCType[typeObj] = c; return(c); } return(_CacheCType[typeObj]); }
public Overlay GetOverlayByIdxRef(int idxRef, eSlotAonTypeObj typeObj) { if (typeObj == eSlotAonTypeObj.House) { if (idxRef >= HouseData.Count) { return(null); } return(HouseData[idxRef]); } return(null); }
public Overlay GetOverlay(int x, int y, eSlotAonTypeObj typeObj) { if (x < 0 || x >= TileMapWidth || y < 0 || y >= TileMapHeight) { return(null); } int idxRef = OverlayLink[x, y]; if (idxRef < 0) { return(null); } return(GetOverlayByIdxRef(idxRef, typeObj)); }
public Trigger GetTrigger(int x, int y, eSlotAonTypeObj typeObj) { if (x < 0 || x >= TileMapWidth || y < 0 || y >= TileMapHeight) { return(null); } int idxRef = TriggerLink[x, y]; if (idxRef < 0) { return(null); } return(GetTriggerByIdxRef(idxRef, typeObj)); }
public Overlay CreateNewOverlay(int x, int y, eSlotAonTypeObj typeObj) { Overlay overlay = null; int idGen = -1; if (typeObj == eSlotAonTypeObj.House) { idGen = HouseData.Count; HouseData.Add(new House()); overlay = HouseData[idGen]; ComboBoxHelper.Instance.ResetTypeObj(eSlotAonTypeObj.House); } if (overlay != null) { // CheckInitArray(ref OverlayLink, TileMapWidth, TileMapHeight, -1); OverlayLink[x, y] = idGen; } return(overlay); }
public int TriggerCountAt(eSlotAonTypeObj typeObj) { if (typeObj == eSlotAonTypeObj.Warps) { return(WarpsData.Count); } else if (typeObj == eSlotAonTypeObj.Signposts) { return(SignpostsData.Count); } else if (typeObj == eSlotAonTypeObj.Person) { return(NPCData.Count); } else if (typeObj == eSlotAonTypeObj.Script) { return(ScriptData.Count); } return(0); }
public Trigger GetTriggerByIdxRef(int idxRef, eSlotAonTypeObj typeObj) { if (idxRef < 0) { return(null); } if (typeObj == eSlotAonTypeObj.Warps) { if (idxRef >= WarpsData.Count) { return(null); } return(WarpsData[idxRef]); } else if (typeObj == eSlotAonTypeObj.Signposts) { if (idxRef >= SignpostsData.Count) { return(null); } return(SignpostsData[idxRef]); } else if (typeObj == eSlotAonTypeObj.Person) { if (idxRef >= NPCData.Count) { return(null); } return(NPCData[idxRef]); } else if (typeObj == eSlotAonTypeObj.Script) { if (idxRef >= ScriptData.Count) { return(null); } return(ScriptData[idxRef]); } return(null); }
public Trigger CreateNewTrigger(int x, int y, eSlotAonTypeObj typeObj) { Trigger trigger = null; int idGen = -1; if (typeObj == eSlotAonTypeObj.Warps) { idGen = WarpsData.Count; WarpsData.Add(new Warps()); trigger = WarpsData[idGen]; } else if (typeObj == eSlotAonTypeObj.Signposts) { idGen = SignpostsData.Count; SignpostsData.Add(new Signposts()); trigger = SignpostsData[idGen]; } else if (typeObj == eSlotAonTypeObj.Person) { idGen = NPCData.Count; NPCData.Add(new NPC()); trigger = NPCData[idGen]; // ComboBoxHelper.Instance.ResetDataNPCList(); } else if (typeObj == eSlotAonTypeObj.Script) { idGen = ScriptData.Count; ScriptData.Add(new Script()); trigger = ScriptData[idGen]; // ComboBoxHelper.Instance.ResetDataScriptList(); } if (trigger != null) { // CheckInitArray(ref TriggerLink, TileMapWidth, TileMapHeight, -1); ComboBoxHelper.Instance.ResetTypeObj(typeObj); TriggerLink[x, y] = idGen; } return(trigger); }
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); } }