コード例 #1
0
    void OnClick()
    {
        GameObject tab = GameObject.FindGameObjectWithTag("TabOpened");

        centerOnChildComp = tab.GetComponent <UICenterOnChild>();
        table             = tab.GetComponent <UITable>();

        if (next)
        {
            int index = table.GetChildList().IndexOf(centerOnChildComp.centeredObject.transform) + 1;
            if (index < table.GetChildList().Count)
            {
                centerOnChildComp.CenterOn(table.GetChildList()[index]);
            }
        }
        else
        {
            int index = table.GetChildList().IndexOf(centerOnChildComp.centeredObject.transform) - 1;
            if (index > -1)
            {
                centerOnChildComp.CenterOn(table.GetChildList()[index]);
            }
        }

        //sv.customMovement = v;
    }
コード例 #2
0
        //刷新扫荡奖励
        private void UpdateFightAward(int num)
        {
            fightResult [num - 1].transform.FindChild("jlnr/Exp/Value").GetComponent <UILabel> ().text   = awards [num - 1].exp.ToString();
            fightResult [num - 1].transform.FindChild("jlnr/Money/Value").GetComponent <UILabel> ().text = awards [num - 1].gold.ToString();
            Transform goods;

            for (int i = 0; i < MAX_AWARD_GOOD_NUM; ++i)
            {
                goods = fightResult [num - 1].transform.FindChild("Goods/" + (i + 1));
                if (i < awards [num - 1].goodsId.Count)
                {
                    ShowGoods(goods, awards [num - 1].goodsId[i], awards [num - 1].idType);
                    goods.gameObject.SetActive(true);
                    goods.gameObject.GetComponent <TweenScale>().from  = new Vector3(1.2f, 1.2f, 1.2f);
                    goods.gameObject.GetComponent <TweenScale>().to    = Vector3.one;
                    goods.gameObject.GetComponent <TweenScale>().delay = i * 0.2f;
                    goods.gameObject.GetComponent <TweenPlay>().PlayForward();
                }
                else
                {
                    goods.gameObject.SetActive(false);
                }
            }
            fightResult [num - 1].SetActive(true);

            resultGrid.Reposition();
            if (num > 2)
            {
                resultCenter.enabled = true;
                resultCenter.CenterOn(fightResult [num - 1].transform);
            }
        }
コード例 #3
0
 void FijarEnUsuario()
 {
     if (GPS.Instance.UserInBounds())
     {
         centerOnChild.CenterOn(GPS.Instance.userLocation.point);
     }
 }
コード例 #4
0
 public override IEnumerator OnRemoveFromStack()
 {
     FusionAudio.StopBGM();
     CenterOnChild.onCenter -= OnCenter;
     CenterOnChild.CenterOn(StartPos);
     curObj = null;
     DestroySelf();
     yield break;
 }
コード例 #5
0
ファイル: MiningWindow.cs プロジェクト: xiney1986/SDKProject
    public void UpdatePageInfo()
    {
        editTeam = false;

        if (MiningManagement.Instance.NewEnemyNum != 0)
        {
            tips.SetActive(true);
            newEnemyNum.text = MiningManagement.Instance.NewEnemyNum.ToString();
        }
        searchMoney.text  = MiningManagement.Instance.GetSearchMineralConsume();
        searchMoney2.text = MiningManagement.Instance.GetSearchMineralConsume();
        //获取矿坑信息
        minerals = MiningManagement.Instance.GetMinerals();
        //加载队伍信息
        LoadTeam();
        //矿坑存在则打开对应页面,否则关闭并且对页面重新排序
        if (minerals[0] != null)
        {
            pageObj[0].SetActive(true);
            ResourcesManager.Instance.LoadAssetBundleTexture("texture/backGround/" + MiningManagement.Instance.GetMineralBackground(0), backgorundsInPage[0]);
        }
        else
        {
            pageObj[0].SetActive(false);
        }
        if (minerals[1] != null)
        {
            pageObj[1].SetActive(true);
            ResourcesManager.Instance.LoadAssetBundleTexture("texture/backGround/" + MiningManagement.Instance.GetMineralBackground(1), backgorundsInPage[1]);
        }
        else
        {
            pageObj[1].SetActive(false);
        }

        if (pageIndex == 2 && searchAnim.transform.parent.gameObject.activeSelf)
        {
            searchAnim.transform.parent.gameObject.SetActive(false);
            searchAnim.Stop();
            fightButtonGroup.SetActive(true);
            fightInfo.SetActive(true);
            if (playerRoleInPage3 != null)
            {
                for (int i = 0; i < 5; i++)
                {
                    playerRoleInPage3[i].gameObject.SetActive(true);
                }
            }
        }

        OrderPagePostion(); //重新对页面排序
        updatePvp();        //更新pvpbar
        updateButton();     //更新button状态
        UpdateInfo();       //跟新页面信息
        centerOnChild.CenterOn(pageObj[pageIndex].transform);
    }
