Inheritance: MonoBehaviour
コード例 #1
0
ファイル: EffectItem.cs プロジェクト: whztt07/mobahero_src
    public void GenerateScrollView(UIScrollView hor, UIScrollView ver)
    {
        if (null == hor || null == ver)
        {
            return;
        }
        DIYDrag component = this.frame.GetComponent <DIYDrag>();

        UIDragScrollView[] components = this.frame.GetComponents <UIDragScrollView>();
        if (components.Length != 2)
        {
            for (int num = components.Length - 1; num != -1; num--)
            {
                UnityEngine.Object.Destroy(components[num]);
            }
            this.ug1            = this.frame.gameObject.AddComponent <UIDragScrollView>();
            this.ug2            = this.frame.gameObject.AddComponent <UIDragScrollView>();
            this.ug1.scrollView = hor;
            this.ug2.scrollView = ver;
        }
        else
        {
            this.ug1            = components[0];
            this.ug2            = components[1];
            this.ug1.scrollView = hor;
            this.ug2.scrollView = ver;
        }
        if (null == component)
        {
            this.frame.gameObject.AddComponent <DIYDrag>();
        }
    }
コード例 #2
0
 /// <summary>
 /// Ìí¼Ó½±ÀøÎïÆ·
 /// </summary>
 /// <param name="item"></param>
 public void AddItem(UIDragScrollView item)
 {
     item.transform.parent     = gridReward.transform;
     item.transform.localScale = new Vector3(1, 1, 1);
     item.draggablePanel       = this.dragReward;
     gridReward.repositionNow  = true;
 }
コード例 #3
0
ファイル: ScrollZone.cs プロジェクト: mulova/ngui_extensions
        static void AddScrollZone(GameObject zoneObj, UIScrollView scroll)
        {
            UIDragScrollView drag = zoneObj.FindComponent <UIDragScrollView>();

            drag.scrollView = scroll;
            zoneObj.FindComponent <ScrollZone>();
        }
コード例 #4
0
ファイル: UIUtil.cs プロジェクト: atom-chen/tianyu
    public Vector3 AddChild(GameObject o)
    {
        Vector3 p = o.transform.localPosition;
        Vector3 s = o.transform.localScale;

        o.transform.parent        = content.transform;
        o.transform.localPosition = p;
        o.transform.localScale    = s;

        Bounds b = NGUIMath.CalculateRelativeWidgetBounds(o.transform);
        //Vector3 vsp = new Vector3(o.transform.localPosition.x + b.center.x - b.size.x / 2, o.transform.localPosition.y + b.center.y - b.size.y / 2, o.transform.localPosition.z + b.center.z - b.size.z / 2);
        Vector3 vs = b.size;
        //    UpdateBox(vsp, vs);

        UIButton btn = o.GetComponent <UIButton>();

        if (btn != null)
        {
            UIDragScrollView dp = o.GetComponent <UIDragScrollView>();
            if (dp == null)
            {
                dp = o.AddComponent <UIDragScrollView>();
            }
            dp.scrollView = content.transform.parent.GetComponent <UIScrollView>();
        }

        UIPanel _uipanel = o.GetComponent <UIPanel>();

        if (_uipanel != null)
        {
            NGUITools.Destroy(_uipanel);
        }
        return(vs);
    }
コード例 #5
0
    /// <summary>
    /// Cache the transform.
    /// </summary>

    protected virtual void Start()
    {
        mTrans          = transform;
        mCollider       = GetComponent <Collider>();
        mButton         = GetComponent <UIButton>();
        mDragScrollView = GetComponent <UIDragScrollView>();
    }
コード例 #6
0
ファイル: UIDragDropItem.cs プロジェクト: ziyihu/TowerDefence
	/// <summary>
	/// Cache the transform.
	/// </summary>

	protected virtual void Start ()
	{
		mTrans = transform;
		mCollider = GetComponent<Collider>();
		mButton = GetComponent<UIButton>();
		mDragScrollView = GetComponent<UIDragScrollView>();
	}
