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;
    }
Exemple #2
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);
        }
    }
    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));
        }
    }
        protected override void Init()
        {
            labTitle          = FindInChild <UILabel>("common/title/label");
            labCurTitle       = FindInChild <UILabel>("center/title");
            btnClose          = FindInChild <Button>("top/btn_close");
            centerOnChild     = FindInChild <UICenterOnChild>("center/container/oncenter");
            gridCenterOnChild = FindInChild <UIGrid>("center/container/oncenter");
            gridList          = transform.GetComponentsInChildren <UIGrid>();

            try
            {
                centerOnChild.enabled = false;

                foreach (UIGrid grid in gridList)
                {
                    grid.repositionNow = true;
                }

                InitRewardItemList();
                InitLabel();

                maxPage   = gridCenterOnChild.maxPerLine;
                pageIndex = FindChild("center/fanye").AddMissingComponent <PageIndex>();
                pageIndex.RegisterOnCenter(centerOnChild);
                pageIndex.InitPage(1, maxPage);

                btnClose.onClick += CloseOnClick;
            }
            finally
            {
                centerOnChild.enabled = true;
            }
        }
    static int set_onCenter(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UICenterOnChild obj = (UICenterOnChild)o;
            UICenterOnChild.OnCenterCallback arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (UICenterOnChild.OnCenterCallback)ToLua.CheckObject(L, 2, typeof(UICenterOnChild.OnCenterCallback));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(UICenterOnChild.OnCenterCallback), func) as UICenterOnChild.OnCenterCallback;
            }

            obj.onCenter = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onCenter on a nil value" : e.Message));
        }
    }
    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;
            }
        }
    }
Exemple #7
0
 static public int set_onCenter(IntPtr l)
 {
     try {
         UICenterOnChild self = (UICenterOnChild)checkSelf(l);
         UICenterOnChild.OnCenterCallback v;
         int op = LuaDelegation.checkDelegate(l, 2, out v);
         if (op == 0)
         {
             self.onCenter = v;
         }
         else if (op == 1)
         {
             self.onCenter += v;
         }
         else if (op == 2)
         {
             self.onCenter -= v;
         }
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 void Start()
 {
     if (null == centerOnChild)
     {
         centerOnChild = this.GetComponent <UICenterOnChild>();
     }
 }
    static int set_onFinished(IntPtr L)
    {
        object          o   = LuaScriptMgr.GetLuaObject(L, 1);
        UICenterOnChild obj = (UICenterOnChild)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name onFinished");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index onFinished on a nil value");
            }
        }

        LuaTypes funcType = LuaDLL.lua_type(L, 3);

        if (funcType != LuaTypes.LUA_TFUNCTION)
        {
            obj.onFinished = (SpringPanel.OnFinished)LuaScriptMgr.GetNetObject(L, 3, typeof(SpringPanel.OnFinished));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3);
            obj.onFinished = () =>
            {
                func.Call();
            };
        }
        return(0);
    }
        protected override void Init()
        {
            InitLabelLanguage();
            btn_close        = FindInChild <Button> ("btn_guanbi");
            closeBackground  = FindInChild <UISprite> ("btn_guanbi/background");
            fightEnd         = FindInChild <Transform> ("FastFightResult/Center/Grid/End").gameObject;
            resultGrid       = FindInChild <UIGrid> ("FastFightResult/Center/Grid");
            resultCenter     = FindInChild <UICenterOnChild> ("FastFightResult/Center");
            resultScrollView = FindInChild <UIScrollView> ("FastFightResult");
            background       = FindInChild <BoxCollider> ("Background/tipsk");
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/01").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/02").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/03").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/04").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/05").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/06").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/07").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/08").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/09").gameObject);
            fightResult.Add(FindInChild <Transform> ("FastFightResult/Center/Grid/10").gameObject);

            btn_close.onClick = CloseFastFightView;
            for (int i = 0; i < fightResult.Count; ++i)
            {
                foreach (Transform goods in fightResult[i].transform.FindChild("Goods"))
                {
                    goods.GetComponent <Button>().onClick = GoodsOnClick;
                }
            }
        }
