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

  • 相关阅读:
    七 HBase表结构设计
    六 一行数据存储到文件的过程。
    五、数据模型特殊属性
    四 数据模型操作
    三、 数据模型概念
    二、 HBase核心功能模块。
    一、 Hbase特性 3v特性,Volume(量级) Varity(种类) Velocity(速度)
    windows下安装redis
    redis缓存穿透和缓存雪崩
    java多线程四种实现方法
  • 原文地址:https://www.cnblogs.com/xulang/p/12504840.html
Copyright © 2011-2022 走看看