コード例 #7
0
    void OnDestroy()
    {
        btnInvite  = null;
        btnInvite2 = null;
        userId     = null;

        scrollView = null;
    }
コード例 #8
0
 protected virtual void Start()
 {
     mTrans          = base.transform;
     mCollider       = base.gameObject.GetComponent <Collider>();
     mCollider2D     = base.gameObject.GetComponent <Collider2D>();
     mButton         = GetComponent <UIButton>();
     mDragScrollView = GetComponent <UIDragScrollView>();
 }
コード例 #9
0
 protected virtual void Start()
 {
     this.mTrans          = base.get_transform();
     this.mCollider       = base.get_gameObject().GetComponent <Collider>();
     this.mCollider2D     = base.get_gameObject().GetComponent <Collider2D>();
     this.mButton         = base.GetComponent <UIButton>();
     this.mDragScrollView = base.GetComponent <UIDragScrollView>();
 }
コード例 #10
0
 protected virtual void OnDragDropRelease(GameObject surface)
 {
     if (!this.cloneOnDrag)
     {
         UIDragScrollView[] componentsInChildren = base.GetComponentsInChildren <UIDragScrollView>();
         UIDragScrollView[] array = componentsInChildren;
         for (int i = 0; i < array.Length; i++)
         {
             UIDragScrollView uIDragScrollView = array[i];
             uIDragScrollView.scrollView = null;
         }
         if (this.mButton != null)
         {
             this.mButton.isEnabled = true;
         }
         else if (this.mCollider != null)
         {
             this.mCollider.enabled = true;
         }
         else if (this.mCollider2D != null)
         {
             this.mCollider2D.enabled = true;
         }
         UIDragDropContainer uIDragDropContainer = (!surface) ? null : NGUITools.FindInParents <UIDragDropContainer>(surface);
         if (uIDragDropContainer != null)
         {
             this.mTrans.parent = ((!(uIDragDropContainer.reparentTarget != null)) ? uIDragDropContainer.transform : uIDragDropContainer.reparentTarget);
             Vector3 localPosition = this.mTrans.localPosition;
             localPosition.z           = 0f;
             this.mTrans.localPosition = localPosition;
         }
         else
         {
             this.mTrans.parent = this.mParent;
         }
         this.mParent = this.mTrans.parent;
         this.mGrid   = NGUITools.FindInParents <UIGrid>(this.mParent);
         this.mTable  = NGUITools.FindInParents <UITable>(this.mParent);
         if (this.mDragScrollView != null)
         {
             base.Invoke("EnableDragScrollView", 0.001f);
         }
         NGUITools.MarkParentAsChanged(base.gameObject);
         if (this.mTable != null)
         {
             this.mTable.repositionNow = true;
         }
         if (this.mGrid != null)
         {
             this.mGrid.repositionNow = true;
         }
     }
     this.OnDragDropEnd();
     if (this.cloneOnDrag)
     {
         this.DestroySelf();
     }
 }
コード例 #11
0
    /// <summary>
    /// 添加语音
    /// </summary>
    private void AddVoiceContent(RichContent content)
    {
        GameObject icongo = NGUITools.AddChild(mWidget.gameObject, mIcon.gameObject);

        icongo.SetActive(true);
        UISprite sprite = icongo.GetComponent <UISprite>();

        sprite.spriteName = content.content;
        sprite.MakePixelPerfect();
        int width  = sprite.width;
        int height = sprite.height;

        icongo.name = "voiceobj";

        BoxCollider boxcollider = UtilTools.SafeAddComponent <BoxCollider>(icongo);

        boxcollider.size   = new Vector3(sprite.width, sprite.height, 0);
        boxcollider.center = new Vector3(sprite.width * 0.5f, -sprite.height * 0.5f, 0);

        //UISpriteAnimation anim = UtilTools.SafeAddComponent<UISpriteAnimation>(icongo);
        //anim.namePrefix = content.anim_namePrefix;
        //anim.loop = true;
        //anim.framesPerSecond = 30;

        UILinkText linkText = UtilTools.SafeAddComponent <UILinkText>(icongo);

        linkText.args        = content.args;
        linkText.linktype    = content.linktype;
        linkText.voiceObject = icongo;
        voice_args           = content.args;

        UIDragScrollView dragScrollview = UtilTools.SafeAddComponent <UIDragScrollView>(icongo);

        float dy      = height - cellHeight;
        float surplus = maxWidth - mPositionX;                  //一行剩余空间

        if (surplus >= width)
        {
            icongo.transform.localPosition = new Vector3(mPositionX, mPositionY, 0);
            if (dy > 0)
            {
                m_dy = m_dy > dy ? m_dy : dy;
            }
        }
        else
        {
            mPositionX = mLabeltemp_x;
            mPositionY = mPositionY - cellHeight - m_dy - cellHeight + NGUIText.fontSize;
            m_dy       = dy > 0 ? dy : 0;
            //iswrap = true;

            icongo.transform.localPosition = new Vector3(mPositionX, mPositionY, 0);
        }
        float iconwidth = width;

        mPositionX += iconwidth;
        SetCurrWidth(mPositionX);
    }