Exemple #11
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);
        }
    }
    private static int set_onFinished(IntPtr L)
    {
        object          luaObject       = LuaScriptMgr.GetLuaObject(L, 1);
        UICenterOnChild uICenterOnChild = (UICenterOnChild)luaObject;

        if (uICenterOnChild == null)
        {
            LuaTypes luaTypes = LuaDLL.lua_type(L, 1);
            if (luaTypes == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name onFinished");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index onFinished on a nil value");
            }
        }
        LuaTypes luaTypes2 = LuaDLL.lua_type(L, 3);

        if (luaTypes2 != LuaTypes.LUA_TFUNCTION)
        {
            uICenterOnChild.onFinished = (SpringPanel.OnFinished)LuaScriptMgr.GetNetObject(L, 3, typeof(SpringPanel.OnFinished));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3);
            uICenterOnChild.onFinished = delegate
            {
                func.Call();
            };
        }
        return(0);
    }
Exemple #13
0
    public override void OnInit()
    {
        base.OnInit();
        AddPropChangedNotify((int)MVCPropertyID.enMainMenu, OnPropertyChanged);
        AddPropChangedNotify((int)MVCPropertyID.enUserProps, OnUserPropsChanged);
        AddPropChangedNotify((int)MVCPropertyID.enSceneManager, OnPropertySceneChanged);


        //-----属相相关----
        UICenterOnChild onCenterChild = FindChild("WrapContent").GetComponent <UICenterOnChild>();

        onCenterChild.onCenter = OnCenterCallback;
        GameObject headPanel = FindChild("HeadPanel");

        //m_expLabel              = FindChildComponent<UILabel>("ExpLabel", headPanel);
        m_expProcess = FindChildComponent <UIProgressBar>("ExpProcess", headPanel);
        m_levelLabel = FindChildComponent <UILabel>("LabelLevel", headPanel);
        m_portrait   = FindChild("portrait", headPanel);
        GameObject goldPanel = FindChild("GoldPanel");

        m_moneyLabel = FindChildComponent <UILabel>("Label", goldPanel);

        RefreshShowProps();

        //添加的队列1 的测试数据
        MainMenu.Singleton.Test();
    }
Exemple #14
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);
        }
    }
