Beispiel #1
0
    /// <summary>
    /// 左上角按钮还原隐藏
    /// </summary>
    void ResetLeftBtnsPos(bool sendEvent = true)
    {
        if (m_trans_btn_Left_Root.gameObject.activeSelf)
        {
            m_trans_btn_Left_Root.gameObject.SetActive(false);

            m_trans_roleInfoRoot.transform.localPosition = new Vector3(0, 300, 0);
            m_trans_roleInfoRoot.gameObject.SetActive(true);

            TweenPosition tp = TweenPosition.Begin(m_trans_roleInfoRoot.gameObject, 0.25f, Vector3.zero);
            //发送UI,功能按钮状态变化事件
            SendGameObjMoveStatusEvent(UIDefine.GameObjMoveStatus.MoveToInvisible, m_lst_FuncBtnsLeft);
            tp.onFinished.Clear();
            //TweenPosition.Begin(m_trans_btn_Right_Root.gameObject, 0.25f, Vector3.zero);
            if (sendEvent)
            {
                tp.AddOnFinished(new EventDelegate(() =>
                {
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.MAINLEFTTBTN_TOGGLE, false);
                }));
            }
            tp.AddOnFinished(new EventDelegate(() =>
            {
                //发送UI,功能按钮状态变化事件
                SendGameObjMoveStatusEvent(UIDefine.GameObjMoveStatus.Invisible, m_lst_FuncBtnsLeft);
            }));
        }
    }
Beispiel #2
0
 public void AddFinished()
 {
     TP.onFinished.Clear();
     //给TweenPosition往前播放的添加事件
     //TP.AddOnFinished(Obj[0].GetComponent<LoadAVPro>().LoadAVProLinkSite1);
     TP.AddOnFinished(Obj[1].GetComponent <SetTexture>().setActTrue);
     TP.AddOnFinished(Obj[2].GetComponent <TweenColor>().PlayForward);
 }
    private bool TweenFromHere(Vector3 to)
    {
        if (!isSliding)
        {
            isSliding = true;
            //get the Y rotator tween
            TweenPosition tween = transform.GetComponent <TweenPosition>();

            if (tween == null)
            {
                tween = gameObject.AddComponent <TweenPosition>();
                tween.AddOnFinished(new EventDelegate.Callback(SetSlidingFalse));
            }

            //set start and end
            tween.from = transform.localPosition;
            tween.to   = to;

            //set to loop and linear
            tween.style          = UITweener.Style.Once;
            tween.animationCurve = AnimationCurve.Linear(0, 0, 1, 1);

            //set speed
            tween.duration = 0.2f;

            //play tween
            tween.ResetToBeginning();
            tween.PlayForward();
            return(true);
        }
        else
        {
            return(false);
        }
    }
Beispiel #4
0
 /// <summary>
 /// 点击主菜单处理
 /// </summary>
 public void ClickMenuBtn()
 {
     if (m_bOpen == false)   //打开主菜单
     //NGUIUtil.DebugLog("open "+Time.time);
     {
         MainCameraM.s_Instance.EnableDrag(false);
         m_bOpen = true;
         MyHead.BtnShow.gameObject.SetActive(false);
         MyHead.BtnHide.gameObject.SetActive(true);
         //NGUIUtil.TweenGameObjectPosY(TweenGo, m_fMinHeight, m_fMaxHeight, 0.2f, 0,gameObject,"RepositionTable");
         Vector3 pos = MyHead.TweenGo.transform.localPosition;
         pos.y = m_fMaxHeight;
         TweenPosition.Begin(MyHead.TweenGo, 0.2f, pos, false);
     }
     else
     {
         m_bOpen = false;
         MyHead.BtnHide.gameObject.SetActive(false);
         //NGUIUtil.TweenGameObjectPosY(TweenGo, m_fMaxHeight, m_fMinHeight, 0.2f,0, gameObject, "ShowBtnShow");
         Vector3 pos = MyHead.TweenGo.transform.localPosition;
         pos.y = m_fMinHeight - 300;
         tw    = TweenPosition.Begin(MyHead.TweenGo, 0.2f, pos, false);
         tw.AddOnFinished(ShowBtnShow);
     }
 }
