16.libgdx根据配置文件生成布局(未完)-程序员宅基地

技术标签: java  ui  

思路:

  screen分为普通和复杂两种,普通的功能大部分是页面跳转以及简单的crud数据,复杂的单独弄出来

  跳转普通的screen,直接根据配置文件调整设置

<layouts>
    <loyout screenId="0" bg="bg_start" name="start" defaultWinId="" bgm="" remark="">
    </loyout>
    <loyout screenId="1" bg="bg_main" name="main" defaultWinId="0" bgm="" remark="">
        <window id="0" scale="1.0" bg="" x="0" y="0" w="0" h="0" float="center" >
            <buttons >
                <button  x="50" y="30" w="0" h="0"   imgUpName="mbtn_empire"  imgDownName="mbtn_empire"  functionId="0" font="" remark="帝国"></button>
                <button  x="300" y="30" w="0" h="0"  imgUpName="mbtn_conquest"  imgDownName="mbtn_conquest"  functionId="1" font="" remark="征服"></button>
                <button  x="550" y="30" w="0" h="0"  imgUpName="mbtn_commder"  imgDownName="mbtn_commder"  functionId="2" font="" remark="指挥官"></button>
                <button  x="800" y="30" w="0" h="0"  imgUpName="mbtn_option"  imgDownName="mbtn_option"  functionId="3" font="" remark="设置"></button>
                <button  x="300" y="120" w="0" h="0"  imgUpName="mbtn_map"  imgDownName="mbtn_map"  functionId="4" font="" remark="地图"></button>
            </buttons>
        </window>
    </loyout>
</layouts>
package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.List;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class MainScreen extends ScreenAdapter {
    
    private MainGame game;
    private EmpireScreen empireScreen;
    

    private Texture manTexture;

    private List<Stage> stages;
    private Stage stage;

    private BaseActor manActor;
    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    //private GameFramework framework;
    
    public MainScreen(MainGame mainGame)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        

        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        manActor = new BaseActor(new TextureRegion(manTexture));
        
        
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(manActor);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w"), buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h"));
                button.setPosition(buttonE.getInt("x"),buttonE.getInt("y"));
                function(buttonE.getInt("functionId"));
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    public void function(int i){
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
通用场景

 

构想中首先根据screenId获得其布局背景图,布局默认stage编号,背景音乐等信息,

然后一个window代表一个stage,buttons下加载其按钮配置 

随后还设想加入Lable(文本标签)和Image(图片标签),并且x,y,w,h等都会变为百分比计算距离,根据float来确定位置(靠左,靠右,居中),根据bgm切换音乐

实现多窗口(多stage),动态加载内容等功能

此篇将随着后续对ui的完善持续更新

6.22更新:

所有坐标按百分比读取,绘制点为图片中心点,如果超边界,会顶边而不超出去

package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.abandon.EmpireScreen;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class GeneralScreen extends ScreenAdapter {
    
    private MainGame game;
    

    private Texture manTexture;
    
    private Image bgImage;

    private List<Stage> stages;
    private Stage stage;

    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=-1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    private Map tempMap;
    private int i;//function的计数标志,从1开始
    //private GameFramework framework;
    
    public GeneralScreen(MainGame mainGame,int screenId)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        this.screenId=screenId;
        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        bgImage= new Image(manTexture);
        bgImage.setSize(mainGame.getWorldWidth(), mainGame.getWorldHeight());
        
        i=1;
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(bgImage);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth()/100, buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight()/100);
                button.setPosition(
                        buttonE.getInt("x")*stage.getWidth()/100+button.getWidth()/2>stage.getWidth()?stage.getWidth()-button.getWidth():buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2<0?0:buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2,
                        buttonE.getInt("y")*stage.getHeight()/100+button.getHeight()/2>stage.getHeight()?stage.getHeight()-button.getHeight():buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2<0?0:buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2);
                tempMap=new HashMap();
                tempMap.put("FUNCTION_ID", buttonE.get("functionId"));
                tempMap.put("ID", i);
                /*switch(screenId) {
                    //一些特殊的数据 暂时废弃
                    case 7:
                    break;
                }*/
                i++;       
                function(tempMap);
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    /*
    0:帝国/战役
    1:征服
    2:指挥官
    3:设置
    4:地图
    5:返回主页
    6:地图跳入(i)
    7:跳入详细地图
    8:
    9:
    10:
    11:
    12:
     */
            
    public void function(Map map){
        int i=Integer.parseInt(map.get("FUNCTION_ID").toString());
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置地图
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 5://返回
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,1);
                    }
                });
                break;
            case 6://地图跳入
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 7://地图编辑
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setMapId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,71);
                    }
                });
                break;
            case 8://跳入征服    
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setStageId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,81);
                    }
                });
                break;
                
                
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
所有坐标按百分比读取

 

转载于:https://www.cnblogs.com/tysk/p/10995508.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30764137/article/details/99412019

智能推荐

【玩转华为云】手把手教你利用ModelArts实现垃圾自动分类_华为云人工智能 垃圾分类-程序员宅基地

文章浏览阅读1.4k次。本篇推文共计2000个字,阅读时间约3分钟。华为云—华为公司倾力打造的云战略品牌,2011年成立,致力于为全球客户提供领先的公有云服务,包含弹性云服务器、云数据库、云安全等云计算服务,软件开发服务,面向企业的大数据和人工智能服务,以及场景化的解决方案。华为云用在线的方式将华为30多年在ICT基础设施领域的技术积累和产品解决方案开放给客户,致力于提供稳定可靠、安全可信、可持续创新的云服务,做智能世界的“黑土地”,推进实现“用得起、用得好、用得放心”的普惠AI。华为云作为底座,为华为全栈全场景A.._华为云人工智能 垃圾分类

