Наследование: MonoBehaviour, IPointerDownHandler, IDragHandler
Пример #1
0
        public void Drag2()
        {
            DragPanel dp = new DragPanel
            {
                Width  = 10,
                Height = 10
            };
            RectangleView r = new RectangleView
            {
                PreferredHeight = 3,
                PreferredWidth  = 3,
                Position        = new Point(3, 3)
            };

            dp.Children.Add(r);

            MouseEventData mev = new MouseEventData(MouseEvent.MOUSE_PRESSED, new Point(3, 3), 1);

            UIElement.HandleMouseEvent(dp, mev);

            mev = new MouseEventData(MouseEvent.MOUSE_DRAGGED, new Point(1, 1), 1);
            UIElement.HandleMouseEvent(dp, mev);
            Assert.AreEqual(new Point(1, 1), r.Position);

            mev = new MouseEventData(MouseEvent.MOUSE_RELEASED, new Point(1, 1), 1);
            UIElement.HandleMouseEvent(dp, mev);
            Assert.AreEqual(new Point(1, 1), r.Position);
        }
Пример #2
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            m_PointerEventData          = new PointerEventData(m_EventSystem);
            m_PointerEventData.position = Input.mousePosition;

            List <RaycastResult> results = new List <RaycastResult>();

            m_Raycaster.Raycast(m_PointerEventData, results);

            foreach (RaycastResult result in results)
            {
                DragPanel dragPanel = result.gameObject.GetComponent <DragPanel>();

                if (dragPanel != null)
                {
                    currentDragPanel = dragPanel;
                    mouseDown        = Input.mousePosition;
                    dragPanelStart   = currentDragPanel.transform.parent.GetComponent <RectTransform>().anchoredPosition;
                }
            }
        }


        if (Input.GetMouseButton(0) && currentDragPanel != null)
        {
            currentDragPanel.transform.parent.GetComponent <RectTransform>().anchoredPosition = Input.mousePosition - mouseDown + dragPanelStart;
        }
        else
        {
            currentDragPanel = null;
        }
    }
Пример #3
0
 private void DragPanel_Loaded(object sender, RoutedEventArgs e)
 {
     dp                 = (DragPanel)sender;
     dp.Layout          = Layout;
     dp.DropShadowColor = DropShadowColor;
     dp.OrderChanged   += OnDpOrderChanged;
 }
Пример #4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            mGridMain = GetTemplateChild(PART_GridMain) as Grid;
            if (mGridMain != null)
            {
            }
            mDragPanel = GetTemplateChild(PART_Panel) as DragPanel;
            if (mDragPanel != null)
            {
                if (PanelWidth > 0)
                {
                    mDragPanel.Width = PanelWidth;
                }
                if (PanelHeight > 0)
                {
                    mDragPanel.Height = PanelHeight;
                }
            }
            if (mGridMain != null && mDragPanel != null)
            {
                mDragHelper.Init(mGridMain, mDragPanel);
            }
        }
Пример #5
0
 public void Drag2Steps()
 {
     DragPanel.SetActive(false);
     stepsPanel.SetActive(true);
     stepText.SetActive(true);
     tarModel.SetActive(true);
     tarText.SetActive(true);
 }
Пример #6
0
        /// <summary>Inserts a ListBoxItem at the specified Order index.</summary>
        public void Insert(int index, ListBoxItem item)
        {
            int index2 = 0;

            foreach (ListBoxItem item2 in Items.OfType <ListBoxItem>().OrderBy(DragPanel.GetOrder))
            {
                ++index2;
                if (index2 > index)
                {
                    DragPanel.SetOrder(item2, index2);
                }
            }

            DragPanel.SetOrder(item, index);
            Items.Add(item);
        }
Пример #7
0
 private void Start()
 {
     game = GameManager.Instance;
     game.events.onPause.AddListener(Pause);
     game.events.onResume.AddListener(Resume);
     game.events.onStart.AddListener(Resume);
     surface.onSurfaceHit.AddListener(OnSurfaceHit);
     // Register Inputs
     UIManager.Controls controls = game.uiManager.controls;
     predictionLine = controls.predictionLine;
     dragPanel      = controls.dragPanel;
     joystick       = controls.joystick;
     // Initialize subsystems [LAST]
     animations.Initialize(this);
     soundEffects.Initialize(this);
     particles.Initialize(this);
     // Pause the player
     Pause();
 }
Пример #8
0
 public virtual void Init(Vector2 pos)
 {
     body.transform.parent.GetComponent <RectTransform>().localPosition = pos;
     _dragPanel = body.AddComponent <DragPanel>();
     _dragPanel.Init();
 }
Пример #9
0
 private void DragPanel_Loaded(object sender, RoutedEventArgs e)
 {
     rp = (DragPanel)sender;
     rp.OrderChanged += OnOrderChanged;
 }
Пример #10
0
 void Awake()
 {
     _dragPanel = GetComponentInChildren <DragPanel>();
 }
Пример #11
0
 public void Sym2Drag()
 {
     symPanel.SetActive(false);
     DragPanel.SetActive(true);
 }
Пример #12
0
 // Use this for initialization
 void Start()
 {
     parent = GetComponentInParent <DragPanel>();
 }
Пример #13
0
 /// <summary>Resets a ListBoxItem Order index.</summary>
 public void ResetItemIndex(ListBoxItem item)
 {
     DragPanel.SetOrder(item, -1);
 }