Beispiel #5
0
    /// <summary>
    /// 设置输赢数量
    /// </summary>
    /// <param name="score"></param>
    public void SetWinLoseScore(float score)
    {
        mWinLoseLabel.gameObject.SetActive(true);
        UISprite sp = mWinLoseLabel.gameObject.GetComponentInChildren <UISprite>();

        if (sp != null)
        {
            sp.spriteName = score > 0 ? "win_bg" : "lose_bg";
        }
        mWinLoseLabel.bitmapFont = score > 0 ? mWinAtlas : mLoseAtlas;
        mWinLoseLabel.text       = score > 0 ? "+" + score : score + "";
        TweenPosition p = mWinLoseLabel.gameObject.AddComponent <TweenPosition>();

        p.from     = mWinScorePos;
        p.to       = mWinScorePos + new Vector3(0, 110, 0);
        p.duration = 0.5f;
        p.AddOnFinished(() =>
        {
            Destroy(p);
            Invoke("DelayHideWinScore", 2.0f);
        });
        //
        if (score > 0)
        {
            SoundProcess.PlaySound("Ten/SDB_chip_fall");
        }
    }
Beispiel #6
0
    /// <summary>
    /// 左上角按钮显示
    /// </summary>
    private void ShowLeftBtn()
    {
        if (IsShowRightBtn())
        {
            m_btn_leftbtn.gameObject.SendMessage("OnClick", SendMessageOptions.RequireReceiver);
        }

        if (!m_trans_btn_Left_Root.gameObject.activeSelf)
        {
            m_trans_btn_Left_Root.gameObject.SetActive(true);
            m_trans_btn_Left_Root.transform.localPosition = new Vector3(0, 300, 0);

            m_trans_roleInfoRoot.gameObject.SetActive(false);
            TweenPosition tp = TweenPosition.Begin(m_trans_btn_Left_Root.gameObject, 0.25f, Vector3.zero);
            //发送UI,功能按钮状态变化事件
            SendGameObjMoveStatusEvent(UIDefine.GameObjMoveStatus.MoveToVisible, m_lst_FuncBtnsLeft);
            tp.onFinished.Clear();
            tp.AddOnFinished(new EventDelegate(() =>
            {
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.MAINLEFTTBTN_TOGGLE, true);
                //发送UI,功能按钮状态变化事件
                SendGameObjMoveStatusEvent(UIDefine.GameObjMoveStatus.Visible, m_lst_FuncBtnsLeft);
            }));
        }
    }
Beispiel #7
0
    public void chiaChipToChip(long money, MoneyInpot toChip)
    {
        // setSubChip(money);
        if (money == 0)
        {
            return;
        }
        setmMoneyInPotNonModifier(moneyInPot - money);
        GameObject obj = (GameObject)Instantiate(prefab);

        obj.transform.localScale = new Vector3(1, 1, 1);
        Chip subChip = obj.GetComponent <Chip>();

        subChip.setMoneyChip(money);
        subChip.transform.parent = gameObject.transform;
        subChip.gameObject.transform.localPosition = new Vector3(0, 0, 0);
        subChip.transform.parent     = toChip.gameObject.transform;
        subChip.transform.localScale = new Vector3(1, 1, 1);
        TweenPosition tp = TweenPosition.Begin(obj, 1, new Vector3(0, 0, 0));

        tp.AddOnFinished(delegate
        {
            toChip.setmMoneyInPotNonModifier(toChip.moneyInPot
                                             + money);
            Destroy(subChip.gameObject);
        });
    }
Beispiel #8
0
    public void CoinMove(CarDirection dir)
    {
        float x = 0.0f;

        if (dir == CarDirection.Left)
        {
            x = -300.0f;
        }
        else if (dir == CarDirection.Left)
        {
            x = 300.0f;
        }
        else
        {
            x = 0.0f;
        }

        tween.enabled = true;
        tween.AddOnFinished(delegate {
            GameObject.Destroy(gameObject);
        });
        tween.from   = new Vector3(x, -100.0f, 0.0f);
        tween.to     = new Vector3(x, 100.0f, 0.0f);
        tween.method = UITweener.Method.EaseIn;
        tween.PlayForward();
    }