コード例 #6
0
    public void DeleteCurrentSelect()
    {
        if (father.centeredObject != null)
        {
            if (File.Exists(getPathFile("TommyPlayground_" + father.centeredObject.name + ".png")))
            {
                father.enabled = false;

                UITexture current = father.centeredObject.GetComponent <UITexture> ();
                //  Erase (current);
                System.IO.File.Delete(getPathFile("TommyPlayground_" + father.centeredObject.name + ".png"));
                //  EventDelegate.Execute(buttonBack.onClick);
                father.CenterOn(null);
                current.gameObject.SetActive(false);
                father.enabled = true;
                //  EraseAll();
                //  EnableAll();
                //backgroundSelected.AddFromOnCenter ();

                //father.enabled = true;
                //    father.Recenter ();
                //  --number;
                //  PlayerPrefs.SetInt("CountImages",number);
            }
        }
    }
コード例 #7
0
ファイル: UICenterOnClick.cs プロジェクト: leedae/MonsterFace
    void OnClick()
    {
        if (mCenter != null)
        {
            //if (mCenter.enabled)
            mCenter.CenterOn(transform);

            Camera curCamera;
            curCamera = GameObject.Find("Camera").GetComponent <Camera>();

            Ray ray = curCamera.camera.ScreenPointToRay(Input.mousePosition);

            if (Input.GetMouseButtonUp(0))
            {
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                {
                    string name = hit.collider.gameObject.name;
                    CommonFunc.s_iScrollIndex = int.Parse(name);
                    Debug.Log(name);
                }
            }
        }
        //if (mPanel != null && mPanel.clipping != UIDrawCall.Clipping.None)
        //{
        //    SpringPanel.Begin(mPanel.cachedGameObject, mPanel.cachedTransform.InverseTransformPoint(transform.position), 6f);
        //    Debug.Log("111?");
        //}
    }
コード例 #8
0
 public void ResetToFirstDay()
 {
     if (transform.childCount > 0)
     {
         _centerOnChildUi.CenterOn(transform.GetChild(0));
     }
 }
コード例 #9
0
    /// <summary>
    /// This method correct the selection through keyboard
    /// or game control.
    /// </summary>
    public void Update()
    {
        // Check of alpha prevents that UIScrollView constantly be located.
        // Caused by NGUI 3.5.4
        if (UICamera.selectedObject == gameObject &&
            transform.FindChild("Hover").GetComponent <UIWidget>().color.a < 1)
        {
            // Was added from the 3.5.9 version of NGUI.
            UICenterOnChild center     = NGUITools.FindInParents <UICenterOnChild>(gameObject);
            UIScrollView    scrollView = NGUITools.FindInParents <UIScrollView>(gameObject);

            Transform panelTrans = scrollView.panel.cachedTransform;

            Vector3 objectPoint = panelTrans.InverseTransformPoint(gameObject.transform.position);
            Vector3 panelPoint  = panelTrans.InverseTransformPoint(
                (scrollView.panel.worldCorners[2] + scrollView.panel.worldCorners[0]) * 0.5f);
            Vector3 offset = objectPoint - panelPoint;

            if (!scrollView.canMoveVertically)
            {
                offset.y = 0f;
            }
            offset.z = 0f;

            SpringPanel.Begin(
                scrollView.panel.cachedGameObject,
                panelTrans.localPosition - offset,
                8f);

            // backward compatibility with v3.5.5 -> v3.5.8 NGUI.
            center.CenterOn(transform);
        }
    }
コード例 #10
0
    public void OnClick()
    {
        UICenterOnChild center = NGUITools.FindInParents <UICenterOnChild>(gameObject);
        UIPanel         panel  = NGUITools.FindInParents <UIPanel>(gameObject);

        if (center != null)
        {
            if (center.enabled)
            {
                center.CenterOn(transform);
            }
        }
        else if (panel != null && panel.clipping != UIDrawCall.Clipping.None)
        {
            UIScrollView sv     = panel.GetComponent <UIScrollView>();
            Vector3      offset = -panel.cachedTransform.InverseTransformPoint(transform.position);
            if (!sv.canMoveHorizontally)
            {
                offset.x = panel.cachedTransform.localPosition.x;
            }
            if (!sv.canMoveVertically)
            {
                offset.y = panel.cachedTransform.localPosition.y;
            }
            SpringPanel.Begin(panel.cachedGameObject, offset, 6f);
        }
    }
