public void destroy() { mLayoutPanel.destroy(); mLayoutPanel = null; mScript.destroy(); mScript = null; }
public void init(LAYOUT_TYPE type, string name, int renderOrder, bool isNGUI) { mName = name; mType = type; mIsNGUI = isNGUI; mScript = mLayoutManager.createScript(mName, this); if (mScript == null) { UnityUtility.logError("can not create layout script! type : " + mType); } // 初始化布局脚本 if (mIsNGUI) { mScript.newObject(out mLayoutPanel, mLayoutManager.getNGUIRoot(), mName); } else { mScript.newObject(out mLayoutCanvas, mLayoutManager.getUGUIRoot(), mName); } mScript.newObject(out mRoot, getLayoutPanel(), "Root"); setRenderOrder(renderOrder); mScript.setRoot(mRoot); mScript.findAllWindow(); mScript.assignWindow(); mScript.init(); mScriptInited = true; // 加载完布局后强制隐藏 setVisibleForce(false); }
public LayoutScript createScript(GameLayout layout) { LayoutScript script = createInstance <LayoutScript>(mScriptRegisteList[layout.getType()]); script.setLayout(layout); return(script); }
private void Init(string scriptSrc, byte[] data) { Data = new BinaryData(data); SymbolTable = SymbolTable.CreateRootSymbolTable(); Script = LayoutScript.Parse(scriptSrc); Interpreter = new LayoutInterpreter(Script, _outputWriter); }
public UGUISlider(LayoutScript script) : base("Slider") { mScript = script; mDirection = DRAG_DIRECTION.DD_HORIZONTAL; mMode = SLIDER_MODE.SM_FILL; }
protected float mScrollSpeed; // 当前滚动速度 public NGUIScroll(LayoutScript script) { mScript = script; mState = SCROLL_STATE.SS_NONE; mDragDirection = DRAG_DIRECTION.DD_HORIZONTAL; mContainerList = new List <IScrollContainer>(); mItemList = new List <IScrollItem>(); }
protected float mDragSensitive = 0.01f; // 拖动的灵敏度 public Scroll(LayoutScript script) { mScript = script; mLoop = false; mState = SCROLL_STATE.SS_NONE; mContainerList = new List <IScrollContainer>(); mItemList = new List <IScrollItem>(); }
// 延迟窗口的显示和隐藏 public static CommandWindowActive ACTIVE_WINDOW_DELAY(LayoutScript script, txUIObject obj, bool active, float dealyTime) { CommandWindowActive cmd = mCommandSystem.newCmd <CommandWindowActive>(false, true); cmd.mActive = active; mCommandSystem.pushDelayCommand(cmd, obj, dealyTime); script.addDelayCmd(cmd); return(cmd); }
protected static bool assign <T>(ref T thisScript, LayoutScript value, bool created) where T : LayoutScript { if (typeof(T) == value.GetType()) { thisScript = created ? value as T : null; return(true); } return(false); }
public static void SMOOTH_WINDOW_FILL_AMOUNT_DELAY(LayoutScript script, txUIObject obj, float delayTime, float start, float target, float time) { CommandWindowSmoothFillAmount cmd = mCommandSystem.newCmd <CommandWindowSmoothFillAmount>(false, true); cmd.mStartFillAmount = start; cmd.mTargetFillAmount = target; cmd.mFadeTime = time; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); }
public void init() { mUIRoot = LayoutScript.newUIObject <txUIObject>("UI Root", null, null, UnityUtility.getGameObject(null, "UI Root")); if (mUIRoot.mObject == null) { UnityUtility.logError("can not find ui root! please add it to scene!"); return; } }
// 延迟恒定速度旋转窗口 public static void ROTATE_SPEED_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 speed, Vector3 startAngle, Vector3 rotateAccelerationValue) { CommandWindowRotateSpeed cmd = mCommandSystem.newCmd <CommandWindowRotateSpeed>(false, true); cmd.mRotateSpeed = speed; cmd.mStartAngle = startAngle; cmd.mRotateAcceleration = rotateAccelerationValue; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); }
// 窗口延迟匀速旋转至指定窗口 public static void ROTATE_TARGET_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 start, Vector3 target, float time) { CommandWindowRotateToTarget cmd = mCommandSystem.newCmd <CommandWindowRotateToTarget>(false, true); cmd.mStartAngle = start; cmd.mTargetAngle = target; cmd.mRotateTime = time; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); }
// 延迟移动窗口 public static void MOVE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float dealyTime, Vector3 start, Vector3 target, float time) { CommandWindowMove cmd = mCommandSystem.newCmd <CommandWindowMove>(false, true); cmd.mStartPosition = start; cmd.mDestPosition = target; cmd.mMoveTime = time; mCommandSystem.pushDelayCommand(cmd, obj, dealyTime); script.addDelayCmd(cmd); }
public LayoutScript createLayoutScript() { LayoutScript script = mLayoutManager.createScript(mType, mName, this); if (script == null) { UnityUtility.logError("can not create layout script! type : " + mType); } return(script); }
//延迟窗口缩放 public static void SCALE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector2 start, Vector2 target, float time) { CommandWindowScale cmd = mCommandSystem.newCmd <CommandWindowScale>(false, true); cmd.mStartScale = start; cmd.mTargetScale = target; cmd.mScaleTime = time; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); }
//延迟窗口的透明度变化 public static void ALPHA_WINDOW_DELAY(LayoutScript script, txUIObject uiObjct, float dealyTime, float start, float target, float time) { CommandWindowAlpha cmd = mCommandSystem.newCmd <CommandWindowAlpha>(false, true); cmd.mStartAlpha = start; cmd.mTargetAlpha = target; cmd.mFadeTime = time; mCommandSystem.pushDelayCommand(cmd, uiObjct, dealyTime); script.addDelayCmd(cmd); }
public static CommandWindowActive ACTIVE_WINDOW_DELAY_EX(LayoutScript script, txUIObject obj, bool active, float dealyTime, CommandCallback startCallback, object userData = null) { CommandWindowActive cmd = mCommandSystem.newCmd <CommandWindowActive>(false, true); cmd.mActive = active; cmd.addStartCommandCallback(startCallback, userData); mCommandSystem.pushDelayCommand(cmd, obj, dealyTime); script.addDelayCmd(cmd); return(cmd); }
public static void PLAY_AUDIO_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, SOUND_DEFINE sound, bool loop, float volume) { CommandWindowPlayAudio cmd = mCommandSystem.newCmd <CommandWindowPlayAudio>(false, true); cmd.mSound = sound; cmd.mLoop = loop; cmd.mVolume = volume; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); }
public void init(LAYOUT_TYPE type, string name, int renderOrder, bool isNGUI, bool isScene) { mName = name; mType = type; mIsNGUI = isNGUI; mIsScene = isScene; mScript = mLayoutManager.createScript(mName, this); if (mScript == null) { logError("can not create layout script! type : " + mType); } // 初始化布局脚本 if (!mIsScene) { if (mIsNGUI) { mScript.newObject(out mLayoutPanel, mLayoutManager.getNGUIRoot(), mName); } else { mScript.newObject(out mLayoutCanvas, mLayoutManager.getUGUIRoot(), mName); } } else { if (mIsNGUI) { mScript.newObject(out mLayoutPanel, null, mName); } else { mScript.newObject(out mLayoutCanvas, null, mName); } } mScript.newObject(out mRoot, getLayoutPanel(), "Root"); setRenderOrder(renderOrder); mScript.setRoot(mRoot); mScript.assignWindow(); // 布局实例化完成,初始化之前,需要调用自适应组件的更新 ScaleAnchor scaleAnchor = getLayoutPanel().getObject().GetComponent <ScaleAnchor>(); PaddingAnchor customAnchor = getLayoutPanel().getObject().GetComponent <PaddingAnchor>(); if (scaleAnchor != null) { ScaleAnchor.forceUpdateChildren(getLayoutPanel().getObject()); } if (customAnchor != null) { PaddingAnchor.forceUpdateChildren(getLayoutPanel().getObject()); } mScript.init(); mScriptInited = true; // 加载完布局后强制隐藏 setVisibleForce(false); }
public static CommandWindowPlayAudio PLAY_AUDIO_DELAY(LayoutScript script, txUIObject obj, float delayTime, SOUND_DEFINE sound, bool loop, float volume) { CommandWindowPlayAudio cmd = newCmd(out cmd, false, true); cmd.mSound = sound; cmd.mLoop = loop; cmd.mVolume = volume; pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
// 延迟移动窗口, 并且可以设置移动时和移动完成的回调函数 public static void MOVE_WINDOW_DELAY_EX(LayoutScript script, txUIObject obj, float delayTime, Vector3 start, Vector3 target, float time, MoveCallback movingCallback, object movingUserData, MoveCallback moveDoneCallback, object moveDoneUserData) { CommandWindowMove cmd = mCommandSystem.newCmd <CommandWindowMove>(false, true); cmd.mStartPosition = start; cmd.mDestPosition = target; cmd.mMoveTime = time; cmd.setMovingCallback(movingCallback, movingUserData); cmd.setMoveDoneCallback(moveDoneCallback, moveDoneUserData); mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); }
public void destroy() { if (mScript != null) { mLayoutScriptCallback?.Invoke(mScript, false); mScript.destroy(); mScript = null; } txUIObject.destroyWindow(mRoot, true); mRoot = null; mResourceManager.unload(ref mPrefab); }
public static CommandWindowFill FILL_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, float start, float target, float time) { CommandWindowFill cmd = newCmd(out cmd, false, true); cmd.mStartValue = start; cmd.mTargetValue = target; cmd.mOnceLength = time; cmd.mTremblingName = CommonDefine.ZERO_ONE; pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
public static CommandWindowAlpha ALPHA_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, float alpha) { CommandWindowAlpha cmd = mCommandSystem.newCmd <CommandWindowAlpha>(false, true); cmd.mName = ""; cmd.mOnceLength = 0.0f; cmd.mStartAlpha = alpha; cmd.mTargetAlpha = alpha; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
protected bool mMouseDown; // 鼠标是否在窗口内按下,鼠标抬起或者离开窗口都会设置为false,鼠标按下时,跟随鼠标移动,鼠标放开时,按惯性移动 public UGUIScroll(LayoutScript script) { mScript = script; mState = SCROLL_STATE.NONE; mDragDirection = DRAG_DIRECTION.HORIZONTAL; mContainerList = new List <IScrollContainer>(); mItemList = new List <IScrollItem>(); mItemOnCenter = true; mFocusSpeedThreshhold = 2.0f; mDragSensitive = 1.0f; mAttenuateFactor = 2.0f; }
public static CommandWindowScale SCALE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector2 scale) { CommandWindowScale cmd = mCommandSystem.newCmd <CommandWindowScale>(false, true); cmd.mName = ""; cmd.mOnceLength = 0.0f; cmd.mStartScale = scale; cmd.mTargetScale = scale; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
public static CommandWindowRotate ROTATE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 rotation) { CommandWindowRotate cmd = mCommandSystem.newCmd <CommandWindowRotate>(false, true); cmd.mName = ""; cmd.mOnceLength = 0.0f; cmd.mStartRotation = rotation; cmd.mTargetRotation = rotation; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
public static CommandWindowMove MOVE_WINDOW_DELAY(LayoutScript script, txUIObject obj, float delayTime, Vector3 pos) { CommandWindowMove cmd = mCommandSystem.newCmd <CommandWindowMove>(false, true); cmd.mName = ""; cmd.mStartPos = pos; cmd.mTargetPos = pos; cmd.mOnceLength = 0.0f; mCommandSystem.pushDelayCommand(cmd, obj, delayTime); script.addDelayCmd(cmd); return(cmd); }
//延迟窗口的透明度变化,可以设置回调函数 public static CommandWindowAlpha ALPHA_WINDOW_DELAY_EX(LayoutScript script, txUIObject uiObjct, float dealyTime, float start, float target, float time, AlphaFadeCallback FadingCallback, object FadingData, AlphaFadeCallback FadeDoneCallBack, object FadeDoneData) { CommandWindowAlpha cmd = mCommandSystem.newCmd <CommandWindowAlpha>(false, true); cmd.mStartAlpha = start; cmd.mTargetAlpha = target; cmd.mFadeTime = time; cmd.setFadingCallback(FadingCallback, FadingData); cmd.setFadeDoneCallback(FadeDoneCallBack, FadeDoneData); mCommandSystem.pushDelayCommand(cmd, uiObjct, dealyTime); script.addDelayCmd(cmd); return(cmd); }