Beispiel #9
0
    public void OnClickKingsGift()
    {
        m_KingsScript.gameObject.SetActive(true);

        KingsScriptStartTime = DateTime.Now;

        bool is_takeable = Network.PlayerInfo.kings_gift.takeable_at < Network.Instance.ServerTime;

        m_KingsScript.text = KingsGiftInfoManager.Instance.GetRandomScript(Network.PlayerInfo.kings_gift.kings_gift_idn, is_takeable);

        m_KingsScriptTween.enabled = true;
        m_KingsScriptTween.ResetToBeginning();
        m_KingsScriptTween.PlayForward();

        if (is_takeable == true)
        {//Complete
            m_Button.SetActive(false);

            m_KingsRewardTween.AddOnFinished(new EventDelegate(RequestKingsGift));

            m_KingsRewardTween.enabled = true;
            m_KingsRewardTween.ResetToBeginning();
            m_KingsRewardTween.PlayForward();
        }
        else
        {//Show Script
            m_KingCharacter.Character.Stop();
            m_KingCharacter.Character.Play(false, "touch");
        }
    }
Beispiel #10
0
 void Start()
 {
     randnum     = Random.Range(1, 10);
     SelectTween = this.transform.Find("Hero_Select").GetComponent <TweenPosition>();
     SelectRole  = this.transform.Find("Hero_Select").GetComponent <UISprite>();
     SelectTween.AddOnFinished(ReSetAnochor);
     this.transform.gameObject.SetActive(false);
 }
Beispiel #11
0
    public void PlaySelectAnimation1()
    {
        GameObject    btn1  = GameObject.Find("Button1");
        TweenPosition tween = TweenPosition.Begin(gameObject, 1.0f, (-(Vector2)btn1.transform.localPosition) * 3.2f + _DeltaPosition);

        tween.AddOnFinished(new EventDelegate(_WordBubble, "OpenAnimation"));
        TweenScale ts = TweenScale.Begin(gameObject, 1.0f, new Vector3(3.2f, 3.2f));
    }
        protected override void Awake()
        {
            base.Awake();

            m_tweener = _GetComponent<TweenPosition>();
            m_tweener.onFinished.Clear();
            m_tweener.AddOnFinished(OnTweenFinish);
            
        }
Beispiel #13
0
 private void Awake()
 {
     transform = GetComponent <Transform>();
     positionTween.AddOnFinished(() =>
     {
         blockMovement = false;
         OnCameraMoveFinished?.Invoke();
     });
 }
Beispiel #14
0
    /// <summary>
    /// 移动的位置
    /// </summary>
    public void PlayHarmAnimation()
    {
        TweenPosition post = TweenPosition.Begin(gameObject, 1f, transform.localPosition + new Vector3(0, 100, 0));

        post.AddOnFinished(delegate()
        {
            GameObject.DestroyObject(gameObject);
        });
        post.Play();
    }
Beispiel #15
0
    public void reciveTo(Vector3 to)
    {
        tween.from = transform.localPosition;
        tween.to   = to;
        tween.ResetToBeginning();
        tween.enabled = true;
        tween.AddOnFinished(onFinished);

        bFinished = true;
    }
Beispiel #16
0
    void ScaleFinished()
    {
        TweenPosition tweenPosition = gameObject.AddComponent <TweenPosition>();

        tweenPosition.duration = 0.5f;
        tweenPosition.AddOnFinished(this.MoveUpFinished);
        tweenPosition.from   = Vector3.zero;
        tweenPosition.to     = new Vector3(0, 200, 0);
        tweenPosition.method = UITweener.Method.EaseInOut;
    }
Beispiel #17
0
    public void addOnFinished(EventDelegate.Callback action)
    {
        TweenPosition twP = GetComponent <TweenPosition>();

        if (twP == null)
        {
            return;
        }
        twP.AddOnFinished(action);
    }
