Пример #1
0
 /// <summary>
 /// 刷新界面
 /// </summary>
 void OnMagicTypeUpdate()
 {
     //数据变更,刷新界面
     for (int i = 0; i < magicGoList.Count; i++)
     {
         //刷新法宝
         magicGoList[i].GetComponent <MagicToggleUI>().SetMagicInfo(refList[i]);
     }
     if (!isActive)
     {
         for (int i = 0; i < refList.Count; i++)
         {
             if (refList[i].RefineLev >= 2)
             {
                 isActive = true;
                 if (toggleAddSoul != null)
                 {
                     toggleAddSoul.GetComponent <BoxCollider>().enabled = isActive;
                 }
                 break;
             }
         }
     }
     //刷新属性
     magicAttributeUI.SetMagicAttribute(MagicWeaponInfo);
     //刷新提升界面
     changeUI.SetMagicAttributeChange(MagicWeaponInfo);
 }
Пример #2
0
 public void SetPlayer(OtherPlayerInfo _player)
 {
     player = _player;
     if (player == null)
     {
         return;
     }
     if (name != null)
     {
         name.text = player.Name;
     }
     if (lev != null)
     {
         lev.text = player.LevelDes;
     }
     if (fight != null)
     {
         fight.text = player.FightValue.ToString();
     }
     if (profName != null)
     {
         profName.text = player.ProfName;
     }
     if (icon != null)
     {
         icon.spriteName = player.IconName;
     }
     if (isSelect != null)
     {
         isSelect.value = false;
         isSelect.GetComponent <BoxCollider>().enabled = true;
     }
 }
Пример #3
0
 //设置阶段切换按钮状态
 private void SetUIToggleState(UIToggle stageButton, bool state)
 {
     if (state)
     {
         stageButton.GetComponent <BoxCollider>().enabled = true;
         UIUtils.ChangeNormalShader(stageButton.FindInChild <UISprite>("background"), NORMAL_COPY_POINT_DEPTH);
     }
     else
     {
         stageButton.GetComponent <BoxCollider>().enabled = false;
         UIUtils.ChangeGrayShader(stageButton.FindInChild <UISprite>("background"), GRAY_COPY_POINT_DEPTH);
     }
 }
 public void IgnoreCollider(bool ignore)
 {
     if (null != eventBtn && null != eventBtn.transform.GetComponent <Collider>())
     {
         eventBtn.GetComponent <Collider>().enabled = !ignore;
     }
 }
Пример #5
0
    public void ServerEditMode(bool edit)
    {
        if (edit && !Topan.Network.isServer)
        {
            return;
        }

        serverEditMode = edit;
        backButton.SetActive(!edit);
        portForwardCheckbox.GetComponent <UIButton>().isEnabled = !edit;
        hostLocalCheckbox.GetComponent <UIButton>().isEnabled   = !edit;
        ButtonAction hsbBA = hostServerButton.GetComponent <ButtonAction>();

        gameNameInput.GetComponent <AlphaGroupUI>().alpha  = (edit) ? 0.5f : 1f;
        gameNameInput.GetComponent <BoxCollider>().enabled = !edit;

        maxPlayerSlider.GetComponent <AlphaGroupUI>().alpha  = (edit) ? 0.5f : 1f;
        maxPlayerSlider.GetComponent <BoxCollider>().enabled = !edit;
        //maxPlayerSlider.GetComponent<UISlider>().thumb.GetComponent<BoxCollider>().enabled = !edit;

        if (edit)
        {
            hostServerButton.cachedLabel.text            = "SAVE CHANGES";
            hsbBA.sendMessage.genericMessage.messageName = "UpdateSettings";
        }
        else
        {
            hostServerButton.cachedLabel.text            = "START SERVER";
            hsbBA.sendMessage.genericMessage.messageName = "StartServer";
        }
    }
Пример #6
0
    //打开按钮状态
    private void enableCheckState(UIToggle toggle)
    {
        SiftItemModule sim = toggle.GetComponent <SiftItemModule> ();

        if (sim.checkedBg != null)
        {
            sim.checkedBg.gameObject.SetActive(true);
        }
//		if (sim.text != null)
//			sim.text.color = Colors.BUTTON_TEXT_NROMAL;
        if (sim.bg != null)
        {
            sim.bg.color = Color.white;
        }
        toggle.GetComponent <BoxCollider> ().enabled = true;
    }