コード例 #11
0
    public void MoveToCurrentDeckPos(GameObject centeredObject)
    {
        centerOnChild.onCenter -= MoveToCurrentDeckPos;

        SpringPanel.Stop(scrollView.gameObject);
        centerOnChild.CenterOn(curSelectedMainSlot.transform);
    }
コード例 #12
0
    private void OnClick()
    {
        UICenterOnChild uicenterOnChild = NGUITools.FindInParents <UICenterOnChild>(base.gameObject);
        UIPanel         uipanel         = NGUITools.FindInParents <UIPanel>(base.gameObject);

        if (uicenterOnChild != null)
        {
            if (uicenterOnChild.enabled)
            {
                uicenterOnChild.CenterOn(base.transform);
            }
        }
        else if (uipanel != null && uipanel.clipping != UIDrawCall.Clipping.None)
        {
            UIScrollView component = uipanel.GetComponent <UIScrollView>();
            Vector3      pos       = -uipanel.cachedTransform.InverseTransformPoint(base.transform.position);
            if (!component.canMoveHorizontally)
            {
                pos.x = uipanel.cachedTransform.localPosition.x;
            }
            if (!component.canMoveVertically)
            {
                pos.y = uipanel.cachedTransform.localPosition.y;
            }
            SpringPanel.Begin(uipanel.cachedGameObject, pos, 6f);
        }
    }
コード例 #13
0
ファイル: CardSelect.cs プロジェクト: jsh6858/FreeDust
    public void OnClickCard(int index)
    {
        if (!_centerChild.gameObject.activeSelf)
        {
            _centerChild.gameObject.SetActive(true);
        }

        for (int i = 0; i < cards.Length; ++i)
        {
            if (i == index) // Select
            {
                cards[i].OnSelected();
                _iSelected = i;

                if (cards[i]._cardType == CARD_TYPE.END)
                {
                    CenterCallBack(_centerChild.centeredObject);
                }
                else
                {
                    _centerChild.CenterOn(_centerChild.transform.GetChild((int)cards[i]._cardType));
                }
            }
            else // Deselect
            {
                cards[i].onDeSelected();
            }
        }
    }
コード例 #14
0
ファイル: UI_Contest.cs プロジェクト: zhengfujun/Encyclopedia
    IEnumerator _Scroll(int index)
    {
        int j = 0;

        while (true)
        {
            if (index == 0 && ScrollStop[index])
            {
                yield break;
            }

            if (index != 0 && ScrollStop[0] && ScrollRes[0] == ScrollRes[index])
            {
                yield break;
            }

            Transform       child = WrapContentRoot[index].GetChild(j);
            UICenterOnChild coc   = child.GetComponent <UICenterOnChild>();
            coc.CenterOn(child);
            ScrollRes[index] = j;

            yield return(new WaitForSeconds(ScrollInterval[index]));

            j++;
            if (j >= WrapContentRoot[index].childCount)
            {
                j = 0;
            }
        }
    }
コード例 #15
0
 private void InitSelect(int index)
 {
     if (index < mScroll.activates.Count)
     {
         CenterOnChild.CenterOn(mScroll.activates[index].transform);
     }
 }
コード例 #16
0
        //打开界面,设置当前可领取
        private void setCurerntCanGetItem(int day)
        {
            int    current  = day - 1;
            string itemName = "goodsListContainer/grid/item_" + current;

            centerOnChild.CenterOn(centerOnChild.transform.Find(itemName));
        }
コード例 #17
0
ファイル: UI_Contest.cs プロジェクト: zhengfujun/Encyclopedia
    IEnumerator _BeginScroll()
    {
        ScrollCoro = new Coroutine[3] {
            null, null, null
        };
        ScrollInterval = new float[3] {
            0.1f, 0.1f, 0.1f
        };
        ScrollRes = new int[3] {
            0, 0, 0
        };
        ScrollStop = new bool[3] {
            false, false, false
        };

        for (int i = 0; i < WrapContentRoot.Length; i++)
        {
            Transform       child = WrapContentRoot[i].GetChild(0);
            UICenterOnChild coc   = child.GetComponent <UICenterOnChild>();
            coc.CenterOn(child);
        }

        for (int i = 0; i < WrapContentRoot.Length; i++)
        {
            ScrollCoro[i] = StartCoroutine("_Scroll", i);

            yield return(new WaitForSeconds(0.2f));
        }
    }