Beispiel #18
0
    private void TriggerMove()
    {
        m_ObjGuideHandRoot.transform.localPosition = fingerId == 0 ? m_vFromLocalPos : m_vFromLocalPos1;
        TweenPosition tmp = m_ObjGuideHandRoot.AddComponent <TweenPosition>();

        tmp.from     = fingerId == 0 ? m_vFromLocalPos : m_vFromLocalPos1;
        tmp.to       = fingerId == 0 ? m_vToLocalPos : m_vToLocalPos1;;
        tmp.duration = m_fDuringTime;
        tmp.AddOnFinished(OnFin);
    }
Beispiel #19
0
    private void Awake()
    {
        var startButton  = transform.Find("StartGameButton").gameObject;
        var optionButton = transform.Find("OptionButton").gameObject;
        var exitButton   = transform.Find("ExitButton").gameObject;

        exitAnim = transform.GetComponent <TweenPosition>();

        UIEventListener.Get(optionButton).onClick += GotoGameOptionBg;
        exitAnim.AddOnFinished(() => { gameObject.SetActive(false); });
    }
Beispiel #20
0
        private void TriggerToShowPilesAnim()
        {
            GameObject    obj   = m_ElementList[m_iCurrentOptionIndex + 1].m_ObjRoot;
            TweenPosition tween = obj.AddComponent <TweenPosition>();

            tween.from       = obj.transform.localPosition;
            tween.from.y     = m_fMovePilesTop;
            tween.to         = obj.transform.localPosition;
            tween.to.y       = m_fMovePilesBottom;
            tween.worldSpace = false;
            tween.duration   = m_fMovePilesDuringtime;
            tween.AddOnFinished(OnMovePilesBottomFinished);
        }
        public void MoveMaterialSlot(bool isUp, bool isAnime)
        {
            UIPanel component = this._uiMaterialFrame[this._frameIndex].get_transform().FindChild("Panel").GetComponent <UIPanel>();

            this.moveSlotIndex = this._frameIndex;
            float         num           = (!isUp) ? 85f : -85f;
            float         duration      = (!isAnime) ? 0.0625f : 0.01f;
            Transform     component2    = component.get_transform().FindChild("LabelGrp").GetComponent <Transform>();
            TweenPosition tweenPosition = TweenPosition.Begin(component2.get_transform().get_gameObject(), duration, Vector3.get_up() * num);

            tweenPosition.animationCurve = UtilCurves.TweenEaseInOutQuad;
            tweenPosition.AddOnFinished(new EventDelegate.Callback(this.CompMoveMaterialSlot));
        }
        public void MoveMaterialSlot(bool isUp, bool isAnime)
        {
            UIPanel component = ((Component)_uiMaterialFrame[_frameIndex].transform.FindChild("Panel")).GetComponent <UIPanel>();

            moveSlotIndex = _frameIndex;
            float         d             = (!isUp) ? 85f : (-85f);
            float         duration      = (!isAnime) ? 0.0625f : 0.01f;
            Transform     component2    = ((Component)component.transform.FindChild("LabelGrp")).GetComponent <Transform>();
            TweenPosition tweenPosition = TweenPosition.Begin(component2.transform.gameObject, duration, Vector3.up * d);

            tweenPosition.animationCurve = UtilCurves.TweenEaseInOutQuad;
            tweenPosition.AddOnFinished(CompMoveMaterialSlot);
        }
Beispiel #23
0
        public void StartFly(Vector3 to, bool needScale, bool inverse, Action onFinished)
        {
            if (!isActiveAndEnabled)
            {
                return;
            }

            var posFrom = Trans.localPosition;
            var posTo   = ParentTrans.InverseTransformPoint(to);

            if (inverse)
            {
                TweenPos.from = posTo;
                TweenPos.to   = posFrom;
            }
            else
            {
                TweenPos.from = posFrom;
                TweenPos.to   = posTo;
            }
            TweenPos.onFinished.Clear();
            TweenPos.AddOnFinished(() =>
            {
                Reset();
                if (onFinished != null)
                {
                    onFinished();
                }
            });
            TweenPos.ResetForPlay();
            TweenPos.PlayForward();

            if (needScale)
            {
                var scaleFrom = Trans.localScale;
                var scaleTo   = Vector3.one;

                if (inverse)
                {
                    TweenScale.from = scaleTo;
                    TweenScale.to   = scaleFrom;
                }
                else
                {
                    TweenScale.from = scaleFrom;
                    TweenScale.to   = scaleTo;
                }
                TweenScale.ResetForPlay();
                TweenScale.PlayForward();
            }
        }
