Skip to content

Commit

Permalink
增加Listview
Browse files Browse the repository at this point in the history
  • Loading branch information
cwbsir committed Feb 6, 2020
1 parent d2a8fd1 commit 00ce345
Show file tree
Hide file tree
Showing 12 changed files with 533 additions and 83 deletions.
1 change: 1 addition & 0 deletions Assets/Lua/ImportClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require "utils/Clone"
require "ui/Image"
require "ui/Button"
require "ui/InputLabel"
require "ui/ListView"
require "datas/GlobalData"
require "managers/UIManager"
require "managers/TickManager"
Expand Down
6 changes: 4 additions & 2 deletions Assets/Lua/StartController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ function StartController:startGame()
image:setParent(globalManager.uiManager.mainTransform);

local label = globalManager.kCreator:createRichLabel();
label:setPosition(100,-50);

label:setPosition(100,-50)
label:setString("你是&#6$602$2$<color=#fb5657>没下划线点击</color>$81$0$0$0#&哈&#6$602$3$<color=#fb5657>下划线点击</color>$91$0$0$0#&吗");
label:setParent(globalManager.uiManager.mainTransform);

local listView = globalManager.kCreator:createListView(image.transform,"listView");
listView:pushBackItem(globalManager.kCreator:createLabel());
end

function StartController:btnClickHandler(sender)
Expand Down
13 changes: 13 additions & 0 deletions Assets/Lua/ui/KCreator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,17 @@ function KCreator:createInputLabel(name)
inputLabel:setColor(globalConst.colorConst.black);
inputLabel:setFontSize(20);
return inputLabel;
end

--创建ListContainer parentTrans父类transform contaienr容器 mainNode根节点
function KCreator:createListView(parentTrans,name)
local mainNode = Node:new();
local obj = UnityEngine.GameObject.Instantiate(globalData.uiPrefabs["ScrollView"]);
obj.name = name;
mainNode:setObject(obj);
mainNode:setParent(parentTrans);
local content = obj.transform:Find("Viewport/Content");
local contaienr = ListView:new();
contaienr:setObject(content.go);
return contaienr,mainNode;
end
Loading

0 comments on commit 00ce345

Please sign in to comment.