コード例 #18
0
 /// <summary>
 /// This function is called whenever the BackPack UI Component is active in the hiearchy.
 /// </summary>
 private void OnEnable()
 {
     UpdateBackPackContent();
     if (equippedItem != null)
     {
         gridCenterComponent.CenterOn(equippedItem.transform);
     }
 }
コード例 #19
0
    private static int CenterOn(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UICenterOnChild uICenterOnChild = (UICenterOnChild)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UICenterOnChild");
        Transform       target          = (Transform)LuaScriptMgr.GetUnityObject(L, 2, typeof(Transform));

        uICenterOnChild.CenterOn(target);
        return(0);
    }
コード例 #20
0
 void CenterOnTransformIndex(int index)
 {
     RecenterTargetWidgetIndex = index;
     _uiCenterOnChild.CenterOn(_cycledTransforms[index]);
     if (onCenterOnChildStarted != null)
     {
         onCenterOnChildStarted();
     }
 }
コード例 #21
0
ファイル: OdometerDigit.cs プロジェクト: zhydian/ChimeraTV
    void Update()
    {
        if (newValue > 9)
        {
            newValue = 9;
            //just in case something odd gets passed in, we don't want an endless loop
        }

        if (newValue != value)
        {
            value++;
            if (value > 9)
            {
                value = 0;
            }
            centerer.CenterOn(centerer.transform.GetChild(value));
        }
    }
コード例 #22
0
    static int CenterOn(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UICenterOnChild obj  = (UICenterOnChild)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UICenterOnChild");
        Transform       arg0 = (Transform)LuaScriptMgr.GetUnityObject(L, 2, typeof(Transform));

        obj.CenterOn(arg0);
        return(0);
    }
コード例 #23
0
 public void SetBanner(GameObject _goBanner)
 {
     //Debug.Log (_goBanner.name);
     if (m_goCenter != _goBanner)
     {
         m_goCenter = _goBanner;
         m_csCenterOnChild.CenterOn(_goBanner.transform);
     }
     else
     {
     }
 }
コード例 #24
0
    void TestRemoveItemRight()
    {
        m_Choose = m_Temp2[2];
        m_Temp2[0].SetDetail(Core.Data.vipManager.GetVipInfoData(Vipindex + 1));
        mCenter.onFinished = DelegatePanelSet;
        mCenter.CenterOn(m_Temp2[2].gameObject.transform);

        m_Temp[0] = new Vector3(m_Temp[2].x + m_Width, m_Temp[2].y, m_Temp[2].z);
        m_Temp2[0].gameObject.transform.localPosition = m_Temp[0];
        m_Temp2[1].SetPanel(0f);
        Vector3 _temp = m_Temp[0];

        m_Temp[0] = m_Temp[1];
        m_Temp[1] = m_Temp[2];
        m_Temp[2] = _temp;

        UIVipGiftCell _Temp = m_Temp2[0];

        m_Temp2[0] = m_Temp2[1];
        m_Temp2[1] = m_Temp2[2];
        m_Temp2[2] = _Temp;
    }
コード例 #25
0
    private void OnClick()
    {
        //IL_0001: Unknown result type (might be due to invalid IL or missing references)
        //IL_0006: Expected O, but got Unknown
        //IL_001a: Unknown result type (might be due to invalid IL or missing references)
        //IL_001f: Expected O, but got Unknown
        //IL_0021: Unknown result type (might be due to invalid IL or missing references)
        //IL_0026: Expected O, but got Unknown
        //IL_002d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0032: Expected O, but got Unknown
        //IL_0081: Unknown result type (might be due to invalid IL or missing references)
        //IL_0086: Unknown result type (might be due to invalid IL or missing references)
        //IL_008b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0090: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ab: Unknown result type (might be due to invalid IL or missing references)
        //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
        UICenterOnClick uICenterOnClick = NGUITools.FindInParents <UICenterOnClick>(this.get_gameObject());

        if (!(uICenterOnClick == null))
        {
            Transform       val             = uICenterOnClick.get_transform();
            UICenterOnChild uICenterOnChild = NGUITools.FindInParents <UICenterOnChild>(this.get_gameObject());
            UIPanel         uIPanel         = NGUITools.FindInParents <UIPanel>(this.get_gameObject());
            if (uICenterOnChild != null)
            {
                if (uICenterOnChild.get_enabled())
                {
                    uICenterOnChild.CenterOn(val);
                }
            }
            else if (uIPanel != null && uIPanel.clipping != 0)
            {
                UIScrollView component = uIPanel.GetComponent <UIScrollView>();
                Vector3      pos       = -uIPanel.cachedTransform.InverseTransformPoint(val.get_position());
                if (!component.canMoveHorizontally)
                {
                    Vector3 localPosition = uIPanel.cachedTransform.get_localPosition();
                    pos.x = localPosition.x;
                }
                if (!component.canMoveVertically)
                {
                    Vector3 localPosition2 = uIPanel.cachedTransform.get_localPosition();
                    pos.y = localPosition2.y;
                }
                SpringPanel.Begin(uIPanel.cachedGameObject, pos, 6f);
            }
        }
    }
