void Start() { tween = this.GetComponent<TweenRotation> (); Roll (); if (!rightRotation) rotationMultiplier = -1; }
public void Init(Bullet bullet){ State = bullet; TweenPost = ActionTarget.AddComponent<TweenPosition> (); TweenPost.duration = bullet.DurationTime; TweenPost.from = bullet.StartPoint; TweenPost.to = bullet.TargetPoint; EventDelegate.Add( TweenPost.onFinished, DeleteSelf); if(bullet.StartSize != Vector3.one){ TweenScal = ActionTarget.AddComponent<TweenScale> (); TweenScal.duration = bullet.DurationTime; TweenScal.from = bullet.StartSize; TweenScal.to = bullet.TargetSize; TweenScal.Play (true); } TweenRota = ActionTarget.AddComponent<TweenRotation>(); TweenRota.to = new Vector3(0.0f, 0.0f, 360.0f); TweenRota.duration = bullet.DurationTime; TweenRota.style = UITweener.Style.Once; EventDelegate.Add(TweenRota.onFinished, _RotationCount); TweenPost.Play (true); TweenRota.Play (true); //Invoke ("DeleteSelf", bullet.DurationTime + 1.0f); }
void Awake () { _transform = transform; _tween = GetComponent<TweenRotation>(); containerCount = 0; _transform.localRotation = Quaternion.identity; }
void Start() { whose = GameState.NO_TURN; chess1 = transform.FindChild("chess1").GetComponent<TweenScale>(); chess2 = transform.FindChild("chess2").GetComponent<TweenScale>(); chess1R = transform.FindChild("chess1").GetComponent<TweenRotation>(); chess2R = transform.FindChild("chess2").GetComponent<TweenRotation>(); }
void Start() { screenCenterX = Screen.width / 2; faceRot = faceMeTran.GetComponent<TweenRotation>(); carlRot = carlTran.GetComponent<TweenRotation>(); isTurning = false; faceRot.SetOnFinished(delegate() { isTurning = false; }); carl = carlTran.GetComponent<Carl>(); }
void Start(){ Tweenrota = spriteObj.AddComponent<TweenRotation>(); Tweenscal = spriteObj.AddComponent<TweenScale>(); Tweenrota.to = new Vector3(0.0f, 0.0f, 360.0f); Tweenrota.duration = 2.0f; Tweenrota.style = UITweener.Style.Once; EventDelegate.Add(Tweenrota.onFinished, _RotationCount); Tweenscal.from = new Vector3(0.1f, 0.1f, 1.0f); Tweenscal.to = new Vector3(1.0f, 1.0f, 1.0f); Tweenscal.duration = 2.0f; EventDelegate.Add( Tweenscal.onFinished, deleteself); }
/// <summary> /// 初始化ui 界面 /// </summary> public void InitUIPanel(LYXBattleManage mage, LYXHeroEntity entity) { _manage = mage; _heroEntity = entity; _isStartRefresh = true; // 血条 bloodSlider = LCSCompHelper.FindComponet<UISlider>(gameObject, "roleblood/blood/bloodslider"); //怒气 angSlider = LCSCompHelper.FindComponet<UISlider>(gameObject, "roleblood/anger/angerslider"); heroDieSpr = LCSCompHelper.FindComponet<UISprite>(gameObject, "die"); heroDieSpr.gameObject.SetActive(false); mTweenRota = TweenRotation.Begin(gameObject, 0.1f, Quaternion.identity); mTweenRota.enabled = false; isHasTween = false; }
public void Die() { died = true; GetComponent <Image>().raycastTarget = false; if ((harmless || !gameController.action) && !gameController.learning) { TweenAlpha twA = TweenAlpha.Begin(gameObject, 0.5f, 0.0f); twA.from = 0.5f; twA.SetOnFinished(() => { Destroy(gameObject); }); return; } float z = type == TargetType.Right ? -15 : 15; Blood.SetActive(true); Vector3 pos = Blood.transform.localPosition; pos.x = 15 * Mathf.Sign(z); Blood.transform.localPosition = pos; TweenRotation twR = TweenRotation.Begin(Body, 0.05f, Quaternion.Euler(0, 0, z)); twR.quaternionLerp = true; twR.method = UITweener.Method.EaseIn; twR.style = UITweener.Style.PingPong; twR.onLoop = () => { twR.style = UITweener.Style.Once; }; twR.SetOnFinished(() => { TweenAlpha twA = TweenAlpha.Begin(gameObject, 0.5f, 0.0f); //twA.from = 0.5f; twA.SetOnFinished(() => { Destroy(gameObject); }); }); }
void InitSkillCard_2() { NextSceneBtn.SetActive(false); for (int i = 0; i < cardContainer.transform.childCount; i++) { GameObject go = cardContainer.transform.GetChild(i).gameObject; TweenPosition tp = go.GetComponent <TweenPosition>(); TweenRotation tr = go.GetComponent <TweenRotation>(); if (go.name != currentGO.name) { tp.enabled = true; tp.from = go.transform.localPosition; tp.onFinished.Clear(); tp.delay = i * 0.3f; tp.duration = 0.8f; tp.from = go.transform.localPosition; tp.to = new Vector3(5.5f, 12.3f + i * 0.1f, 80); tp.ResetToBeginning(); tr.enabled = true; tr.delay = i * 0.2f; tr.duration = 0.8f; tr.onFinished.Clear(); tr.from = go.transform.rotation.eulerAngles; tr.to = new Vector3(80, 0, 1.1722f); tr.ResetToBeginning(); } if (go.name == currentGO.name) { if (i >= cardContainer.transform.childCount - 1) { tp = cardContainer.transform.GetChild(cardContainer.transform.childCount - 2).GetComponent <TweenPosition>(); tp.onFinished.Add(new EventDelegate(AlphaShowDes_Info)); } } if (i >= cardContainer.transform.childCount - 1) { tp.onFinished.Add(new EventDelegate(AlphaShowDes_Info)); } } }
public void ReceivedTransform(NetworkPlayerTransform ntransform) { if (!running) { return; } // When receiving, buffer the information // Receive latest state information //Vector3 pos = ntransform.position; //Quaternion rot = ntransform.rotation; // Shift buffer contents, oldest data erased, 18 becomes 19, ... , 0 becomes 1 for (int i = bufferedStates.Length - 1; i >= 1; i--) { bufferedStates[i] = bufferedStates[i - 1]; } // Save currect received state as 0 in the buffer, safe to overwrite after shifting bufferedStates[0] = ntransform; // Increment state count but never exceed buffer size statesCount = Mathf.Min(statesCount + 1, bufferedStates.Length); // Check integrity, lowest numbered state in the buffer is newest and so on for (int i = 0; i < statesCount - 1; i++) { if (bufferedStates[i].timeStamp < bufferedStates[i + 1].timeStamp) { print("Latest received transform is indeed the last sent transform."); } } if (bufferedStates[0] != null && bufferedStates[1] != null) { float timeToTween = (float)(bufferedStates[0].timeStamp - bufferedStates[1].timeStamp) * 0.001f; TweenPosition.Begin(myGameObject, timeToTween, bufferedStates[0].position); TweenRotation.Begin(myGameObject, timeToTween, bufferedStates[0].rotation); TweenRotation.Begin(movementTransform.gameObject, timeToTween, bufferedStates[0].rotationMovement); TweenRotation.Begin(boneTransform.gameObject, timeToTween, bufferedStates[0].rotationBone); } }
public bool StartTween() { if (!_positionData.IsActive && !_colorData.IsActive && !_scaleData.IsActive && !_rotationData.IsActive) { Debug.unityLogger.Log(LogType.Warning, "TweenFactory doesn't tween anything..."); return(false); } if (_positionData.IsActive) { Tween tween = new TweenPosition(_gameObject, (Vector3)_positionData.Value, _positionData.Speed, TweenMatcher.Matcher[_positionData.Type]); CompleteTween(tween, PositionTweenComplete); } if (_scaleData.IsActive) { Tween tween = new TweenScale(_gameObject, (Vector3)_scaleData.Value, _scaleData.Speed, TweenMatcher.Matcher[_scaleData.Type]); CompleteTween(tween, ScaleTweenComplete); } if (_rotationData.IsActive) { Tween tween = new TweenRotation(_gameObject, (Vector3)_rotationData.Value, _rotationData.Speed, TweenMatcher.Matcher[_rotationData.Type]); CompleteTween(tween, RotationTweenComplete); } if (_colorData.IsActive) { Tween tween = new TweenColor(_gameObject, (Color)_colorData.Value, _colorData.Speed, TweenMatcher.Matcher[_colorData.Type]); CompleteTween(tween, ColorTweenComplete); } return(true); }
public void Init(BallMoveData ballDt, float ballMoveSpeedBeiLv = 1f) { IsInitMoveBall = true; m_BallMoveData = ballDt; m_BallAni = ballDt.m_SSBallAni; m_BallMoveSpeedBeiLv = ballMoveSpeedBeiLv; if (m_Rigidbody != null) { m_Rigidbody.useGravity = false; } if (ballDt.m_RealBallTr != null) { ballDt.m_RealBallTr.localEulerAngles = new Vector3(0f, UnityEngine.Random.Range(0f, 360f), 0f); } m_BallTweenRot = m_BallAni.m_BallData.m_BallSpawnTr.gameObject.GetComponent <TweenRotation>(); SSGameDataCtrl.GetInstance().m_SSUIRoot.OnCreatExitGameUIEvent += OnCreatExitGameUIEvent; SSGameDataCtrl.GetInstance().m_SSUIRoot.OnRemoveExitGameUIEvent += OnRemoveExitGameUIEvent; }
private static int get_cachedTransform(IntPtr L) { object luaObject = LuaScriptMgr.GetLuaObject(L, 1); TweenRotation tweenRotation = (TweenRotation)luaObject; if (tweenRotation == null) { LuaTypes luaTypes = LuaDLL.lua_type(L, 1); if (luaTypes == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name cachedTransform"); } else { LuaDLL.luaL_error(L, "attempt to index cachedTransform on a nil value"); } } LuaScriptMgr.Push(L, tweenRotation.cachedTransform); return(1); }
void OnShieldTreeHover(GameObject go, bool hover) { if (!treeAnimating && !shieldClicked) { if (hover) { Quaternion newRot = shieldTree.transform.localRotation; newRot.eulerAngles = new Vector3(0, 10, 0); TweenRotation.Begin(shieldTree, hoverTreeDuration, newRot); TweenAlpha.Begin(go, hoverTreeDuration, 175 / 255f); } else { Quaternion newRot = shieldTree.transform.localRotation; newRot.eulerAngles = new Vector3(0, 15, 0); TweenRotation.Begin(shieldTree, hoverTreeDuration, newRot); TweenAlpha.Begin(go, hoverTreeDuration, 100 / 255f); } } }
/// <summary> /// 状态发生改变 /// </summary> /// <param name="oldState"></param> /// <param name="newState"></param> protected virtual void ChangeState(CardState oldState, CardState newState) { if (gameObject == null) { return; } switch (state) { case CardState.Behind: TweenRotation.Begin(gameObject, 0.5f, transform.localRotation * Quaternion.Euler(0f, 0f, 180f)); break; case CardState.Front: TweenRotation.Begin(gameObject, 0.5f, transform.localRotation * Quaternion.Euler(0f, 0f, 180f)); break; default: break; } }
void OnWeaponTreeHover(GameObject go, bool hover) { if (!treeAnimating && !weaponClicked) { if (hover) { Quaternion newRot = weaponTree.transform.localRotation; newRot.eulerAngles = new Vector3(350, 0, 0); TweenRotation.Begin(weaponTree, hoverTreeDuration, newRot); TweenAlpha.Begin(go, hoverTreeDuration, 175 / 255f); } else { Quaternion newRot = weaponTree.transform.localRotation; newRot.eulerAngles = new Vector3(345, 0, 0); TweenRotation.Begin(weaponTree, hoverTreeDuration, newRot); TweenAlpha.Begin(go, hoverTreeDuration, 100 / 255f); } } }
public void Exit() { if (!this.isEnter) { return; } this.isEnter = false; this.tp.PlayReverse(); this.tp.SetOnFinished(delegate { TweenRotation[] array = this.tweenRots; for (int i = 0; i < array.Length; i++) { TweenRotation tweenRotation = array[i]; tweenRotation.set_enabled(false); } SingletonMonoBehaviour <UIShortCutMenu> .Instance.isCloseAnimNow = false; SingletonMonoBehaviour <UIShortCutMenu> .Instance.SetActiveChildren(false); }); }
private static int set_value(IntPtr L) { object luaObject = LuaScriptMgr.GetLuaObject(L, 1); TweenRotation tweenRotation = (TweenRotation)luaObject; if (tweenRotation == null) { LuaTypes luaTypes = LuaDLL.lua_type(L, 1); if (luaTypes == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name value"); } else { LuaDLL.luaL_error(L, "attempt to index value on a nil value"); } } tweenRotation.value = LuaScriptMgr.GetQuaternion(L, 3); return(0); }
static int _m_SetEndToCurrentValue(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TweenRotation __cl_gen_to_be_invoked = (TweenRotation)translator.FastGetCSObj(L, 1); try { { __cl_gen_to_be_invoked.SetEndToCurrentValue( ); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
protected override void OnShow() { GameObject prefab = ResourcesManager.Instance.LoadDiceCard(modelName); GameObject go = GameObject.Instantiate(prefab); go.transform.localPosition = new Vector3(-15, 0, 0); go.transform.SetParent(cardWidget, false); go.name = prefab.name; TweenPosition tp = go.AddComponent <TweenPosition>(); if (cardWidget.childCount == 1) { tp.duration = 1.5f; tp.delay = 0.2f; tp.from = new Vector3(-15, 0, 0); tp.to = new Vector3(16.5f, 6, 30); } else if (cardWidget.childCount == 2) { tp.duration = 1.5f; tp.delay = 0.2f; tp.from = new Vector3(-15, 0, 0); tp.to = new Vector3(15.0f, 6, 30); } else { Debug.LogError("cardChildCount has error" + " __" + cardWidget.childCount); return; } tp.onFinished.Clear(); tp.onFinished.Add(new EventDelegate(OnDiceTPFished)); TweenRotation tr = go.AddComponent <TweenRotation>(); tr.ignoreTimeScale = false; tr.from = new Vector3(90, 0, 0); tr.to = new Vector3(0, 180, 0); tr.delay = 0.2f; tr.duration = 1.5f; }
public void Init() { m_myTrans = transform; m_tweenAlpha = m_myTrans.GetComponent <TweenAlpha>(); m_tweenAlpha.onFinished = TweenAlphaFinished; m_tweenPosition = m_myTrans.GetComponent <TweenPosition>(); m_tweenPosition.onFinished = TweenPositionFinished; m_jinzhanatk = m_myTrans.Find("jinzhanatk").gameObject; m_stjinzhanatk = m_myTrans.Find("stjinzhanatk").gameObject; m_yuanchengatk = m_myTrans.Find("yuanchengatk").gameObject; m_styuanchengatk = m_myTrans.Find("styuanchengatk").gameObject; m_toweratk = m_myTrans.Find("toweratk").gameObject; m_gongchengatk = m_myTrans.Find("gongchengatk").gameObject; m_anshaatk = m_myTrans.Find("anshaatk").gameObject; m_hit = m_myTrans.Find("hit").gameObject; m_hitScale = m_hit.GetComponent <TweenScale>(); m_hitAlpha = m_hit.GetComponent <TweenAlpha>(); m_hitRot = m_hit.GetComponent <TweenRotation>(); }
public void RotateGlobeToThis() { //cancel auto rotation dataLink.theFeed.MinimizeAllButOne(dataLink.gameObject); dataLink.theFeed.StopRotation(); //globe's Y roation Transform targetTransform = dataLink.theFeed.pointOrigin.transform; //current rot float yRot = targetTransform.localRotation.eulerAngles.y; //change the tween TweenRotation tween = targetTransform.GetComponent <TweenRotation>(); tween.from = new Vector3(0, yRot, 0); tween.to = new Vector3(0, modulo(-dataLink.longatude, 360), 0); tween.ResetToBeginning(); tween.PlayForward(); }
public void MenuExit() { this.swipeEvent.set_enabled(false); for (int i = 0; i < this.menuButton.Length; i++) { TweenRotation component = this.menuButton[i].GetComponent <TweenRotation>(); component.from = default(Vector3); this.menuButton[i].get_transform().set_eulerAngles(component.from); if (i <= 3) { component.to = new Vector3(0f, 0f, (float)(i * -25)); } if (i >= 4) { component.to = new Vector3(0f, 0f, (float)(75 + -25 * (i - 4))); } component.delay = 0f; component.duration = 0.3f; } base.get_gameObject().GetComponent <UIPlayTween>().Play(false); }
public void MenuExit() { swipeEvent.enabled = false; for (int i = 0; i < menuButton.Length; i++) { TweenRotation component = menuButton[i].GetComponent <TweenRotation>(); component.from = default(Vector3); menuButton[i].transform.eulerAngles = component.from; if (i <= 3) { component.to = new Vector3(0f, 0f, i * -25); } if (i >= 4) { component.to = new Vector3(0f, 0f, 75 + -25 * (i - 4)); } component.delay = 0f; component.duration = 0.3f; } base.gameObject.GetComponent <UIPlayTween>().Play(forward: false); }
public override void OnInspectorGUI() { GUILayout.Space(6f); EditorTools.SetLabelWidth(120f); TweenRotation tw = target as TweenRotation; GUI.changed = false; Vector3 from = EditorGUILayout.Vector3Field("From", tw.From); Vector3 to = EditorGUILayout.Vector3Field("To", tw.To); if (GUI.changed) { EditorTools.RegisterUndo("Tween Change", tw); tw.From = from; tw.To = to; } DrawCommonProperties(); }
public static TweenRotation Begin(GameObject go, float duration, Quaternion rot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) TweenRotation tweenRotation = UITweener.Begin <TweenRotation>(go, duration, true); TweenRotation tweenRotation2 = tweenRotation; Quaternion value = tweenRotation.value; tweenRotation2.from = value.get_eulerAngles(); tweenRotation.to = rot.get_eulerAngles(); if (duration <= 0f) { tweenRotation.Sample(1f, true); tweenRotation.set_enabled(false); } return(tweenRotation); }
void NowRoationFinsh() { mNextObj.SetActive(true); EventDelegate.Remove(NowRotaion.onFinished, NowRoationFinsh); NextRotaion = mNextObj.GetComponent <TweenRotation>(); if (NextRotaion != null) { GameObject.Destroy(NextRotaion); NextRotaion = null; } mNowObj.SetActive(false); NextRotaion = mNextObj.AddComponent <TweenRotation>(); NextRotaion.from = new Vector3(0, 90, 0); NextRotaion.to = Vector3.zero; NextRotaion.duration = Duration / 2; NextRotaion.ResetToBeginning(); NextRotaion.PlayForward(); EventDelegate.Add(NextRotaion.onFinished, NextRoationFinsh); }
/// <summary> /// 设置主界面当前选中的选项 /// </summary> /// <param name="index"></param> private void SetSelectIndex(int index, int appearDir) { _selectIndex = index; SelCharacterData data = _charDatas[_selectIndex]; _charCGImg.sprite = ResourceManager.GetInstance().GetSprite("SelCharView", data.spName); _charDesImg.sprite = ResourceManager.GetInstance().GetSprite("SelCharView", data.desSp); if (appearDir == Consts.DIR_NULL) { _viewState = eViewState.Wait; _stateTime = 0; } else { TweenRotation tween0 = TweenManager.GetInstance().Create <TweenRotation>(); tween0.SetParas(_charDesTf.gameObject, 0, 30, ePlayMode.Once); TweenAnchoredPos tween1 = TweenManager.GetInstance().Create <TweenAnchoredPos>(); tween1.SetParas(_charCGTf.gameObject, 0, 30, ePlayMode.Once); if (appearDir == Consts.DIR_LEFT) { _charDesTf.localEulerAngles = new Vector3(0, 270, 0); tween0.SetParas(new Vector3(0, 360, 0), InterpolationMode.Linear); _charCGTf.anchoredPosition = CGLeftAppearPos; } else { _charDesTf.localEulerAngles = new Vector3(0, 90, 0); tween0.SetParas(Vector3.zero, InterpolationMode.Linear); _charCGTf.anchoredPosition = CGRightAppearPos; } tween1.SetParas(CGDefaultPos, InterpolationMode.EaseInQuad); tween1.SetFinishCallBack(SelCharTweenCallback); TweenManager.GetInstance().AddTween(tween0); TweenManager.GetInstance().AddTween(tween1); _viewState = eViewState.ChangeCharAni; } }
void OnFinshedMove() { Debug.LogError("you have it already"); for (int i = 0; i < ChooseBtnContainer.childCount; i++) { GameObject go = ChooseBtnContainer.GetChild(i).gameObject; TweenRotation tr = go.GetComponent <TweenRotation>(); tr.enabled = true; tr.duration = 0.3f; tr.delay = i * 0.3f; tr.onFinished.Clear(); tr.from = go.transform.localRotation.eulerAngles; tr.to = new Vector3(0, 0, 0); tr.ResetToBeginning(); if (i >= ChooseBtnContainer.childCount - 1) { //Debug.LogError(ChooseBtnContainer.GetChild(ChooseBtnContainer.childCount - 1).transform.localRotation); //isFinishedDown = true; tr.onFinished.Add(new EventDelegate(AddComponentToCard)); } } }
static void OnUpArrowBtnClick() { TweenPosition arrow_Tp = arrow.GetComponent <TweenPosition>(); TweenRotation arrow_RT = arrow.GetComponent <TweenRotation>(); TweenPosition cardWidget_Tp = cardWidget.GetComponent <TweenPosition>(); arrow_Tp.enabled = true; cardWidget_Tp.enabled = true; arrow_RT.enabled = true; if (arrowState == ArrowState.moveToUp) { arrow_Tp.from = arrow_Tp.transform.localPosition; arrow_Tp.to = new Vector3(0, -183.9f, 0); arrowState = ArrowState.moveToDown; cardWidget_Tp.from = cardWidget_Tp.transform.localPosition; cardWidget_Tp.to = new Vector3(0, 3.5f, -5); arrow_RT.from = arrow_RT.transform.rotation.eulerAngles; arrow_RT.to = new Vector3(0, 0, 180); } else if (arrowState == ArrowState.moveToDown) { arrow_Tp.from = arrow_Tp.transform.localPosition; arrow_Tp.to = new Vector3(0, -518.94f, 0); arrowState = ArrowState.moveToUp; cardWidget_Tp.from = cardWidget_Tp.transform.localPosition; cardWidget_Tp.to = new Vector3(0, -1, -5); arrow_RT.from = arrow_RT.transform.rotation.eulerAngles; arrow_RT.to = new Vector3(0, 0, 0); } arrow_Tp.ResetToBeginning(); cardWidget_Tp.ResetToBeginning(); arrow_RT.ResetToBeginning(); }
static int get_to(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); TweenRotation obj = (TweenRotation)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name to"); } else { LuaDLL.luaL_error(L, "attempt to index to on a nil value"); } } LuaScriptMgr.Push(L, obj.to); return(1); }
private void checkCollison(float positionThreshold, float angleThreshold) { float distance = Vector3.Distance(m_transform.localPosition, targetPosition); if (distance <= positionThreshold) { print("position ok"); } if (distance <= positionThreshold && Vector3.Angle(m_transform.right, targetRight) < angleThreshold && Vector3.Angle(m_transform.up, targetUp) < angleThreshold && Vector3.Angle(m_transform.forward, targetForward) < angleThreshold )//判断为达到正确位置 { TouchableObject tobj = GetComponent <TouchableObject>(); tobj.SetDraggable(false); tobj.SetRotatable(false); TweenRotation tween = TweenRotation.Begin(gameObject, 0.5f, targetRotation); tween.method = UITweener.Method.EaseInOut; UITweener tweener = TweenPosition.Begin(gameObject, 0.5f, targetPosition); tweener.method = UITweener.Method.EaseInOut; //TweenRotation tween = GetComponent<TweenRotation>(); tween.from = m_transform.localEulerAngles; tween.to = targetAngles; float y = tween.from.y; if (Mathf.Abs(360 - tween.from.y) < Mathf.Abs(tween.from.y - 0)) { //tween.from = new Vector3(tween.from.x, tween.from.y - 360, tween.from.z); tween.to = new Vector3(tween.to.x, tween.to.y + 360, tween.to.z); } Debug.Log("from:" + tween.from + "to:" + tween.to); //tween.PlayForward(); //BlockManager.Instance.AddScore(); tween.SetOnFinished(BlockManager.Instance.AddScore); isFinished = true;//标志该结构已经归位 //targetRotation. } }
void showFocus(GameObject mj) { Transform tm = focus.transform; TweenPosition tp = tm.GetComponent <TweenPosition>(); tp.enabled = false; tm.SetParent(mj.transform); //tm.localScale = new Vector3 (0.6f, 0.6f, 0.6f); //tm.localPosition = new Vector3 (0, 0.25f, 0.25f); tm.localRotation = Quaternion.Euler(0, 0, 0); focus.SetActive(true); tp.enabled = false; tp.from = tm.localPosition; tp.to = new Vector3(0, 0.25f, 0.25f); tp.style = UITweener.Style.Once; tp.duration = 0.3f; tp.AddOnFinished(new EventDelegate(() => { tp.onFinished.Clear(); tm.localPosition = new Vector3(0, 0.25f, 0.25f); tp.style = UITweener.Style.PingPong; tp.from = tm.localPosition; tp.to = tm.localPosition + new Vector3(0, 0, 0.2f); tp.duration = 1.0f; tp.Play(); TweenRotation tr = tm.GetComponent <TweenRotation>(); tr.from = tm.localEulerAngles; tr.to = tm.localEulerAngles + new Vector3(0, 0, 360); tr.Play(); })); tp.Play(); }
//-------------- Auto rotate ---------------------- public void StartRotation() { //enable auto focus autoFucus = true; //get the Y rotator tween TweenRotation tween = pointOrigin.transform.GetComponent <TweenRotation>(); //set start and end tween.from = new Vector3(0, 0, 0); tween.to = new Vector3(0, 360, 0); //set to loop and linear tween.style = UITweener.Style.Loop; tween.animationCurve = AnimationCurve.Linear(0, 0, 1, 1); //set speed tween.duration = 24f; //play tween tween.PlayForward(); }
/// <summary> /// 旋转效果 /// </summary> public void TweenRotationEffect(GameObject go, float duration, Vector3 from_rot, Vector3 to_rot, float delaytime = 0.0f, UITweener.Style style = UITweener.Style.Once) { if (go == null) { return; } TweenRotation tr = go.GetComponent <TweenRotation>(); if (tr == null) { tr = go.AddComponent <TweenRotation>(); } tr.from = from_rot; tr.to = to_rot; tr.duration = duration; tr.delay = delaytime; tr.style = style; tr.PlayForward(); }
void GetTweenComponent() { if (MyTweenAlpha == null) { MyTweenAlpha = gameObject.GetComponent <TweenAlpha>(); if (MyTweenAlpha == null) { MyTweenAlpha = gameObject.AddComponent <TweenAlpha>(); } } if (MyTweenPosition == null) { MyTweenPosition = gameObject.GetComponent <TweenPosition>(); if (MyTweenPosition == null) { MyTweenPosition = gameObject.AddComponent <TweenPosition>(); } MyTweenPosition.to = MyTweenPosition.from = transform.localPosition; } if (MyTweenRotation == null) { MyTweenRotation = gameObject.GetComponent <TweenRotation>(); if (MyTweenRotation == null) { MyTweenRotation = gameObject.AddComponent <TweenRotation>(); } MyTweenRotation.to = MyTweenRotation.from = transform.localRotation.eulerAngles; } if (MyTweenScale == null) { MyTweenScale = gameObject.GetComponent <TweenScale>(); if (MyTweenScale == null) { MyTweenScale = gameObject.AddComponent <TweenScale>(); } MyTweenScale.to = MyTweenScale.from = transform.localScale; } }
public override void OnInspectorGUI() { GUILayout.Space(6f); EditorGUIUtility.labelWidth = 120f; TweenRotation tw = target as TweenRotation; GUI.changed = false; Vector3 from = EditorGUILayout.Vector3Field("From", tw.from); Vector3 to = EditorGUILayout.Vector3Field("To", tw.to); if (GUI.changed) { RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; EditorUtility.SetDirty(tw); } DrawCommonProperties(); }
void OnEnable() { Tween = target as TweenRotation; }
public GUICostumePartyMusicPopUp.SongBtn Init(int index, GUICostumePartyMusicPopUp.SongBtn.ChangeCallBack cb) { this.index = index; this.ChangeEvent = cb; this.mPlay = GameUITools.FindUISprite("Play", base.gameObject); this.mPause = GameUITools.FindUISprite("Pause", base.gameObject); this.mTR = GameUITools.RegisterClickEvent("BG", new UIEventListener.VoidDelegate(this.OnBGClick), base.gameObject).GetComponent<TweenRotation>(); this.mPlay.enabled = true; this.mPause.enabled = false; this.mTR.enabled = false; return this; }
private void InitRollWindow() { this.treasureBox = GameUITools.FindGameObject("Treasure-Box", base.gameObject); this.mTreasure1 = GameUITools.FindUISprite("Treasure-Box/Treasure1", base.gameObject); this.mTreasure2 = GameUITools.FindUISprite("Treasure-Box/Treasure2", base.gameObject); this.tp1 = this.mTreasure1.GetComponent<TweenPosition>(); this.tp2 = this.mTreasure2.GetComponent<TweenPosition>(); this.ts1 = this.mTreasure1.GetComponent<TweenScale>(); this.tr2 = this.mTreasure2.GetComponent<TweenRotation>(); this.ta1 = this.mTreasure1.GetComponent<TweenAlpha>(); this.ta2 = this.mTreasure2.GetComponent<TweenAlpha>(); this.AgainGold = GameUITools.FindUISprite("Cost/Gold", this.AgainBtn.gameObject); this.AgainMoney = GameUITools.FindUILabel("Cost/Money", this.AgainBtn.gameObject); this.AgainLabel = GameUITools.FindUILabel("Label", this.AgainBtn.gameObject); this.line = GameUITools.FindUISprite("Line", this.window); this.Refresh(); }
private void CreateObjects() { if (Globals.Instance.Player.ActivitySystem.IsOpenFestival) { GameUITools.FindGameObject("BG/BG", base.gameObject).GetComponent<UITexture>().mainTexture = Res.Load<Texture>("MainBg/HallowmasCup", false); } else { GameUITools.FindGameObject("BG/BG", base.gameObject).GetComponent<UITexture>().mainTexture = Res.Load<Texture>("MainBg/awakeBigBg", false); } float num = 90f; for (int i = 0; i < 4; i++) { this.mSplitAngles[i] = (int)((float)(i - 1) * num); if (this.mSplitAngles[i] < 0) { this.mSplitAngles[i] += 360; } } this.mSplitAngles[this.mSplitAngles.Length - 1] = 360; this.mWindow = GameUITools.FindGameObject("Window", base.gameObject); this.mWindow.gameObject.SetActive(false); GameObject gameObject = GameUITools.FindGameObject("Pos", this.mWindow); for (int j = 0; j < gameObject.transform.childCount; j++) { this.mPosItems[j] = gameObject.transform.GetChild(j).gameObject.AddComponent<MagicLoveTouchPos>(); this.mPosItems[j].Init(this, j - 1); } this.mBase = GameUITools.FindGameObject("BG/Base", base.gameObject); this.mBase.gameObject.SetActive(false); Tools.SetParticleRQWithUIScale(GameUITools.FindGameObject("ui98", this.mBase.gameObject), 3002); GameUITools.RegisterClickEvent("RulesBtn", new UIEventListener.VoidDelegate(this.OnRulesBtnClick), this.mWindow); GameUITools.RegisterClickEvent("LeftBtn", new UIEventListener.VoidDelegate(this.OnLeftBtnClick), this.mWindow); GameUITools.RegisterClickEvent("RightBtn", new UIEventListener.VoidDelegate(this.OnRightBtnClick), this.mWindow); gameObject = GameUITools.FindGameObject("ProgressBar", this.mWindow); this.mProgressBar = GameUITools.FindUISprite("Bar", gameObject); Vector3 localPosition; for (int k = 0; k < MagicLoveTable.LoveValueList.Count; k++) { GameObject gameObject2 = GameUITools.FindGameObject(k.ToString(), this.mProgressBar.gameObject); if (gameObject2 != null) { GameUITools.FindUILabel("Value", gameObject2).text = MagicLoveTable.LoveValueList[k].ToString(); localPosition = gameObject2.transform.localPosition; localPosition.y = -(float)MagicLoveTable.LoveValueList[k] / (float)MagicLoveTable.MaxLoveValue * (float)this.mProgressBar.height; gameObject2.transform.localPosition = localPosition; gameObject2.SetActive(true); } } this.mBarName = GameUITools.FindUILabel("Name", gameObject); this.mBarValue = GameUITools.FindUILabel("Value", gameObject); this.mState = GameUITools.FindUILabel("State", gameObject); this.mReward = GameUITools.RegisterClickEvent("Reward", new UIEventListener.VoidDelegate(this.OnRewardClick), gameObject).GetComponent<UISprite>(); this.mUI100 = GameUITools.FindGameObject("ui100", this.mProgressBar.gameObject); Tools.SetParticleRenderQueue2(this.mUI100, 3050); this.mUI100.SetActive(false); this.mUI100_1 = GameUITools.FindGameObject("ui100_1", this.mProgressBar.gameObject); Tools.SetParticleRenderQueue2(this.mUI100_1, 3050); this.mUI100_1.SetActive(false); this.mUI30 = GameUITools.FindGameObject("ui30", this.mReward.gameObject); Tools.SetParticleRenderQueue2(this.mUI30, 3050); this.mUI30.SetActive(false); this.mRewardValue = GameUITools.FindUILabel("Value", this.mReward.gameObject); this.mFinish = GameUITools.FindUISprite("Finish", gameObject); this.mUI21 = GameUITools.FindGameObject("ui21", this.mFinish.gameObject); Tools.SetParticleRenderQueue2(this.mUI21, 3050); this.mUI21.SetActive(false); gameObject = GameUITools.FindGameObject("Bottom", this.mWindow); this.mStartBtn = GameUITools.RegisterClickEvent("Start", new UIEventListener.VoidDelegate(this.OnStartBtnClick), gameObject).GetComponent<UIButton>(); this.mAddTimes = GameUITools.FindUILabel("Times", GameUITools.RegisterClickEvent("Add", new UIEventListener.VoidDelegate(this.OnAddBtnClick), gameObject)); this.mRefreshCost = GameUITools.FindUILabel("Cost", GameUITools.RegisterClickEvent("Refresh", new UIEventListener.VoidDelegate(this.OnRefreshBtnClick), gameObject)); this.mRefreshCost.text = GameConst.GetInt32(248).ToString(); this.mContent = GameUITools.FindGameObject("Content", base.gameObject).transform; this.mContentTweenR = this.mContent.GetComponent<TweenRotation>(); EventDelegate.Add(this.mContentTweenR.onFinished, new EventDelegate.Callback(this.OnTweenEnd)); for (int l = 0; l < this.mContent.childCount; l++) { this.mPetItems[l] = this.mContent.GetChild(l).gameObject.AddComponent<MagicLovePetItem>(); this.mPetItems[l].Init(this, l); } this.Radius *= ParticleScaler.GetsRootScaleFactor(); localPosition = this.mPetItems[0].transform.localPosition; localPosition.x = -this.Radius; this.mPetItems[0].transform.localPosition = localPosition; localPosition = this.mPetItems[1].transform.localPosition; localPosition.z = -this.Radius; this.mPetItems[1].transform.localPosition = localPosition; localPosition = this.mPetItems[2].transform.localPosition; localPosition.x = this.Radius; this.mPetItems[2].transform.localPosition = localPosition; localPosition = this.mPetItems[3].transform.localPosition; localPosition.z = this.Radius; this.mPetItems[3].transform.localPosition = localPosition; this.camera3d = GameUITools.FindGameObject("Camera", base.gameObject); gameObject = GameUITools.FindGameObject("PlayLayer", base.gameObject); gameObject.SetActive(true); this.mStartLayer = GameUITools.FindGameObject("Start", gameObject).AddComponent<MagicLoveStartLayer>(); this.mStartLayer.Init(this); this.mStartLayer.gameObject.SetActive(false); this.mEndLayer = GameUITools.FindGameObject("End", gameObject).AddComponent<MagicLoveEndLayer>(); this.mEndLayer.Init(this); this.mEndLayer.gameObject.SetActive(false); this.mFarmLayer = GameUITools.FindGameObject("Farm", gameObject).AddComponent<MagicLoveFarmLayer>(); this.mFarmLayer.Init(this); this.mFarmLayer.gameObject.SetActive(false); this.mResultLayer = GameUITools.FindGameObject("ResultLayer", base.gameObject).AddComponent<MagicLoveResultLayer>(); this.mResultLayer.Init(this); this.mResultLayer.gameObject.SetActive(false); Globals.Instance.Player.MagicLoveSystem.SendGetMagicLoveData(); }