这是一个场景的NPC搜素功能,由于后期NPC的数量可能会比较多,所以不能采用创建加载的方法来实现这个功能,想了想,只能采用无限滚动的方式来实现。NGUI有无限滚动的案例,可惜才疏学浅,看不懂,只能自己写了一个,原理也是一样的,可惜效果不是很好,贴上了LUA的源码。
图上的UIWrapContent组件是NGUI实现无限滚动的组件,是后面加上的,我自己写的是没有的。
--[[
作者:TGD
说明:
备注:
--]]
local Control_MiniMap_BtnList = {}
Control_MiniMap_BtnList.gameObject = nil;
Control_MiniMap_BtnList.baseControl = nil;
--------------------UI
local grid = nil;
local scrollView = nil;
local uiWrapContent = nil;
local uiCenterOnChild = nil;
------------------------Data
local this = nil;
local npcList = nil;
-- 剔除后的list
local newList = {};
-- Grid中的元素高度
local btnHeight = nil;
-- 存在的最大按钮个数
local maxBtnCount = 10;
-- 按钮Control集合
local controlPool = {};
local sVpos = nil;
local strength = 10;
-- 上一次滑动后,ScrollView的位置
local lastSVPos = nil;
-- 本次滑动结束后,ScrollView的位置
local currentPos = nil;
-- 默认允许滚动的数目,当上端或者下端超过5个后,开始滚动切换
local scrollCount = 5;
-- 上端第5个按钮的绝对垂直位置
local absluteUpperY = nil;
-- 下端第5个按钮的绝对垂直位置
local absluteDownY = nil;
--- 剪切视图底部垂直位置
local clipViewY= nil;
-- 上滑计数
local Count = maxBtnCount+1;
-- 下滑计数
local downCount = 0;
-- ScrollView的内容高度
local sVContentHeight = nil;
function Control_MiniMap_BtnList:ControlOnLoad(go, baseControl)
-- go:该脚本控制的gameObject
-- baseControl:该脚本的组件
self.gameObject = go;
self.baseControl = baseControl;
this = self.gameObject;
-- 这里是获取相关的组件的方法
scrollView = go.transform:Find("Scroll View"):GetComponent("UIScrollView");
lastSVPos = scrollView.gameObject.transform.localPosition;
sVpos= Vector3.New(0,0,0);
-- 添加拖拽监听
-- 项目封装的UIScrollView拖拽监听方法
--scrollView:AddFinishFunc(Control_MiniMap_BtnList.OnDrugScrollView);
grid = go.transform:Find("Scroll View/Grid"):GetComponent("UIGrid");
btnHeight = grid.cellHeight;
-- 项目内部的UI自动深度排序方法
CommonTools.BaseControlDepthOrderBy(baseControl);
end
function Control_MiniMap_BtnList:FlushData(list)
-- list是传递过来的NPC信息的数据列表
npcList = list;
for i= 0, npcList.Count-1 do
-- 筛选数据,留下NPC数据
if npcList[i]:ToString() == "NpcSprite" then
table.insert(newList, npcList[i]);
end
end
if #newList<=maxBtnCount then
for i=1, #newList do
local npcData = newList[i];
-- 项目中的创建UI的方法,创建完成后,会默认放入项目中的对象池中
local control = ControlPrototype[ControlTypeEnum.Control_MiniMap_NpcBtn];
local luaModule = UIManager.Instance:CreateControlInPool(grid.transform, control[1], control[2], nil, npcData);
table.insert(controlPool, luaModule);
end
for i=1, #controlPool do
controlPool[i].gameObject:SetActive(false);
controlPool[i].gameObject:SetActive(true);
end
else
for i=1, maxBtnCount do
local npcData = newList[i];
local control = ControlPrototype[ControlTypeEnum.Control_MiniMap_NpcBtn];
local luaModule = UIManager.Instance:CreateControlInPool(grid.transform, control[1], control[2], nil, npcData);
table.insert(controlPool, luaModule);
end
for i=1, #controlPool do
controlPool[i].gameObject:SetActive(false);
controlPool[i].gameObject:SetActive(true);
end
grid:Reposition();
--sVContentHeight = (#newList-8)*btnHeight;
--absluteUpperY = 1.0816; --默认写死
--absluteDownY = controlPool[13].gameObject.transform.position.y;
--clipViewY = controlPool[7].gameObject.transform.position.y;
end
grid:Reposition();
end
function Control_MiniMap_BtnList.OnDrugScrollView()
currentPos = scrollView.gameObject.transform.localPosition;
-- 向上滑动时
if currentPos.y > lastSVPos.y then
lastSVPos = currentPos;
if #newList > maxBtnCount then
local value = controlPool[1].gameObject.transform.position.y -absluteUpperY;
--local value1 = currentPos.y - btnHeight(scrollCount+1);
--local value2 = (currentPos.y - (currentPos.y%(btnHeight(scrollCount+1))))%(btnHeight*(scrollCount+1));
if value > 0 and Count <= #newList then
for i=1, scrollCount-1 do
local pos = controlPool[maxBtnCount].gameObject.transform.localPosition;
local luamodule = controlPool[1];
-- 数据更新
if newList[Count] ~= nil then
controlPool[1]:FlushData(newList[Count]);
Count = Count +1;
-- 位置更新
controlPool[1].gameObject.transform.localPosition = Vector3.New(pos.x, pos.y - btnHeight, pos.z);
table.remove(controlPool, 1);
table.insert(controlPool, luamodule);
downCount = downCount+1;
end
end
end
end
end
-- 向下滑动时
if currentPos.y < lastSVPos.y then
lastSVPos = currentPos;
if #newList > maxBtnCount then
--local value1 = currentPos.y - btnHeight*(scrollCount-4);
--local value2 = (currentPos.y - (currentPos.y % btnHeight)) % btnHeight;
--local value3 = sVContentHeight - currentPos.y - btnHeight*(scrollCount+2);
local value = absluteDownY-controlPool[maxBtnCount].gameObject.transform.position.y;
local value1 = controlPool[maxBtnCount].gameObject.transform.position.y -clipViewY;
--
if value>0 and value1<0 and downCount >= 1 then
for i=1, scrollCount-1 do
local pos = controlPool[1].gameObject.transform.localPosition;
local luamodule = controlPool[maxBtnCount];
-- 数据更新
if newList[downCount] ~= nil then
controlPool[maxBtnCount]:FlushData(newList[downCount]);
downCount = downCount -1;
controlPool[maxBtnCount].gameObject.transform.localPosition = Vector3.New(pos.x, pos.y + btnHeight, pos.z);
table.remove(controlPool);
table.insert(controlPool, 1, luamodule);
Count = Count -1;
end
end
end
end
end
end
function Control_MiniMap_BtnList:OnLoadData(...)
local data = {...};
if #data>0 then
local npcinfo = data[1];
Control_MiniMap_BtnList:FlushData(npcinfo);
else
LogError("Control_MiniMap_BtnList 获取npc信息失败");
end
end
function Control_MiniMap_BtnList:OnUpdate(ElapsedSeconds)
-- ElapsedSeconds:过去的时间,单位:秒
end
function Control_MiniMap_BtnList:OnRelease()
scrollView:DelFinishFunc(Control_MiniMap_BtnList.OnDrugScrollView);
end
return Control_MiniMap_BtnList
虽然实现了,可惜效果不是很好,滑动的快的话,会出现滑不溜,甚至数据断层的情况。
最后还是选择了使用NGUI中的无限滚动方法。请教的同事,代码非常简单。。。。。。。
-- 获取相应的组件,添加委托事件
uiWrapContent = go.transform:Find("Scroll View/Grid"):GetComponent("UIWrapContent");
uiCenterOnChild = go.transform:Find("Scroll View/Grid"):GetComponent("UICenterOnChild");
-- 添加无限滚动委托
uiWrapContent.onInitializeItem = Control_MiniMap_BtnList.onInitializeElement;
-- 在刷新数据的时候,同事刷新UIWrapContent的两个属性
-- 设置为负数,则从下部滚动加载没有加载的值。这个是必须的,决定了数据刷新的方向和数据量
uiWrapContent.maxIndex = 0;
uiWrapContent.minIndex = -1*(#newList-1);
-- wrapIndex 表示当前显示的item的真正索引,realIndex是数据的索引。
function Control_MiniMap_BtnList.onInitializeElement(go, wrapIndex, realIndex)
-- LogError("111111 "..wrapIndex.." "..realIndex);
controlPool[wrapIndex+1]:FlushData(newList[math.abs(realIndex)+1]);
end
这就实现了无限滚动。。。。。
下面是同事做的利用无限滚动实现的匹配系统的小功能
等级匹配系统代码
--[[
作者:gang
说明:队伍目标调整UI
备注:
--]]
local UI_SetTarget = {}
UI_SetTarget.gameObject = nil;
UI_SetTarget.baseUI = nil;
require("Protocol.team_pb")
local this = nil;
--按钮
--关闭按钮
local Button_Close = nil;
--确定按钮
local Button_Sure = nil;
--限制文字
local Label_Limit = nil;
--限制时间
local Label_Time = nil;
--自动匹配选择按钮
local Toggle_AutoMatching = nil;
--左边的
local scrollViewLeft = nil;
--右边的
local scrollViewRight = nil;
--左边等级限制挂载点
local GridLeft = nil;
--右边等级限制挂载点
local GridRight = nil;
--获取左边选择的等级
local CenterLeft = nil;
--获取右边选择的等级
local CenterRight = nil;
--等级总挂载点
local GameObjLevelLimit = nil;
--按钮委托
local delSure = nil;
local delClose = nil;
--刷新队伍界面
local delRevRefresh = nil;
--左边等级控件列表
local leftLevelObj = {};
--右边等级控件列表
local rightLevelObj = {};
--设置目标要用到的排列控件
local popupControl = nil;
local scrollView = nil;
function UI_SetTarget:OnLoad(go, baseUI)
-- go:为该脚本控制的gameObject
-- baseUI:该脚本控制的MonoBehaviour组件
UI_SetTarget.gameObject = go;
UI_SetTarget.baseUI = baseUI;
this = self;
moduleGrounp = Module_Manager:Get(ModuleEnum.Module_Grounp);
Button_Close = go.transform:Find("Item/Button_Close");
Button_Sure = go.transform:Find("Item/Button_Sure");
Label_Limit = go.transform:Find("Item/Label_Limit"):GetComponent('UILabel');
Label_Time = go.transform:Find("Item/Label_Time"):GetComponent('UILabel');
Toggle_AutoMatching = go.transform:Find("Item/Toggle_AutoMatching"):GetComponent('UIToggle');
--GridLeft = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Left/Grid"):GetComponent('UIGrid');
--GridRight = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Right/Grid"):GetComponent('UIGrid');
GridLeft = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Left/Grid"):GetComponent('UIWrapContent');
GridRight = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Right/Grid"):GetComponent('UIWrapContent');
scrollViewLeft = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Left"):GetComponent('UIScrollView');
scrollViewRight = go.transform:Find("Item/GameObjLevelLimit/Scroll View_Right"):GetComponent('UIScrollView');
CenterLeft = GridLeft.transform:GetComponent("UICenterOnChild");
CenterRight = GridRight.transform:GetComponent("UICenterOnChild");
GameObjLevelLimit = go.transform:Find("Item/GameObjLevelLimit");
--------------------注册委托---------------------
delSure = DelegateFactory.DelegateDefines_OnTouchButtonHandler(self.Sure);
EventManager.SetButtonEventHandler(Button_Sure.gameObject, EnumButtonEvent.OnClick, delSure, 0, 0);
delClose = DelegateFactory.DelegateDefines_OnTouchButtonHandler(self.Close);
EventManager.SetButtonEventHandler(Button_Close.gameObject, EnumButtonEvent.OnClick, delClose, 0, 0);
delRevRefresh = DelegateFactory.Code_MessageController_MsgHandle(self.RevRefresh);
MessageController.Instance:AddNotification(MSMap.Grounps_Refresh_C2C,delRevRefresh);
CommonTools.BaseUIDepthOrderBy(baseUI);
leftLevelObj = {};
rightLevelObj = {};
GridLeft.onInitializeItem = this.onInitializeItemleft;
GridRight.onInitializeItem = this.onInitializeItemright;
this:InitInfo();
this:InitTargetButton();
end
--scrolview初始位置
local startPos = nil;
--初始化设置目标的按钮
function UI_SetTarget:InitTargetButton()
scrollView = this.gameObject.transform:Find("Item/Control_PopupList"):GetComponent("UIScrollView");
scrollView:AddFinishFunc(self.OnScrollViewDragFinish);
startPos = scrollView.gameObject.transform.localPosition;
local popup = this.gameObject.transform:Find("Item/Control_PopupList"):GetComponent("BaseControl");
if(popup ~= nil) then
popup:OnLoad(Commons.popupLuaPath);
local data1 = {};
local temp1 = {};
temp1.name = "无";
temp1.taskType = 0;
temp1.taskBaseId = 0;
temp1.isMatch = false;
temp1.maxLevel = 129;
temp1.minLevel = 1;
temp1.limit = "无";
temp1.time = "全天";
temp1.data2 = {};
table.insert(data1,temp1);
for i = 1, #moduleGrounp.TaskTarget,1 do
table.insert(data1,moduleGrounp.TaskTarget[i]);
end
local starIndex = 1;
for k =1, #data1 , 1 do
if data1[k].taskBaseId == moduleGrounp.TaskBaseId then
starIndex = k;
end
end
local popupVo = {};
popupVo.firstMenuList = data1;
popupVo.firstMenuControlType = ControlTypeEnum.Control_GrounpsTargetClassBt1;
popupVo.secondMenuControlType = ControlTypeEnum.Control_GrounpsTargetClassBt2;
popupVo.closeLastWhenOpenNew = true; -- 点击一级菜单时是否需要收缩上一次打开的一级菜单
popupVo.closeCurFirstMenuWhenSecondMenuClick = true; -- 点击二级菜单的时候是否需要把当前的一级菜单按钮收回
-- 打开界面是是否需要默认选中那一条一级数据, 填0或者不填则不默认显示哪一条
-- popupVo.startShowFirstDataIndex = starIndex;
-- 默认显示哪一条二级数据, 如果startShowFirstDataIndex > 0,这个值不填或者填0默认显示第一条,
--如果startShowFirstDataIndex填0或者不填,则这个数据不生效
--popupVo.startShowSecondDataIndex = 0;
-- 跟上面聊天关联, 默认选中某条数据时, 是否需要显示出二级菜单列表
popupVo.needShowSecondMenuListOnStart = false;
--点击一级菜单时是否显示默认显示第一条数据
popupVo.alwayShowFirstDataWhenClickFirstMenu = false;
popupControl = popup:GetModule();
popupControl.SetFirstMenuClickDelegate(self.firstMenuClick);
popupControl.SetSecondMenuClickDelegate(self.secondMenuClick);
popup:OnLoadData(popupVo);
popupVo.startShowSecondDataIndex = starIndex;
popupControl:ClickFirstMenu(starIndex);
end
end
--回弹
function UI_SetTarget.OnScrollViewDragFinish()
if(scrollView.shouldMoveVertically == false) then
scrollView.restrictWithinPanel = false;
SpringPanel.Begin(scrollView.gameObject, startPos, 10);
else
scrollView.restrictWithinPanel = true;
end
end
--初始化等级限制
local forgeReward = nil;
--创建行动目标及等级限制 初始化
function UI_SetTarget:InitInfo()
--初始化行动目标
--初始化等级限制
forgeReward = PrototypeManager.Instance:GetPrototypeList("LevelExpPrototype");
if forgeReward == nil then
LogError("LevelExpConf表无数据,请检查");
else
myTaskType = moduleGrounp.TaskType;
myTaskBaseId = moduleGrounp.TaskBaseId;
end
end
function UI_SetTarget:OnLoadData(...)
-- local params = {...}, 如果#params大于0, 可根据params[1]获取第一个参数
end
function UI_SetTarget:OnUpdate(ElapsedSeconds)
-- ElapsedSeconds:过去的时间,单位:秒
end
function UI_SetTarget:OnRelease()
EventManager.RemoveButtonAllEventHandler(Button_Sure.gameObject);
EventManager.RemoveButtonAllEventHandler(Button_Close.gameObject);
MessageController.Instance:RemoveNotification(MSMap.Grounps_Refresh_C2C,delRevRefresh);
for i = 1, #leftLevelObj,1 do
UIManager.Instance:ReleaseControl(leftLevelObj[i].gameObject);
UIManager.Instance:ReleaseControl(rightLevelObj[i].gameObject);
end
end
--现在已经选择的一级按钮
local NowButClass1 = nil;
--存储的选择的一级按钮
local SaveButClass1 = nil;
--储存任务任务类型
local myTaskType = nil;
--储存任务任务id
local myTaskBaseId = nil;
--确定后的对应的任务类型与id
local SendTaskType = nil;
local sendBaseId = nil;
--点击一级菜单按钮 isOpenState: 是否是打开状态
function UI_SetTarget.firstMenuClick(firstData, control,isOpenState,curIndex)
--传进来属于该按钮的第一层数据 包含了第二层的数据 control 是按钮控件
if isOpenState then
--LogError("一级按钮"..firstData.name);
myTaskType = firstData.taskType;
--是否有对应的子按钮
if firstData.data2 ~= nil and #firstData.data2 > 0 then
--有子按钮就记录当前的按钮 当二级按钮选择之后才将该按扭改为选中状态
SaveButClass1 = control;
if myTaskType == moduleGrounp.TaskType then
if NowButClass1 ~= nil then
NowButClass1.SetIsSelect(false);
end
NowButClass1 = control;
NowButClass1.SetIsSelect(true);
--this.SetLvLimit(firstData.minLevel,firstData.maxLevel);
end
else
--没有子按钮就选择自己
this.CheckNeedMatch(firstData.isMatch)
if NowButClass1 ~= nil and NowButClass1 ~= control then
NowButClass1.SetIsSelect(false);
end
NowButClass1 = control;
NowButClass1.SetIsSelect(true);
this.SetLvLimit(firstData.minLevel,firstData.maxLevel);
SaveButClass1 = control;
myTaskBaseId = firstData.taskBaseId;
SendTaskType = myTaskType;
sendBaseId = myTaskBaseId;
Label_Limit.text = firstData.limit;
Label_Time.text = firstData.time;
end
end
end
--点击二级菜单按钮
function UI_SetTarget.secondMenuClick(secondData, control, curFirstIndex, curSecondIndex)
--传进来属于该按钮第二层的数据 control 是按钮控件
--LogError("二级按钮"..secondData.taskBaseId);
if SaveButClass1 == nil then
LogError("没有存储到一级按钮,请检查!")
else
this.CheckNeedMatch(secondData.isMatch);
NowButClass1.SetIsSelect(false);
NowButClass1 = SaveButClass1;
NowButClass1.SetIsSelect(true);
this.SetLvLimit(secondData.minLevel,secondData.maxLevel);
SaveButClass1 = nil;
myTaskBaseId = secondData.taskBaseId;
SendTaskType = myTaskType;
sendBaseId = myTaskBaseId;
Label_Limit.text = secondData.limit;
Label_Time.text = secondData.time;
end
end
--检查点击该按钮后是否可以进行匹配
function UI_SetTarget.CheckNeedMatch(isMatch)
if isMatch then
Toggle_AutoMatching.gameObject:SetActive(true);
Toggle_AutoMatching.value = true;
else
Toggle_AutoMatching.gameObject:SetActive(false);
Toggle_AutoMatching.value = false;
end
end
--确定提交
function UI_SetTarget.Sure(go, args, param1, param2)
local level1;
local level2;
level1 = tonumber(CenterLeft.centeredObject:GetComponent("UILabel").text);
level2 = tonumber(CenterRight.centeredObject:GetComponent("UILabel").text);
--自动匹配
local min = nil;
local max = nil
if level1 > level2 then
max = level1;
min = level2;
else
min = level1;
max = level2;
end
-- LogError(min .. " min ".. max.." max");
-- LogError("sendBaseId"..sendBaseId);
----手动设置可匹配值
if sendBaseId ~= nil then
if Toggle_AutoMatching.value then
if moduleGrounp.Matching then
moduleGrounp.ChangeGrounpsInfo(sendBaseId,SendTaskType,min,max)
else
moduleGrounp.ApplyMatch(sendBaseId,SendTaskType,min,max);
end
else
moduleGrounp.ChangeGrounpsInfo(sendBaseId,SendTaskType,min,max)
moduleGrounp.QuitApplyMatch();
end
UI_SetTarget.Close();
else
UIManager.Instance:OpenUI(UITypeEnum.UI_Message,Language[10001328]);
end
end
--关闭
function UI_SetTarget.Close(go, args, param1, param2)
UIManager.Instance:CloseUI(UITypeEnum.UI_SetTarget);
end
---值的偏移量
local indexOffset = 0;
--位移量
local leftPosY;
local rightPosY;
--偏移到的索引
local offsetMin = nil;
local offsetMax = nil;
--设置等级限制
function UI_SetTarget.SetLvLimit(minLv,maxLv)
--情况特殊 要倒转
if minLv == nil or maxLv == nil then
minLv = moduleGrounp.MinLevel;
maxLv = moduleGrounp.MaxLevel;
LogError("传入等级范围为空");
else
--LogError("传入等级为".." min "..minLv.." max "..maxLv);
end
indexOffset = minLv;
GridLeft.maxIndex = 0;
GridLeft.minIndex = -1 * (maxLv- minLv);
GridRight.maxIndex = 0;
GridRight.minIndex = -1 * (maxLv- minLv);
local star = MainStar();
local myLv = star:GetSpritePropertype(EnumSpritePropertype.Level);
--位移
if minLv < (myLv - 5) then
offsetMin = myLv - 5;
elseif myLv - 5 <= minLv and minLv <= myLv then
offsetMin = minLv;
else
LogError("任务超出最小等级范围")
offsetMin = minLv;
end
if myLv <= maxLv and maxLv <= myLv + 5 then
offsetMax = max;
elseif maxLv > myLv + 5 then
offsetMax = myLv + 5
else
offsetMax = maxLv;
LogError("任务超出最大等级范围");
end
if offsetMax < offsetMin then
offsetMax = offsetMin
end
leftPosY = math.ceil((offsetMin - indexOffset) * GridLeft.itemSize);
rightPosY = math.ceil((offsetMax - indexOffset) * GridRight.itemSize);
--LogError(offsetMin.."offsetMin222");
--LogError(offsetMax.."offsetMax222");
--复位
GridLeft:SortAlphabetically();
GridRight:SortAlphabetically();
scrollViewLeft:ResetPosition();
scrollViewRight:ResetPosition();
this.isOpenleft = true;
this.isOpenright = true;
CommonTools.WaitForFrames(1,this.SetLvTarget);
--CommonTools.WaitForFrames(8,this.CenterOnLv);
end
function UI_SetTarget.SetLvTarget()
SpringPanel.Begin(scrollViewLeft.gameObject, Vector3.New(scrollViewLeft.transform.localPosition.x, math.abs(leftPosY),0), 20);
SpringPanel.Begin(scrollViewRight.gameObject, Vector3.New(scrollViewRight.transform.localPosition.x, math.abs(rightPosY),0), 20);
end
--有人加入队伍的消息
function UI_SetTarget.RevRefresh(notify)
if not (notify.ErrorCode == 0) then
UIManager.Instance:OpenUI(UITypeEnum.UI_Message, Language[ErrorInfo[notify.ErrorCode]]);
return;
end
if not moduleGrounp.isCaptain then
UI_SetTarget.Close();
end
--print("收到有人加入队伍的信息");
end
UI_SetTarget.centerOnLeft = nil;
UI_SetTarget.centerOnRight = nil;
UI_SetTarget.isOpenleft = true;
UI_SetTarget.isOpenright = true;
function UI_SetTarget.onInitializeItemleft(go, wrapIndex, realIndex)
go.transform:GetComponent('UILabel').text = tostring(math.abs(realIndex) + indexOffset);
--LogError(go.transform.localPosition.y);
if offsetMin ~= nil then
--LogError(math.abs(realIndex) .."-.-" ..offsetMin);
if math.abs(realIndex) == offsetMin -indexOffset then
this.centerOnLeft = go;
--LogError(realIndex.."minrealindex.......")
if this.isOpenleft then
CommonTools.WaitForFrames(2,this.CenterOnLvLeft);
this.isOpenleft = false;
end
end
end
end
function UI_SetTarget.onInitializeItemright(go, wrapIndex, realIndex)
go.transform:GetComponent('UILabel').text = tostring(math.abs(realIndex) + indexOffset);
--LogError(go.transform.localPosition.y);
if offsetMax ~= nil then
if math.abs(realIndex) == offsetMax - indexOffset then
this.centerOnRight = go;
--LogError(realIndex.."maxrealindex.......")
if this.isOpenright then
CommonTools.WaitForFrames(2,this.CenterOnLvRight);
this.isOpenright = false;
end
end
end
end
function UI_SetTarget.CenterOnLvLeft()
--LogError("asdasdasd");
if this.centerOnLeft ~= nil then
CenterLeft:CenterOn(this.centerOnLeft.gameObject.transform);
--LogError("centerOnLeft asdasdasd");
end
end
function UI_SetTarget.CenterOnLvRight()
if this.centerOnRight ~= nil then
CenterRight:CenterOn(this.centerOnRight.gameObject.transform);
--LogError("centerOnRight asdadasda");
end
end
return UI_SetTarget;