Beispiel #24
0
    public void PlayTweenPosition(GameObject go, Vector3 from, Vector3 to, float time, EventDelegate.Callback callBack = null)
    {
        TweenPosition tp = go.GetComponent <TweenPosition>();

        tp.from     = from;
        tp.to       = to;
        tp.duration = 1f;
        tp.ResetToBeginning();
        if (callBack != null)
        {
            tp.AddOnFinished(callBack);
        }
        tp.PlayForward();
    }
Beispiel #25
0
        private void OnMovePilesBottomFinished()
        {
            GameObject    obj   = m_ElementList[m_iCurrentOptionIndex + 1].m_ObjRoot;
            TweenPosition tween = obj.GetComponent <TweenPosition>();

            Destroy(tween);
            tween            = obj.AddComponent <TweenPosition>();
            tween.from       = obj.transform.localPosition;
            tween.from.y     = m_fMovePilesBottom;
            tween.to         = obj.transform.localPosition;
            tween.to.y       = m_fMovePilesTop;
            tween.worldSpace = false;
            tween.duration   = m_fMovePilesDuringtime;
            tween.AddOnFinished(OnMovePilesTopFinished);
            tween.enabled = true;
        }
Beispiel #26
0
    IEnumerator TweenMoveParent(float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        NGUIUtil.SetActive(MyHead.m_lblTroptype.transform.parent.gameObject, false);
        TweenPosition tp = MyHead.MoveParent.GetComponent <TweenPosition>();

        if (tp)
        {
            tp.AddOnFinished(ShowSkill);
            tp.from    = MyHead.MoveParent.transform.localPosition;
            tp.to      = MyHead.MoveLeft.localPosition;
            tp.enabled = true;
            tp.PlayForward();
        }
    }
Beispiel #27
0
    public static void TweenPos(GameObject go, Vector3 targetPos, float duration)
    {
        TweenPosition tp = TweenPosition.Begin(go, duration, targetPos);
        LuaBehaviour  lb = go.GetComponent <LuaBehaviour>();

        if (lb != null)
        {
            tp.AddOnFinished(() =>
            {
                lb.OnCommand("EndTween");
                if (go.GetComponent <TweenPosition>() != null)
                {
                    UnityEngine.Object.Destroy(go.GetComponent <TweenPosition>());
                }
            });
        }
    }
Beispiel #28
0
    public void Reposition(Vector3 pos)
    {
        this.transform.localPosition = pos;

        TweenPosition tp = gameObject.GetComponent <TweenPosition> ();

        if (tp == null)
        {
            CommonUtil.CommonLogger.LogError("HealLabel Gameobj has no PosTween: " + gameObject.name);
            return;
        }

        tp.from = this.transform.localPosition;
        tp.to   = tp.from + new Vector3(0, PosYMove, 0);

        tp.AddOnFinished(Finished);
    }
    private IEnumerator MoveNext(bool isnext)
    {
        islock = true;
        if (CheckCanMove(isnext))
        {
            if (CurrentPage == 1 && !isnext)
            {
                ReSetPosition(false);
                CurrentPage = PersistPageNum;
            }
            else if (CurrentPage == PersistPageNum && isnext)
            {
                ReSetPosition(true);
                CurrentPage = 1;
            }

            yield return(new WaitForEndOfFrame());

            if (isnext)
            {
                CurrentPage++;
                mCurDataPage++;
            }
            else
            {
                CurrentPage--;
                mCurDataPage--;
            }
            RefreshCtrBar();

            Vector3 tem = mRoot.localPosition;
            Vector3 pos = new Vector3(tem.x, isnext ? (tem.y + Height) : (tem.y - Height), tem.z);

            TweenPosition tr = TweenPosition.Begin(mRoot.gameObject, MoveSpeed, pos);
            tr.method = UITweener.Method.EaseInOut;
            tr.AddOnFinished(() =>
            {
                islock = false;
                if (mRoot.GetComponent <TweenPosition>() != null)
                {
                    DestroyImmediate(mRoot.GetComponent <TweenPosition>());
                }
            });
            tr.PlayForward();
        }
    }