Python 开发桌面应用居然如此简单_python制作桌面端-程序员宅基地

文章浏览阅读6.4k次,点赞4次,收藏86次。我们都知道 Python 可以用来开发桌面应用,一旦功能开发完成,最后打包的可执行文件体积大,并且使用 Python 开发桌面应用周期相对较长假如想快速开发一款 PC 端的桌面应用,推荐使用 Aardio + Python 搭配的方式进行开发1. Aardio介绍Aardio 是一款专注于 Windows 桌面端的软件开发,适用于快速开发一些自用的 PC端桌面工具,并且它支持与Python、JS、Golang 等主流语言进行混合编程它是一款免费的开发工具,简单易学,支持多线程,具有轻巧..._python制作桌面端

IDEA中Spring配置错误:class path resource [.xml] cannot be opened because it does not exist_class path resource [feign/requestinterceptor.clas-程序员宅基地

文章浏览阅读10w+次,点赞71次,收藏72次。如果在运行 Spring 项目时出现了类似于:class path resource [applicationContext.xml] cannot be opened because it does not exist这样的异常 意思就是没有找到你的 .xml 配置文件原因我可以肯定你一定用的是 ApplicationContext ctx = new ClassPathXmlApplicati_class path resource [feign/requestinterceptor.class] cannot be opened becaus

Activiti工作流引擎-程序员宅基地

文章浏览阅读1w次,点赞8次,收藏50次。Activiti是一个工作流引擎, activiti可以将业务系统中复杂的业务流程抽取出来,使用专门的建模语言BPMN2.0进行定义,业务流程按照预先定义的流程进行执行,实现了系统的流程由activiti进行管理,减少业务系统由于流程变更进行系统升级改造的工作量,从而提高系统的健壮性,同时也减少了系统开发维护成本。........._activiti工作流引擎

【BZOJ】【3053】The Closest M Points-程序员宅基地

文章浏览阅读76次。KD-Tree  题目大意:K维空间内,与给定点欧几里得距离最近的 m 个点。  KD树啊……还能怎样啊……然而扩展到k维其实并没多么复杂?除了我已经脑补不出建树过程……不过代码好像变化不大>_>  然而我WA了。。。为什么呢。。。我也不知道……  一开始我的Push_up是这么写的:inline void Push_up(int o){ rep(..._euclidean distance between w and the closest point to w in s v

testng生成报告ReportNG美化测试报告-程序员宅基地

文章浏览阅读184次。testng生成报告ReportNG美化测试报告testng生成报告ReportNG美化测试报告ReportNG 是一个配合TestNG运行case后自动帮你在test-output文件内生成一个相对较为美观的测试报告!ReportNG 里面Log 是不支持中文的,我改过ReportNG.jar源码,具体方法看最下面,也可以找我直接要jar!话不多说直接上环境准备:1,你需要这些架包 ..._testng reportng美化报告

随便推点

C++实现线性表的顺序存储结构_c++使用顺序存储表示方法创建线性表-程序员宅基地

文章浏览阅读2.5k次,点赞6次,收藏48次。C++线性表的顺序存储结构 线性表是最基本、最简单、也是最常用的一种数据结构。线性表(linear list)是数据结构的一种,一个线性表是n个具有相同特性的数据元素的有限序列。线性表的特点除第一个元素外,其他每一个元素有且仅有一个直接前驱。除最后一个元素外,其他每一个元素有且仅有一个直接后继。直接前驱和直接后继描..._c++使用顺序存储表示方法创建线性表

重装protobuf报错undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameB5cxx11Ev-程序员宅基地

文章浏览阅读1.4w次,点赞2次,收藏7次。服务器将protobuf版本从2.6.1降级到2.5.0后,重新装回2.6.1,出现报错:protoc: symbol lookup error: /usr/lib/x86_64-linux-gnu/libprotoc.so.9: undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameB5cxx11Ev搜索网上解决办法,发现并...__znk6google8protobuf7message11gettypenameb5cxx11ev

【校招VIP】java语言考点之synchronized和volatile-程序员宅基地

文章浏览阅读356次。synchronized和volatile两个关键字也是校招常考点之一。volatile可以禁止进行指令重排。synchronized可作用于一段代码或方法,既可以保证可见性,又能够保证原子性。_synchronized和volatile

互联网平台经济模式逐渐形成,许多新的创新型企业涌现出来,将会影响到社会的治理结构以及公共政策走向-程序员宅基地

文章浏览阅读461次。作者:禅与计算机程序设计艺术 1.简介在新冠病毒疫情期间,由于经济全面恢复、国内外大量人员返乡、工作日程调整等因素的影响,使得整个社会成为新冠病毒大流行的重灾区。为了减轻生产企业和消费者的不满情绪,提高社会福利水平,防止再次发生类似事件,各地都制定了诸多限制、规范、政策等方面的法律法规,但这些法律法规

ethereum/EIPs-161 State trie clearing-程序员宅基地

文章浏览阅读152次。EIP 161: State trie clearing- makes it possible to remove a large number of empty accounts that were put in the state at very low cost as a result of earlier DoS attacks. With this EIP, 'empty' accou..._eip161

2003与2007导出_导出2003-程序员宅基地

文章浏览阅读120次。using System;using System.Data;using System.Configuration;using System.Collections;using System.Data.OleDb;using System.IO;using System.Web;using System.Web.Security;using System.Web.U..._导出2003