调整json格式
This commit is contained in:
1 parent
d69778bf11
commit
d1f62dc32c
1063 files changed
+54639
-54637
No files matched your search
@@ -1,9 +1,8 @@
|
||||
# coding=utf-8
|
||||
import time
|
||||
|
||||
from ToolsConfig import *
|
||||
from ItemTools import IsSameItem
|
||||
from FastComp import *
|
||||
from ToolsConfig import *
|
||||
|
||||
CdTags = {}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# coding=utf-8
|
||||
from ToolsConfig import serverCompFactory, clientCompFactory, serverApi, clientApi, LevelId
|
||||
from ItemTools import IsSameItem
|
||||
from ToolsConfig import serverCompFactory, clientCompFactory, serverApi, LevelId
|
||||
|
||||
|
||||
def DictFromBlockEntityData(blockEntityData, posDim):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# coding=utf-8
|
||||
import copy
|
||||
|
||||
from ToolsConfig import *
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# coding=utf-8
|
||||
import copy
|
||||
from ToolsConfig import *
|
||||
|
||||
MOD_NAME = 'rtdd'
|
||||
MOD_VERSION = '0.0.1'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# coding=utf-8
|
||||
from SystemTools import *
|
||||
from SpecialFunciton.BlueFoxSystem import *
|
||||
from OtherTools import *
|
||||
from SpecialFunciton.BlueFoxSystem import *
|
||||
from SystemTools import *
|
||||
from ToolsConfig import *
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
# coding=utf-8
|
||||
import copy
|
||||
|
||||
from ..ToolsConfig import *
|
||||
from BlueFoxSystem import BlueFoxServerSystem
|
||||
from ..OtherTools import Mount
|
||||
from LocalCoord import FixPosition, OriginCoord, RotCoord, RotAxes, BlockFaceRot
|
||||
from ..OtherTools import Mount
|
||||
from ..ToolsConfig import *
|
||||
|
||||
blockBlocks = {}
|
||||
blockEntityDataComp = serverCompFactory.CreateBlockEntityData(LevelId)
|
||||
|
||||
-3
@@ -1,10 +1,7 @@
|
||||
# coding=utf-8
|
||||
from math import *
|
||||
from ..ToolsConfig import *
|
||||
import time
|
||||
|
||||
|
||||
|
||||
class GraduallySum(object):
|
||||
"""
|
||||
渐变数
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
# coding=utf-8
|
||||
|
||||
from ..ToolsConfig import *
|
||||
from ..ItemTools import IsSameItem, GetItemBaseInfoSafely, GetItemDurabilityPercent, DeclareItemAnyNum, IsItemDict
|
||||
from ..ScreenTools import ScreenTools
|
||||
from BlueFoxSystem import BlueFoxClientSystem
|
||||
from ..OtherTools import Mount, FixList
|
||||
from ControllableUi.Animation import MoveToPos
|
||||
from ..ItemTools import IsSameItem, GetItemBaseInfoSafely, GetItemDurabilityPercent, DeclareItemAnyNum, IsItemDict
|
||||
from ..OtherTools import Mount, FixList
|
||||
from ..ScreenTools import ScreenTools
|
||||
from ..ToolsConfig import *
|
||||
|
||||
|
||||
class SlotOffset(dict):
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
# coding=utf-8
|
||||
from ..ToolsConfig import clientBaseSystem, serverBaseSystem, clientCompFactory, LevelId
|
||||
from ..MolangTools import molangNames
|
||||
from ..OtherTools import mounts
|
||||
from ..ScreenTools import ScreenTools, RegisterScreenFastly
|
||||
from ..SystemTools import SystemTools
|
||||
from ..ToolsConfig import MOD_NAME, serverCompFactory, serverApi
|
||||
from ..ScreenTools import ScreenTools, RegisterScreenFastly
|
||||
from ..OtherTools import mounts
|
||||
from ..MolangTools import molangNames
|
||||
from ..ToolsConfig import clientBaseSystem, serverBaseSystem, clientCompFactory, LevelId
|
||||
|
||||
|
||||
class BlueFoxClientSystem(clientBaseSystem):
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
# coding=utf-8
|
||||
from BlueFoxMath import cos, sin, floor, pi, ceil, MatProduct
|
||||
from ..ToolsConfig import *
|
||||
|
||||
|
||||
def FixPosition(pos):
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
# coding=utf-8
|
||||
import copy
|
||||
|
||||
from ..ToolsConfig import *
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
# coding=utf-8
|
||||
from ..ToolsConfig import *
|
||||
import random
|
||||
|
||||
from ..ToolsConfig import *
|
||||
|
||||
|
||||
def Probability(odds):
|
||||
"""
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
# coding=utf-8
|
||||
import copy
|
||||
|
||||
from ..OtherTools import AddTupleContext, GetDistance
|
||||
from ..ToolsConfig import *
|
||||
from ..OtherTools import GetDistance
|
||||
|
||||
routeControls = {} # 所有路径节点
|
||||
|
||||
|
||||
+5
-3
@@ -3,13 +3,15 @@ import math
|
||||
import random
|
||||
import re
|
||||
import time
|
||||
|
||||
import mod.client.extraClientApi as clientApi
|
||||
from mod.common.utils.mcmath import Matrix
|
||||
|
||||
from config.PlayConfig import PlayConfig
|
||||
from exception.NotClientSystemException import NotClientSystemException
|
||||
from exception.NotPlayConfigException import NotPlayConfigException
|
||||
from utils.SafeEval import SafeEval
|
||||
from .utils.CatmullRom import getCatmullromLerpFromKeyframe
|
||||
from exception.NotPlayConfigException import NotPlayConfigException
|
||||
from exception.NotClientSystemException import NotClientSystemException
|
||||
|
||||
compFactory = clientApi.GetEngineCompFactory()
|
||||
levelId = clientApi.GetLevelId()
|
||||
@@ -455,7 +457,7 @@ class Camera(object):
|
||||
nowCameraPosition = self.positionOrigin
|
||||
if self.loop == 'hold_on_last_frame' or self.loop == True or self.playConfig.isAllowDrag:
|
||||
nowCameraRotation = self.cameraCompFactory.GetCameraRotation()
|
||||
if not self.playConfig.isAllowDrag:nowCameraPosition = self.cameraCompFactory.GetCameraAnchor()
|
||||
if not self.playConfig.isAllowDrag: nowCameraPosition = self.cameraCompFactory.GetCameraAnchor()
|
||||
|
||||
# 是否强制回正 Z 轴
|
||||
if self.playConfig.isZRotForceReturn:
|
||||
|
||||
+9
-5
@@ -51,8 +51,10 @@ def startListen(client):
|
||||
Camera.globalCameraObj.destroyListen()
|
||||
|
||||
_enable = True
|
||||
client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent", cameraListenObj, cameraListenObj.GameRenderTickEvent, 10)
|
||||
client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "HealthChangeClientEvent", cameraListenObj, cameraListenObj.HealthChangeClientEvent)
|
||||
client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent",
|
||||
cameraListenObj, cameraListenObj.GameRenderTickEvent, 10)
|
||||
client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "HealthChangeClientEvent",
|
||||
cameraListenObj, cameraListenObj.HealthChangeClientEvent)
|
||||
|
||||
|
||||
def stopListen(client, delayTime=0):
|
||||
@@ -74,8 +76,10 @@ def stopListen(client, delayTime=0):
|
||||
return
|
||||
|
||||
_enable = False
|
||||
client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent", cameraListenObj, cameraListenObj.GameRenderTickEvent)
|
||||
client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "HealthChangeClientEvent", cameraListenObj,
|
||||
client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent",
|
||||
cameraListenObj, cameraListenObj.GameRenderTickEvent)
|
||||
client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(),
|
||||
"HealthChangeClientEvent", cameraListenObj,
|
||||
cameraListenObj.HealthChangeClientEvent)
|
||||
|
||||
if delayTime > 0:
|
||||
@@ -94,4 +98,4 @@ def stopListenKeepLastAnim(client):
|
||||
t = Camera.globalCameraObj.animationLength - (time.time() - Camera.globalCameraObj.startAnimationTime)
|
||||
stopListen(client, t)
|
||||
else:
|
||||
stopListen(client)
|
||||
stopListen(client)
|
||||
+16
-9
@@ -1,14 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import math
|
||||
import time
|
||||
|
||||
import mod.client.extraClientApi as clientApi
|
||||
|
||||
from .utils.CatmullRom import getCatmullromLerpFromKeyframe
|
||||
from .Camera import Camera, levelId, compFactory
|
||||
from .exception.NotClientSystemException import NotClientSystemException
|
||||
from .utils.CatmullRom import getCatmullromLerpFromKeyframe
|
||||
|
||||
|
||||
class Interpolation(object):
|
||||
|
||||
# 全局对象
|
||||
globalObj = None
|
||||
|
||||
@@ -40,7 +41,8 @@ class Interpolation(object):
|
||||
# 摄像机接口对象
|
||||
self.cameraComponentFactory = compFactory.CreateCamera(levelId)
|
||||
|
||||
self.client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent", self, self.onGameRenderTick, 0)
|
||||
self.client.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(),
|
||||
"GameRenderTickEvent", self, self.onGameRenderTick, 0)
|
||||
|
||||
def onGameRenderTick(self, event):
|
||||
"""
|
||||
@@ -54,9 +56,9 @@ class Interpolation(object):
|
||||
# 当发现关键帧循环时,清空特定变量
|
||||
if self.index < self.preIndex:
|
||||
self.preRot = (0, 0)
|
||||
|
||||
|
||||
startToNowTime = min(
|
||||
nowTime - self.updateTime + self.keyframes[min(max(self.index - 1, 0), len(self.keyframes) - 1)][0],
|
||||
nowTime - self.updateTime + self.keyframes[min(max(self.index - 1, 0), len(self.keyframes) - 1)][0],
|
||||
self.keyframes[self.index][0]
|
||||
)
|
||||
rotX = getCatmullromLerpFromKeyframe(self.keyframes, self.index, startToNowTime, 0)
|
||||
@@ -75,7 +77,7 @@ class Interpolation(object):
|
||||
beforeEventRot = (0, 0, 0)
|
||||
if Camera.globalCameraObj and Camera.globalCameraObj.beforeRot:
|
||||
beforeEventRot = Camera.globalCameraObj.beforeRot
|
||||
|
||||
|
||||
tempRot = (
|
||||
rotX - self.preRot[0],
|
||||
rotY - self.preRot[1],
|
||||
@@ -97,11 +99,14 @@ class Interpolation(object):
|
||||
self.tempRot[2] -= tempRot[2]
|
||||
|
||||
def stop(self):
|
||||
self.client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "GameRenderTickEvent", self, self.onGameRenderTick)
|
||||
self.client.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(),
|
||||
"GameRenderTickEvent", self, self.onGameRenderTick)
|
||||
Interpolation.globalObj = None
|
||||
if not self.isReturn and not self.cancelReturn:
|
||||
# 启动回正
|
||||
endTime = math.sqrt(self.tempRot[0] * self.tempRot[0] + self.tempRot[1] * self.tempRot[1] + self.tempRot[2] * self.tempRot[2])
|
||||
endTime = math.sqrt(
|
||||
self.tempRot[0] * self.tempRot[0] + self.tempRot[1] * self.tempRot[1] + self.tempRot[2] * self.tempRot[
|
||||
2])
|
||||
endTime *= 0.3
|
||||
keyframes = [
|
||||
(0.0, [0, 0, 0]),
|
||||
@@ -109,6 +114,7 @@ class Interpolation(object):
|
||||
]
|
||||
setInterpolation(self.client, keyframes, 1, isReturn=True)
|
||||
|
||||
|
||||
def setInterpolation(client, keyframes, index, speed=10.0, isReturn=False):
|
||||
"""
|
||||
设置插值
|
||||
@@ -131,9 +137,10 @@ def setInterpolation(client, keyframes, index, speed=10.0, isReturn=False):
|
||||
Interpolation.globalObj.updateTime = time.time()
|
||||
Interpolation.globalObj.index = index
|
||||
|
||||
|
||||
def stopInterpolation():
|
||||
"""
|
||||
停止插值
|
||||
"""
|
||||
if Interpolation.globalObj:
|
||||
Interpolation.globalObj.stop()
|
||||
Interpolation.globalObj.stop()
|
||||
+3
-1
@@ -2,7 +2,9 @@
|
||||
|
||||
class PlayConfig(object):
|
||||
|
||||
def __init__(self, isFirstPerson = False, isAllowDrag = False, isAllowMove = False, isPosFollowXRot = True, isPosFollowYRot = True, isZRotForceReturn = True, isZRotStartOrigin = False, isDelayOneFrame = True, isLockPerspective = True, tickPosFunc = None, tickRotFunc = None, playAfterFunc = None):
|
||||
def __init__(self, isFirstPerson=False, isAllowDrag=False, isAllowMove=False, isPosFollowXRot=True,
|
||||
isPosFollowYRot=True, isZRotForceReturn=True, isZRotStartOrigin=False, isDelayOneFrame=True,
|
||||
isLockPerspective=True, tickPosFunc=None, tickRotFunc=None, playAfterFunc=None):
|
||||
"""
|
||||
play 方法的参数对象
|
||||
|
||||
|
||||
+2
-2
@@ -4,6 +4,6 @@ class NotClientSystemException(Exception):
|
||||
"""
|
||||
不是客户端系统异常
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, errorMessage):
|
||||
super(NotClientSystemException, self).__init__(errorMessage)
|
||||
super(NotClientSystemException, self).__init__(errorMessage)
|
||||
+2
-2
@@ -4,6 +4,6 @@ class NotPlayConfigException(Exception):
|
||||
"""
|
||||
不是播放配置对象异常
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, errorMessage):
|
||||
super(NotPlayConfigException, self).__init__(errorMessage)
|
||||
super(NotPlayConfigException, self).__init__(errorMessage)
|
||||
+2
-2
@@ -4,6 +4,6 @@ class SafeEvalException(Exception):
|
||||
"""
|
||||
安全计算异常
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, errorMessage):
|
||||
super(SafeEvalException, self).__init__(errorMessage)
|
||||
super(SafeEvalException, self).__init__(errorMessage)
|
||||
+14
-12
@@ -4,7 +4,7 @@ class SplineCurve:
|
||||
"""
|
||||
Catmull-Rom 样条曲线类
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, points):
|
||||
"""
|
||||
初始化样条曲线
|
||||
@@ -16,45 +16,46 @@ class SplineCurve:
|
||||
"""根据参数 t 获取曲线上的点"""
|
||||
if len(self.points) < 2:
|
||||
return 0
|
||||
|
||||
|
||||
# 处理边界情况
|
||||
if t <= 0:
|
||||
return self.points[0]
|
||||
if t >= 1:
|
||||
return self.points[-1]
|
||||
|
||||
|
||||
# 找到包含 t 的线段
|
||||
numSegments = len(self.points) - 1
|
||||
segmentIndex = int(t * numSegments)
|
||||
segmentIndex = max(0, min(segmentIndex, numSegments - 1))
|
||||
|
||||
|
||||
# 计算线段内的局部参数
|
||||
localT = t * numSegments - segmentIndex
|
||||
|
||||
|
||||
# 获取四个控制点用于 Catmull-Rom 插值
|
||||
p0Index = max(0, segmentIndex - 1)
|
||||
p1Index = segmentIndex
|
||||
p2Index = segmentIndex + 1
|
||||
p3Index = min(len(self.points) - 1, segmentIndex + 2)
|
||||
|
||||
|
||||
p0 = self.points[p0Index]
|
||||
p1 = self.points[p1Index]
|
||||
p2 = self.points[p2Index]
|
||||
p3 = self.points[p3Index]
|
||||
|
||||
|
||||
# Catmull-Rom 插值公式
|
||||
t2 = localT * localT
|
||||
t3 = t2 * localT
|
||||
|
||||
|
||||
# 计算插值点的 y 坐标
|
||||
y = 0.5 * (
|
||||
(2 * p1) +
|
||||
(-p0 + p2) * localT +
|
||||
(2 * p0 - 5 * p1 + 4 * p2 - p3) * t2 +
|
||||
(-p0 + 3 * p1 - 3 * p2 + p3) * t3
|
||||
(2 * p1) +
|
||||
(-p0 + p2) * localT +
|
||||
(2 * p0 - 5 * p1 + 4 * p2 - p3) * t2 +
|
||||
(-p0 + 3 * p1 - 3 * p2 + p3) * t3
|
||||
)
|
||||
return y
|
||||
|
||||
|
||||
def getCatmullromLerp(beforePlus, before, after, afterPlus, axis, alpha):
|
||||
"""
|
||||
Catmull-Rom 插值函数
|
||||
@@ -92,6 +93,7 @@ def getCatmullromLerp(beforePlus, before, after, afterPlus, axis, alpha):
|
||||
point = curve.getPoint(timeParam)
|
||||
return point
|
||||
|
||||
|
||||
def getCatmullromLerpFromKeyframe(keyframeArray, index, nowTime, axis):
|
||||
"""
|
||||
通过关键帧数组获取当前时间点的平滑插值
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from ..exception.SafeEvalException import SafeEvalException
|
||||
|
||||
|
||||
class SafeEval:
|
||||
def __init__(self):
|
||||
self.operators = {
|
||||
@@ -92,4 +93,4 @@ class SafeEval:
|
||||
|
||||
def raiseException(self, message):
|
||||
"""抛出异常"""
|
||||
SafeEvalException(message)
|
||||
SafeEvalException(message)
|
||||
@@ -1,13 +1,11 @@
|
||||
# coding=utf-8
|
||||
import mod.server.extraServerApi as serverApi
|
||||
import mod.client.extraClientApi as clientApi
|
||||
from mod.common.mod import Mod
|
||||
from ModConfig import *
|
||||
import logging
|
||||
|
||||
import mod.client.extraClientApi as clientApi
|
||||
import mod.server.extraServerApi as serverApi
|
||||
|
||||
if False:
|
||||
from typing import *
|
||||
from mod.client.ui.controls.baseUIControl import *
|
||||
pass
|
||||
IsDebug = 1
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user