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

jupiter-ocean

v1.0.6

Published

nothing but what I need.

Downloads

39

Readme

Jupiter-Ocean

1.介绍

本项目是记录使用typescript开发游戏时所使用的部分结构、函数的合集。

2.使用

npm install jupiter-ocean

3.模块使用

GameTask

  1. 自定义结构上新增一个 tasks(taskList|taskRecord...)属性,结构为:TaskRecord<T>用于存储任务列表。
  2. 自定义一个检查点枚举,用于不同地方的检查点触发不同任务。
  3. 每个检查点绑定一个方法,用于处理检查点触发时任务的更新,调用bindTaskCheckFunc方法绑定。
    /** 任务检查点方法 */
    export type TaskCheckFunc = (task: ITask, ...args: any[]) => Promise<{
        task: ITask,
        /** 本次添加值 */
        addVal: number,
        /** 本次设置值 */
        setVal: number
    }>;

    /**
     * 绑定任务检查点函数(需要先绑定再检查)
     * @param checkPoint 任务检查点
     * @param func 检查点函数
     */
    export function bindTaskCheckFunc(checkPoint: number, func: TaskCheckFunc) {
        GameTaskCheckFuncRecord[checkPoint] = func;
    }
  1. 在需要的位置添加任务,调用addTask方法添加。
  2. 在游戏各个指定的检查点位置,调用checkTask方法检查任务。
  3. 在任务过期、任务领奖等位置调用setTaskStage方法更新任务状态或者调用delTask方法删除任务。
  4. 任务管理器设计如下: 任务管理器

GameActivity

  1. 自定义结构上新增一个 activities(activityList|activityRecord...)属性,结构为:ActivityRecord<T>用于存储活动列表。
  2. 建议活动根据configId区间进行类型区分,方便管理。
  3. 根据类型区间活动阶段绑定若干方法,用于处理不同阶段不同类型区间的活动,调用bindActivityFunc方法绑定。
    /**
     * 绑定状态处理函数
     * @param func 函数
     * @param stage 阶段
     * @param configIDSection 配置ID区间 
     */
    export function bindActivityStageFunc(func: ActivityStageHandler, stage: ActivityStage, configIDSection: ConfigIDSection){
        // ...
    }
  1. 在需要的位置添加活动,调用addActivity方法添加。
  2. 在游戏中的登录、整点等位置调用checkActivitys方法检查所有活动。活动会调用对应阶段对应类型区间的处理函数进行处理。
  3. 活动的状态机如下: 活动状态