Ejemplo n.º 1
0
 public bool IsSame(Lucky_P_Item item)
 {
     if (type == item.type || item.type == 9 || type == 9)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
 public void Begin()
 {
     _speed = minSp - 1;
     InvokeRepeating("MyUpdate", 0, 0.01f);
     _accSp = -1;
     if (current == null)
     {
         current = dataList [0];
     }
 }
Ejemplo n.º 3
0
 private void MyUpdate()
 {
     frame++;
     if (frame >= _speed)
     {
         if (_speed > maxSp && _speed < minSp)
         {
             _speed += _accSp;
         }
         frame = 0;
         current.ShowRect(false);
         current = current.first;
         current.ShowRect(true);
         if (_accSp > 0 && _speed == minSp && current.type == endType)
         {
             //降低速度后,找到对应的类型停止.
             CancelInvoke("MyUpdate");
         }
     }
 }
Ejemplo n.º 4
0
    private List <Lucky_P_Item> CheckAllType()
    {
        List <Lucky_P_Item> list = new List <Lucky_P_Item>();
        Lucky_P_Item        one  = null;

        for (int i = 0; i < dataList.Count; i++)
        {
            for (int j = 0; j < dataList[i].Count; j++)
            {
                if (one == null && !dataList[i][j].IsAllR())
                {
                    one = dataList[i][j];
                }
                if (one != null && !dataList[i][j].IsSame(one))
                {
                    return(new List <Lucky_P_Item>());
                }
                list.Add(dataList[i][j]);
            }
        }
        return(list);
    }
Ejemplo n.º 5
0
    void Start()
    {
        list = new List <Lucky_P_Item> ();
        int          i        = 0;
        Lucky_P_Item tempItem = null;

        //形成一个循环.前面跟随前面.
        foreach (Transform tf in transform)
        {
            Lucky_P_Item lp = tf.GetComponent <Lucky_P_Item>();
            if (lp == null)
            {
                lp = tf.gameObject.AddComponent <Lucky_P_Item>();
            }
            list.Add(lp);
            tf.localPosition   = new Vector3(0, i * -75, 0);
            tf.gameObject.name = i.ToString();
            i++;
            if (tempItem != null)
            {
                tempItem.first = lp;
                lp.back        = tempItem;
            }
            else
            {
                firstlyItem = lp;
            }
            if (i >= tf.childCount)         //确认第一个和最后一个.
            {
                lastItem = lp;
            }

            tempItem = lp;
        }
        listLengh = list.Count;

//		Begin ();
    }
Ejemplo n.º 6
0
    void MyUpdate()
    {
        if (isBegin && listLengh > 0)
        {
            item = null;
            for (int i = 0; i < listLengh; i++)
            {
                if (item == null)
                {
                    item = lastItem;
                }
                else
                {
                    item = item.back;
                }
                itemV3 = item.transform.localPosition;


                if (item.first == null)
                {
                    itemV3.y -= _speed;
                }
                else
                {
                    itemV3.y = item.first.transform.localPosition.y + heightSpace;
                }
                //判断是否到了奖励的终点.
                if (startEnd && item.endPoint != -1 && item.endPoint >= itemV3.y)
                {
                    itemV3.y   = item.endPoint;
                    item.isEnd = true;
                    if (!endList.Contains(item))
                    {
                        endList.Add(item);
                    }
                    if (endList.Count == endInts.Count)
                    {
                        //完成.
                        isBegin = false;
                        isDone  = true;
                        CancelInvoke("MyUpdate");
                    }
                }
                item.transform.localPosition = itemV3;
            }
            if (lastItem.transform.localPosition.y < maxY)
            {
                //最后一个变成第一个,倒数第二个变成最后一个.
                firstlyItem.back = lastItem;
                lastItem.first   = firstlyItem;
                item             = lastItem.back;
                item.first       = null;

                firstlyItem      = lastItem;
                lastItem         = item;
                firstlyItem.back = null;
                if (startEnd && _delay <= 0)           //开始停止.
                {
                    if (endIndex >= 0)
                    {
                        if (endInts.Count != endPoints.Count)
                        {
                            Debug.LogError("奖励数组与终点数组长度不一");
                            return;
                        }
                        //设置图标后.
                        firstlyItem.SetIcon(endInts[endIndex]);
                        firstlyItem.endPoint = endPoints[endIndex];
                        endIndex--;
                    }
                }
                else
                {
                    if (_delay > 0)
                    {
                        _delay -= Time.deltaTime;
                    }
                    firstlyItem.ChangeTest();
                }
            }
        }
    }
Ejemplo n.º 7
0
    private List <List <Lucky_P_Item> > CheckType(List <string> dic, int num)
    {
        List <Lucky_P_Item>         list  = new List <Lucky_P_Item>();
        List <List <Lucky_P_Item> > lists = new List <List <Lucky_P_Item> >();
        Lucky_P_Item first = null;
        Lucky_P_Item last  = null;

        for (int i = 0; i < dic.Count; i++)
        {
            string[] strs  = dic[i].Split(',');
            int      key   = int.Parse(strs[0]);
            int      value = int.Parse(strs[1]);
            list.Add(dataList[value][key]);
            if (!dataList[value][key].IsAllR())
            {
                last = dataList[value][key];
                if (first == null)
                {
                    first = last;
                }
            }
        }
        if (first == null && last == null)
        {
            lists.Add(list);
            return(lists);
        }

        List <Lucky_P_Item> tempList = new List <Lucky_P_Item>();

        if (first.IsSame(list[0]) && first.IsSame(list[1]) && first.IsSame(list[2]))   //左3连.
        {
            tempList.Add(list[0]);
            tempList.Add(list[1]);
            tempList.Add(list[2]);
            if (first.IsSame(list[3]))           //4连
            {
                tempList.Add(list[3]);
                if (first.IsSame(list[4]))               //5连.
                {
                    tempList.Add(list[4]);
                    lists.Add(tempList);
                    return(lists);
                }
            }
            lists.Add(tempList);
        }

        //判断右边
        tempList = new List <Lucky_P_Item>();
        if (last.IsSame(list[4]) && last.IsSame(list[3]) && last.IsSame(list[2]))   //左3连.
        {
            tempList.Add(list[4]);
            tempList.Add(list[3]);
            tempList.Add(list[2]);
            if (first.IsSame(list[1]))           //4连
            {
                tempList.Add(list[1]);
            }
            lists.Add(tempList);
        }
        return(lists);
    }