コード例 #12
0
        public override void Awake()
        {
            base.Awake();

            var t = mDMono.transform;

            IconSprite      = t.GetComponent <UISprite>("Icon");
            FrameSprite     = t.GetComponent <UISprite>("Frame");
            FrameBGSprite   = t.GetComponent <UISprite>("FrameBG");
            LevelSprite     = t.GetComponent <UISprite>("HideObj/Property");
            LevelLabel      = t.GetComponent <UILabel>("HideObj/LevelSprite/LabelLevel");
            LevelBGSprite   = t.GetComponent <UISprite>("HideObj/LevelSprite");
            breakLebel      = t.GetComponent <UILabel>("HideObj/BreakObj/Break");
            StarController  = t.GetMonoILRComponent <LTPartnerStarController>("HideObj/StarList");
            SelectSpriteObj = t.FindEx("Select").gameObject;
            HideObj         = t.FindEx("HideObj").gameObject;
            RecommendSprite = t.FindEx("RecommendSprite").gameObject;
            DeathSprite     = t.FindEx("DeathSprite").gameObject;
            if (t.Find("HireSprite") != null)
            {
                HireSprite = t.FindEx("HireSprite").gameObject;
            }

            Transform ps = t.Find("ps");

            if (ps != null)
            {
                SleepPS = ps.gameObject;
            }

            Transform mercenarytemp = t.Find("Flag");

            if (mercenarytemp != null)
            {
                MercenaryUseFlag = mercenarytemp.gameObject;
            }

            Transform dragScroll = t.Find("Icon");

            if (dragScroll != null)
            {
                dragScrollView = dragScroll.GetComponent <UIDragScrollView>();

                DragClassifyEventDispatcher draDispatcher = dragScroll.GetComponent <DragClassifyEventDispatcher>();
                if (draDispatcher != null)
                {
                    draDispatcher.onDragFunc.Add(new EventDelegate(OnDrag));
                    draDispatcher.onDragStartFunc.Add(new EventDelegate(OnDragStart));
                    draDispatcher.onDragEndFunc.Add(new EventDelegate(OnDragEnd));
                }
            }

            if (IconSprite)
            {
                listener          = UIEventListener.Get(IconSprite.gameObject);
                listener.onClick += OnClick;
            }
        }