Exemple #15
0
 static public int set_onFinished(IntPtr l)
 {
     try {
         UICenterOnChild        self = (UICenterOnChild)checkSelf(l);
         SpringPanel.OnFinished v;
         int op = LuaDelegation.checkDelegate(l, 2, out v);
         if (op == 0)
         {
             self.onFinished = v;
         }
         else if (op == 1)
         {
             self.onFinished += v;
         }
         else if (op == 2)
         {
             self.onFinished -= v;
         }
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #16
0
 void Awake()
 {
     if (TransChildCount > 0)
     {
         for (int i = 0; i < TransChildCount; i++)
         {
             Children.Add(transform.GetChild(i));
         }
         this.mTotalCount = TransChildCount;
         Sorting();
         ResetChildrenPosition();
     }
     if (Panel != null)
     {
         Panel.onClipMove = WrapContent;
     }
     if (isChildOnCenter)
     {
         if (UICenterOnChild == null)
         {
             uiCenterOnChild         = gameObject.AddComponent <UICenterOnChild>();
             uiCenterOnChild.enabled = pivot != UIWidget.Pivot.Center;
         }
     }
     else if (UICenterOnChild != null)
     {
         Destroy(uiCenterOnChild);
         uiCenterOnChild = null;
     }
 }
	void Start ()
	{
		this.onChild = GetComponent<UICenterOnChild> ();

		packManager = PackageListManager.Instance;
		packManager.onListLoaded += Instance_onListLoaded;
	}
Exemple #18
0
        public override void Awake()
        {
            base.Awake();

            var tRoot = controller.transform;

            controller.backButton = tRoot.GetComponent <UIButton>("Edge/TopRight/CancelBtn");
            var tGrid = tRoot.FindEx("Center/Scroll/PlaceHolder/Grid");

            ItemList = new List <GameObject>();

            for (var i = 0; i < tGrid.childCount; i++)
            {
                ItemList.Add(tGrid.GetChild(i).gameObject);
            }

            DropSprite     = tRoot.GetComponent <UISprite>("Edge/Bottom/LevelDesc/Icon");
            PartnerLabel   = tRoot.GetComponent <UILabel>("Edge/BottomRight/Desc");
            CenterOnChild  = tGrid.GetComponent <UICenterOnChild>();
            LevelDescLabel = tRoot.GetComponent <UILabel>("Edge/Bottom/LevelDesc/Desc");
            LevelNumLabel  = tRoot.GetComponent <UILabel>("Edge/Bottom/LevelDesc/Num");
            GoldColor      = new Color32(251, 239, 70, 255);
            ExpColor       = new Color32(102, 255, 254, 255);
            GoldFx         = tRoot.Find("Center/GoldBG").gameObject;
            ExpFx          = tRoot.Find("Center/ExpBG").gameObject;
            var tItemList = tRoot.FindEx("Edge/BottomRight/ItemList");

            mPartnerDataItems = new List <LTpartnerInfoItem>();

            for (var i = 0; i < tItemList.childCount; i++)
            {
                mPartnerDataItems.Add(tItemList.GetChild(i).GetMonoILRComponent <LTpartnerInfoItem>());
            }

            StartPos = tGrid.FindEx("Sprite (3)/StartPos");

            BattleBtn = tRoot.GetComponent <UIButton>("Edge/Bottom/StartBtn");
            BattleBtn.onClick.Clear();
            BattleBtn.onClick.Add(new EventDelegate(OnBattleBtnClick));
            LastTimesLabel = BattleBtn.transform.GetComponent <UILabel>("Num");

            BlitzBtn = tRoot.GetComponent <UIButton>("Edge/Bottom/BlitzBtn");
            BlitzBtn.onClick.Clear();
            BlitzBtn.onClick.Add(new EventDelegate(OnBlitzBtnClick));
            BlitzTimesLabel = BlitzBtn.transform.GetComponent <UILabel>("Num");

            LockBtn = tRoot.GetComponent <UIButton>("Edge/Bottom/LockBtn");
            LockBtn.onClick.Clear();
            LockBtn.onClick.Add(new EventDelegate(OnBattleBtnClick));
            UnLockLevelLabel = LockBtn.transform.GetComponent <UILabel>("Desc");

            var noticeBtn = tRoot.GetComponent <UIButton>("Edge/Notice");

            noticeBtn.onClick.Clear();
            noticeBtn.onClick.Add(new EventDelegate(OnNoticeBtnClick));

            C_VigorController = tRoot.GetMonoILRComponent <EnterVigorController>("Edge/Bottom/StartBtn/Sprite");
            B_VigorController = tRoot.GetMonoILRComponent <EnterVigorController>("Edge/Bottom/BlitzBtn/Sprite");
        }
Exemple #19
0
    // Use this for initialization
    void OnEnable()
    {
        tempBool      = action = false;
        centerOnChild = WrapContent.GetComponent <UICenterOnChild>();
//		scrollviewOffsetX = Panel.transform.localPosition.x;
        Panel.GetComponent <UIScrollView>().ResetPosition();
//		Panel.transform.localPosition = new Vector3(scrollviewOffsetX,Panel.transform.localPosition.y,Panel.transform.localPosition.z);
    }
    static int Recenter(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UICenterOnChild obj = (UICenterOnChild)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UICenterOnChild");

        obj.Recenter();
        return(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);
    }
Exemple #22
0
 void OnDisable()
 {
     if (centerOnChild == null)
     {
         centerOnChild = GetComponent <UICenterOnChild>();
     }
     centerOnChild.onFinished -= OnFinished;
     centerOnChild.onCenter   -= OnCenter;
 }
 void Awake()
 {
     centerChild = gameObject.GetComponent <UICenterOnChild> ();
     mPanel      = gameObject.GetComponent <UIPanel> ();
     if (centerChild != null)
     {
         centerChild.onFinished = adjustPage;
     }
 }
    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);
    }