コード例 #26
0
 static public int CenterOn(IntPtr l)
 {
     try {
         UICenterOnChild       self = (UICenterOnChild)checkSelf(l);
         UnityEngine.Transform a1;
         checkType(l, 2, out a1);
         self.CenterOn(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #27
0
 void OnClick()
 {
     if (mCenter != null)
     {
         if (mCenter.enabled)
         {
             mCenter.CenterOn(transform);
         }
     }
     else if (mPanel != null && mPanel.clipping != UIDrawCall.Clipping.None)
     {
         SpringPanel.Begin(mPanel.cachedGameObject, mPanel.cachedTransform.InverseTransformPoint(transform.position), 6f);
     }
 }
コード例 #28
0
 static int CenterOn(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UICenterOnChild       obj  = (UICenterOnChild)ToLua.CheckObject <UICenterOnChild>(L, 1);
         UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
         obj.CenterOn(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #29
0
    public void SetBanner(GameObject _goBanner)
    {
        //Debug.Log (_goBanner.name);
        if (m_goCenter != _goBanner)
        {
            m_goCenter = _goBanner;
            m_csCenterOnChild.CenterOn(_goBanner.transform);

            int banner_id = int.Parse(_goBanner.name.Replace(STR_PAGE_ROOT, ""));
            m_iPageIndex = banner_id;
            SetExplainText(m_goCenter);
        }
        else
        {
        }
    }
コード例 #30
0
 public void Centering(Transform target, bool is_instant = false)
 {
     if (centerOnChild == null)
     {
         reserveTarget = target;
     }
     else
     {
         if (is_instant)
         {
             centerOnChild.springStrength = 99999f;
             lastTarget = null;
         }
         centerOnChild.CenterOn(target);
     }
 }
コード例 #31
0
	private void Init()
	{
		GameObject firstChild = null;

		GameObject dayOfWeekContainerToMake = (GameObject)Resources.Load(PrefabPath + PrefabName);

		if (null == dayOfWeekContainerToMake)
		{
			Debug.LogError("DayOfWeekController.Init - can't load prefab" + PrefabPath + PrefabName);
			return;
		}

		for (int i = 0; i < NumberOfTheDaysView; i++) 
		{
			
			GameObject dayOfWeekChild = NGUITools.AddChild(gameObject, dayOfWeekContainerToMake);

			if (null == dayOfWeekChild)
			{
				Debug.LogError("DayOfWeekController.Init - can't add prefab to scroll view parent: " + PrefabPath + PrefabName);
				return;
			}

			UIWidget widget = dayOfWeekChild.GetComponent<UIWidget>();

			if (null==widget)
			{
				throw new MissingComponentException("DayOfWeekController.Init - can't get UIWidget component from " + dayOfWeekChild.name);
			}

			if (i > 0)
				_nextChildPositionY -= widget.height + _childYOffset;

			Vector3 widgetPosition = widget.transform.localPosition;

			widget.transform.localPosition = new Vector3(widgetPosition.x, _nextChildPositionY, widgetPosition.z);

			DayOfWeekModel dayOfWeekModel = dayOfWeekChild.GetComponent<DayOfWeekModel>();

			if (null == dayOfWeekModel)
			{
				throw new MissingComponentException("DayOfWeekController.Init - can't get DayOfWeekModel component from " + dayOfWeekChild.name);
			}

			dayOfWeekModel.Init(i);

			if (0 == i)
			{
				firstChild = dayOfWeekChild;
			}

			// Scale effect
			var scaleEffect = dayOfWeekChild.AddComponent<ScrollItemScale>();
			scaleEffect.ParentScrollView = _scrollViewUi;
		}

		if (null == firstChild)
		{
			throw new MissingComponentException("DayOfWeekController.Init - firstChild is not setting");
		}

		Destroy(_centerOnChildUi);

		_centerOnChildUi = gameObject.AddComponent<UICenterOnChild>();

		if (null == _centerOnChildUi)
		{
			throw new MissingComponentException("DayofWeekController.Start - can't get UICenterOnChild component");
		}
		

		_centerOnChildUi.CenterOn(firstChild.transform);

		_centerOnChildUi.onFinished = UpdateSelectedDay;

		_scrollViewUi.ResetPosition();

		UpdateSelectedDay();
	}