2 Star 1 Fork 1

GermMC / WikiGermEngine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
custom_chat.md 9.85 KB
一键复制 编辑 原始数据 按行查看 历史
GermMC 提交于 2022-04-09 10:29 . 清茶的更新

自定义聊天界面


配置文件

game_gui_chat.yml

game_gui_chat: #这里是自定义聊天界面配置文件的名字 不可修改 游戏内默认T键即可打开
  #注意啦注意啦 以下dos仅在聊天颠覆界面可以用
  # writeChat<->萌芽引擎牛逼       在聊天栏里写入萌芽引擎牛逼这几个字
  # replaceChat<->萌芽引擎@啦啦啦  在聊天栏内所有的 萌芽引擎 替换为 啦啦啦
  # invalidChat<->true           开启聊天栏内的字符串互动
  # invalidChat<->false          关闭聊天栏内的字符串互动
  # 目前想到这几个 如果有需求请联系我
  #
  #很常见的一个问题 客户端未响应
  #可能原因有,某个配置节点有问题,客户端需要输出一个消息日志到聊天框
  #这个时候消息日志会被聊天栏收到,聊天框频道处理时又触发了这个问题,然后就无限触发循环导致了未响应
  #
  #这里的写法仅仅做示例教学 并不能直接拿来用
  private:
    #是否渲染背景
    background: true
    #是否enter后关闭界面
    enterClose: true
    #是否在enter后自动删除文字
    autoClear: true
    #是否永久聚焦 默认为 true
    permanentFocus: true
    #限制输入的字符长度 默认为 256
    limit: 256
    locationX: "4"
    locationY: "h-12"
    width: "w-4"
    height: "12"
    #按下enter后的dos
    enterDos:
      - "hudMessage<->left1@%input%"
  color:
    type: color
    #性状  有太多了 后面再列出
    shape: 0
    locationX: "2"
    locationY: "h-14"
    width: "w-4"
    height: "12"
    #颜色块的颜色为RGBA,请在前面加上0x,如果不了解什么是RGBA可以搜索 什么是RGBA
    color: 0x88880000
    #颜色块的末尾颜色,可以形成渐变色(可删除)删除后为纯色
    endColor: 0x88880000
  button:
    type: button
    defaultPath: 'local<->textures/gui/chat/emoji.png'
    #鼠标悬浮到按钮时的图片、GIF(如果填的是gif文件就会渲染成gif)
    hoverPath: 'local<->textures/gui/chat/emoji_hover.png'
    #悬浮到按钮播放声音(可删除)
    hoverSound: 'minecraft:ui.button.click'
    #点击按钮播放声音(可删除)
    clickSound: 'minecraft:ui.button.click'
    locationX: "4"
    locationY: "h-18-12-4"
    width: "34"
    height: "18"
    #点击的时候执行dos,这里的dos在任何dos中都适用(可删除) 萌芽GUI精华所在
    clickDos:
      - "condition<->str(%chat_input_emoji_child_opened%,true)@[2,3]@[4]"
      - "closeChild<->chat_input_emoji_child"
      - "invalidChat<->false"
      - "openChild<->chat_input_emoji_child"
      - "invalidChat<->true"
chat_input_emoji_child:
  color:
    type: color
    #性状  有太多了 后面再列出
    shape: 0
    locationX: "2"
    locationY: "h-35-50"
    width: "180"
    height: "50"
    #颜色块的颜色为RGBA,请在前面加上0x,如果不了解什么是RGBA可以搜索 什么是RGBA
    color: 0x88000000
    #颜色块的末尾颜色,可以形成渐变色(可删除)删除后为纯色
    endColor: 0x88000000
  button:
    type: button
    defaultPath: 'local<->textures/misc/air.png'
    #鼠标悬浮到按钮时的图片、GIF(如果填的是gif文件就会渲染成gif)
    hoverPath: 'local<->textures/misc/translucent.png'
    #悬浮到按钮播放声音(可删除)
    hoverSound: 'minecraft:ui.button.click'
    #点击按钮播放声音(可删除)
    clickSound: 'minecraft:ui.button.click'
    locationX: "2"
    locationY: "h-35-50"
    width: "9"
    height: "9"
    texts:
      - "鴀"
    hoverTexts:
      - "&c鴀"
    #点击的时候执行dos,这里的dos在任何dos中都适用(可删除) 萌芽GUI精华所在
    clickDos:
      - "writeChat<->鴀" #在聊天栏里写入鴀

game_hud_chat.yml