Exemple #25
0
 /// <summary>
 /// 注册到UICenterOnChild,让UICenterOnChild触发滑页变化
 /// </summary>
 /// <param name="center">Center.</param>
 public void RegisterOnCenter(UICenterOnChild center)
 {
     centerOnChild = center;
     centerOnChild.onCenterFinish = PageIndexCallBack;
     //if (center != null)
     //{
     //this.centerOnChild = center;
     //NGUITools.FindInParents<UIScrollView>(center.gameObject).onDragFinished+=PageIndexCallBack;
     //}
 }
Exemple #26
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     centerOnChild         = GetComponent <UICenterOnChild>();
     centerOnChild.enabled = false;
     fijarEnUsuario        = false;
 }
Exemple #27
0
 public override void Init()
 {
     this.WaitingView_open();
     this.mToggleCache       = this.transform.Find("LeftAnchor/Panel/Grid/ToggleCache").gameObject;
     this.mToggleGrid        = this.transform.Find("LeftAnchor/Panel/Grid").GetComponent <UIGrid>();
     this.mGoodsGrid         = this.transform.Find("RightAnchor/ScrollView/Grid").GetComponent <UIGrid>();
     this.mGoodsPanel        = this.transform.Find("RightAnchor/ScrollView").GetComponent <UIPanel>();
     this.mGoodsCenterHelper = this.mGoodsGrid.GetComponent <UICenterOnChild>();
     this.mItemCache         = (Resources.Load("Prefab/UI/Shop/ShopItem") as GameObject);
     this.mScrollBar         = this.transform.Find("RightAnchor/ProgBar").GetComponent <UIScrollBar>();
 }
