예제 #1
0
 public void PlayItemsAnim(bool afterOpenAnim = false)
 {
     if (IsPlayingAnim)
     {
         return;
     }
     IsPlayingAnim = true;
     try
     {
         //if (!HasItemsAnimComplete()) return;
         float winOpenDelay = (afterOpenAnim && openAnim) ? openAnim.length : 0;
         openAnimPlayTime = 0;
         //int count = 0;
         for (int i = 0; i < ActiveItems.Count; ++i)
         {
             WinItem item = ActiveItems[i];
             if (item.PlayOpenAnim(winOpenDelay))
             {
                 if (item.AnimDelay > openAnimPlayTime)
                 {
                     openAnimPlayTime = item.AnimDelay + item.openAnim.length;
                 }
                 //Main.Log("play anim@@@:" + item.name);
             }
         }
         openAnimPlayTime = openAnimPlayTime + winOpenDelay + 0.1f;
         Invoke("onPlayOpenAnimEnd", openAnimPlayTime);
     }
     catch (System.Exception ex)
     {
         Debug.LogException(ex);
         onPlayOpenAnimEnd();
     }
 }
예제 #2
0
    protected void InitGridActiveItems(UIGrid grid, UIPanel panel)
    {
        if (!grid || !panel)
        {
            return;
        }
        ActiveItems.Clear();
        WinItem[] items = grid.GetComponentsInChildren <WinItem>();
        int       index = 0;

        for (int i = 0; i < items.Length; ++i)
        {
            WinItem item = items[i];
            if (panel.IsVisible(item.transform.position) && item.gameObject.activeSelf)
            {
                item.AnimDelay = this.itemAnimInterval * index++; //enable the open animation
                ActiveItems.Add(item);
            }
            else
            {
                item.AnimDelay = -1; //disable the open animation
            }
        }
    }