function GameBoardViewX:TouchAt(x,y)
----返回点击的Item的xy
if self.PosStart == nil then ----初始化面板偏移量
self.PosStart = ccp(self:getPositionX(), self:getPositionY());
self.ItemW = GamePlayConfig_Tile_Width
self.ItemH = GamePlayConfig_Tile_Height
end
if self.PosStart then ----修正点击偏移量
x = x - self.PosStart.x;
y = y - self.PosStart.y;
end
-- local sx = 0;
-- local sy = 0;
-- if self.m_GamePlayConfig_Tile_ScaleX then sx = self.m_GamePlayConfig_Tile_ScaleX; else sx = GamePlayConfig_Tile_ScaleX end
-- if self.m_GamePlayConfig_Tile_ScaleY then sy = self.m_GamePlayConfig_Tile_ScaleY; else sy = GamePlayConfig_Tile_ScaleY end
local temp_x = math.ceil(x / self.ItemW / self.m_GamePlayConfig_Tile_ScaleX)
local temp_y = math.ceil(GamePlayConfig_Max_Item_Y -1 - y / self.ItemH / self.m_GamePlayConfig_Tile_ScaleY)
--print("TouchAt",x, y, temp_x, temp_y);
--print("#self.baseMap[1] #self.baseMap", #self.baseMap[1], #self.baseMap)
if self.baseMap then
if temp_x >= 1 and temp_x <= #self.baseMap[1]
and temp_y >= 1 and temp_y <= #self.baseMap
then
--print("temp_y, temp_x", temp_y, temp_x)
return ccp(temp_y, temp_x)
end
end
return ccp(temp_y, temp_x)
end
if self.PosStart == nil then ----初始化面板偏移量
self.PosStart = ccp(self:getPositionX(), self:getPositionY());
self.ItemW = GamePlayConfig_Tile_Width
self.ItemH = GamePlayConfig_Tile_Height
end
if self.PosStart then ----修正点击偏移量
x = x - self.PosStart.x;
y = y - self.PosStart.y;
end
-- local sx = 0;
-- local sy = 0;
-- if self.m_GamePlayConfig_Tile_ScaleX then sx = self.m_GamePlayConfig_Tile_ScaleX; else sx = GamePlayConfig_Tile_ScaleX end
-- if self.m_GamePlayConfig_Tile_ScaleY then sy = self.m_GamePlayConfig_Tile_ScaleY; else sy = GamePlayConfig_Tile_ScaleY end
local temp_x = math.ceil(x / self.ItemW / self.m_GamePlayConfig_Tile_ScaleX)
local temp_y = math.ceil(GamePlayConfig_Max_Item_Y -1 - y / self.ItemH / self.m_GamePlayConfig_Tile_ScaleY)
--print("TouchAt",x, y, temp_x, temp_y);
--print("#self.baseMap[1] #self.baseMap", #self.baseMap[1], #self.baseMap)
if self.baseMap then
if temp_x >= 1 and temp_x <= #self.baseMap[1]
and temp_y >= 1 and temp_y <= #self.baseMap
then
--print("temp_y, temp_x", temp_y, temp_x)
return ccp(temp_y, temp_x)
end
end
return ccp(temp_y, temp_x)
end