Beispiel #30
0
    private Dictionary <int, GameObject> mVoiceDic           = new Dictionary <int, GameObject>();           //语音聊天喇叭

    #region 互动表情
    /// <summary>
    /// 添加一个互动表情
    /// </summary>
    /// <param name="from"></param>
    /// <param name="to"></param>
    /// <param name="con"></param>
    public void AddOneInteractionFace(Vector3 from, Vector3 to, SendReceiveGameChat data)
    {
        List <ConfigDada>   conList = ConfigManager.GetConfigs <TSTHuDongFaceConfig>();
        TSTHuDongFaceConfig con     = null;

        for (int i = 0; i < conList.Count; i++)
        {
            TSTHuDongFaceConfig temp = conList[i] as TSTHuDongFaceConfig;
            if (temp.id == data.faceIndex)
            {
                con = temp;
                break;
            }
        }
        if (con == null)
        {
            return;
        }
        GameObject go = NGUITools.AddChild(mItemRoot, mItem);

        go.gameObject.SetActive(true);
        TweenPosition   tween = go.GetComponent <TweenPosition>();
        UISprite        sp    = go.GetComponent <UISprite>();
        SpriteAnimation anim  = go.GetComponent <SpriteAnimation>();

        //设置起始点和目标点
        mFrom.position = from;
        mTo.position   = to;
        from           = mFrom.localPosition;
        to             = mTo.localPosition;
        //飞行动画和表情动画
        sp.spriteName  = con.foreName + "0";
        tween.duration = 0.4f;
        string sound = con.sound;

        tween.AddOnFinished(() =>
        {
            anim.SetBegin(con.foreName, 1, con.length);
            anim.SetDalayDestory(4.0f);
            SoundProcess.PlaySound("HuDongFaceSound/" + sound);
        });
        tween.from = from;
        tween.to   = to;
        tween.PlayForward();
    }
Beispiel #31
0
        public void MoveToLeftLand()
        {
            if (currentLandId == 1 || isMoving)
            {
                return;
            }
            isMoving = true;

            GameObject fx = controller.GObjects[string.Concat("landParticles", currentLandId)];

            fx.CustomSetActive(false);
            LandName.text = string.Empty;
            LandNameTween.PlayReverse();

            preteritLand = currentLand;
            currentLand  = CreateLand((currentLandId - 1).ToString());
            if (currentLand != null)
            {
                currentLandId--;
                currentLand.transform.localPosition = leftPos;
                currentLand.CustomSetActive(true);

                TweenPosition preteritLandTP = preteritLand.GetComponent <TweenPosition>();
                TweenPosition currentLandTP  = currentLand.GetComponent <TweenPosition>();
                preteritLandTP.from     = CenterPos;
                preteritLandTP.to       = RightPos;
                preteritLandTP.duration = 0.3f;

                currentLandTP.from     = leftPos;
                currentLandTP.to       = CenterPos;
                currentLandTP.duration = 0.5f;

                currentLandTP.AddOnFinished(OnMoveLandFinish);
                preteritLandTP.ResetToBeginning();
                preteritLandTP.PlayForward();
                currentLandTP.ResetToBeginning();
                currentLandTP.PlayForward();
            }
            else
            {
                isMoving     = false;
                currentLand  = preteritLand;
                preteritLand = null;
            }
        }
Beispiel #32
0
 void Awake()
 {
     instance = this;
     tweenPosition = GetComponent<TweenPosition>();
     tweenPosition.AddOnFinished(OnTweenFinished);
 }