#当玩家打开了聊天窗口时
#该界面的独有dos
#switchChannel<->default 切换至默认频道 (含有所有消息)
#switchChannel<->other 切换至其他频道 (含有所有未被分类的消息)
#switchChannel<->channel1 切换至到指定名称的频道
#暂时想到这么多 期待您的补充...
game_hud_chat:
  private:
    #基础设置
    EssentialSettings:
      #是否关闭原版聊天框
      #在关闭原版聊天框后 switchChannel Dos 其实就没用了
      #你可以把接收到的消息在collectDos中使用 insertLabel Dos 或 addLabel Dos 插入到各个对应的label组件中
      #然后你就可以控制各个组件来调整频道的信息显示
      #
      #总的来说 使用原版聊天界面做频道简单但是做不了很高级
      #       关闭原版聊天显示自己用dos做可以任意改写,想怎么做就怎么做,但是难~
      disableMinecraftHudChat: false
    #频道设置
    ChannelSettings:
      #频道的名称 用于dos切换频道时使用
      #优先级为上面的比下面的高
      channel1:
        #消息进入该频道的条件 chatMessage 为收到的消息占位符
        condition: "startStr(chatMessage,§公)"
        #该频道会保留的消息记录条数 (关闭原版聊天显示后其实就无需设置了)
        limit: 100
        #当某条消息超过这个宽度时会被换行 (在关闭原版聊天显示后才会生效,否则按照原版的分离计算逻辑)
        splitWidth: "w*0.4+40"
        #该频道收到新消息时触发的Dos
        #其中 %chat_channel_channel1_size% 代表该频道的消息总数(chat_channel为固定前缀、channel1为频道名字、size为变量标识符)
        collectDos:
          - "insertLabel<->thisGui@canvasChannel1$MessageList@%chat_channel_channel1_size%@chatMessage" #在label部件的某行后面插入频道新接收的话
          - "addLabel<->thisGui@canvasChannel1$MessageList@chatMessage" #在label部件的最后面加上频道新接收的话
          - "removeLabel<->thisGui@canvasChannel1$MessageList@100" #删除label的第一百行
          - "removeLabel<->thisGui@canvasChannel1$MessageList@first" #删除label的第一行
          - "removeLabel<->thisGui@canvasChannel1$MessageList@last" #删除label的最后一行
      channel2:
        condition: "startStr(chatMessage,§喇)"
        splitWidth: "w*0.4+40"
        limit: 100
        collectDos:
          - 'message<->channel2 频道收到了消息 chatMessage'
      channel3:
        condition: "startStr(chatMessage,§附)"
        splitWidth: "w*0.4+40"
        limit: 100
        collectDos:
          - 'message<->channel3 频道收到了消息 chatMessage'
      #名字为default的频道,该频道所有消息都会接收,所以他没有condition字段的设置
      default:
        splitWidth: "w*0.4+40"
        limit: 100
        collectDos:
          - 'message<->channel3 频道收到了消息 chatMessage'
      #名字为other的频道,会接收除了default以外的其他频道都没有接受的消息,所以他也没有condition字段的设置
      other:
        splitWidth: "w*0.4+40"
        limit: 100
        collectDos:
          - 'message<->channel3 频道收到了消息 chatMessage'
  channel1Switcher:
    type: button
    defaultPath: 'local<->textures/gui/chat/公告.png'
    hoverPath: 'local<->textures/gui/chat/公告.png'
    clickSound: 'minecraft:ui.button.click'
    width: "w*0.05"
    height: "w*0.025"
    locationX: "w*0.1"
    locationY: "h*0.89"
    locationZ: "0"
    clickDos:
      - 'switchChannel<->channel1'
      - 'calPlaceholder<->abc@%abc%+1'
      - 'message<->§公 这是一条测试的公告,序号 %abc%'
  channel2Switcher:
    type: button
    defaultPath: 'local<->textures/gui/chat/喇叭.png'
    hoverPath: 'local<->textures/gui/chat/喇叭.png'
    clickSound: 'minecraft:ui.button.click'
    width: "w*0.05"
    height: "w*0.025"
    locationX: "w*0.18"
    locationY: "h*0.89"
    locationZ: "0"
    clickDos:
      - 'switchChannel<->channel2'
      - 'calPlaceholder<->abc@%abc%+1'
      - 'message<->§喇 这是一条测试的喇叭,序号 %abc%'
  channel3Switcher:
    type: button
    defaultPath: 'local<->textures/gui/chat/附近.png'
    hoverPath: 'local<->textures/gui/chat/附近.png'
    clickSound: 'minecraft:ui.button.click'
    width: "w*0.05"
    height: "w*0.025"
    locationX: "w*0.26"
    locationY: "h*0.89"
    locationZ: "0"
    clickDos:
      - 'switchChannel<->channel3'
      - 'calPlaceholder<->abc@%abc%+1'
      - 'message<->§私 这是一条测试的附近消息,序号 %abc%'
  channel4Switcher:
    type: button
    defaultPath: 'local<->textures/gui/chat/其他.png'
    hoverPath: 'local<->textures/gui/chat/其他.png'
    clickSound: 'minecraft:ui.button.click'
    width: "w*0.05"
    height: "w*0.025"
    locationX: "w*0.34"
    locationY: "h*0.89"
    locationZ: "0"
    clickDos:
      - 'switchChannel<->other'
      - 'calPlaceholder<->abc@%abc%+1'
      - 'message<->切换到了其他频道'
  公告频道:
    type: canvas
    locationX: '0'
    locationY: '0'
    drag:
      locationX: '8'
      locationY: '1'
      width: '184'
      height: '8'
    relativeParts:
      公告滚动列表背景:
        type: texture
        path: "textures/gui/chat/背景.png"
        locationX: '0'
        locationY: '0'
        width: '200'
        height: '180'
      公告滚动列表:
        type: scroll
        invalid: false
        width: '184'
        height: '164'
        locationX: '8'
        locationY: '8'
        sliderV:
          type: 1
          width: "8"
          height: "16"
          color: 0x88888800
          texts:
            - "&e我是竖向滑块"
        locationVX: '180'
        locationVY: '12'
        widthV: '10'
        heightV: '164-24'
        invalidV: false
        scrollableV: '1000'
        scrolledV: '0'
        scrollableParts:
          label:
            type: label
            align: "left"
            scale: '1'
            texts:
              - "亲爱的: %player_name%"
              - "您的世界: %world_name%"
            locationX: "10"
            locationY: "10"
1
https://gitee.com/germmc/wiki-germ-engine.git
git@gitee.com:germmc/wiki-germ-engine.git
germmc
wiki-germ-engine
WikiGermEngine
master

搜索帮助