static int SetStartToCurrentValue(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        TweenPosition obj = (TweenPosition)LuaScriptMgr.GetUnityObjectSelf(L, 1, "TweenPosition");

        obj.SetStartToCurrentValue();
        return(0);
    }
Esempio n. 2
0
    static int SetStartToCurrentValue(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        TweenPosition obj = LuaScriptMgr.GetNetObject <TweenPosition>(L, 1);

        obj.SetStartToCurrentValue();
        return(0);
    }
Esempio n. 3
0
 static public int SetStartToCurrentValue(IntPtr l)
 {
     try {
         TweenPosition self = (TweenPosition)checkSelf(l);
         self.SetStartToCurrentValue();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 4
0
 void missAnimate()
 {
     //有問題待完工
     Destroy(TP);
     TP         = gameObject.AddComponent <TweenPosition>();
     TP.enabled = false;
     TP.SetStartToCurrentValue();
     TP.to       = Vector3.left * 660;
     TP.duration = 1;
     TP.delay    = 0;
     TP.enabled  = true;
     TA.enabled  = true;
 }
Esempio n. 5
0
 static int SetStartToCurrentValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         TweenPosition obj = (TweenPosition)ToLua.CheckObject <TweenPosition>(L, 1);
         obj.SetStartToCurrentValue();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 6
0
    public static int SetStartToCurrentValue(IntPtr l)
    {
        int result;

        try
        {
            TweenPosition tweenPosition = (TweenPosition)LuaObject.checkSelf(l);
            tweenPosition.SetStartToCurrentValue();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    private static int SetStartToCurrentValue(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            TweenPosition tweenPosition = (TweenPosition)ToLua.CheckObject(L, 1, typeof(TweenPosition));
            tweenPosition.SetStartToCurrentValue();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 8
0
        static int _m_SetStartToCurrentValue(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            TweenPosition __cl_gen_to_be_invoked = (TweenPosition)translator.FastGetCSObj(L, 1);


            try {
                {
                    __cl_gen_to_be_invoked.SetStartToCurrentValue(  );



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 9
0
    //public int Bpm
    //{
    //    set
    //    {
    //        bpm = value;
    //    }
    //    get
    //    {
    //        return bpm;
    //    }
    //}

    //public int Speedmultiplier
    //{
    //    set
    //    {
    //        Speedmultiplier = value;
    //    }
    //}

    // slot range is 1500 , 1x speed have 8 beat
    void Start()
    {
        if (NodeType == 0)
        {
            Sprite.spriteName = null;
        }
        else if (NodeType > 0 && NodeType < 4)
        {
            Sprite.spriteName = NodeType.ToString();
        }
        else
        {
            Debug.LogError("wrong color code");
        }
        speedmultiplier = SettingData.Speed;
        TA       = gameObject.GetComponent <TweenAlpha>();
        TP       = gameObject.GetComponent <TweenPosition>();
        TS       = gameObject.GetComponent <TweenScale>();
        TP.delay = Delay;
        TP.SetStartToCurrentValue();
        TP.to       = Vector3.left * 600;
        TP.duration = 8f / bpm * 60f / speedmultiplier;
        TP.PlayForward();
    }
    private float RemoveReposition(int removeIndex, int lastIndex, Action <Transform> callback, int flag)
    {
        float delay = 0;

        Transform removeTrans = mItems[removeIndex % mShortCount];

        if (callback != null)
        {
            Transform trans = Instantiate(removeTrans) as Transform;
            trans.parent        = removeTrans.parent;
            trans.localPosition = removeTrans.localPosition;
            trans.localRotation = removeTrans.localRotation;
            trans.localScale    = removeTrans.localScale;
            callback(trans);
        }

        for (int index = removeIndex + 1; index <= lastIndex; ++index)
        {
            int       shortIndex     = index % mShortCount;
            int       prevShortIndex = (index - 1) % mShortCount;
            Transform trans          = mItems[shortIndex];
            mItems[prevShortIndex] = trans;
            TweenPosition tp = trans.GetComponent <TweenPosition>();
            if (!tp)
            {
                tp          = trans.gameObject.AddComponent <TweenPosition>();
                tp.duration = 0.5F;
            }
            tp.SetStartToCurrentValue();
            tp.to = (index - 1) * space * mAxis;
            tp.ResetToBeginning();
            tp.PlayForward();
            delay = tp.duration;
        }
        mItems[lastIndex % mShortCount] = removeTrans;

        if (flag == 0)
        {
            removeTrans.localPosition = (lastIndex + 1) * space * mAxis;
            if (onUpdateItem != null)
            {
                onUpdateItem(removeTrans, lastIndex);
            }
            TweenPosition removeTp = removeTrans.GetComponent <TweenPosition>();
            if (!removeTp)
            {
                removeTp          = removeTrans.gameObject.AddComponent <TweenPosition>();
                removeTp.duration = 0.5F;
            }
            removeTp.SetStartToCurrentValue();
            removeTp.to = lastIndex * space * mAxis;
            removeTp.ResetToBeginning();
            removeTp.PlayForward();

            delay = removeTp.duration;
        }
        else if (flag == 1)
        {
            removeTrans.localPosition = (lastIndex - mShortCount) * space * mAxis;
            mCenterIndex--;
            if (onUpdateItem != null)
            {
                onUpdateItem(removeTrans, flag == 0 ? lastIndex : lastIndex - mShortCount);
            }
        }
        else if (flag == 2)
        {
            removeTrans.localPosition = lastIndex * space * mAxis;
            removeTrans.gameObject.SetActive(false);
        }
        return(delay);
    }
    public float InsertAt(int insertIndex, Action <Transform> callback = null)
    {
        if (!mRunning)
        {
            return(0);
        }

        insertIndex = Mathf.Clamp(insertIndex, 0, mTotalCount);

        float delay      = 0;
        int   firstIndex = mCenterIndex - itemRadius;
        int   lastIndex  = mCenterIndex + itemRadius;

        if (insertIndex < firstIndex)
        {
            for (int shortIndex = 0; shortIndex < mShortCount; shortIndex++)
            {
                mItems[shortIndex].localPosition += space * mAxis;
            }
            mCenterIndex++;

            ResetViewport(1, 0);
        }
        else if (insertIndex <= lastIndex)
        {
            int onView = IsOnView(insertIndex);
            if (onView == 0)
            {
                if (callback != null)
                {
                    Transform trans = Instantiate(itemPrefab.transform) as Transform;
                    trans.parent        = transform;
                    trans.localPosition = insertIndex * space * mAxis;
                    trans.localRotation = Quaternion.identity;
                    trans.localScale    = Vector3.one;
                    trans.GetComponent <UIRect>().alpha = 1;
                    callback(trans);
                }

                Transform insertTrans = mItems[lastIndex % mShortCount];
                for (int index = lastIndex - 1; index >= insertIndex; --index)
                {
                    int       shortIndex     = index % mShortCount;
                    int       prevShortIndex = (index + 1) % mShortCount;
                    Transform trans          = mItems[shortIndex];
                    mItems[prevShortIndex] = trans;
                    TweenPosition tp = trans.GetComponent <TweenPosition>();
                    if (!tp)
                    {
                        tp          = trans.gameObject.AddComponent <TweenPosition>();
                        tp.duration = 0.5F;
                    }
                    tp.SetStartToCurrentValue();
                    tp.to = (index - 1) * space * mAxis;
                    tp.ResetToBeginning();
                    tp.PlayForward();
                }
                mItems[insertIndex % mShortCount] = insertTrans;
                TweenPosition insertTp = insertTrans.GetComponent <TweenPosition>();
                if (!insertTp)
                {
                    insertTp          = insertTrans.gameObject.AddComponent <TweenPosition>();
                    insertTp.duration = 0.5F;
                }
                insertTp.SetStartToCurrentValue();
                insertTp.to = (lastIndex + 1) * space * mAxis;
                insertTp.ResetToBeginning();
                insertTp.PlayForward();
                delay = insertTp.duration;
                StartCoroutine(DelayOperation(insertTp.duration, () => {
                    if (onUpdateItem != null)
                    {
                        onUpdateItem(insertTrans, insertIndex);
                    }
                    insertTrans.localPosition = insertIndex * space * mAxis;
                }
                                              ));
            }
            else
            {
                Transform insertTrans = mItems[lastIndex % mShortCount];
                for (int index = lastIndex - 1; index >= insertIndex; --index)
                {
                    int shortIndex = index % mShortCount;
                    mItems[shortIndex].localPosition += space * mAxis;
                    int nextShortIndex = (index + 1) % mShortCount;
                    mItems[nextShortIndex] = mItems[shortIndex];
                }

                mItems[insertIndex % mShortCount] = insertTrans;
                insertTrans.localPosition         = insertIndex * space * mAxis;
                insertTrans.gameObject.SetActive(true);
                if (onUpdateItem != null)
                {
                    onUpdateItem(insertTrans, insertIndex);
                }

                if (onView < 0)
                {
                    ResetViewport(1, 0);
                }
            }
        }
        mTotalCount++;

        StartCoroutine(DelayOperation(delay, () => {
            mScrollView.InvalidateBounds();
            mScrollView.onDragFinished();
        }
                                      ));

        if (progressBar)
        {
            progressBar.alpha = mTotalCount - 1;
        }

        return(delay);
    }