Ejemplo n.º 1
0
        private void OnTooltip(Object p_sender, EventArgs p_args)
        {
            PartyBuffView partyBuffView = p_sender as PartyBuffView;

            if (partyBuffView != null)
            {
                StringEventArgs stringEventArgs = p_args as StringEventArgs;
                if (stringEventArgs != null)
                {
                    if (partyBuffView.PartyBuff != null)
                    {
                        if (stringEventArgs.caption != String.Empty)
                        {
                            TooltipManager.Instance.Show(this, stringEventArgs.caption, stringEventArgs.text, TextTooltip.ESize.BIG, partyBuffView.gameObject.transform.position, partyBuffView.Icon.transform.localScale * 0.5f);
                        }
                        else
                        {
                            TooltipManager.Instance.Show(this, stringEventArgs.text, partyBuffView.gameObject.transform.position, partyBuffView.Icon.transform.localScale * 0.5f);
                        }
                    }
                }
                else
                {
                    TooltipManager.Instance.Hide(this);
                }
            }
        }
Ejemplo n.º 2
0
        public static void UpdatePartyBuffs(GameObject p_parent, List <PartyBuff> p_buffs, List <PartyBuffView> p_buffViews, GameObject p_buffViewPrefab, EventHandler p_onTooltip)
        {
            Int32   num  = 0;
            Boolean flag = false;

            foreach (PartyBuffView partyBuffView in p_buffViews)
            {
                partyBuffView.UpdateDurationLabel();
            }
            foreach (PartyBuff partyBuff in p_buffs)
            {
                if (!partyBuff.IsExpired())
                {
                    Boolean flag2 = false;
                    foreach (PartyBuffView partyBuffView2 in p_buffViews)
                    {
                        if (partyBuffView2.PartyBuff != null && partyBuffView2.PartyBuff.StaticData.StaticID == partyBuff.StaticData.StaticID && partyBuffView2.gameObject.activeSelf)
                        {
                            flag2 = true;
                            partyBuffView2.UpdateDurationLabel();
                            break;
                        }
                    }
                    if (flag2)
                    {
                        num++;
                    }
                    else
                    {
                        if (p_buffViews.Count <= num)
                        {
                            flag = true;
                            GameObject gameObject = NGUITools.AddChild(p_parent, p_buffViewPrefab);
                            gameObject.transform.localPosition = new Vector3(num * 72f, 400f, 0f);
                            PartyBuffView component = gameObject.GetComponent <PartyBuffView>();
                            component.OnTooltipEvent += p_onTooltip;
                            p_buffViews.Add(component);
                            p_buffViews[num].Init();
                            p_buffViews[num].UpdateBuff(partyBuff);
                            NGUITools.SetActive(p_buffViews[num].gameObject, false);
                        }
                        p_buffViews[num].UpdateBuff(partyBuff);
                        if (!p_buffViews[num].gameObject.activeSelf)
                        {
                            if (p_buffViews[num].IsWaitTimeDone())
                            {
                                NGUITools.SetActive(p_buffViews[num].gameObject, true);
                            }
                            else
                            {
                                NGUITools.SetActive(p_buffViews[num].gameObject, false);
                            }
                        }
                        num++;
                    }
                }
            }
            Boolean flag3             = false;
            List <PartyBuffView> list = new List <PartyBuffView>();

            if (p_buffs.Count < p_buffViews.Count)
            {
                flag3 = true;
                for (Int32 i = p_buffViews.Count - 1; i >= 0; i--)
                {
                    if (!p_buffs.Contains(p_buffViews[i].PartyBuff))
                    {
                        if (!p_buffViews[i].SetDestroyTime)
                        {
                            p_buffViews[i].OnTooltipEvent -= p_onTooltip;
                            p_buffViews[i].SetDisabled();
                        }
                        else
                        {
                            list.Add(p_buffViews[i]);
                            p_buffViews.RemoveAt(i);
                        }
                    }
                }
            }
            for (Int32 j = list.Count - 1; j >= 0; j--)
            {
                if (list[j].SetDestroyTime)
                {
                    PartyBuffView partyBuffView3 = list[j];
                    list.RemoveAt(j);
                    NGUITools.SetActive(partyBuffView3.gameObject, false);
                    Helper.DestroyGO <PartyBuffView>(partyBuffView3);
                }
            }
            list.Clear();
            if ((p_buffs != null && p_buffs.Count > 0) || flag3)
            {
                Vector3 pos = new Vector3((-(Single)p_buffViews.Count * 72f + 80f) / 2f, p_parent.transform.localPosition.y, 0f);
                if (flag || flag3)
                {
                    if (flag3)
                    {
                        for (Int32 k = 0; k < p_buffViews.Count; k++)
                        {
                            p_buffViews[k].transform.localPosition = new Vector3(k * 72f, 400f, 0f);
                        }
                    }
                    TweenPosition tweenPosition = TweenPosition.Begin(p_parent, 0.3f, pos);
                    tweenPosition.method        = UITweener.Method.EaseOut;
                    tweenPosition.steeperCurves = true;
                }
            }
        }