Skip to content

Commit

Permalink
同步Frame代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ZHOURUIH committed Oct 28, 2018
1 parent d8f80b9 commit 895acc5
Show file tree
Hide file tree
Showing 75 changed files with 432 additions and 331 deletions.
6 changes: 3 additions & 3 deletions Assets/Scripts/Frame/AttachedScript/WidgetUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using UnityEngine;

public class WidgetUtility
public class WidgetUtility : GameBase
{
protected static Vector2 mRootSize = new Vector2(CommonDefine.STANDARD_WIDTH, CommonDefine.STANDARD_HEIGHT);
protected static void getRootSize()
Expand All @@ -27,8 +27,8 @@ public static Vector3[] getParentSides(GameObject parent)
public static Vector2 getRectSize(UIRect rect)
{
Vector3[] sides = getRectLocalSide(rect);
float width = MathUtility.getLength(sides[0] - sides[2]);
float height = MathUtility.getLength(sides[1] - sides[3]);
float width = getLength(sides[0] - sides[2]);
float height = getLength(sides[1] - sides[3]);
return new Vector2(width, height);
}
public static Vector3[] getRectLocalSide(UIRect rect)
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Frame/Camera/GameCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void update(float elapsedTime)
if (mCurLinker == null && mKeyProcess)
{
float cameraSpeed = mMoveSpeed;
if (!MathUtility.isFloatZero(cameraSpeed))
if (!isFloatZero(cameraSpeed))
{
// 键盘移动摄像机
if (Input.GetKey(KeyCode.LeftShift))
Expand Down Expand Up @@ -96,14 +96,14 @@ public override void update(float elapsedTime)
if (mInputManager.getMouseKeepDown(MOUSE_BUTTON.MB_RIGHT) || mInputManager.getMouseCurrentDown(MOUSE_BUTTON.MB_RIGHT))
{
Vector2 moveDelta = mInputManager.getMouseDelta();
if (!MathUtility.isFloatZero(moveDelta.x) || !MathUtility.isFloatZero(moveDelta.y))
if (!isFloatZero(moveDelta.x) || !isFloatZero(moveDelta.y))
{
yawpitch(moveDelta.x * mMouseSpeed, -moveDelta.y * mMouseSpeed);
}
}
// 鼠标滚轮移动摄像机
float mouseWheelDelta = mInputManager.getMouseWheelDelta();
if (!MathUtility.isFloatZero(mouseWheelDelta))
if (!isFloatZero(mouseWheelDelta))
{
move(Vector3.forward * mouseWheelDelta / 120.0f * 10.0f);
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Frame/Character/CharacterBaseData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;

public class CharacterBaseData
public class CharacterBaseData : GameBase
{
public CharacterBaseData()
{
Expand Down
8 changes: 4 additions & 4 deletions Assets/Scripts/Frame/Character/MovableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public virtual void move(Vector3 moveDelta, Space space = Space.Self)
{
if (space == Space.Self)
{
moveDelta = MathUtility.rotateVector3(moveDelta, getQuaternionRotation());
moveDelta = rotateVector3(moveDelta, getQuaternionRotation());
}
setPosition(getPosition() + moveDelta);
}
Expand Down Expand Up @@ -244,8 +244,8 @@ public void setParent(GameObject parent, bool resetTrans = true)
public void copyObjectTransform(GameObject obj)
{
Transform objTrans = obj.transform;
ObjectTools.MOVE_OBJECT(this, objTrans.localPosition);
ObjectTools.ROTATE_OBJECT(this, objTrans.localEulerAngles);
ObjectTools.SCALE_OBJECT(this, objTrans.localScale);
OT.MOVE_OBJECT(this, objTrans.localPosition);
OT.ROTATE_OBJECT(this, objTrans.localEulerAngles);
OT.SCALE_OBJECT(this, objTrans.localScale);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public override void execute()
if (mTarget != null)
{
// 停止正在进行的摄像机运动
ObjectTools.MOVE_OBJECT(camera, camera.getPosition());
ObjectTools.ROTATE_OBJECT(camera, camera.getRotation());
OT.MOVE_OBJECT(camera, camera.getPosition());
OT.ROTATE_OBJECT(camera, camera.getRotation());
CameraLinker linker = camera.getComponent(mLinkerName) as CameraLinker;
if (linker != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void execute()
component.setActive(true);
if (mRandomOffset)
{
mOffset = MathUtility.randomFloat(0.0f, mOnceLength);
mOffset = randomFloat(0.0f, mOnceLength);
}
component.setTargetRotation(mTargetRotation);
component.setStartRotation(mStartRotation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void execute()
component.setActive(true);
if (mRandomOffset)
{
mOffset = MathUtility.randomFloat(0.0f, mOnceLength);
mOffset = randomFloat(0.0f, mOnceLength);
}
component.setTargetRotation(mTargetRotation);
component.setStartRotation(mStartRotation);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Frame/CommandSystem/CommandReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public virtual void receiveCommand(Command cmd)
}
public string getName() { return mName; }
// 谨慎使用设置名字
public void setName(string name) { mName = name; }
public virtual void setName(string name) { mName = name; }
public virtual void destroy()
{
// 通知命令系统有一个命令接受者已经被销毁了,需要取消命令缓冲区中的即将发给该接受者的命令
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void execute()
component.setActive(true);
if (mRandomOffset)
{
mOffset = MathUtility.randomFloat(0.0f, mOnceLength);
mOffset = randomFloat(0.0f, mOnceLength);
}
component.setTargetRotation(mTargetRotation);
component.setStartRotation(mStartRotation);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Frame/Common/Config/ApplicationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public ApplicationConfig(string name)
{ }
public override void writeConfig()
{
FileUtility.writeTxtFile(CommonDefine.F_CONFIG_PATH + "ApplicationSetting.txt", generateFloatFile());
writeTxtFile(CommonDefine.F_CONFIG_PATH + "ApplicationSetting.txt", generateFloatFile());
}
//---------------------------------------------------------------------------------------------------------------------------------
protected override void addFloat()
Expand Down
10 changes: 5 additions & 5 deletions Assets/Scripts/Frame/Common/Config/ConfigBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected string generateFloatFile()
fileString += "\r\n";
fileString += info.Value.mTypeString;
fileString += " = ";
fileString += StringUtility.floatToString(info.Value.mValue, 2);
fileString += floatToString(info.Value.mValue, 2);
fileString += nextLineStr;
}
// 移除最后的\r\n\r\n
Expand Down Expand Up @@ -209,8 +209,8 @@ protected string generateStringFile()
}
protected void readFile(string fileName, bool floatParam)
{
string text = FileUtility.openTxtFile(fileName);
string[] lineList = StringUtility.split(text, true, "\r\n");
string text = openTxtFile(fileName);
string[] lineList = split(text, true, "\r\n");
Dictionary<string, ConfigInfo> valueList = new Dictionary<string, ConfigInfo>();
string comment = "";
// 前4行需要被丢弃
Expand All @@ -233,7 +233,7 @@ protected void readFile(string fileName, bool floatParam)
}
else
{
string[] value = StringUtility.split(line, false, "=");
string[] value = split(line, false, "=");
if(value.Length != 2)
{
logError("配置文件错误 : line : " + line);
Expand All @@ -260,7 +260,7 @@ protected void readFile(string fileName, bool floatParam)
GAME_DEFINE_FLOAT def = floatNameToType(keys[i]);
if (def != GAME_DEFINE_FLOAT.GDF_NONE)
{
setFloatParam(def, StringUtility.stringToFloat(values[i].mValue), values[i].mComment);
setFloatParam(def, stringToFloat(values[i].mValue), values[i].mComment);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Frame/Common/Config/FrameConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public FrameConfig(string name)
{ }
public override void writeConfig()
{
FileUtility.writeTxtFile(CommonDefine.F_CONFIG_PATH + "FrameFloatConfig.txt", generateFloatFile());
writeTxtFile(CommonDefine.F_CONFIG_PATH + "FrameFloatConfig.txt", generateFloatFile());
}
//-----------------------------------------------------------------------------------------------------------------------
protected override void addFloat()
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/Frame/Common/FrameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

// 管理类初始化完成调用
// 这个父类的添加是方便代码的书写
public class FrameBase
// 继承StringUtility是为了在调用工具函数时方便,把四个完全独立的工具函数类串起来继承,所有继承自FrameBase的类都可以直接访问四大工具类中的函数
public class FrameBase : FileUtility
{
// FrameComponent
public static GameFramework mGameFramework = null;
Expand Down
23 changes: 12 additions & 11 deletions Assets/Scripts/Frame/Common/LayoutTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using System.Collections;
using System;

public class LayoutTools : GameBase
// LayoutTools
public class LT : GameBase
{
public static bool checkStaticPanel(txUIObject obj)
{
Expand Down Expand Up @@ -249,7 +250,7 @@ public static void ROTATE_KEYFRMAE_WINDOW_EX(txUIObject obj, string keyframe, Ve
{
return;
}
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void ROTATE_WINDOW(txUIObject obj, Vector3 rotation)");
}
Expand Down Expand Up @@ -297,7 +298,7 @@ public static CommandWindowRotate ROTATE_KEYFRMAE_WINDOW_DELAY(LayoutScript scri
{
return null;
}
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandWindowKeyFrameRotate ROTATE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 rotation)");
}
Expand Down Expand Up @@ -424,7 +425,7 @@ public static void MOVE_KEYFRAME_WINDOW_EX(txUIObject obj, string fileName, Vect
{
return;
}
if (fileName == "" || MathUtility.isFloatZero(onceLength))
if (fileName == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void MOVE_WINDOW(txUIObject obj, Vector3 pos)");
}
Expand Down Expand Up @@ -484,7 +485,7 @@ public static CommandWindowMove MOVE_KEYFRAME_WINDOW_DELAY_EX(LayoutScript scrip
{
return null;
}
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandWindowKeyFrameMove MOVE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 pos)");
}
Expand Down Expand Up @@ -606,7 +607,7 @@ public static void SCALE_KEYFRAME_WINDOW_EX(txUIObject obj, string fileName, Vec
{
return;
}
if (fileName == "" || MathUtility.isFloatZero(onceLength))
if (fileName == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void SCALE_WINDOW(txUIObject obj, Vector2 scale)");
}
Expand Down Expand Up @@ -670,7 +671,7 @@ public static CommandWindowScale SCALE_KEYFRAME_WINDOW_DELAY_EX(LayoutScript scr
{
return null;
}
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,CommandWindowScale SCALE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector2 scale)");
}
Expand Down Expand Up @@ -804,7 +805,7 @@ public static void ALPHA_KEYFRAME_WINDOW_EX(txUIObject obj, string name, float s
}
public static void ALPHA_KEYFRAME_WINDOW_EX(txUIObject obj, string name, float start, float target, float onceLength, bool loop, float offset, KeyFrameCallback tremblingCallback, KeyFrameCallback trembleDoneCallback)
{
if (name == "" || MathUtility.isFloatZero(onceLength))
if (name == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void ALPHA_WINDOW(txUIObject obj, float alpha)");
}
Expand Down Expand Up @@ -860,7 +861,7 @@ public static CommandWindowAlpha ALPHA_KEYFRAME_WINDOW_DELAY_EX(LayoutScript scr
}
public static CommandWindowAlpha ALPHA_KEYFRAME_WINDOW_DELAY_EX(LayoutScript script, txUIObject obj, float delayTime, string keyframe, float start, float target, float onceLength, bool loop, float offset, KeyFrameCallback tremblingCallback, KeyFrameCallback trembleDoneCallback)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandWindowAlphaTremble ALPHA_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, float alpha)");
}
Expand Down Expand Up @@ -898,7 +899,7 @@ public static void HSL_KEYFRAME_WINDOW(txUIObject obj, string keyframe, Vector3
}
public static void HSL_KEYFRAME_WINDOW(txUIObject obj, string keyframe, Vector3 start, Vector3 target, float onceLength, bool loop, float offset)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void HSL_WINDOW(txUIObject obj, Vector3 hsl)");
}
Expand Down Expand Up @@ -932,7 +933,7 @@ public static void LUM_KEYFRAME_WINDOW(txUIObject obj, string keyframe, float st
}
public static void LUM_KEYFRAME_WINDOW(txUIObject obj, string keyframe, float start, float target, float onceLength, bool loop, float offset)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void LUM_WINDOW(txUIObject obj, Vector3 hsl)");
}
Expand Down
23 changes: 12 additions & 11 deletions Assets/Scripts/Frame/Common/ObjectTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using System.Collections;
using System;

public class ObjectTools : GameBase
// ObjectTools
public class OT : GameBase
{
//--------------------------------------------------------------------------------------------------------------------------------------------
// 旋转
Expand Down Expand Up @@ -51,7 +52,7 @@ public static void ROTATE_OBJECT(MovableObject obj, string keyframe, Vector3 sta
}
public static void ROTATE_OBJECT_EX(MovableObject obj, string keyframe, Vector3 start, Vector3 target, float onceLength, bool loop, float offset, KeyFrameCallback rotatingCallback, KeyFrameCallback doneCallback)
{
if(keyframe == "" || MathUtility.isFloatZero(onceLength))
if(keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void ROTATE_OBJECT(txUIObject obj, Vector3 rotation)");
}
Expand Down Expand Up @@ -90,7 +91,7 @@ public static CommandMovableObjectRotate ROTATE_OBJECT_DELAY(MovableObject obj,
}
public static CommandMovableObjectRotate ROTATE_OBJECT_DELAY(MovableObject obj, float delayTime, string keyframe, Vector3 start, Vector3 target, float onceLength, bool loop, float offset)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandMovableObjectRotate ROTATE_OBJECT_DELAY(MovableObject obj, float delayTime, Vector3 rotation)");
}
Expand Down Expand Up @@ -187,7 +188,7 @@ public static void ROTATE_OBJECT_PHY(MovableObject obj, string keyframe, Vector3
}
public static void ROTATE_OBJECT_PHY_EX(MovableObject obj, string keyframe, Vector3 start, Vector3 target, float onceLength, bool loop, float offset, KeyFrameCallback rotatingCallback, KeyFrameCallback doneCallback)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void ROTATE_OBJECT_PHY(txUIObject obj, Vector3 rotation)");
}
Expand Down Expand Up @@ -226,7 +227,7 @@ public static CommandMovableObjectRotatePhysics ROTATE_OBJECT_PHY_DELAY(MovableO
}
public static CommandMovableObjectRotatePhysics ROTATE_OBJECT_PHY_DELAY(MovableObject obj, float delayTime, string keyframe, Vector3 start, Vector3 target, float onceLength, bool loop, float offset)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandMovableObjectRotatePhysics ROTATE_OBJECT_PHY_DELAY(MovableObject obj, float delayTime, Vector3 rotation)");
}
Expand Down Expand Up @@ -332,7 +333,7 @@ public static void MOVE_OBJECT_EX(MovableObject obj, string fileName, Vector3 st
}
public static void MOVE_OBJECT_EX(MovableObject obj, string fileName, Vector3 startPos, Vector3 targetPos, float onceLength, bool loop, float offset, KeyFrameCallback TremblingCallBack, KeyFrameCallback TrembleDoneCallBack)
{
if (fileName == "" || MathUtility.isFloatZero(onceLength))
if (fileName == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void MOVE_OBJECT(MovableObject obj, Vector3 pos)");
}
Expand Down Expand Up @@ -383,7 +384,7 @@ public static CommandMovableObjectMove MOVE_OBJECT_DELAY(MovableObject obj, floa
}
public static CommandMovableObjectMove MOVE_OBJECT_DELAY_EX(MovableObject obj, float delayTime, string keyframe, Vector3 startPos, Vector3 targetPos, float onceLength, bool loop, float offset, KeyFrameCallback movingCallback, KeyFrameCallback moveDoneCallback)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandMovableObjectMove MOVE_OBJECT_DELAY(MovableObject obj, float delayTime, Vector3 pos)");
}
Expand Down Expand Up @@ -452,7 +453,7 @@ public static void MOVE_OBJECT_PHY_EX(MovableObject obj, string fileName, Vector
}
public static void MOVE_OBJECT_PHY_EX(MovableObject obj, string fileName, Vector3 startPos, Vector3 targetPos, float onceLength, bool loop, float offset, KeyFrameCallback TremblingCallBack, KeyFrameCallback TrembleDoneCallBack)
{
if (fileName == "" || MathUtility.isFloatZero(onceLength))
if (fileName == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void MOVE_OBJECT_PHY(MovableObject obj, Vector3 pos)");
}
Expand Down Expand Up @@ -503,7 +504,7 @@ public static CommandMovableObjectMovePhysics MOVE_OBJECT_PHY_DELAY(MovableObjec
}
public static CommandMovableObjectMovePhysics MOVE_OBJECT_PHY_DELAY_EX(MovableObject obj, float delayTime, string keyframe, Vector3 startPos, Vector3 targetPos, float onceLength, bool loop, float offset, KeyFrameCallback movingCallback, KeyFrameCallback moveDoneCallback)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,CommandMovableObjectMovePhysics MOVE_OBJECT_PHY_DELAY(MovableObject obj, float delayTime, Vector3 pos)");
}
Expand Down Expand Up @@ -625,7 +626,7 @@ public static void SCALE_OBJECT_EX(MovableObject obj, string fileName, Vector2 s
}
public static void SCALE_OBJECT_EX(MovableObject obj, string fileName, Vector2 start, Vector2 target, float onceLength, bool loop, float offset, KeyFrameCallback scaleTremblingCallback, KeyFrameCallback scaleTrembleDoneCallback)
{
if (fileName == "" || MathUtility.isFloatZero(onceLength))
if (fileName == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用void SCALE_OBJECT(MovableObject obj, Vector2 scale)");
}
Expand Down Expand Up @@ -680,7 +681,7 @@ public static CommandMovableObjectScale SCALE_OBJECT_DELAY_EX(MovableObject obj,
}
public static CommandMovableObjectScale SCALE_OBJECT_DELAY_EX(MovableObject obj, float delayTime, string keyframe, Vector2 start, Vector2 target, float onceLength, bool loop, float offset, KeyFrameCallback scaleTremblingCallback, KeyFrameCallback scaleTrembleDoneCallback)
{
if (keyframe == "" || MathUtility.isFloatZero(onceLength))
if (keyframe == "" || isFloatZero(onceLength))
{
logError("时间或关键帧不能为空,如果要停止组件,请使用CommandMovableObjectScale SCALE_OBJECT_DELAY(MovableObject obj, float delayTime, Vector2 scale)");
}
Expand Down
Loading

0 comments on commit 895acc5

Please sign in to comment.