Exemple #28
0
 static public int get_springStrength(IntPtr l)
 {
     try {
         UICenterOnChild self = (UICenterOnChild)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.springStrength);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #29
0
 static public int Recenter(IntPtr l)
 {
     try {
         UICenterOnChild self = (UICenterOnChild)checkSelf(l);
         self.Recenter();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #30
0
 static public int get_nextPageThreshold(IntPtr l)
 {
     try {
         UICenterOnChild self = (UICenterOnChild)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.nextPageThreshold);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #31
0
 static public int get_centeredObject(IntPtr l)
 {
     try {
         UICenterOnChild self = (UICenterOnChild)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.centeredObject);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #32
0
	void Awake (){
		HeadItem = GameObject.Find("Item");
		headList = HeadItem.transform.parent.gameObject;
		HeadItem.SetActive(false);
		HeadItem.transform.parent = null;
//		GameObject item;
//
//		for(int i =0;i<100;i++){
//			item = Instantiate(Item,Item.transform.position,Item.transform.rotation) as GameObject;
//			item.transform.parent = List.transform;
//			item.transform.localScale = List.transform.localScale;
//		}
		BodyItem=GameObject.Find("Item_body_img");
		bodyList = BodyItem.transform.parent.gameObject;
		BodyItem.SetActive(false);
		BodyItem.transform.parent = null;

//		for(int i = 0;i<10;i++){
//			item = Instantiate(Item_body_img,Item_body_img.transform.position,Item_body_img.transform.rotation) as GameObject;
//			item.transform.parent = List.transform;
//			item.transform.localScale = List.transform.localScale;
//		}
		uiCenterOnChild = NGUITools.FindInParents<UICenterOnChild>(bodyList.gameObject);
		if(uiCenterOnChild!=null && uiCenterOnChild.enabled){
			uiCenterOnChild.onFinished = onDragFinished;
		}else{
			UIScrollView scrollview = NGUITools.FindInParents<UIScrollView>(bodyList.gameObject);

		scrollview.onDragFinished = onDragFinished;
		}


		selectItem = NGUITools.AddSprite(headList.transform.parent.gameObject,LoaderManager.loaderManager.GetUIatlas("formation"),"potential/highlight");
		selectItem.width = 128;
		selectItem.height = 128;
		NGUITools.NormalizeWidgetDepths();

		selectItem.transform.position = Vector3.zero;
		selectItem.transform.localPosition = Vector3.zero;

		head_bodys = new List<Head_Body>();
		for(int i = 0;i<10;i++){
			AddHero();
		}
		selectItem.depth = NGUITools.CalculateNextDepth(headList.gameObject);
		UIScrollView headscrollview = NGUITools.FindInParents<UIScrollView>(headList.gameObject);
		Debug.Log("bounds:"+headscrollview.bounds.size);

	}
Exemple #33
0
 void Start()
 {
     uigrid = this.GetComponent<UIGrid>();
     if(uigrid == null){
         Debug.LogError("UIGrid must in parent");
     }
     dynamicGrid = this.GetComponent<DynamicGrid>();
     if(uigrid == null){
         Debug.LogError("DynamicGrid must in parent");
     }
     centerOnChild = this.GetComponent<UICenterOnChild>();
     if(centerOnChild == null){
         Debug.LogError("UICenterOnChild must in parent");
     }
     centerOnChild.recalculateCenterCellOnUpdate = true;
 }
		void Start () 
		{
			if (null == targetScrollView)
			{
				Debug.LogError("TooltipPaginationDots: target scroll view not set!");
				enabled = false;
				return;
			}

			_centerOnChild = targetScrollView.gameObject.GetComponent<UICenterOnChild>();
			if (null == _centerOnChild)
			{
				Debug.LogError("TooltipPaginationDots: target scroll view has no UICenterOnChild component!");
				enabled = false;
				return;
			}

			_centerOnChild.OnCenteredObjectChanged = UpdatePageDot;

			if (null != dotSprites && dotSprites.Length > 0)
				dotSprites[0].color = activeColor;
		}
	void Start ()
	{
		_centerOnChildUi = GetComponent<UICenterOnChild>();

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

		_scrollViewUi = GetComponent<UIScrollView>();

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

		_scrollViewStartYPos = _scrollViewUi.transform.localPosition.y;

		Init();

		// HACK: Causes the dynamic fonts on children to layer correctly
		NGUITools.SetActive (gameObject, false);
		NGUITools.SetActive (gameObject, true);
	}
 private void Start()
 {
     this.mCenter = NGUITools.FindInParents<UICenterOnChild>(base.gameObject);
     this.mPanel = NGUITools.FindInParents<UIPanel>(base.gameObject);
 }
	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();
	}
Exemple #38
0
    // Use this for initialization
    void Start()
    {
        if( m_BtnMore == null )
        {
            Debug.LogError("The 'BtnMore' has not assigle!" ,this);
            return;
        }

        if( m_BtnClose == null )
        {
            Debug.LogError("The 'BtnClose' has not assigle!" ,this);
            return;
        }

        if( m_MoreWidget == null )
        {
            Debug.LogError("The 'MoreWidget' has not assigle!" ,this);
            return;
        }

        //
        if( m_InputPanelLeft == null )
        {
            Debug.LogError( "The InputPanelLeft has not assigned.", this );
            return;
        }

        //
        if( m_InputPanelRight == null )
        {
            Debug.LogError( "The InputPanelRight has not assigned.", this );
            return;
        }

        //
        m_GridItems = m_GridApartmentLayout.GetComponentsInChildren<MainScene.ApartmentLayoutItem>();

        //
        if( m_GridItems == null || m_GridItems.Length <= 0 )
        {
            Debug.LogError( "The GridItems is Null or Empty.", this );
            return;
        }

        //
        if( m_GridDefaultItem == null )
            m_GridDefaultItem = m_GridItems[0];

        //
        if( m_GridDefaultItem == null )
        {
            Debug.LogError( "The GridDefaultItem has not assigned.", this );
            return;
        }

        //
        m_UICenterOnChild = m_GridApartmentLayout.GetComponent<UICenterOnChild>();

        //
        if( m_UICenterOnChild == null )
        {
            Debug.LogError( "The GridApartmentLayout has not assigned Component:'UICenterOnChild'.", this );
            return;
        }

        AddListenner();

        m_MoreWidget.gameObject.SetActive(false);

        m_bInited = true;
    }
	void Start ()
	{
		mCenter = NGUITools.FindInParents<UICenterOnChild>(gameObject);
		mPanel = NGUITools.FindInParents<UIPanel>(gameObject);
	}
Exemple #40
0
    private void Start()
    {
        // Get the current prize index
        int index = PlayerPrefsFast.GetInt(this.RewardIndexKey, 0);

        // Get the last time a reward was given
        string lastDateString = PlayerPrefsFast.GetString(this.LastDateRewardKey, string.Empty);
        DateTime lastDate;
        bool parsed = DateTime.TryParse(lastDateString, out lastDate);

        if (parsed)
        {
            // Give reward after 1 day
            if (lastDate.AddDays(1) <= DateTime.Now)
            {
                // Give reward, and then set it to the next index
                index++;
                List<Transform> childRewards = this.RewardsGrid.GetChildList();

                // Make sure we don't give more rewards that we hvae set up
                if (index <= childRewards.Count)
                {
                    foreach (Transform child in childRewards)
                    {
                        DailyReward dailyReward = child.GetComponent<DailyReward>();

                        if (dailyReward != null)
                        {
                            dailyReward.SetCurrentReward(index);

                            if (dailyReward.Day == index)
                            {
                                this.centerOnChildTarget = child.GetComponent<UICenterOnChild>();
                            }
                        }
                    }

                    PlayerPrefsFast.SetInt(this.RewardIndexKey, index);
                    PlayerPrefsFast.SetString(this.LastDateRewardKey, DateTime.Now.ToString());
                    PlayerPrefsFast.Flush();

                    this.RewardsGrid.enabled = true;
                    this.RewardsGrid.repositionNow = true;
                    this.refreshGrid = true;
                }
                else
                {
                   this.gameObject.SetActive(false);
                }
            }
            else
            {
                this.gameObject.SetActive(false);
            }
        }
        else
        {
            // It's the first time, so set the date as now
            PlayerPrefsFast.SetString(this.LastDateRewardKey, DateTime.Now.ToString());
            PlayerPrefsFast.Flush();

            this.gameObject.SetActive(false);
        }
    }
        // Use this for initialization
        private void Start()
        {
            //
            if( m_InputPanelLeft == null )
            {
                Debug.LogError( "The InputPanelLeft has not assigned.", this );
                return;
            }

            //
            if( m_InputPanelRight == null )
            {
                Debug.LogError( "The InputPanelRight has not assigned.", this );
                return;
            }

            //
            if( m_GridApartmentLayout == null )
            {
                Debug.LogError( "The GridApartmentLayout has not assigned.", this );
                return;
            }

            //
            m_GridItems = m_GridApartmentLayout.GetComponentsInChildren<ApartmentLayoutItem>();

            //
            if( m_GridItems == null || m_GridItems.Length <= 0 )
            {
                Debug.LogError( "The GridItems is Null or Empty.", this );
                return;
            }

            //
            if( m_GridDefaultItem == null )
                m_GridDefaultItem = m_GridItems[0];

            //
            if( m_GridDefaultItem == null )
            {
                Debug.LogError( "The GridDefaultItem has not assigned.", this );
                return;
            }

            //
            m_UICenterOnChild = m_GridApartmentLayout.GetComponent<UICenterOnChild>();

            //
            if( m_UICenterOnChild == null )
            {
                Debug.LogError( "The GridApartmentLayout has not assigned Component:'UICenterOnChild'.", this );
                return;
            }

            //			//
            //			if( string.IsNullOrEmpty( m_WaveLeftGestureName ) )
            //			{
            //				Debug.LogError( "The WaveLeftGestureName is Null or Empty", this );
            //				return;
            //			}
            //
            //			//
            //			if( string.IsNullOrEmpty( m_WaveRightGestureName ) )
            //			{
            //				Debug.LogError( "The WaveRightGestureName is Null or Empty", this );
            //				return;
            //			}

            //
            m_Menu = this.GetComponent<Menu>();

            //
            if( m_Menu == null )
            {
                Debug.LogError( "This GameObject has not assigned Component:'Menu'.", this );
                return;
            }

            //
            m_Menu.OnOpen += this.OnMenuOpen;
            m_Menu.OnOpened += this.OnMenuOpened;

            //
            m_UICenterOnChild.onCenter = OnCenterStart;
            m_UICenterOnChild.onFinished = OnCenterFinished;

            //
            UIEventListener listener = UIEventListener.Get( m_InputPanelLeft.gameObject );
            listener.onHover = this.OnHoverInputPanelLeft;
            listener.onClick = this.OnClickedInputPanelLeft;

            listener = UIEventListener.Get( m_InputPanelRight.gameObject );
            listener.onHover = this.OnHoverInputPanelRight;
            listener.onClick = this.OnClickedInputPanelRight;

            //
            StartCoroutine( DelayInit() );
        }
Exemple #42
0
	void Awake()
	{
		centerOnChild = GetComponent<UICenterOnChild>();
	}
    private void Start()
    {
        //lay character ve
        HTTPRequest request = new HTTPRequest(new Uri(APIUrl.UrlCharater), HTTPMethods.Get, OnCharacterFinished);
        request.Send();

        username = GameObject.Find("usernameSignup").GetComponent<UIInput>();
        password = GameObject.Find("passwordSignup").GetComponent<UIInput>();
        confirmPassword = GameObject.Find("confirmPassword").GetComponent<UIInput>();
        characterSelected = GameObject.Find("characterList").GetComponent<UICenterOnChild>();
        characterList = GameObject.Find("characterList").GetComponent<UIGrid>();
    }
Exemple #44
0
 void Awake()
 {
     if (TransChildCount > 0)
     {
         for (int i = 0; i < TransChildCount; i++)
             Children.Add(transform.GetChild(i));
         this.mTotalCount = TransChildCount;
         Sorting();
         ResetChildrenPosition();
     }
     if (Panel != null) Panel.onClipMove = WrapContent;
     if (isChildOnCenter)
     {
         if (UICenterOnChild == null)
         {
             uiCenterOnChild = gameObject.AddComponent<UICenterOnChild>();
             uiCenterOnChild.enabled = pivot != UIWidget.Pivot.Center;
             if (isInvalidateBounds) uiCenterOnChild.onFinished = InvalidateBounds;
         }
     }
     else if (UICenterOnChild != null)
     {
         Destroy(uiCenterOnChild);
         uiCenterOnChild = null;
     }
 }
Exemple #45
0
	void OnDisable()
	{
		if( centerOnChild == null ) centerOnChild = GetComponent<UICenterOnChild>();			
		centerOnChild.onFinished 	-= OnFinished;
		centerOnChild.onCenter 		-= OnCenter;
	}