zoukankan      html  css  js  c++  java
  • Lua 面向对象编程学习 FreeGame 的框架学习 以面向对象 思想 做Lua的编程 FreeGame 为 触动精灵 的 扩展框架

    首先第一步

    编译器的下载 与安装 以及 Lua 环境的搭建:

    图片1:

    图片2:

     

    图片3:

    图片4:

    图片5:

    部分代码:

    ActionDao={ };

    function ActionDao:new(...)
        local o={};
        setmetatable(o,self);
        self.__index=self;
        self.__tostring=function(o)
            local str="";
            for k,v in pairs(o.colors) do
                str=str..v.name..","
            end
            return "Action:"..str;
        end
        o.colors= {...};
        o.fragment={};
        o.after=nil;
        return o;
    end

    function ActionDao:run()

        local p=nil;
        for k,v in pairs(self.colors) do
            p = v:getPoints();
            if not p then
                print("没有找到:"..(v.name));
                break;
            end
        end
        if p and #self.fragment>0 then
            for k,f in pairs(self.fragment) do
                f:run(self,p);
                if self.after~=nil and self.after()==false then
                    return true;
                end
            end
        end
    end

    function ActionDao:click(...)
        self.fragment[#self.fragment+1]=Clickf:new(...);
        return self;
    end

    function ActionDao:slidf(...)
        self.fragment[#self.fragment+1]=Slidf:new(...);
        return self;
    end

    function ActionDao:sleep(...)
        self.fragment[#self.fragment+1]=Sleep:new(...);
        return self;
    end

    function ActionDao:afterfc(func)
        self.after=func;
        return self;
    end


    return ActionDao;




    其它部分在百度云盘:
     

    链接:https://pan.baidu.com/s/1W31oUoh5zMGJMPja32PqCQ
    提取码:84aj

  • 相关阅读:
    poj1047
    poj1129
    poj1050
    C#中break、continue的用法
    关于一个不大常用的SQL数据类型-UNIQUEIDENTIFIER
    关于net2.0里面新出现的类backgroundworker的应用
    深入讲解SQL Union和Union All的使用方法
    让你一次性搞定堆、栈、值类型、引用类型 (转载)
    EXEC与sp_executesql的区别及应用(转)
    几种常用排序算法总结(转载)
  • 原文地址:https://www.cnblogs.com/xulang/p/12504840.html
Copyright © 2011-2022 走看看