npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pixuireactutils

v1.1.8

Published

pixui react script tools

Downloads

1

Readme

脚本工具

1.MakeImage.js

React 里用于一键生成图集文件 用法有2个命令:

  • node MakeImage.js create path
  • node MakeImage.js update path

(path: 一个文件夹的路径,可以按绝对路径写法,形如:/Users/zhengyanan/Desktop/work_git/LgameVideoGameTest/src/asset/Textures/VideoGame;也可以按相对当前位置的路径,形如../../LgameVideoGameTest/src/asset/Textures/VideoGame。)

第一条命令是创建一个Images.tsx文件,可以直接代码中使用。如图:

第二条命令是更新Images.tsx文件,用于增加图片的时候,更新Images.tsx。如上图所示,创建之后按上面的要求,只能改Images的key值(这个已足够满足需求,因为这个key值,代码中才可能用到)。使用update可以保留这些你的改动,无需重新改代码中的引用。如果没改动的话,那就无所谓,直接重新create即可。

2. GenerateConstructorAndGeterSeter.js

先定义好类的字段后,一键生成该类的构造函数,getter方法 和 setter方法。

用法只有一个命令:

  • node GenerateConstructorAndGeterSeter.js xxx.tsx 110

其中,xxx.tsx指的是待生成的类文件;110是选项,3个bit位依次表示是否生成构造函数、setter、getter。

例如,先定义好类的字段,如下:

class RealTimeMatchInfo{
        bo: number // 赛制bo1, bo3, bo5
        location: string
        round: number // 当前是第几场, 从1开始
        matchId: number
        seasonId: number
        stageId: number
        status: number //  状态 0: 未开始; 1: 进行中; 2: 已结束
        teamA: number // 战队A id
        teamAScore: number // 战队A 获胜的游戏单局数
        teamB: number // 战队B id
        teamBScore: number // 战队B 获胜的游戏单局数
        winTeam: number // 系列赛胜利战队ID
    }

然后执行 上述命令,即可自动生成构造函数 和 setter方法,生成的结果如下:

class RealTimeMatchInfo{
    bo: number // 赛制bo1, bo3, bo5
    location: string
    round: number // 当前是第几场, 从1开始
    matchId: number
    seasonId: number
    stageId: number
    status: number //  状态 0: 未开始; 1: 进行中; 2: 已结束
    teamA: number // 战队A id
    teamAScore: number // 战队A 获胜的游戏单局数
    teamB: number // 战队B id
    teamBScore: number // 战队B 获胜的游戏单局数
    winTeam: number // 系列赛胜利战队ID

	constructor(){
		this.bo = -1
		this.location = ""
		this.round = -1
		this.matchId = -1
		this.seasonId = -1
		this.stageId = -1
		this.status = -1
		this.teamA = -1
		this.teamAScore = -1
		this.teamB = -1
		this.teamBScore = -1
		this.winTeam = -1
	}

	setBo(bo: number){
		this.bo = bo
	}

	setLocation(location: string){
		this.location = location
	}

	setRound(round: number){
		this.round = round
	}

	setMatchId(matchId: number){
		this.matchId = matchId
	}

	setSeasonId(seasonId: number){
		this.seasonId = seasonId
	}

	setStageId(stageId: number){
		this.stageId = stageId
	}

	setStatus(status: number){
		this.status = status
	}

	setTeamA(teamA: number){
		this.teamA = teamA
	}

	setTeamAScore(teamAScore: number){
		this.teamAScore = teamAScore
	}

	setTeamB(teamB: number){
		this.teamB = teamB
	}

	setTeamBScore(teamBScore: number){
		this.teamBScore = teamBScore
	}

	setWinTeam(winTeam: number){
		this.winTeam = winTeam
	}
}