Пример #7
0
 public void InitToggles()
 {
     if (toggleMap != null)
     {
         return;
     }
     toggleMap = new Dictionary <string, UIToggle>();
     foreach (GameObject o in toggleObj)
     {
         if (o != null)
         {
             toggleMap[o.name] = o.GetComponent <UIToggle>();
         }
     }
     foreach (GameObject b in toggleObj)
     {
         if (b != null)
         {
             UIToggle t = b.FindComponent <UIToggle>();
             if (t.GetComponent <BoxCollider2D>() == null)
             {
                 NGUITools.AddWidgetCollider(t.gameObject);
             }
             EventDelegateUtil.AddCallback(t.onChange, OnToggleChange, t);
         }
     }
 }
Пример #8
0
        protected void Start()
        {
            StartBtn.isEnabled     = false;
            RefuelBtn.isEnabled    = false;
            ReductionBtn.isEnabled = false;
            if (AutoToggle != null)
            {
                AutoToggle.GetComponent <UIButton>().isEnabled = false;
            }
            var reductionBtnL = UIEventListener.Get(ReductionBtn.gameObject);

            reductionBtnL.onPress = OnReductionBtnPress;
            var refuelBtnL = UIEventListener.Get(RefuelBtn.gameObject);

            refuelBtnL.onPress = OnRefuelBtnPress;
        }
Пример #9
0
    //关闭按钮
    private void disableCheckState(UIToggle toggle)
    {
        toggle.value = false;
        SiftItemModule sim = toggle.GetComponent <SiftItemModule> ();

        if (sim.checkedBg != null)
        {
            sim.checkedBg.gameObject.SetActive(false);
        }
//		if (sim.text != null)
//			sim.text.color = Color.gray;
        if (sim.bg != null)
        {
            sim.bg.color = Color.gray;
        }
        toggle.GetComponent <BoxCollider> ().enabled = false;
    }
Пример #10
0
 public void restTabStrip()
 {
     if (disableTab != -1)
     {
         tabs[disableTab].GetComponent <UIButton>().isEnabled = true;
     }
     disableTab = -1;
     currentActive.GetComponent <UIButton>().SetState(UIButton.State.Normal, false);
 }
Пример #11
0
    //设置按钮状态
    private void setCheckState(UIToggle toggle)
    {
        toggle.startsActive = false;
        SiftItemModule sim = toggle.GetComponent <SiftItemModule> ();

        sim.checkedBg.gameObject.SetActive(false);
        sim.text.color = Color.gray;
        //sim.bg.color = Color.gray;
    }
Пример #12
0
        public void OnExtendBtnClick()
        {
            //mPanel.widgetsAreStatic = false;
            expandTweener.Play(expandToggle.value);
            //expandTweener.SetOnFinished(delegate () {
            //    //mPanel.widgetsAreStatic = true;
            //});
            UISprite sprite = expandToggle.GetComponent <UISprite>();

            sprite.fillGeometry = !expandToggle.value;
            sprite.geometry.Clear();
            sprite.MarkAsChanged();
        }
 void EnableBoxEvent(bool enable)
 {
     //for (int i = 0; i < SpriteEasyOrHigh.Length; i++)
     for (int i = 0; i < SpriteEasyOrHigh.Length - 1; i++)
     {
         SpriteEasyOrHigh[i].GetComponent <BoxCollider>().enabled = enable;
     }
     InputPassWord.GetComponent <BoxCollider>().enabled  = enable;
     BtnCreateRoom.GetComponent <BoxCollider>().enabled  = enable;
     BtnBack.GetComponent <BoxCollider>().enabled        = enable;
     BtnCreateMenu.GetComponent <BoxCollider>().enabled  = enable;
     BtnAddRoomMenu.GetComponent <BoxCollider>().enabled = enable;
 }
Пример #14
0
        void TabOnChange()
        {
            UIToggle toggle = UIToggle.current;

            if (toggle.value)
            {
                UIToggleRender tRender = toggle.GetComponent <UIToggleRender>();
                if (tRender != null)
                {
                    TriggerRenderEvent("OnChange", tRender.data);
                }
            }
        }