コード例 #13
0
    static int OnPan(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UIDragScrollView obj  = (UIDragScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIDragScrollView");
        Vector2          arg0 = LuaScriptMgr.GetVector2(L, 2);

        obj.OnPan(arg0);
        return(0);
    }
コード例 #14
0
ファイル: CreatureIcon.cs プロジェクト: sakura68/portfolio
    public void RemoveDragScrollView()
    {
        UIDragScrollView uiDragScrollView = gameObject.GetComponent <UIDragScrollView>();

        if (uiDragScrollView != null)
        {
            Destroy(uiDragScrollView);
        }
    }
コード例 #15
0
    public void CloseScrollView()
    {
        UIDragScrollView component = base.GetComponent <UIDragScrollView>();

        if (component != null)
        {
            component.enabled = false;
        }
    }
コード例 #16
0
    public void Fill(Component com, MyJson.IJsonNode json)
    {
        UIDragScrollView t = com as UIDragScrollView;
        var jsono          = json as MyJson.JsonNode_Object;

        if (jsono.ContainsKey("scrollView"))
        {
            t.scrollView = (GameObjParser.IDToObj(jsono["scrollView"] as MyJson.JsonNode_ValueNumber)).GetComponent <UIScrollView>();
        }
    }
コード例 #17
0
    /// <summary>
    /// Cache the transform.
    /// </summary>

    protected virtual void Start()
    {
        mTrans          = transform;
        mCollider       = collider;
        mButton         = GetComponent <UIButton>();
        mDragScrollView = GetComponent <UIDragScrollView>();
        mTexture        = GetComponent <UITexture>();

        updatePosition();
    }
コード例 #18
0
    /// <summary>
    /// 生成物品选择UI
    /// </summary>
    private void CreateItemChooseUI()
    {
        if (null == m_grid_GridContent || null == data || null == data.cloneTemp)
        {
            return;
        }
        if (null != m_label_Title)
        {
            m_label_Title.text = data.title;
        }
        bool isNull = (data.createNum == 0) ? true :false;

        if (null != m_label_NullTips)
        {
            if (m_label_NullTips.gameObject.activeSelf != isNull)
            {
                m_label_NullTips.gameObject.SetActive(isNull);
            }
            if (isNull)
            {
                m_label_NullTips.text = data.nullTips;
            }
        }
        if (!isNull)
        {
            GameObject       cloneObj       = null;
            UIDragScrollView dragScrollVeiw = null;
            for (int i = 0; i < data.createNum; i++)
            {
                cloneObj = NGUITools.AddChild(m_grid_GridContent.gameObject, data.cloneTemp);
                if (null == cloneObj)
                {
                    continue;
                }
                dragScrollVeiw = cloneObj.GetComponent <UIDragScrollView>();
                if (null == dragScrollVeiw)
                {
                    dragScrollVeiw = cloneObj.AddComponent <UIDragScrollView>();
                }
                if (null != data.gridCreateCallback)
                {
                    data.gridCreateCallback.Invoke(cloneObj, i);
                }
            }
            if (null != data.desPassCallback)
            {
                data.desPassCallback.Invoke(m_label_Des);
            }
            m_grid_GridContent.Reposition();
            if (null != m_scrollview_SelectScrollView)
            {
                m_scrollview_SelectScrollView.ResetPosition();
            }
        }
    }
コード例 #19
0
    public override void OnInit()
    {
        base.OnInit();
        AddPropChangedNotify((int)MVCPropertyID.enShopProps, OnPropertyChanged);
        m_gridList          = new Dictionary <int, UIDragScrollView>();
        m_ringHonorGridList = new Dictionary <int, UIDragScrollView>();

//        m_PlayEnter     = FindChildComponent<UIPanel>("Enter");
        m_MagicStoe      = FindChildComponent <UIPanel>("StoneShopPanel");
        m_Recruitment    = FindChildComponent <UIPanel>("RecruitmentPanel");
        m_item           = FindChildComponent <UIDragScrollView>("StoneGrid");
        m_stoneGridList  = FindChildComponent <UIGrid>("StoneGridList");
        m_friendShipText = FindChildComponent <UILabel>("RecruitmentMoreText");
        m_friendRecruitmentMoreButton = FindChildComponent <UIButton>("FriendRecruitmentMore");
        m_friendRecruitmentOnceButton = FindChildComponent <UIButton>("FriendRecruitmentOnce");
        m_stoneRecruitmentButton      = FindChildComponent <UIButton>("StoneRecruitmentButton");
        m_stoneRecruitmentGrid        = FindChildComponent <UISprite>("StoneRecruitmentGrid");
        m_recoverStaminaButton        = FindChildComponent <UIButton>("RecoverStamina");
        m_recoverEnergyButton         = FindChildComponent <UIButton>("RecoverEnergy");
        m_recoverStaminaButtonLable   = FindChildComponent <UILabel>("StaminaLabel");
        m_recoverEnergyButtonLable    = FindChildComponent <UILabel>("EnergyLabel");
        m_friendShipNum    = FindChildComponent <UILabel>("FriendShipNum");
        m_ringOdHonorPanel = FindChildComponent <UIPanel>("RingOfHonorPanel");
        m_cardGridList     = FindChildComponent <UIGrid>("CardGridList");

        m_ringHonorPos = m_cardGridList.GetComponent <Parma>().m_id * 0.01f;

        m_ringItem      = FindChildComponent <UIDragScrollView>("CardInfoPanel");
        m_cardListPanel = FindChildComponent <UIPanel>("ExcangeCardList");
        m_cardListPanel.transform.GetComponent <UIScrollView>().onDragFinished = OnScrollDragFinish;


        m_skillItem           = FindChildComponent <UITexture>("SkillItem");
        m_skillGirdList       = FindChildComponent <UIGrid>("Skill");
        m_tips                = FindChildComponent <UISprite>("Tips");
        m_skillName           = FindChildComponent <UILabel>("SkillName");
        m_skillDes            = FindChildComponent <UILabel>("SkillDes");
        m_skillCD             = FindChildComponent <UILabel>("SkillCD");
        m_expandFriendsLabel  = FindChildComponent <UILabel>("ExpandFriendsLabel");
        m_expandFriendsBG     = FindChildComponent <UISprite>("ExpandFriendsBG");
        m_expandFriendsButton = FindChildComponent <UIButton>("ExpandFriends");
        m_recoverEnergyBG     = FindChildComponent <UISprite>("RecoverEnergyBG");
        m_recoverStaminaBG    = FindChildComponent <UISprite>("RecoverStaminaBG");
//        m_enterIdButton = FindChildComponent<UIButton>("EnterIdBtn");
        m_enterCardIdInput       = FindChildComponent <UIInput>("Input");
        m_ringOfHonorButtonLeft  = FindChildComponent <UIButton>("Selectturn_left");
        m_ringOfHonorButtonRight = FindChildComponent <UIButton>("Selectturn_right");
        m_ringHonorBar           = FindChildComponent <UIProgressBar>("RingOfHonorCardBar");


        //m_ringHonorBar.onDragFinished = OnScrollBar;
        //EventDelegate.Add(m_ringHonorBar.onChange, OnScrollBar);
    }
コード例 #20
0
    public MyJson.IJsonNode Parser(Component com, NeedList needlist)
    {
        UIDragScrollView t = com as UIDragScrollView;
        var json           = new MyJson.JsonNode_Object();

        if (t.scrollView != null)
        {
            json["scrollView"] = new MyJson.JsonNode_ValueNumber(GameObjParser.ObjToID(t.scrollView.gameObject));
        }

        return(json);
    }
コード例 #21
0
    public void Init(string name, GameObject scrollView)
    {
        levelName = name;
        string catagory = director.GetCatagoryString(levelName);

        labelTitle.text = director.GetAbbreviation(catagory);
        labelName.key   = "LK" + levelName + "Title";

        UIDragScrollView dragScroll = this.gameObject.GetComponent <UIDragScrollView>();

        dragScroll.scrollView = scrollView.GetComponent <UIScrollView>();
    }
コード例 #22
0
        public static void AddDragScrollView()
        {
            UIScrollView view = Selection.activeGameObject.GetComponent <UIScrollView>();

            foreach (BoxCollider2D box in view.GetComponentsInChildren <BoxCollider2D>(true))
            {
                UIDragScrollView drag = box.gameObject.GetComponentEx <UIDragScrollView>();
                drag.scrollView = view;
                CompatibilityEditor.SetDirty(drag);
                Debug.Log("Add DragScrollView for " + box.transform.GetScenePath(), box.gameObject);
            }
        }
コード例 #23
0
 void OnEnable()
 {
     if (scroll == null)
     {
         scroll = gameObject.GetComponentEx <UIDragScrollView>();
         transform.localScale = Vector3.one;
     }
     if (resetPosition)
     {
         scroll.scrollView.ResetPosition();
     }
 }
コード例 #24
0
 static public int get_scrollView(IntPtr l)
 {
     try {
         UIDragScrollView self = (UIDragScrollView)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.scrollView);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #25
0
    // Use this for initialization

    public override void OnStart()
    {
        Gamestate gs = GameObject.FindGameObjectWithTag("Gamestate").GetComponent <Gamestate> ();

        if (gs && gs.achievementManager)
        {
            int unlockedAmount = 0;
            for (int i = 0; i < gs.achievementManager.achievements.Length; i++)
            {
                Achievement achievement = gs.achievementManager.achievements[i];
                GameObject  obInst      = (GameObject)Instantiate(prefabContentAchievement);
                obInst.name                    = achievement.id;
                obInst.transform.parent        = panelContainer.transform;
                obInst.transform.localScale    = new Vector3(1, 1, 1);
                obInst.transform.localPosition = new Vector3(0, 200 - (i * 150), 0);

                UIDragScrollView scrollView = obInst.GetComponent <UIDragScrollView>();
                scrollView.scrollView = panelContainer.GetComponent <UIScrollView>();

                GameManager.SetNGUILabel(obInst.transform.Find("Label Name"), achievement.id);
                GameManager.SetNGUILabel(obInst.transform.Find("Label Description"), achievement.desc);
                string sAmount = achievement.rewardAmount.ToString() + " ";
                if (achievement.rewardType == AchievementReward.Coin)
                {
                    sAmount += "Gemu Gold";
                }
                else if (achievement.rewardType == AchievementReward.Ticket)
                {
                    sAmount += "Gemu Points";
                }
                else if (achievement.rewardType == AchievementReward.Exp)
                {
                    sAmount += "Exp";
                }

                GameManager.SetNGUILabel(obInst.transform.Find("Label Reward"), sAmount);
                string sKey = "AC_" + achievement.id + "_" + achievement.amount;
                if (PlayerPrefs.HasKey(sKey))
                {
                    unlockedAmount++;
                    //PlayerPrefs.SetInt(sKey,1);
                    //PlayerPrefs.DeleteKey("AC_"+achievement.id+"_"+achievement.amount); //for testing
                    Transform trIconLock = obInst.transform.Find("Icon");
                    if (trIconLock)
                    {
                        trIconLock.gameObject.SetActive(false);
                    }
                }
            }
            labelInfo.text = unlockedAmount.ToString() + "/" + gs.achievementManager.achievements.Length;
        }
    }
コード例 #26
0
	/// <summary>
	/// Cache the transform.
	/// </summary>

	protected virtual void Start ()
	{
		mTrans = transform;
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
		mCollider = collider;
		mCollider2D = collider2D;
#else
		mCollider = gameObject.GetComponent<Collider>();
		mCollider2D = gameObject.GetComponent<Collider2D>();
#endif
		mButton = GetComponent<UIButton>();
		mDragScrollView = GetComponent<UIDragScrollView>();
	}
コード例 #27
0
    /// <summary>
    /// Cache the transform.
    /// </summary>

    protected virtual void Start()
    {
        mTrans = transform;
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
        mCollider   = collider;
        mCollider2D = collider2D;
#else
        mCollider   = gameObject.GetComponent <Collider>();
        mCollider2D = gameObject.GetComponent <Collider2D>();
#endif
        mButton         = GetComponent <UIButton>();
        mDragScrollView = GetComponent <UIDragScrollView>();
    }
コード例 #28
0
    public void SetSlotScrollDragEnable(bool isEnable)
    {
        for (int i = 0; i < RecycleObjectList.Count; i++)
        {
            UIDragScrollView sc = RecycleObjectList[i].GetComponent <UIDragScrollView>();
            if (sc == null)
            {
                continue;
            }

            sc.enabled = isEnable;
        }
    }
コード例 #29
0
    /// <summary>
    /// Cache the transform.
    /// </summary>

    protected virtual void Start()
    {
        try
        {
            mTrans          = transform;
            mCollider       = GetComponent <Collider>();
            mDragScrollView = GetComponent <UIDragScrollView>();
        }
        catch (System.Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace);
        }
    }
コード例 #30
0
    public void OnScrollviewDragStarted(GameObject go)
    {
        UIDragScrollView ds = go.GetComponent <UIDragScrollView>();

        if (ds != null && ds.scrollView != null)
        {
            //isVertEnable = ds.scrollView.movement != UIScrollView.Movement.Vertical;
            isHorzEnable = ds.scrollView.movement != UIScrollView.Movement.Horizontal;
        }
        else
        {
            //isVertEnable = true;
            isHorzEnable = true;
        }

        //if(!MUtils.IsActive(containPanel.transform)) return;
        if (!IsChild(containPanel.transform, go.transform))
        {
            return;
        }
        if (startSlide)
        {
            return;
        }

        Vector3 mousePos = Input.mousePosition;

        float nguiScreenHeigth = uiroot.activeHeight;
        float nguiScreenWidth  = uiroot.activeHeight * uiroot.manualWidth / uiroot.manualHeight;

        //需要把原点改为屏幕中心
        mousePos.x = (mousePos.x / Screen.width - 0.5f) * nguiScreenWidth;
        mousePos.y = (mousePos.y / Screen.height - 0.5f) * nguiScreenHeigth;

        //string debugText = string.Format("{0}, {1}", nguiScreenWidth, nguiScreenHeigth);

        //判断是否在区域内
        if ((rect.x <= mousePos.x && mousePos.x <= rect.y) &&
            (rect.z <= mousePos.y && mousePos.y <= rect.w))
        {
            //debugText += ", In";
            startSlide    = true;
            dragAmount    = Vector2.zero;
            dragStartTime = Time.time;
            dragStartPos  = Input.mousePosition;
        }
        //else
        //	debugText += ", Out";
        //Debug.Log(debugText + mousePos);
        //Debug.Log("start at: " + Input.mousePosition + ", gameObject = " + go.name);
    }
コード例 #31
0
 static public int OnPan(IntPtr l)
 {
     try {
         UIDragScrollView    self = (UIDragScrollView)checkSelf(l);
         UnityEngine.Vector2 a1;
         checkType(l, 2, out a1);
         self.OnPan(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #32
0
 static public int set_scrollView(IntPtr l)
 {
     try {
         UIDragScrollView self = (UIDragScrollView)checkSelf(l);
         UIScrollView     v;
         checkType(l, 2, out v);
         self.scrollView = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #33
0
ファイル: UIDragDropItem.cs プロジェクト: floatyears/Decrypt
 protected virtual void Start()
 {
     this.mTrans = base.transform;
     this.mCollider = base.collider;
     this.mCollider2D = base.collider2D;
     this.mButton = base.GetComponent<UIButton>();
     this.mDragScrollView = base.GetComponent<UIDragScrollView>();
 }
コード例 #34
0
 /// <summary>
 /// Cache the transform.
 /// </summary>
 protected virtual void Start()
 {
     mTrans = transform;
     mCollider = GetComponent<Collider>();
     mDragScrollView = GetComponent<UIDragScrollView>();
        UiSprite = GetComponent<UISprite>();
 }
コード例 #35
0
	/// <summary>
	/// Cache the transform.
	/// </summary>

	protected virtual void Start ()
	{
		mButton = GetComponent<UIButton>();
		mDragScrollView = GetComponent<UIDragScrollView>();
	}
コード例 #36
0
	/// <summary>
	/// Cache the transform.
	/// </summary>

	protected virtual void Start ()
	{
		mTrans = transform;
		mCollider = collider;
		mDragScrollView = GetComponent<UIDragScrollView>();
	}
コード例 #37
0
ファイル: UIDragDropItem.cs プロジェクト: GameDiffs/TheForest
 protected virtual void Start()
 {
     this.mButton = base.GetComponent<UIButton>();
     this.mDragScrollView = base.GetComponent<UIDragScrollView>();
 }