[Unity Hot Update]tolua# & Luaframework (10): Extension Toolkit

Source: Internet
Author: User
Tags lua

This toolkit has the following features:

1. Provide a resource packaging tool. Because luaframework defaults to packaging the resources in the example, it is not universal, so there is a tool to see in detail in series two.

2. Provides a tool to simplify the process of writing LUA files. According to Luaframework, if you want to add a panel, then you need to write the corresponding controller, View, and modify the three framework of the LUA files, more cumbersome, so there is a tool to improve efficiency.


3. Provide a small UI framework. This framework is designed for hot updates, provides C # and LUA implementations, and regulates the writing of C # code. The advantage is that for a panel, its C # implementation is much more similar to the implementation of LUA, and can be reduced by two development times, such as the following:

using unityengine;using System.collections;public class Mainpanel:uipanelbase {Publ    IC UILabel Hplabel;    Public UILabel Mplabel; protected override void Awake () {base.        Awake ();    UIPanelManager.Instance.CreatePanel (Uipanelname.mainpanel, OnCreate); } protected override void OnCreate (Gameobject go) {base.        OnCreate (GO); Hplabel = transform. Findchild ("Hplabel").        Getcomponent<uilabel> (); Mplabel = transform. Findchild ("Mplabel").        Getcomponent<uilabel> (); Uieventlistener.get (transform. Findchild ("Button1"). Gameobject). OnClick = Delegate (Gameobject a) {UIPanelManager.Instance.Get Panel (Uipanelname.firstpanel).        Open ();        }; Uieventlistener.get (transform. Findchild ("Button2"). Gameobject). OnClick = Delegate (Gameobject a) {uipanelmanager.in Stance. Getpanel (Uipanelname.thirdpanel).            Open ();    }; }}

Require "Common/define" require "logic/uipanelbase" Mainctrl = Uipanelbase:new (); local gameobject;local transform; Local tweener;function mainctrl.new () return mainctrl;endfunction Mainctrl.awake () panelmgr:createpanel (' Main ', mainctrl.oncreate); endfunction mainctrl.oncreate (obj) gameobject = obj;    Transform = Obj.transform; Mainctrl.gameobject = obj;    Mainctrl.transform = Obj.transform; Mainctrl.hplabel = Transform:findchild ("Hplabel"): Getcomponent (' UILabel '); Mainctrl.mplabel = Transform:findchild ("Mplabel"): Getcomponent (' UILabel '); Uieventlistener.get (Transform:findchild ("Button1"). Gameobject). OnClick = Mainctrl.openfirstpanel; Uieventlistener.get (Transform:findchild ("Button2"). Gameobject). OnClick = Mainctrl.openthirdpanel; Mainctrl:open (); endfunction Mainctrl.openfirstpanel () Ctrlmanager.getctrl (Ctrlnames.first): Open (); endfunction Mainctrl.openthirdpanel () Ctrlmanager.getctrl (Ctrlnames.third): Open (); end

You might think that there are a lot of differences, but don't forget that we can create Lua template files, so that when the C # version is implemented, the LUA version can be implemented more quickly.


Expansion pack:


Http://pan.baidu.com/s/1dEZhqpV

[Unity Hot Update]tolua# & Luaframework (10): Extension Toolkit

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.