Пример #15
0
    void SetToggleBox()
    {
        UIToggle tog = null;

        for (int i = 0; i < items.Count; i++)
        {
            tog = items[i].isSelect;
            if (tog != null && items[i].GetPlayer() != null && !SelectIDs.Contains(items[i].GetPlayer().ServerInstanceID))
            {
                tog.GetComponent <BoxCollider>().enabled = (SelectIDs.Count + count) < 3;
            }
        }
    }
Пример #16
0
        /// <summary>
        /// 根据当前的toggle状态显示群信息
        /// </summary>
        /// <param name="toggle"></param>
        public void CurrentGroupShow(UIToggle toggle)
        {
            if (toggle.value)
            {
                PlayerPrefs.SetString("teaSelectIndex", toggle.name);
                GroupModificaOwner.gameObject.SetActive(false);
                GroupModificaOther.gameObject.SetActive(false);
                _currentToggle = toggle;
                GroupPeopleBg.SetActive(false);
                CurrentGroupName.text = toggle.GetComponent <NnFriendGroupItem>().CurrentGroupName;
                CurrentGroupSign.text = toggle.GetComponent <NnFriendGroupItem>().CurrentGroupSign;
                CurrentGroupId.text   = string.Format("(ID:{0})", toggle.GetComponent <NnFriendGroupItem>().CurrentGroupId);
                var teaId = toggle.GetComponent <NnFriendGroupItem>().CurrentGroupId;
                TeahouseController.Instance.CurrentTeaId = teaId;
                _currenrGroupOwnerId = toggle.GetComponent <NnFriendGroupItem>().CurrentGroupOwnerId;
                _curPageNum          = 0;
                var dict = new Dictionary <string, object>();
                dict["tea_id"] = teaId;
                dict["p"]      = _curPageNum;
//                Facade.Instance<TwManager>().SendActions(new []{ "friends.findGroupFriend" , "friends.getGroupRooms"}, dict, GroupFriendCallBack);
                Facade.Instance <TwManager>().SendAction("friends.findGroupFriend", dict, GroupFriendCallBack);
                Facade.Instance <TwManager>().SendAction("friends.getGroupRooms", dict, GroupRoomData);
                if (_currenrGroupOwnerId == UserInfoModel.Instance.UserInfo.UserId)
                {
                    _isCurrentGroupOwner = true;
                    var dic = new Dictionary <string, object>();
                    dic["tea_id"] = teaId;
                    Facade.Instance <TwManager>().SendAction("friends.wiatFriendApply", dic, UserApplyCallBack);
                }
                else
                {
                    BtnWaitApply.SetActive(false);
                    GroupPeopleInfo.SetActive(false);
                    BtnRemind.SetActive(false);
                    _isCurrentGroupOwner = false;
                }
            }
        }
Пример #17
0
 void addToggleDelegate()
 {
     for (int i = 0; i < itemTotalCount; i++)
     {
         UIToggle to = selectPanel.transform.GetChild(i).GetComponent <UIToggle> ();
         to.onChange.Add(new EventDelegate(() => {
             if (to.value)
             {
                 StorageItem im = to.GetComponent <StorageItem> ();
                 insertSelectPanel(im);
             }
         }));
     }
 }
Пример #18
0
    void OnSelectCard()
    {
        int heroId;

        if (pai1.value)
        {
            SelectCard.selectCardName = pai1.GetComponent <UISprite>().spriteName;
            SelectCard.selectCardId   = ((LoginVO)login[1]).card_id;
            InsHero("yx_011");
            heroId        = int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3));
            heroName.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].name;

            des.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].describe;

            SetDingweiAndTedian(heroId);
            InitSkillData(heroId);
            skillMultList.InSize(4, 2);
            skillMultList.Info(skilldata.ToArray());
        }
        else if (pai2.value)
        {
            SelectCard.selectCardName = pai2.GetComponent <UISprite>().spriteName;
            SelectCard.selectCardId   = ((LoginVO)login[2]).card_id;
            InsHero("yx_014");
            heroId        = int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3));
            heroName.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].name;

            des.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].describe;

            InitSkillData(int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3)));
            SetDingweiAndTedian(int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3)));
            skillMultList.InSize(4, 2);
            skillMultList.Info(skilldata.ToArray());
        }
        else if (pai3.value)
        {
            SelectCard.selectCardName = pai3.GetComponent <UISprite>().spriteName;
            SelectCard.selectCardId   = ((LoginVO)login[3]).card_id;
            InsHero("yx_010");
            heroId        = int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3));
            heroName.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].name;

            des.text = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].describe;

            InitSkillData(int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3)));
            SetDingweiAndTedian(int.Parse(StringUtil.StrReplace((SelectCard.selectCardId).ToString(), "201", 0, 3)));
            skillMultList.InSize(4, 2);
            skillMultList.Info(skilldata.ToArray());
        }
    }
