Quick 3.3 Final load change of CCS

Source: Internet
Author: User
Tags addchild

1, with self._topuiwidget = CCS. Guireader:getinstance (): Widgetfromjsonfile ("Maptopui.json") is still used in the previous C + + set, the time mechanism and the existing quick incompatible.

So we have to use

Local node = cc.uiloader:load ("Testpanel.json")
Self:addchild (node,0)

The button's listening Addtoucheventlistener is no longer available.

In exchange for

Local button = Cc.uiloader:seekNodeByName (self, "button")
button:onbuttonclicked (function (event)
Print ("click")
End

Engulfing events to implement panel popup occlusion The following unresponsive events can only be used under the new quick time mechanism.

If you use the old CCS set, you can only make the root responsive.

Note that CCS and quick3.3 final are incompatible and try to use only one.

Button A picture under the Click does not change big.

LocalShoppanel =require("Src.app.scenes.ShopPanel")LocalMainscene = Class ("Mainscene",function()    returnDisplay.newscene ("Mainscene")End)functionMainscene:ctor ()--Self._topuiwidget = CCS. Guireader:getinstance (): Widgetfromjsonfile ("Testpanel.json");--self:addchild (self._topuiwidget,0)    Localnode = Cc.uiloader:Load("Testpanel.json") self:addchild (node,0)    --local function touchevent (sender,eventtype)--if EventType = = Ccui. Toucheventtype.ended Then--print ("clicked");--End--End        Localbutton = Cc.uiloader:seekNodeByName (self,"Button") button:onbuttonclicked (function(Event)Print("Click")    End)        Locallabel = Cc.uiloader:seekNodeByName (self,"Fntlabel") label:setstring ( -); LocalAtlaslabel = Cc.uiloader:seekNodeByName (self,"Atlaslabel") atlaslabel:setstring ( -); LocalListView = Cc.uiloader:seekNodeByName (self,"ListView")    --Addtoucheventlistener is no longer available.--local function touchevent (sender,eventtype)--if EventType = = Ccui. Toucheventtype.ended Then--Print ("click");--End--End--Local button = Cc.uiloader:seekNodeByName (self, "button_2")--Button:addtoucheventlistener (touchevent)            Localp =shoppanel.new () Self:addchild (p, -)EndfunctionMainscene:addhomebtnquick () self._homebtn= Cc.ui.UIPushButton.new ({normal="Itemselect.png"}): OnButtonClicked (function()            Print("HOMEBTN Click")        End): AddTo (self):p OS (display.cx,display.cy)EndfunctionMainscene:onenter ()Endfunctionmainscene:onexit ()EndreturnMainscene

Panel: Code

LocalShoppanel = Class ("Shoppanel",function()    returnDisplay.newcolorlayer (CC.C4B (255,255,255, -))End)functionShoppanel:ctor ()--Self:initui ()Self:addtouch ()EndfunctionShoppanel:addtouch () self:settouchenabled (true) self:settouchswallowenabled (true)    --[[because the picture of the pause layer is covered above the game layer, if we do not intercept the touch event of the game layer, it will trigger the touch event of the game layer. Addtouch is to intercept all touch events at the pause layer. The widget's root is set to be interactive]]Self:addnodeeventlistener (CC. Node_touch_event,function(event) Dump (event)End)EndfunctionShoppanel:initui () self.lv=Cc.ui.UIListView.new {--BgColor = cc.c4b ( A.Viewrect = Cc.rect (0,0,420,380), Direction=Cc.ui.UIScrollView.DIRECTION_VERTICAL}--: OnTouch (Handler (self, self.touchlistener)): AddTo (self)--Add Items     forI=1,8  Do        Localitem =Self.lv:newItem ()LocalContent =cc.ui.UILabel.new ({text="Click Delete it de".. I, Size= -, Align=Cc.ui.TEXT_ALIGN_CENTER, Color=display. Color_white}) item:addcontent (content) item:setitemsize ( -, the) Self.lv:addItem (item)Endself.lv:reload ()EndreturnShoppanel

Quick 3.3 Final load change of CCS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.