Пример #1
0
 private void Stage_End()
 {
     if (touch != null)
     {
         f.RemoveChild(touch.group);
         touch = null;
         ModelManager.inst.alertModel.isTip = false;
     }
 }
Пример #2
0
    private void Stage_Begin()
    {
        bool isOk = ModelManager.inst.userModel.GetUnlcok(Config.UNLOCK_TIP);

        if (!isOk)
        {
            return;
        }
        if (Stage.inst.touchCount > 1)
        {
            return;
        }
        DisplayObject ds = Stage.inst.touchTarget;

        if (ds == null || ds.gOwner == null)
        {
            return;
        }
        object[] n = touchs.Find((object[] obj) =>
        {
            if (obj [0].ToString() == ds.gOwner.ToString().Replace("FairyGUI.", ""))
            {
                if (obj [1] == ds.gOwner)
                {
                    return(true);
                }
                return(false);
            }
            else if (obj [0].ToString() == ds.gOwner.parent.ToString() && obj [1] == ds.gOwner.parent)
            {
                return(true);
            }
            return(false);
        });
        if (n != null)
        {
            Vector2 v2 = Stage.inst.touchPosition;
            v2 = f.GlobalToLocal(v2);
            ModelManager.inst.alertModel.data  = n [2];
            ModelManager.inst.alertModel.type  = n [0].ToString();
            ModelManager.inst.alertModel.isTip = true;
            if (touch != null && touch.parent != null)
            {
                f.RemoveChild(touch.group);
            }
            touch = null;
            touch = new ComTip();
            f.AddChild(touch.group);
            touch.group.x = v2.x;
            touch.group.y = v2.y;
            touch.UpdatePos();
            float xx = touch.group.x + touch.group.width;
            float yy = touch.group.y + touch.group.height;
            if (touch.group.x < 0)
            {
                touch.group.x = 0;
            }
            if (touch.group.y < 30)
            {
                touch.group.y = 30;
            }
            float gw = GRoot.inst.width;
            float gh = GRoot.inst.height;
            if (xx > gw)
            {
                touch.group.x -= xx - gw;
            }
            if (yy > gh)
            {
                touch.group.y -= yy - gh;
            }
        }
    }