Пример #19
0
        /// <summary>
        /// 选项卡按钮的默认状态
        /// </summary>
        /// <param name="current"></param>
        private void setTabDefaultState(UIToggle current)
        {
            if (disableTabTest(current))
            {
                return;
            }
            UIButton btn = current.GetComponent <UIButton>();

            btn.enabled = true;
            btn.SetState(UIButtonColor.State.Normal, true);
            int index = int.Parse(current.gameObject.name.Substring(current.name.Length - 1));

            current.GetComponent <UISprite>().depth = 12 - index;
            switch (activeState)
            {
            case TabType.TweenScale:
                TweenHeight.Begin(current.GetComponent <UIWidget>(), 0f, defHeight);      //改变选项卡高度/
                break;

            case TabType.TweenColor:
                //btn.transform.Find("Label").GetComponent<UILabel>().color = defTextColor;  //文字变成正常色/
                break;
            }
        }
Пример #20
0
        /// <summary>
        /// 选项卡按钮的激活状态
        /// </summary>
        /// <param name="current"></param>
        private void setTabActiveState(UIToggle current)
        {
            if (disableTabTest(current))
            {
                return;
            }
            UIButton btn = current.GetComponent <UIButton>();

            btn.enabled = false;
            btn.SetState(UIButtonColor.State.Pressed, true);
            current.GetComponent <UISprite>().depth = 15;
            currentActive = current;

            switch (activeState)
            {
            case TabType.TweenScale:
                TweenHeight.Begin(current.GetComponent <UIWidget>(), 0f, actHeight);      //改变选项卡高度/
                break;

            case TabType.TweenColor:
                //btn.transform.Find("Label").GetComponent<UILabel>().color = actTextColor;  //文字变成激活色/
                break;
            }
        }
Пример #21
0
    public void MusicStateSwitch()
    {
        var tweener = MusicToggler.GetComponent <TweenAlpha>();

        DataManager.MusicOnOff = MusicToggler.value;
        DataManager.SetMusicState();
        if (MusicToggler.value)
        {
            tweener.PlayForwardBypassProccess();
            musicController.PlayMusic(musicController.BGPlayDelayTime);
        }

        else
        {
            tweener.PlayReverseBypassProccess();
            musicController.StopMusic();
        }
    }
Пример #22
0
        public override void UpdateBoxCollider()
        {
            var box = Toggle.GetComponent <BoxCollider>();

            if (box == null)
            {
                return;
            }
            var bound  = Bounds;
            var size   = bound.size;
            var center = bound.extents;
            var local  = Toggle.transform.localPosition;

            center.x   = -local.x + size.x / 2;
            center.y   = -local.y - size.y / 2;
            box.center = center;
            box.size   = size;
        }
Пример #23
0
    // Use this for initialization
    void Start()
    {
        UIEventListener events = goldTab.GetComponent <UIEventListener>();

        if (events == null)
        {
            events = goldTab.gameObject.AddComponent <UIEventListener>();
        }
        events.onClick = this.OnGoldTab;

        UIEventListener eventsCash = cashTab.GetComponent <UIEventListener>();

        if (eventsCash == null)
        {
            eventsCash = cashTab.gameObject.AddComponent <UIEventListener>();
        }
        eventsCash.onClick = this.OnCashTab;
    }
Пример #24
0
        private void UpdateBox(Vector2 size)
        {
            var box = Toggle.GetComponent <BoxCollider>();

            if (box == null)
            {
                return;
            }
            var bound = Bounds;

            box.size = size;
            var center = bound.extents;
            var local  = transform.position;

            local      = box.transform.InverseTransformPoint(local);
            center.x   = local.x + size.x / 2;
            center.y   = Mathf.Abs(local.y) - center.y;
            box.center = center;
        }
