@

前言

很久之前整理的小东西,这个是从我个人博客网站拷过来的地址

下面是源码

Plane

package com.trhsy.cn.plane;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.IOException; /**
* @ClassName Plane
* @Description todo
* @Author Administrator
* @Date 2020/3/24 002415:03
**/
public class Plane {
/**
* @Author fan
* @Description //TODO 定义一个飞机
* @Date 15:07 2020/3/24 0024
* @Param
* @return
**/
Image planeImage = null;
public int x = 300;
public int y = 700;
public int lifeCount = 5; /**
* @return
* @Author fan
* @Description //TODO 给飞机附图片
* @Date 15:19 2020/3/24 0024
* @Param []
**/
public Plane() {
try {
planeImage = ImageIO.read(Plane.class.getClassLoader().getResourceAsStream("images/plane.png"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
// 画飞机图片
g.drawImage(planeImage, x, y, null);
// 飞机移动
this.move();
// 血条
if (lifeCount > 0) {
g.setColor(Color.WHITE);
g.fillRect(20, 80, 100, 10);
g.setColor(Color.red);
g.fillRect(20, 80, (100 / 5) * lifeCount, 10);
g.setColor(Color.blue);
g.setFont(new Font("幼圆", Font.BOLD, 30));
g.drawString("Score:" + Play.count, 20, 60);
}
} public void move() {
if (isUP && !isDown && !isLeft && !isRight) {
//上
y = y - 5;
} else if (!isUP && isDown && !isLeft && !isRight) {
//下
y = y + 5;
} else if (!isUP && !isDown && isLeft && !isRight) {
//左
x = x - 5;
} else if (!isUP && !isDown && !isLeft && isRight) {
//右
x = x + 5;
} else if (isUP && !isDown && isLeft && !isRight) {
//左上
x = x - 5;
y = y - 5;
} else if (!isUP && isDown && isLeft && !isRight) {
//左下
x = x - 5;
y = y + 5;
} else if (isUP && !isDown && !isLeft && isRight) {
//右上
x = x + 5;
y = y - 5;
} else if (!isUP && isDown && !isLeft && isRight) {
//右下
x = x + 5;
y = y + 5;
}
} boolean isUP = false;
boolean isDown = false;
boolean isLeft = false;
boolean isRight = false; /**
* @return void
* @Author fan
* @Description //TODO 按下
* @Date 15:21 2020/3/24 0024
* @Param [e]
**/
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_D) {
isRight = true;
} else if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_A) {
isLeft = true;
} else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_W) {
isUP = true;
} else if (keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_S) {
isDown = true;
}
} /**
* @return void
* @Author fan
* @Description //TODO 松开
* @Date 15:24 2020/3/24 0024
* @Param [e]
**/
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_D) {
isRight = false;
} else if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_A) {
isLeft = false;
} else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_W) {
isUP = false;
} else if (keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_S) {
isDown = false;
}
} public Rectangle getRectangle() {
return new Rectangle(x, y, planeImage.getWidth(null), planeImage.getHeight(null));
} }

PlaneStatus类

package com.trhsy.cn.util;

/**
* @ClassName PlaneStatus
* @Description todo 0 游戏开始前 1 第一关 -1 游戏结束
* @Author Administrator
* @Date 2020/3/24 002415:28
**/
public class PlaneStatus {
public static int roleNum = 1;
public static int playStatus = 0;
}

Power类

