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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tencent-act-center-ngr

v1.0.17

Published

这是ngr 王者荣耀世界的活动中心/发现中心的小应用 sdk快速接入组件

Downloads

849

Readme

简介

  • 这是ngr 王者荣耀世界的活动中心/发现中心的小应用 sdk快速接入组件
  • 组件与 小应用活动中心发现中心对接。 小应用活动中心的git: https://git.woa.com/linksee-web/pix/world/actcenterfind

安装

npm i tencent-act-center-ngr

使用

import { GameletAPI } from "gamelet-pixui-frame";

// 预加载时,活动入口判断用到
import { initActCenter } from "tencent-act-center-ngr";
// 页面渲染时,活动标题、活动规则弹窗 用到
import { initActRule } from "tencent-act-center-ngr";

const appId = GameletAPI.getAppID().toString();

console.log("preprocess start");
console.log("preprocess appId: ", appId);


initActCenter({
  // 在活动中心的菜单配置内
  onEnterActCenter: (menuList, showEntrance) => {
    console.log("匹配到符合自己的活动中心菜单活动", appId);
    
    menuList.forEach(menuInfo=>{
      const midInfo = {
            mid: menuInfo.mid,
            subMid: menuInfo.subMid
        }
      // 注册至游戏内活动中心tab
      showEntrance(midInfo);
    });
   
  },
  // 在发现中心的菜单配置内
  onEnterFindCenter(menuList, showEntrance){
    console.log("匹配到符合自己的发现中心菜单活动", appId);
  // 与活动中心的回调函数用法一致
    menuList.forEach(menuInfo=>{
      const midInfo = {
            mid: menuInfo.mid,
            subMid: menuInfo.subMid
        }
      // 注册至游戏内活动中心tab
      showEntrance(midInfo);
    });
  },
  // 不在菜单活动配置内
  onNotInActCenter() {
    console.log("不在活动中心", appId);
  },
  // 用户打开客户端活动中心时触发
  openActCenter(menuList) {
    console.log("用户打开活动中心", appId);
  },
  // 当小应用在活动中心内的状态变更时触发
  watchStateActCenter(state, menuList) {
    //0在活动中心内, 1不在活动中心内
    console.log("watchStateActCenter", state);
  },
});

在渲染时:

initActRule({
  // 强制启动本地数据
  useLocalData:true,
  // 活动的剩余时间标题  默认为  剩余时间
  remainTimeTitle:'剩余时间',
  // 活动剩余时间的value值   默认为中文的语言
  /**
    中文对照显示格式
    <1h  : <1小时
    <24h : {hours}小时
    <72h : 当被天整除时 ${days}天 ,否则 `${days}天${hours}小时
    <59d : ${days}天
    <360d : ${days/30}个月
    长期  : 长期
  **/
  // 多语言时用到,展示时间单位时的文案
  timeUnit:{
    hours:'hours', // 默认 小时
    days:'days', // 默认 天
    months:'months', // 默认 个月
    long:'long-term', // 默认 长期
  },
  // 本地环境模拟一个页面打开时,客户端传入的活动菜单信息
  setDevArgsInfo: (mockArgsInfo) => {
    let json = mockArgsInfo;
    // 活动中心的二级菜单id
    json.subMid = 11147;
    // 小应用id
    json.actID = appId;
    // 活动名称
    json.name = "官网引流";
    // 结束时间
    json.endTime = "2026-12-31 18:19:02";
    // 设置活动规则文案
    json.actDetail.actRule = {

      activityMainTitle: "关注官方账号",
      activitySubTitle: "关注任意@王者荣耀世界官方账号即可领取",
      // 是否展示活动规则可点击的icon,如果这里设置成false  则右上角标题左侧的icon进行隐藏
      activityRuleIsPreview: true,
      activityRuleTitle: "活动详情",
      activityRuleFirstTitle: "规则说明",
      actRuleList:[
        {
          activityRuleFirstTitle:'活动时间',
          activityRuleSecondTitles:[
            {
              activityRuleSecondTitle:'',
              activityRuleSecondText:'<p>本活动长期开放</p>'
            }
          ]
        },
        {
          activityRuleFirstTitle:'参与条件',
          activityRuleSecondTitles:[
            {
              activityRuleSecondTitle:'',
              activityRuleSecondText:'<p>解锁发现中心后即可参与活动。</p'
            },
            {
              activityRuleSecondTitle:'',
              activityRuleSecondText:'<p>解锁发现中心后即可参与活动22。</p'
            }
          ]
        },
        {
          activityRuleFirstTitle:'活动简介',
          activityRuleSecondTitles:[
            {
              activityRuleSecondTitle:'',
              activityRuleSecondText:'<p>活动期间,完成相关任务可获得<span style="color: rgb(212, 177, 6);">【晶珀】</span>奖励。</p>'
            }
          ]
        }
      ],
      
    };

    return json;
  },
  // 时间到期
  timesUp: (argsInfo) => {
    console.log("时间到期", JSON.stringify(argsInfo));
    GameletAPI.callGame(
      JSON.stringify({
        type: "pandoraActCenterReady",
        redPoint: "1",
        appId,
        appName: argsInfo.name,
        tabID: "1",
        // 排序,二级菜单名称 客户端是从活动中心的列表读取
        //sortPriority: tabForm.sort.toString(),
        //secondTabName: tabForm.title,
        inBottomVal: "0",
        state: "2", // 0-注册,1-修改信息,2-移除
        centerType: "2", //tabType[tabForm.tab.toString()],  //1-庆典,2-活动
        subMid: argsInfo.subMid, // 二级菜单
      }),
    );
  },
});
表单多语言,存放在 argsInfo.actDetail.actRule

如下配置属性:

 remainTimeTitle  // 剩余时间标题
 timeUnitHours    // 时间单位 小时
 timeUnitDays     // 时间单位 天
 timeUnitMonths   // 时间单位 个月
 timeUnitLong     // 时间单位 长期
 activityMainTitle    // 活动标题
 activitySubTitle     // 活动副标题
 activityRuleIsPreview    // bool值 是否展示活动规则弹窗
 activityRuleTitle    // 活动规则标题 - 弹窗
 actRuleList  // 活动规则的标题数组
    - activityRuleFirstTitle     // 一级标题
      - activityRuleSecondTitles // 二级标题数组
        - activityRuleSecondTitle // 二级标题文案
        - activityRuleSecondText  // 二级标题正文

  当如果是灵犀平台侧配置活动规则多与语言,那么 剩余时间 + 活动弹窗的多语言内容 存在 excelExtra中,excelExtra在actRule下

  excelExtra: // 平台给的多语言规则
    - hoursUnit    // 时间单位 小时
    - daysUnit 
    - monthsUnit 
    - long        // 时间单位 长期
    - remainTimeTitle    // 剩余时间标题
    - activityRuleTitle   // 活动规则标题 - 弹窗
    - activityRuleFirstTitle_0   // 一级标题
    - activityRuleSecondText_0   // 二级标题正文
    - activityRuleFirstTitle_{n}   // 一级标题第N个 n < 10
    - activityRuleSecondText_{n}   // 二级标题正文第N个 n < 10

详情说明:https://iwiki.woa.com/p/4015288144