Пример #25
0
    private void InsCbk(UIGrid mParent, List <YuanPic> yuanPic, PicSelectClick.SelectType selectType)
    {
        int num = 0;

        foreach (YuanPic item in yuanPic)
        {
            UIToggle tempCkbSelect = ((GameObject)Instantiate(ckbSelect)).GetComponent <UIToggle>();
            tempCkbSelect.transform.parent = mParent.transform;
            UIPanel tempPanel = tempCkbSelect.transform.GetComponent <UIPanel>();
            if (tempPanel != null)
            {
                Destroy(tempPanel);
            }
            PicSelectClick tempPicSelectClick = tempCkbSelect.GetComponent <PicSelectClick>();
            UISlicedSprite tempSprite         = tempCkbSelect.transform.FindChild("Background").GetComponent <UISlicedSprite>();

            tempSprite.atlas      = item.atlas;
            tempSprite.spriteName = item.spriteName;

            tempPicSelectClick.sender     = this;
            tempPicSelectClick.selectType = selectType;
            tempPicSelectClick.num        = num.ToString();

            tempCkbSelect.group = 3;
            if (num == 0)
            {
                tempCkbSelect.isChecked = true;
            }
            else
            {
                tempCkbSelect.isChecked = false;
            }

            tempCkbSelect.transform.localPosition = Vector3.zero;
            tempCkbSelect.transform.localScale    = new Vector3(1, 1, 1);

            num++;
        }
        mParent.repositionNow = true;
    }
Пример #26
0
 private void OnInitPanelCtrl(object data)
 {
     if (!(data is List <object>))
     {
         if (RankToggle == null)
         {
             return;
         }
         RankToggle.startsActive = true;
         RankToggle.value        = true;
         RankToggle.GetComponent <UIToggledObjects>().activate[0].SetActive(true);
         return;
     }
     else
     {
         if (RoomToggle == null)
         {
             return;
         }
         RoomToggle.startsActive = true;
         RoomToggle.value        = true;
         RoomToggle.GetComponent <UIToggledObjects>().activate[0].SetActive(true);
     }
 }