package com.trhsy.cn.power;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.IOException; /**
* @ClassName Power
* @Description todo 血瓶类
* @Author Administrator
* @Date 2020/3/24 002415:29
**/
public class Power {
Image PowerImage = null;
//初始位置
int x = 20;
int y = 0; public Power() {
this.x = (int) (Math.random() * 540) + 20;
try {
PowerImage = ImageIO.read(Gift.class.getClassLoader()
.getResourceAsStream("images/power.png"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
// 画血瓶图片
g.drawImage(PowerImage, x, y, null);
// 血瓶移动
y++;
} public Rectangle getRectangle() {
return new Rectangle(x, y, PowerImage.getWidth(null), PowerImage.getHeight(null));
} }

Gift

package com.trhsy.cn.power;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.io.IOException;
import javax.imageio.ImageIO; public class Gift {
Image GiftImage = null;
int x = 20;
int y = 0; public Gift() {
this.x = (int) (Math.random() * 540) + 20;
try {
GiftImage = ImageIO.read(Gift.class.getClassLoader()
.getResourceAsStream("images/blood.png"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
// 画血瓶图片
g.drawImage(GiftImage, x, y, null);
// 血瓶移动
y++;
} public Rectangle getRectangle() {
return new Rectangle(x, y, GiftImage.getWidth(null), GiftImage.getHeight(null));
}
}

Diji

package com.trhsy.cn.plane;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.io.IOException;
import javax.imageio.ImageIO; public class Diji {
Image dijiImage = null;
public int y = -20;
/**
*20 ~ 760
**/
public int x = 10;
int r; public Diji() {
this.x = (int) (Math.random() * 540) + 40;
try {
r = (int) (Math.random() * 3) + 1;
dijiImage = ImageIO.read(Diji.class.getClassLoader()
.getResourceAsStream("images/diji_" + r + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
//画 敌机图片
g.drawImage(dijiImage, x, y, null);
//敌机移动
if (r == 1) {
y += 4;
} else if (r == 2) {
y += 4;
} else if (r == 3) {
y += 7;
}
} public Rectangle getRectangle() {
return new Rectangle(x, y, dijiImage.getWidth(null), dijiImage.getHeight(null));
}
}

play类

package com.trhsy.cn.plane;

import com.trhsy.cn.bullet.DijiZiDan;
import com.trhsy.cn.bullet.MyZiDan;
import com.trhsy.cn.power.Gift;
import com.trhsy.cn.power.Power;
import com.trhsy.cn.util.PlaneStatus; import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName Play
* @Description todo
* @Author Administrator
* @Date 2020/3/24 002415:40
**/
public class Play {
static int count = 0;
Image bgImage = null;
/**
* @Author fan
* @Description //TODO 战机
* @Date 16:11 2020/3/24 0024
* @Param
* @return
**/
Plane plane = new Plane();
/**
* @Author fan
* @Description //TODO 战机子弹
* @Date 16:11 2020/3/24 0024
* @Param
* @return
**/
List<MyZiDan> mzds = new ArrayList<MyZiDan>();
/**
* @Author fan
* @Description //TODO 敌机
* @Date 16:11 2020/3/24 0024
* @Param
* @return
**/
List<Diji> dijis = new ArrayList<Diji>();
/**
* @Author fan
* @Description //TODO 敌机子弹
* @Date 16:11 2020/3/24 0024
* @Param
* @return
**/
List<DijiZiDan> dijizidans = new ArrayList<DijiZiDan>();
/**
* @Author fan
* @Description //TODO 血瓶
* @Date 16:11 2020/3/24 0024
* @Param
* @return
**/
List<Gift> gifts = new ArrayList<Gift>(); List<Power> powers = new ArrayList<Power>(); public Play() {
try {
bgImage = ImageIO.read(Play.class.getClassLoader().getResourceAsStream("images/bg_01.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
} int bgY1 = 0;
int bgY2 = -600;
int fireTime = 0;
boolean flag = false; public void draw(Graphics g) {
// 画背景图片
g.drawImage(bgImage, 0, bgY1, null);
bgY1 += 5;
bgY1 = 0;
g.drawImage(bgImage, 0, bgY2, null);
bgY2 += 5;
if (bgY2 >= 0) {
bgY2 = -600;
}
// 清理战机子弹
for (int i = 0; i < mzds.size(); i++) {
MyZiDan myZidan = mzds.get(i);
if (myZidan.x > 800) {
mzds.remove(i);
}
}
// 添加子弹
if (isFire1 == true && flag == false) {
if (fireTime % 8 == 0) {
mzds.add(new MyZiDan(plane.x + 25, plane.y + 0));
}
fireTime++;
}
if (isFire1 == true && flag == true) {
if (fireTime % 4 == 0) {
}
mzds.add(new MyZiDan(plane.x + 8, plane.y + 0));
mzds.add(new MyZiDan(plane.x + 52, plane.y + 0));
}
fireTime++;
// 画战机子弹
for (int i = 0; i < mzds.size(); i++) {
MyZiDan myZidan = mzds.get(i);
myZidan.draw(g);
}
// 清理敌机
for (int i = 0; i < dijis.size(); i++) {
Diji dj = dijis.get(i);
if (dj.x < -100) {
dijis.remove(i);
}
}
// 抽奖:添加敌机
dijis.add(new Diji()); // 抽奖:添加血瓶
if ((int) (Math.random() * 1000) == 5) {
gifts.add(new Gift());
}
for (int i = 0; i < gifts.size(); i++) {
Gift gift = gifts.get(i);
gift.draw(g);
}
//抽奖:添加power
if ((int) (Math.random() * 1000) == 5) {
powers.add(new Power());
}
for (int i = 0; i < powers.size(); i++) {
Power power = powers.get(i);
power.draw(g);
}
// 画敌机
for (int i = 0; i < dijis.size(); i++) {
Diji dj = dijis.get(i);
dj.draw(g);
}
// 画飞机
plane.draw(g);
// 判断战机相撞
for (int i = 0; i < dijis.size(); i++) {
// 先得到每一个敌机
Diji dj = dijis.get(i);
Rectangle r1 = dj.getRectangle();
Rectangle r2 = plane.getRectangle();
if (r1.intersects(r2)) {
dijis.remove(i);
plane.lifeCount = plane.lifeCount - 1;
if (plane.lifeCount > 0) {
flag = false;
}
if (plane.lifeCount < 1) {
PlaneStatus.playStatus = -1;
}
}
// 判断战机和血瓶相撞
for (int q = 0; q < gifts.size(); q++) {
// 先得到每一个血瓶
Gift gift = gifts.get(q);
Rectangle rectangle = gift.getRectangle();
Rectangle rectangle1 = plane.getRectangle();
if (rectangle.intersects(rectangle1)) {
gifts.remove(q);
}
if (plane.lifeCount < 5) {
} plane.lifeCount = plane.lifeCount + 1;
//// 判断战机和Power相撞
for (int w = 0; w < powers.size(); w++) {
// 先得到每一个power
Power power = powers.get(w);
Rectangle rectangle2 = power.getRectangle();
Rectangle rectangle3 = plane.getRectangle();
if (rectangle2.intersects(rectangle3)) {
powers.remove(w);
flag = true;
}
}
// 判断敌机在中弹
for (int e = 0; e < mzds.size(); e++) {
// 得到每个战机子弹
MyZiDan myzidan = mzds.get(e);
Rectangle rectangle2 = myzidan.getRectangle();
for (int j = 0; j < dijis.size(); j++) {
// 每一个敌机
Diji diji = dijis.get(j);
Rectangle rectangle3 = diji.getRectangle();
if (rectangle2.intersects(rectangle3)) {
mzds.remove(i);
dijis.remove(j);
count++;
}
}
}
}
} } boolean isFire1 = false;
boolean isFire2 = false; public void keyPressed(KeyEvent e) {
plane.keyPressed(e);
if (e.getKeyCode() == KeyEvent.VK_J) {
isFire1 = true;
} /*if (e.getKeyCode() == KeyEvent.VK_K) { isFire2 = true; }*/
} public void keyReleased(KeyEvent e) {
plane.keyReleased(e);
if (e.getKeyCode() == KeyEvent.VK_J) {
isFire1 = false;
fireTime = 0;
} /*if (e.getKeyCode() == KeyEvent.VK_K) { isFire2 = false; fireTime = 0; }*/
if (e.getKeyCode() == KeyEvent.VK_P) {
for (int i = 0; i < dijis.size(); i++) {
dijis.remove(i);
}
}
}
}

over类

package com.trhsy.cn.util;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.IOException; /**
* @ClassName Over
* @Description todo
* @Author Administrator
* @Date 2020/3/24 002416:03
**/
public class Over {
Image obg=null;
Image ng=null;
public Over() {
try {
obg=ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/obg.jpg"));
ng=ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/ng.png")); } catch (IOException e) {
e.printStackTrace();
}
}
public void draw(Graphics g){
g.drawImage(obg, 0, 0, null);
g.drawImage(ng, 120,100, null);
g.setColor(Color.black);
g.setFont(new Font("幼圆", Font.BOLD, 40));
g.drawString("游戏结束啦!",200 ,600 );
}
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
}

MainFrame主类

import com.trhsy.cn.plane.Play;
import com.trhsy.cn.util.Before;
import com.trhsy.cn.util.Over;
import com.trhsy.cn.util.PlaneStatus; import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; /**
* @ClassName MainFrame
* @Description todo
* @Author Administrator
* @Date 2020/3/24 002416:04
**/
public class MainFrame extends JFrame{
private static final long serialVersionUID = 1L;
Before before =new Before();
Play play = new Play();
Over over = new Over();
public MainFrame() {
//设 置标题
this.setTitle(" 让子弹飞一会~");
//设置大小
this.setSize(600, 800);
//定位居中
this.setLocationRelativeTo(null);
//添加关闭操作
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//禁止重置大小z
this.setResizable(false);
//添加键盘监听器 KeyListener -->KeyAdapter
this.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if(PlaneStatus.playStatus == 0){
before.keyPressed(e);
}else if(PlaneStatus.playStatus ==1){
play.keyPressed(e);
}else if(PlaneStatus.playStatus==-1){
over.keyPressed(e);
}
}
@Override
public void keyReleased(KeyEvent e) {
if(PlaneStatus.playStatus == 0){
before.keyReleased(e);
}else if(PlaneStatus.playStatus ==1){
play.keyReleased(e);
}else if(PlaneStatus.playStatus==-1){
over.keyReleased(e);
}
}
}); //启 动一个线程:每隔20 毫秒执行一次
new Thread(){
public void run(){
while(true){
MainFrame.this.repaint();
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start(); //显示
this.setVisible(true);
}
Image bufferImage =null;
/**
* @Author fan
* @Description //TODO 这个方法也是20毫秒执行一次
* @Date 16:10 2020/3/24 0024
* @Param [g]
* @return void
**/
@Override
public void paint(Graphics g){
if(bufferImage==null){
bufferImage = this.createImage(600, 800);
}
Graphics g4Image = bufferImage.getGraphics();
g4Image.setColor(Color.BLACK);
g4Image.fillRect(0, 0, 600, 800);
this.draw(g4Image);
g.drawImage(bufferImage, 0, 0, null);
}
public void draw(Graphics g){
if(PlaneStatus.playStatus == 0){
before.draw(g);
}else if(PlaneStatus.playStatus ==1){
play.draw(g);
}else if(PlaneStatus.playStatus==-1){
over.draw(g);
}
}
public static void main(String[] args) {
new MainFrame();
} }

MyZiDan

package com.trhsy.cn.bullet;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.io.IOException;
import javax.imageio.ImageIO; public class MyZiDan {
Image zidanImage = null;
public int x;
public int y; public MyZiDan(int x, int y) {
this.x = x;
this.y = y;
try {
zidanImage = ImageIO.read(MyZiDan.class.getClassLoader().getResourceAsStream("images/zidan.png"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
// 画我军子弹图片
g.drawImage(zidanImage, x, y, null);
// 我的飞机子弹移动速度
y -= 20;
} public Rectangle getRectangle() {
return new Rectangle(x, y, zidanImage.getWidth(null), zidanImage.getHeight(null));
}
}

DijiZiDan

package com.trhsy.cn.bullet;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.io.IOException;
import javax.imageio.ImageIO; public class DijiZiDan {
Image zidanImage = null;
int x;
int y;
int fangxiang = 0; public DijiZiDan(int x, int y) {
this.x = x;
this.y = y;
fangxiang = (int) (Math.random() * 5);//0 ~ 7
try {
zidanImage = ImageIO.read(DijiZiDan.class.getClassLoader()
.getResourceAsStream("images/dijizidan.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
} public void draw(Graphics g) {
//画 敌机子弹图片
g.drawImage(zidanImage, x, y, null);
//移动
this.move();
} public void move() {
if (fangxiang == 0) {
//下
y = y + 2;
} else if (fangxiang == 1) {
//左
x = x - 2;
} else if (fangxiang == 2) {
//右
x = x + 2;
} else if (fangxiang == 3) {
//左下
x = x - 2;
y = y + 2;
} else if (fangxiang == 4) {
// 右下
x = x + 2;
y = y + 2;
}
} public Rectangle getRectangle() {
return new Rectangle(x, y, zidanImage.getWidth(null), zidanImage.getHeight(null));
}
}

Before

package com.trhsy.cn.util;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.imageio.ImageIO; /**
* @Author fan
* @Description //TODO 游戏开始之前加载
* @Date 16:07 2020/3/24 0024
* @Param
* @return
**/
public class Before {
Image bg = null;
Image wfeiji = null;
Image kdiji1 = null;
Image kdiji2 = null;
Image kdiji3 = null; public Before() {
try {
bg = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/bg.jpg"));
wfeiji = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/feiji_1.png"));
kdiji1 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_01.png"));
kdiji2 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_02.png"));
kdiji3 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_03.png"));
} catch (IOException e) {
e.printStackTrace();
}
} int time = 0; public void draw(Graphics g) {
if (PlaneStatus.roleNum == 1) {
// 画妹妹
g.drawImage(bg, 0, 0, null);
g.drawImage(wfeiji, 260, 600, null);
g.drawImage(kdiji1, 200, 50, null);
g.drawImage(kdiji1, 400, 50, null);
g.drawImage(kdiji1, 150, 480, null);
g.drawImage(kdiji1, 400, 480, null);
g.drawImage(kdiji2, 100, 200, null);
g.drawImage(kdiji2, 300, 100, null);
g.drawImage(kdiji2, 480, 200, null);
g.drawImage(kdiji3, 300, 300, null);
g.drawImage(kdiji3, 70, 400, null);
g.drawImage(kdiji3, 510, 400, null);
//画回车符
time++;
g.setColor(Color.YELLOW);
g.setFont(new Font("幼圆", Font.BOLD, 30)); }
if (time <= 10) {
g.drawString("[Enter]>>", 50, 750);
} else if (time <= 20) {
g.drawString("[Enter] >>", 50, 750);
} else if (time <= 30) {
g.drawString("[Enter] >>", 50, 750);
if (time == 30) {
time = 0;
}
}
} public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ENTER) { }
if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT) {
PlaneStatus.roleNum = 3 - PlaneStatus.roleNum;
//1~2 互换
}
} public void keyReleased(KeyEvent e) { } }

java版飞机大战代码的更多相关文章

  1. java版飞机大战 实战项目详细步骤.md

    [toc] 分析 飞机大战 首先对这个游戏分析,在屏幕上的物体都是飞行物,我们可以把建一个类,让其他飞行物继承这个类.游戏中应有英雄机(也就是自己控制的飞机).敌人.而敌人应该分为打死给分的飞机(就是 ...

  2. python版飞机大战代码简易版

    # -*- coding:utf-8 -*- import pygame import sys from pygame.locals import * from pygame.font import ...

  3. 微信5.0 Android版飞机大战破解无敌模式手记

    微信5.0 Android版飞机大战破解无敌模式手记 转载: http://www.blogjava.net/zh-weir/archive/2013/08/14/402821.html 微信5.0 ...

  4. 微信小游戏 demo 飞机大战 代码分析(四)(enemy.js, bullet.js, index.js)

    微信小游戏 demo 飞机大战 代码分析(四)(enemy.js, bullet.js, index.js) 微信小游戏 demo 飞机大战 代码分析(一)(main.js) 微信小游戏 demo 飞 ...

  5. 微信小游戏 demo 飞机大战 代码分析 (三)(spirit.js, animation.js)

    微信小游戏 demo 飞机大战 代码分析(三)(spirit.js, animation.js) 微信小游戏 demo 飞机大战 代码分析(一)(main.js) 微信小游戏 demo 飞机大战 代码 ...

  6. 微信小游戏 demo 飞机大战 代码分析 (二)(databus.js)

    微信小游戏 demo 飞机大战 代码分析(二)(databus.js) 微信小游戏 demo 飞机大战 代码分析(一)(main.js) 微信小游戏 demo 飞机大战 代码分析(三)(spirit. ...

  7. 微信小游戏 demo 飞机大战 代码分析 (一)(game.js, main.js)

    微信小游戏 demo 飞机大战 代码分析(一)(main.js) 微信小游戏 demo 飞机大战 代码分析(二)(databus.js) 微信小游戏 demo 飞机大战 代码分析(三)(spirit. ...

  8. java版第一个代码——HelloWorld!

    java版第一个代码--HelloWorld! 今天来接触一下java代码: 事前准备 jdk的配置(推荐jdk8或jdk11) notepad++或idea软件 开始编写 建立文件夹存放代码 建立j ...

  9. Python版飞机大战

    前面学了java用java写了飞机大战这次学完python基础后写了个python版的飞机大战,有兴趣的可以看下. 父类是飞行物类是所有对象的父类,setting里面是需要加载的图片,你可以换称自己的 ...

随机推荐

  1. .NetCore 异步编程 - async/await

    前言: 这段时间开始用.netcore做公司项目,发现前辈搭的框架通篇运用了异步编程方式,也就是async/await方式,作为一个刚接触的小白,自然不太明白其中原理,最重要的是,这个玩意如果不明白基 ...

  2. git commit 代码提交规范

    格式 type: description 1. type 类型 type 是 commit 的类别,只允许如下几种标识: fix: 修复bug add: 新功能 update: 更新 refactor ...

  3. VMware虚拟机中共享文件夹 开机启动

    输入命令: sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=02 ...

  4. centos8平台用ss监控网络

    一,ss所属的包: [root@blog ~]# whereis ss ss: /usr/sbin/ss /usr/share/man/man8/ss.8.gz [root@blog ~]# rpm ...

  5. LNOI 2020 退役记

    不会爆零了吧嘤嘤嘤 \(Day -7\) 周五正在上化学珂,突然被老师叫出去说省选还有名额,问我报不报名.啊嘞嘞还有一周了告诉我还有名额?经过了激烈的思想斗争,还是决定停课搞一搞,学一回OI好歹看看省 ...

  6. 使用creata-react-app脚手架创建react项目时非常慢的问题

    创建react项目必须要有下面两个步骤 cnpm install -g create-react-app  //创建react全局变量 create-react-app my-app //创建一个re ...

  7. Deepin v15.11驱动安装问题

    最近想用Linux跑深度学习,试了好几个发行版,最终选择了Deepin v15.11,但由于配置比较新,它不能兼容很多驱动,还得自己装,以下是我失败N次后得到的经验: 电脑配置 配置如下: 型号:DE ...

  8. 入门 第一个python可视化程序 基于pyqt5

    不得不说 py的GUI实在是太难上手了 我现在突然很怀念MFC VB c#这些东西了 因为控件的代码你只要一点就能进入查看 而pyqt5 pyside2 都不可以 你要看就看全部的代码 你要改你也只能 ...

  9. .Net Core API 发布到IIS后,如何配置SSL详细步骤

    一.首先,我们要将API发布到IIS,不脱机工作.但是这里会有问题,调用接口时,会返回 也就是说,我们需要配置SSL.接下来我们就来详细说明. 二.域名商提供SSL证书审核. 我的域名提供商是腾讯,直 ...

  10. (python)getattr等用法

    getattr() 函数用于返回一个对象属性值; 语法 getattr(object, name[, default]) 参数 object -- 对象. name -- 字符串,对象属性. defa ...