Ejemplo n.º 1
0
    /// <summary>
    /// 对比两个
    /// </summary>
    /// <param name="firstIndex"></param>
    /// <param name="secondIndex"></param>
    /// <returns>返回true,说明 firstIndex 比较大</returns>
    public bool CompareBars(int firstIndex, int secondIndex)
    {
        for (int i = 0; i < this.lastCompareIndexs.Count; i++)
        {
            int index = this.lastCompareIndexs[i];
            if (index == firstIndex || index == secondIndex)
            {
                continue;
            }
            this.barList[index].InactiveAnimation();
        }
        this.lastCompareIndexs.Clear();
        this.lastCompareIndexs.Add(firstIndex);
        this.lastCompareIndexs.Add(secondIndex);

        Bar bar1 = this.barList[firstIndex];
        Bar bar2 = this.barList[secondIndex];

        // 播放动画
        bar1.ActiveAnimation();
        bar2.ActiveAnimation();

        // 对比音效
        this.PlayCompareSound();

        return(bar1.num > bar2.num);
    }