Пример #14
0
    void FriendInit()
    {
        //mRankFriend = new WasRank ();
        UIDraggablePanel2 DragPanel;
        UIGrid            Grid;

        DragPanel = mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "LPanel_friend/scroll_friend", true).GetComponent <UIDraggablePanel2> ();
        Grid      = mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "LPanel_friend/scroll_friend/grid", true).GetComponent <UIGrid> ();
        SetFriendsListObject();

        DragPanel.Init(arrFriendObj.Count, delegate(UIListItem item, int index) {
            FriendList scr  = item.Target.GetComponent <FriendList> ();
            AmFriend curObj = arrFriendObj [index];
            item.Target.transform.FindChild("Label_name").GetComponent <UILabel> ().text = curObj.Nick;
            Material PlayerPic;
            PlayerPic = Instantiate(Resources.Load("Materials/KakaoPic")) as Material;
            GetRankList(curObj.UserID);
            scr.KakaoID = curObj.UserID;

//            for (int i = 0 ; i < Ag.mySelf.arrFriendRank.Count; i ++) {
//                Debug.Log (curObj.UserID + "FriendUSerID" + mRankFriend.league + "MySelf " + Ag.mySelf.arrFriendRank.Count + "arrCount " + "  friendUserid  " + Ag.mySelf.arrFriendRank[i].userID + "friendLeague" + Ag.mySelf.arrFriendRank[i].league);
//            }

            scr.FriendNick = curObj.Nick;
            if (mRankFriend.league.Substring(0, 3) == "PRO")    //_5" || mRankFriend.league == "PRO_4" || mRankFriend.league == "PRO_3" || mRankFriend.league == "PRO_2" || mRankFriend.league == "PRO_1") {
            {
                Ag.mViewCard.CardLeagueSpritename(mRankFriend.league);
                int lgNum = mRankFriend.league.GetContinuousInteger();
                item.Target.transform.FindChild("division/div1").gameObject.GetComponent <UISprite> ().spriteName = "icon_div" + lgNum + "s";
                //child.transform.FindChild ("division/div1").gameObject.GetComponent<UISprite> ().spriteName = Ag.mViewCard.LeagueSpriteNameS;
                Ag.LogIntenseWord("mRankFriend.league.GetContinuousInteger :: " + mRankFriend.league + " RankUserid " + mRankFriend.userID);
            }
            else
            {
                item.Target.transform.FindChild("division/div1").gameObject.GetComponent <UISprite> ().spriteName = "icon_div5s";
            }


            Debug.Log("Ag.mViewCard.LeagueSpriteNameS" + Ag.mViewCard.LeagueSpriteNameS);
            item.Target.transform.FindChild("face").gameObject.GetComponent <UITexture> ().material = PlayerPic;
            item.Target.transform.FindChild("btn_versuscall").gameObject.GetComponent <UIButtonMessage> ().target       = item.Target;
            item.Target.transform.FindChild("btn_versuscall").gameObject.GetComponent <UIButtonMessage> ().functionName = "versuscall";
            item.Target.transform.FindChild("Checkbox_onoff/Background").GetComponent <UISprite> ().spriteName          = "img_friendoff";
            scr.PlayerNum    = index;
            item.Target.name = index.ToString();
            //item.Target.transform.FindChild ("btn_versuscall").transform.gameObject.SetActive (false);
            item.Target.transform.FindChild("btn_nowplay").transform.gameObject.SetActive(false);

            if (curObj.IsOnNode)
            {
                Debug.Log(Ag.NodeObj.MatchOKwith(curObj.UserID).HasValue + "KKONICKNAME      " + curObj.Nick);
                if (Ag.NodeObj.MatchOKwith(curObj.UserID).Value == true)
                {
                    item.Target.transform.FindChild("Checkbox_onoff/Background").GetComponent <UISprite> ().spriteName = "img_friendon";
                    item.Target.transform.FindChild("btn_versuscall").transform.gameObject.SetActive(true);
                    item.Target.transform.FindChild("btn_nowplay").transform.gameObject.SetActive(false);
                }
                else
                {
                    item.Target.transform.FindChild("Checkbox_onoff/Background").GetComponent <UISprite> ().spriteName = "img_friendplay";
                    item.Target.transform.FindChild("btn_versuscall").transform.gameObject.SetActive(false);
                    item.Target.transform.FindChild("btn_nowplay").transform.gameObject.SetActive(true);
                }
                scr.LogOn = true;
            }
            else
            {
                item.Target.transform.FindChild("btn_versuscall").transform.gameObject.SetActive(true);
                item.Target.transform.FindChild("btn_nowplay").transform.gameObject.SetActive(false);
                scr.LogOn = false;
            }
            if (PreviewLabs.PlayerPrefs.GetBool("viewUserpic"))
            {
                for (int i = 0; i < KakaoFriends.Instance.appFriends.Count; i++)
                {
                    if (item.Target.GetComponent <FriendList> ().KakaoID == KakaoFriends.Instance.appFriends [i].userid)
                    {
                        if (dicTex [i] != null)
                        {
                            item.Target.transform.FindChild("face").gameObject.GetComponent <UITexture> ().material.mainTexture = dicTex [i];
                        }
                        else
                        {
                            item.Target.transform.FindChild("face").gameObject.GetComponent <UITexture> ().material.mainTexture = (Texture2D)Resources.Load("userface_bundle");
                        }
                    }
                }
            }
        });
        Grid.Reposition();
        DragPanel.ResetPosition();
    }