Пример #27
0
        private void CheckBoxStateChange(bool state)
        {
            if (UIToggle.current.Equals(yuansushi) && current != yuansushi) //元素师
            {
                if (state)
                {
                    job = GameConst.JOB_FASHI;
                    LoadRoleMode();
                    tipsLabel.text = LanguageManager.GetWord("RoleCreate.YSSInfo").Replace(@"\n", "\n");;
                    NGUITools.FindChild(yuansushi.gameObject, "job").SetActive(false);
                    NGUITools.FindChild(yuansushi.gameObject, "high").SetActive(true);
                    NGUITools.FindChild(qiangxieshi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(qiangxieshi.gameObject, "high").SetActive(false);
                    NGUITools.FindChild(mojianshi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(mojianshi.gameObject, "high").SetActive(false);

                    yuansushi.gameObject.GetComponent <TweenPosition>().from =
                        yuansushi.gameObject.transform.localPosition;
                    yuansushi.gameObject.GetComponent <TweenPosition>().to = new Vector3(-400, topY - gapY1, 0);
                    yuansushi.GetComponent <TweenScale>().from             = new Vector3(1, 1, 1);
                    yuansushi.GetComponent <TweenScale>().to = new Vector3(1.1f, 1.1f, 1.1f);

                    qiangxieshi.gameObject.GetComponent <TweenPosition>().from = qiangxieshi.gameObject.transform.localPosition;
                    qiangxieshi.gameObject.GetComponent <TweenPosition>().to   = new Vector3(-400, topY - gapY1 - gapUp - gapDown, 0);

                    info.localPosition = new Vector3(-295, topY - gapY1 - gapUp, 0);
                    //info.gameObject.SetActive(true);
                    //info.GetComponent<TweenPlay>().PlayForward();

                    if (current == mojianshi)
                    {
                        current.GetComponent <TweenScale>().PlayReverse();
                        qiangxieshi.GetComponent <TweenScale>().from = new Vector3(1, 1, 1);
                        qiangxieshi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }
                    else if (current == qiangxieshi)
                    {
                        qiangxieshi.GetComponent <TweenScale>().from = new Vector3(1.1f, 1.1f, 1.1f);
                        qiangxieshi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }

                    yuansushi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    qiangxieshi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    current = yuansushi;
                }
            }
            else if (UIToggle.current.Equals(qiangxieshi) && current != qiangxieshi)
            {
                if (state)
                {
                    job = GameConst.JOB_CHIKE;
                    LoadRoleMode();
                    tipsLabel.text = LanguageManager.GetWord("RoleCreate.QXSInfo").Replace(@"\n", "\n");

                    NGUITools.FindChild(yuansushi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(yuansushi.gameObject, "high").SetActive(false);
                    NGUITools.FindChild(qiangxieshi.gameObject, "job").SetActive(false);
                    NGUITools.FindChild(qiangxieshi.gameObject, "high").SetActive(true);
                    NGUITools.FindChild(mojianshi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(mojianshi.gameObject, "high").SetActive(false);

                    yuansushi.gameObject.GetComponent <TweenPosition>().from = yuansushi.gameObject.transform.localPosition;
                    yuansushi.gameObject.GetComponent <TweenPosition>().to   = new Vector3(-400, topY - gapY1, 0);

                    qiangxieshi.gameObject.GetComponent <TweenPosition>().from = qiangxieshi.gameObject.transform.localPosition;
                    qiangxieshi.gameObject.GetComponent <TweenPosition>().to   = new Vector3(-400, topY - 2 * gapY1, 0);

                    qiangxieshi.GetComponent <TweenScale>().from = new Vector3(1, 1, 1);
                    qiangxieshi.GetComponent <TweenScale>().to   = new Vector3(1.1f, 1.1f, 1.1f);


                    info.localPosition = new Vector3(-295, topY - 2 * gapY1 - gapUp, 0);
                    //info.gameObject.SetActive(true);
                    //info.GetComponent<TweenPlay>().PlayForward();
                    if (current == mojianshi)
                    {
                        current.GetComponent <TweenScale>().PlayReverse();
                        yuansushi.GetComponent <TweenScale>().from = new Vector3(1, 1, 1);
                        yuansushi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }
                    else if (current == yuansushi)
                    {
                        yuansushi.GetComponent <TweenScale>().from = new Vector3(1.1f, 1.1f, 1.1f);
                        yuansushi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }
                    yuansushi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    qiangxieshi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    current = qiangxieshi;
                }
            }
            else if (UIToggle.current.Equals(mojianshi) && current != mojianshi)
            {
                if (state)
                {
                    job = GameConst.JOB_JIAN;
                    LoadRoleMode();
                    tipsLabel.text = LanguageManager.GetWord("RoleCreate.MJSInfo").Replace(@"\n", "\n");;


                    NGUITools.FindChild(yuansushi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(yuansushi.gameObject, "high").SetActive(false);
                    NGUITools.FindChild(qiangxieshi.gameObject, "job").SetActive(true);
                    NGUITools.FindChild(qiangxieshi.gameObject, "high").SetActive(false);
                    NGUITools.FindChild(mojianshi.gameObject, "job").SetActive(false);
                    NGUITools.FindChild(mojianshi.gameObject, "high").SetActive(true);

                    yuansushi.gameObject.GetComponent <TweenPosition>().from = yuansushi.gameObject.transform.localPosition;
                    yuansushi.gameObject.GetComponent <TweenPosition>().to   = new Vector3(-400, topY - gapUp - gapDown, 0);

                    qiangxieshi.gameObject.GetComponent <TweenPosition>().from = qiangxieshi.gameObject.transform.localPosition;
                    qiangxieshi.gameObject.GetComponent <TweenPosition>().to   = new Vector3(-400, topY - gapUp - gapDown - gapY1, 0);

                    info.localPosition = new Vector3(-295, topY - gapUp, 0);
                    //info.gameObject.SetActive(true);
                    //info.GetComponent<TweenPlay>().PlayForward();
                    if (current == yuansushi)
                    {
                        yuansushi.GetComponent <TweenScale>().from = new Vector3(1.1f, 1.1f, 1.1f);
                        yuansushi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);

                        qiangxieshi.GetComponent <TweenScale>().from = new Vector3(1, 1, 1);
                        qiangxieshi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }
                    else if (current == qiangxieshi)
                    {
                        qiangxieshi.GetComponent <TweenScale>().from = new Vector3(1.1f, 1.1f, 1.1f);
                        qiangxieshi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);

                        yuansushi.GetComponent <TweenScale>().from = new Vector3(1, 1, 1);
                        yuansushi.GetComponent <TweenScale>().to   = new Vector3(1, 1, 1);
                    }
                    mojianshi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    yuansushi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    qiangxieshi.gameObject.GetComponent <TweenPlay>().PlayForward();
                    current = mojianshi;
                }
            }
            //scale.Begin();
        }
Пример #28
0
        /// <summary>
        /// tab动态初始化,根据文字内容多少生成相等数量的tab
        /// </summary>
        /// <param name="tabGroupID">tab组id</param>
        /// <param name="tabText">tab上的文字名</param>
        /// <param name="tabSprite">tab上的图片名,按顺序依次是:normal、hover、pressed、disable,list长度应该为4,不足的用"-1"补齐,至少要有normal</param>
        /// <param name="tabJustActived">tab被激活时候执行的委托</param>
        /// <returns></returns>
        public TabStrip init(int tabGroupID, List <string> tabText, List <string> tabSprite, Action <int> tabJustActived)
        {
            this.widget = this.transform.GetComponent <UIWidget>();
            defHeight   = Mathf.FloorToInt(tabBtnSize.y);        //默认高度取值/
            actHeight   = Mathf.FloorToInt(tabBtnSize.y * 1.2f); //激活高度取值/
            oneShot     = true;
            UIToggle tabTogOriginal = null;                      //初始第一个tab/

            if (tabs.Count > 0)                                  //如果tabs下面有子物体,全部清除/
            {
                clearChildren(this.transform);
                tabs.Clear();
            }

            for (int i = 0; i < tabText.Count; i++)   //给每个选项卡添加值改变的监听,有没有给每个选项卡添加监听是一回事,每个选项卡被点击时执行的是不是同一个方法是另外一回事/
            {
                GameObject tabObj = generate(this.transform, getPrefab(UIDownLoad.Prefab_TabPre_Cell), Vector3.one, Vector3.zero, Vector3.zero);
                tabObj.name = "tab" + i.ToString();                          //给tab调整名字/
                //给每个tab设置sprite图片/
                setUISprite(tabObj.GetComponent <UISprite>(), tabSprite[0]); //首先设置好图集/
                UIButton uiBtn = tabObj.GetComponent <UIButton>();
                uiBtn.normalSprite = tabSprite[0];
                if (!tabSprite[1].Equals("-1"))
                {
                    uiBtn.hoverSprite = tabSprite[1];
                }
                if (!tabSprite[2].Equals("-1"))
                {
                    uiBtn.hoverSprite = tabSprite[2];
                }
                if (!tabSprite[3].Equals("-1"))
                {
                    uiBtn.hoverSprite = tabSprite[3];
                }
                //设置tab的状态/
                UIToggle tabTog = tabObj.GetComponent <UIToggle>();
                tabTog.GetComponent <UIWidget>().SetRect(0, 0, tabBtnSize.x, tabBtnSize.y);
                tabTog.group = tabGroupID;
                if (i == 0)
                {
                    tabTogOriginal = tabTog;
                    tabTogOriginal.startsActive = true;  //设置第一个选项卡的起始默认状态为true/
                    setTabActiveState(tabTogOriginal);   //onchange未触发前默认设置选项卡1为激活状态/
                }
                //UILabel childLabel = tabObj.transform.Find("Label").GetComponent<UILabel>();
                //childLabel.text = tabText[i];
                //childLabel.color = defTextColor;
                //设置tab值改变时候的监听/
                tabTog.onChange.Add(new EventDelegate(() =>
                {
                    if (oneShot)
                    {
                        setTabDefaultState(tabTogOriginal);
                        oneShot = false;
                    }
                    if (UIToggle.current.value)
                    {
                        setTabActiveState(UIToggle.current);
                        tabJustActived(int.Parse(UIToggle.current.name.Substring(UIToggle.current.name.Length - 1)));
                    }
                    else
                    {
                        setTabDefaultState(UIToggle.current);
                    }
                }));

                tabs.Add(tabTog);
                //labs.Add(childLabel);
            }
            adjustDepth(widget.depth); //调整深度值/
            alignment(tabBtnSize);     //对元素进行排列/
            return(this);
        }
Пример #29
0
        /// <summary>
        /// 查找群中创建的房间信息
        /// </summary>
        /// <param name="data"></param>
        private void GroupRoomData(object data)
        {
            var roomDic = data as Dictionary <string, object>;

            if (roomDic == null)
            {
                return;
            }
            var creatRoom  = roomDic["creatRoom"];
            var normalRoom = roomDic["normalRoom"];

            if (creatRoom != null)
            {
                var roomDatas = creatRoom as List <object>;
                if (roomDatas == null)
                {
                    return;
                }

                _currentToggle.GetComponent <NnFriendGroupItem>().OnFreshRoomCount(roomDatas.Count);

                while (GroupRoomGrid.transform.childCount > 0)
                {
                    DestroyImmediate(GroupRoomGrid.transform.GetChild(0).gameObject);
                }
                foreach (var roomData in roomDatas)
                {
                    var roomDetial = roomData as Dictionary <string, object>;
                    if (roomDetial == null)
                    {
                        return;
                    }
                    var roomId    = roomDetial.ContainsKey("rndId") ? roomDetial["rndId"].ToString() : "";
                    var gameName  = roomDetial.ContainsKey("name") ? roomDetial["name"].ToString() : "";
                    var round     = roomDetial.ContainsKey("round") ? roomDetial["round"].ToString() : "";
                    var roomOwnId = roomDetial.ContainsKey("ownid") ? roomDetial["ownid"].ToString() : "";
                    var userHead  = "";
                    var userName  = "";
                    foreach (var userdata in _currentGroupUesrData)
                    {
                        if (userdata["user_id"].ToString().Equals(roomOwnId))
                        {
                            userHead = userdata["avatar_x"].ToString();
                            userName = userdata["nick_m"].ToString();
                        }
                    }
                    var info  = roomDetial.ContainsKey("info") ? roomDetial["info"].ToString() : "";
                    var infos = info.Split(';');
                    var ante  = "";
                    var rule  = "";
                    foreach (var s in infos)
                    {
                        if (s.Contains("底"))
                        {
                            ante = s.Split(':')[1];
                            continue;
                        }
                        if (!s.Contains("翻"))
                        {
                            continue;
                        }
                        rule = s.Split(':')[1].Split(' ')[0];
                    }
                    var item = YxWindowUtils.CreateItem(NnGroupRoomItem, GroupRoomGrid.transform);
                    item.InitData(userHead, userName, roomOwnId, gameName, roomId, ante, round, "房主付费", rule);
                    item.name = roomId;
                }
                GroupRoomGrid.repositionNow = true;
            }

            if (normalRoom != null)
            {
                var normalRoomData = normalRoom as List <object>;
                if (normalRoomData == null)
                {
                    return;
                }
                while (GroupRecreationRoomGrid.transform.childCount > 0)
                {
                    DestroyImmediate(GroupRecreationRoomGrid.transform.GetChild(0).gameObject);
                }
                foreach (var roomData in normalRoomData)
                {
                    var roomInfo = roomData as Dictionary <string, object>;
                    if (roomInfo == null)
                    {
                        return;
                    }
                    var minGold = roomInfo.ContainsKey("gold_min_q")
                        ? int.Parse(roomInfo["gold_min_q"].ToString())
                        : -1;
                    var maxGold = roomInfo.ContainsKey("gold_max_q")
                        ? int.Parse(roomInfo["gold_max_q"].ToString())
                        : -1;
                    var gameName = roomInfo.ContainsKey("game_name") ? roomInfo["game_name"].ToString() : "";
                    var gameKey  = roomInfo.ContainsKey("game_key_c") ? roomInfo["game_key_c"].ToString() : "";
                    var gameType = roomInfo.ContainsKey("game_type") ? int.Parse(roomInfo["game_type"].ToString()) : 0;
                    var item3    = YxWindowUtils.CreateItem(GroupRecreationRoomItem, GroupRecreationRoomGrid.transform);
                    item3.GetComponent <UIButton>().onClick.Add(new EventDelegate(() =>
                    {
                        GameListController.Instance.QuickGame(gameKey);
                    }));
                    item3.InitRoomData(gameName, maxGold, minGold);
                }

                GroupRecreationRoomGrid.repositionNow = true;
            }
        }
Пример #30
0
 void Bloquear()
 {
     mToggle.GetComponent <UIButton>().isEnabled = false;
 }