Наследование: MonoBehaviour
 public MvxComponentOnEventTargetBinding(Component component, string eventName)
     : base(component)
 {
     _eventName = eventName;
     if (component == null)
     {
         MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - Component is null in MvxComponentOnEventTargetBinding");
     }
     else
     {
         _eventTarget = UIEventListener.Get(component.gameObject);
         switch (_eventName)
         {
             case "onClick":
                 _eventTarget.onClick += this.OnClick;
                 break;
             case "onPress":
                 _eventTarget.onPress += this.OnPress;
                 break;
             case "onDrag":
                 _eventTarget.onDrag += this.OnDrag;
                 break;
             case "OnDrop":
                 _eventTarget.onDrop += this.OnDrop;
                 break;
         }
     }
 }
Пример #2
0
	// Use this for initialization
	void Start () 
    {
        Stars = new List<GameObject>();
        Stars.Add(transform.FindChild("Container item/Sprite star1").gameObject);
        Stars.Add(transform.FindChild("Container item/Sprite star2").gameObject);
        Stars.Add(transform.FindChild("Container item/Sprite star3").gameObject);
        Stars.Add(transform.FindChild("Container item/Sprite star4").gameObject);
        Stars.Add(transform.FindChild("Container item/Sprite star5").gameObject);

        ItemIcon = transform.FindChild("Sprite item").gameObject;
        GoodsIcon = transform.FindChild("Sprite coin").gameObject;
        HeadIcon = transform.FindChild("Sprite hero").gameObject;
        HeadContainer = transform.FindChild("Container item").gameObject;
        JobSprite = transform.FindChild("Container item/Sprite job").gameObject;
        CountLabel = transform.FindChild("Label count").gameObject;

        SelectSprite = transform.FindChild("Sprite select").gameObject;
        ClickSprite = transform.FindChild("Sprite click").gameObject;

        BtnUIEventListener = UIEventListener.Get(gameObject);
        BtnUIEventListener.onClick += ClickHandler;

        SelectSprite.SetActive(false);
        ClickSprite.SetActive(false);

	    SetContent();
    }
Пример #3
0
 // Use this for initialization
 private void Awake()
 {
     closeLis = UIEventListener.Get(transform.Find("Buttons/Button-Close").gameObject);
     applyLis = UIEventListener.Get(transform.Find("Buttons/Button-Apply").gameObject);
     viewDetailLis = UIEventListener.Get(transform.Find("Buttons/Button-ViewDetail").gameObject);
     friendItem = GetComponent<FriendItem>();
 }
Пример #4
0
 public static void AddSubmitEvent(string name, UIEventListener.VoidDelegate callback)
 {
     Transform t = uiRoot.gameObject.transform.Find(name);
     if (t == null)
         Debug.Log("AddSubmitEvent Not Find " + name);
     UIEventListener.Get(t.gameObject).onSubmit += callback;
 }
Пример #5
0
 /// <summary>
 /// Used to initial some varibles.
 /// </summary>
 private void Awake()
 {
     okLis = UIEventListener.Get(transform.Find("OK").gameObject);
     cancelLis = UIEventListener.Get(transform.Find("Cancel").gameObject);
     costCoins = Utils.FindChild(transform, "CostValue").GetComponent<UILabel>();
     grid = GetComponentInChildren<UIGrid>();
 }
        public MvxGameObjectOnEventTargetBinding(GameObject gameObject, string eventName)
            : base(gameObject)
        {
            _eventName = eventName;
            if (gameObject == null)
            {
                MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - GameObject is null in MvxGameObjectOnEventTargetBinding");
            }
            else
            {
                _eventTarget = UIEventListener.Get(gameObject);
                switch (_eventName)
                {
                    case "onClick":
                        _eventTarget.onClick += this.OnClick;
                        break;
                    case "onPress":
                        _eventTarget.onPress += this.OnPress;
                        break;
					case "onDrag":
						_eventTarget.onDrag += this.OnDrag;
						break;
					case "onDrop":
						_eventTarget.onDrop += this.OnDrop;
						break;
					case "onSelect":
						_eventTarget.onSelect += this.OnSelect;
						break;
                }
            }
        }
        static internal int checkDelegate(IntPtr l,int p,out UIEventListener.FloatDelegate ua) {
            int op = extractFunction(l,p);
			if(LuaDLL.lua_isnil(l,p)) {
				ua=null;
				return op;
			}
            else if (LuaDLL.lua_isuserdata(l, p)==1)
            {
                ua = (UIEventListener.FloatDelegate)checkObj(l, p);
                return op;
            }
            LuaDelegate ld;
            checkType(l, -1, out ld);
            if(ld.d!=null)
            {
                ua = (UIEventListener.FloatDelegate)ld.d;
                return op;
            }
			LuaDLL.lua_pop(l,1);
			
			l = LuaState.get(l).L;
            ua = (UnityEngine.GameObject a1,float a2) =>
            {
                int error = pushTry(l);

				pushValue(l,a1);
				pushValue(l,a2);
				ld.pcall(2, error);
				LuaDLL.lua_settop(l, error-1);
			};
			ld.d=ua;
			return op;
		}
Пример #8
0
	// Use this for initialization
	void Start ()
	{
	    AlertIcon = transform.FindChild("Sprite alert").gameObject;
        AlertIcon.SetActive(PlayerModelLocator.Instance.CanSign);
        BtnUIEventListener = UIEventListener.Get(gameObject);
        BtnUIEventListener.onClick += ClickHandler;
	}
Пример #9
0
 public void Awake()
 {
     background = GetComponent<Image>();
     this.width = this.GetComponent<Image>().sprite.rect.width;
     this.height = this.GetComponent<Image>().sprite.rect.height;
     this.listener = UIEventListener.Get(this.background.gameObject);
 }
Пример #10
0
    public void InitModal( GUIManager.ModalType modalType, string strMessage,
							UIEventListener.VoidDelegate[] btnDelegates, 
							UIEventListener.VoidDelegate CommonBtnDelegate )
    {
        this.modalType = modalType;

        // set label
        if( messageLabel != null )
            messageLabel.text = strMessage;

        // set event handler
        if( buttonListeners.Length >= 1 ) {
            buttonListeners[0].onClick = btnDelegates[0];
            buttonListeners[0].onClick += CommonBtnDelegate;
        }

        if( buttonListeners.Length >= 2 ) {
            buttonListeners[1].onClick = btnDelegates[1];
            buttonListeners[1].onClick += CommonBtnDelegate;
        }

        if( buttonListeners.Length >= 3 ) {
            buttonListeners[2].onClick = btnDelegates[2];
            buttonListeners[2].onClick += CommonBtnDelegate;
        }
    }
Пример #11
0
 public void Init(int id, string desc, UIEventListener.VoidDelegate onClick)
 {
     m_iId = id;
     m_strDesc = desc;
     m_Label.text = "ID : " + id.ToString() + "  " + desc;
     UIEventListener.Get(m_Button.gameObject).onClick = onClick;
 }
Пример #12
0
 public void Init(FriendInfo info, UIEventListener.VoidDelegate rejectDel, UIEventListener.VoidDelegate agreeDel)
 {
     base.Init(info);
     var loginDateTime = Utils.ConvertFromJavaTimestamp(info.LastLoginTime);
     loginLbl.text = Utils.GetTimeUntilNow(loginDateTime);
     rejectLis.onClick = rejectDel;
     agreeLis.onClick = agreeDel;
 }
Пример #13
0
 public GameObject RegisterPressEvent(string _name, UIEventListener.BoolDelegate delgate, GameObject parent = null)
 {
     if (parent == null)
     {
         parent = base.gameObject;
     }
     return GameUITools.RegisterPressEvent(_name, delgate, parent);
 }
Пример #14
0
 // Use this for initialization
 void Awake()
 {
     mailItems = transform.Find("MailItems").GetComponent<UIGrid>();
     okLis = UIEventListener.Get(transform.Find("OK").gameObject);
     okLis.onClick = OnOk;
     dimmerLis = UIEventListener.Get(transform.Find("Dimmer").gameObject);
     dimmerLis.onClick = OnDimmer;
 }
Пример #15
0
 public void Init(RecieveEnergyInfo energyInfo, UIEventListener.VoidDelegate dDelegate)
 {
     givenTime.text = Utils.GetTimeUntilNow(energyInfo.GiveEnergyTime);
     receiveBtnSprite.isEnabled = receiveBtn.isEnabled = !energyInfo.RecieveStatus;
     receiveLis.onClick = dDelegate;
     var friendInfo = FriendModelLocator.Instance.FindInfo(energyInfo.FriendUuid);
     Init(friendInfo);
 }
Пример #16
0
 protected override void Awake()
 {
     base.Awake();
     givenTime = transform.FindChild("GiveTime/GiveTimeValue").GetComponent<UILabel>();
     receiveBtn = transform.Find("ReceiveBtn").GetComponent<UIButton>();
     receiveBtnSprite = Utils.FindChild(transform, "ReceiveBtnSprite").GetComponent<UIButton>();
     receiveLis = UIEventListener.Get(receiveBtn.gameObject);
 }
Пример #17
0
 //增加按钮事件,这样写非常有好处。
 public void AddClick(UIEventListener.VoidDelegate fun)
 {
     if (_clickFun == null) {
         _clickFun = fun;
     } else {
         Debug.Log("回调函数为空,无法执行");
     }
 }
	void Awake()
	{
		preRecommendRoot.SetActive(false);
		loadingIndicatorRoot.SetActive(false);
		postRecommendRoot.SetActive(false);
		recommendButtonObject = UIEventListener.Get(recommendButton.gameObject);
		Clear();
	}
Пример #19
0
 protected override void Awake()
 {
     base.Awake();
     selMaskTran = Utils.FindChild(transform, "Mask");
     itemClickedLis = UIEventListener.Get(gameObject);
     itemClickedLis.onClick += OnItemClicked;
     timeRemainLabel = cachedTran.FindChild("TimeRemain").GetComponent<UILabel>();
 }
Пример #20
0
    // Use this for initialization
    void Start()
    {
        AlertIcon = transform.FindChild("Sprite alert").gameObject;
        AlertIcon.SetActive(PlayerModelLocator.Instance.HasFinishedQuest);
        BtnUIEventListener = UIEventListener.Get(gameObject);
        BtnUIEventListener.onClick += ClickHandler;

        EventManager.Instance.AddListener<QuestFinishEvent>(OnFinishHandler);
    }
Пример #21
0
 //双击
 public void AddDoubleClick(UIEventListener.VoidDelegate fun)
 {
     if (_doubleClickFun == null) {
         _doubleClickFun = fun;
     } else {
         Debug.Log("回调函数有问题");
         Debug.Log("请输入毁掉函数");
     }
 }
Пример #22
0
 protected override void Awake()
 {
     base.Awake();
     loginLbl = transform.Find("LoginTime/LoginTimeValue").GetComponent<UILabel>();
     rejectBtn = transform.Find("Reject").GetComponent<UIButton>();
     agreeBtn = transform.Find("Agree").GetComponent<UIButton>();
     rejectLis = UIEventListener.Get(rejectBtn.gameObject);
     agreeLis = UIEventListener.Get(agreeBtn.gameObject);
 }
Пример #23
0
 // Use this for initialization
 private void Awake()
 {
     selCount = Utils.FindChild(transform, "SelValue").GetComponent<UILabel>();
     soulCount = Utils.FindChild(transform, "SoulValue").GetComponent<UILabel>();
     scHeroList = HeroModelLocator.Instance.SCHeroList;
     hero = HeroModelLocator.Instance.HeroTemplates;
     sellLis = UIEventListener.Get(transform.Find("Button-Sell").gameObject);
     grid = transform.Find("Container/Grid").GetComponent<UIGrid>();
 }
Пример #24
0
 public static void Show(ItemInfo info, GUIAwakeItemInfoPopUp.EOpenType type, UIEventListener.VoidDelegate cb)
 {
     if (info == null)
     {
         global::Debug.LogErrorFormat("ItemInfo info is null", new object[0]);
         return;
     }
     GameUIPopupManager.GetInstance().PushState(GameUIPopupManager.eSTATE.GUIAwakeItemInfoPopUp, false, null, null);
     GameUIPopupManager.GetInstance().GetCurrentPopup().InitPopUp(info, type, cb);
 }
Пример #25
0
 protected override void Awake()
 {
     base.Awake();
     loginLbl = transform.Find("LoginTime/LoginTimeValue").GetComponent<UILabel>();
     givenBtn = transform.Find("GivenBtn").GetComponent<UIButton>();
     givenBtnSprite = Utils.FindChild(transform, "GivenBtnSprite").GetComponent<UIButton>();
     givenLis = UIEventListener.Get(givenBtn.gameObject);
     delLis = UIEventListener.Get(transform.Find("Button-Del").gameObject);
     ShowDel(false);
 }
Пример #26
0
    // Use this for initialization
    void Awake()
    {
        BtnLogin = transform.FindChild("Image Button - login").gameObject;

        InputAccount = transform.FindChild("Input - account").gameObject;

        BtnLoginUIEventListener = UIEventListener.Get(BtnLogin);
        btnRandomNameUiEventListener = UIEventListener.Get(transform.FindChild("RandomCharName").gameObject);
        btnClearWordsUiEventListener = UIEventListener.Get(Utils.FindChild(transform, "ClearWords").gameObject);
    }
Пример #27
0
 public void Init(FriendInfo info, UIEventListener.VoidDelegate dDelegate)
 {
     base.Init(info);
     var loginDateTime = Utils.ConvertFromJavaTimestamp(info.LastLoginTime);
     loginLbl.text = Utils.GetTimeUntilNow(loginDateTime);
     var givenTime = Utils.ConvertFromJavaTimestamp(info.GiveEnergyTime);
     givenBtnSprite.isEnabled = givenBtn.isEnabled = !Utils.IsSameDay(givenTime, DateTime.Today);
     givenLis.onClick = dDelegate;
     delegateCached = dDelegate;
 }
Пример #28
0
    // Use this for initialization
    void Awake()
    {
        BtnLogin = transform.FindChild("Image Button - login").gameObject;

        BtnReturn = transform.FindChild("Image Button - close").gameObject;

        InputAccount = transform.FindChild("Input - account").gameObject;
        InputPassword = transform.FindChild("Input - password").gameObject;

        BtnLoginUIEventListener = UIEventListener.Get(BtnLogin);
        BtnCloseUIEventListener = UIEventListener.Get(BtnReturn);
    }
Пример #29
0
    // Use this for initialization
    void Awake()
    {
        BtnReturn = transform.FindChild("Image Button - back").gameObject;
        BtnReturn.AddComponent<CloseServersHandler>();

        AllServerContainer = transform.FindChild("Scroll View/AllItemContainer").gameObject;
        UsedServerContainer = transform.FindChild("Scroll View Used/UsedItemContainer").gameObject;
        ServerItemPrefab = Resources.Load("Prefabs/Component/ServerItem") as GameObject;

        //BtnAllServerEventListener = UIEventListener.Get(BtnRegister);
        BtnCloseUIEventListener = UIEventListener.Get(BtnReturn);
    }
Пример #30
0
 //为选项卡添加事件
 public void AddEvent(string key, UIEventListener.VoidDelegate tabEvent)
 {
     for (int i = 0; i < Tabs.Count; i++)
     {
         Tab tab = Tabs[i];
         if (tab.key == key)
         {
             UIEventListener.Get(tab.tab).onClick += tabEvent;
             break;
         }
     }
 }
Пример #31
0
 //注册控件事件处理函数
 protected override void RegisterControlEvents()
 {
     UIEventListener.Get(m_btn_btnclose.gameObject).onClick = _onClick_Btnclose_Btn;
 }
Пример #32
0
    public void Init(HeroData herosData, NewHeroItem.CardType cardType = NewHeroItem.CardType.Lock, bool useShowFrame = true, bool changeStarDepth = true)
    {
        this.useShowFrame           = useShowFrame;
        this.m_changeStarDepth      = changeStarDepth;
        this.m_HeroTexture.material = CharacterDataMgr.instance.ReturnMaterialType(1);
        if (cardType == NewHeroItem.CardType.NullObject)
        {
            this.ShowAlphItem();
            return;
        }
        if (this.m_Frame && this.m_Frame.gameObject)
        {
            this.m_Frame.gameObject.SetActive(true);
        }
        if (this.m_CenterCanChange && this.m_CenterCanChange.gameObject)
        {
            this.m_CenterCanChange.gameObject.SetActive(false);
        }
        this.heroData       = herosData;
        this.cardTypeRecord = cardType;
        this.InitHeroItem();
        if (herosData != null)
        {
            this.ShowQuality(herosData.Quality);
            this.ShowStars(cardType, herosData.Stars);
            SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(herosData.HeroID);
            if (heroMainData == null)
            {
                ClientLogger.Error("HeroMain中查找" + herosData.HeroID + "结果为空,联系策划");
                return;
            }
            if (this.cardTypeRecord == NewHeroItem.CardType.HeroCardLeft || this.cardTypeRecord == NewHeroItem.CardType.HeroCardRight)
            {
                SysBattleSceneVo dataById = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(LevelManager.CurLevelId);
                if (this.cardTypeRecord == NewHeroItem.CardType.HeroCardRight && dataById != null && dataById.show_enemy_squad == 0)
                {
                    if (this.m_CenterCanChange && this.m_CenterCanChange.gameObject)
                    {
                        this.m_CenterCanChange.gameObject.SetActive(true);
                    }
                }
                else
                {
                    this.m_HeroTexture.material    = CharacterDataMgr.instance.ReturnMaterialType(1);
                    this.m_HeroTexture.mainTexture = ResourceManager.Load <Texture>(heroMainData.longAvatar_icon, true, true, null, 0, false);
                }
            }
            else
            {
                this.m_HeroTexture.mainTexture = ResourceManager.Load <Texture>(heroMainData.avatar_icon, true, true, null, 0, false);
            }
            this.m_LV.text      = herosData.LV.ToString();
            base.transform.name = herosData.HeroID;
        }
        else
        {
            base.transform.name = string.Empty;
        }
        if (this.m_Center && this.m_Center.gameObject)
        {
            this.m_Center.gameObject.SetActive(true);
        }
        switch (cardType)
        {
        case NewHeroItem.CardType.None:
            this.ShowItem(false);
            if (this.m_CenterCanChange && this.m_CenterCanChange.gameObject)
            {
                this.m_CenterCanChange.gameObject.SetActive(true);
            }
            if (this.m_Center && this.m_Center.gameObject)
            {
                this.m_Center.gameObject.SetActive(false);
            }
            break;

        case NewHeroItem.CardType.Lock:
            this.ShowItem(false);
            this.ShowFrame(0, 0, "PVP_select_hero_03");
            if (this.m_None && this.m_None.gameObject)
            {
                this.m_None.gameObject.SetActive(true);
            }
            break;

        case NewHeroItem.CardType.HeroAvator:
            if (this.m_BottomRight && this.m_BottomRight.gameObject)
            {
                this.m_BottomRight.gameObject.SetActive(false);
            }
            this.ShowFrame(218, 218, "PVP_select_hero_04");
            this.m_LV.SetActive(false);
            break;

        case NewHeroItem.CardType.HeroCardLeft:
            this.ShowFrame(420, 140, "PVP_select_hero_01");
            if (this.m_Bottom && this.m_Bottom.gameObject)
            {
                this.m_Bottom.gameObject.SetActive(false);
            }
            break;

        case NewHeroItem.CardType.HeroCardRight:
            this.ShowCardLeftOrRight(false);
            this.ShowFrame(420, 140, "PVP_select_hero_02");
            if (this.m_Bottom && this.m_Bottom.gameObject)
            {
                this.m_Bottom.gameObject.SetActive(false);
            }
            break;
        }
        UIEventListener.Get(base.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnSelectHero);
    }
Пример #33
0
 void Start()
 {
     UIEventListener.Get(ReturnBtn).onClick   = OnReturn;
     UIEventListener.Get(transferBtn).onClick = OnTransfer;
 }
Пример #34
0
 void Start()
 {
     UIEventListener.Get(ReturnBtn).onClick = OnReturn;
     UIEventListener.Get(SubmitBtn).onClick = OnSubmit;
 }
Пример #35
0
 // Use this for initialization
 void Start()
 {
     UIEventListener.Get(m_OpMenu).onClick = onOpMenu;
 }
Пример #36
0
 private void OnClick()
 {
     if (!(this.mChild == null) || !(this.atlas != null) || !(this.font != null) || this.items.Count <= 1)
     {
         this.OnSelect(false);
     }
     else
     {
         this.mLabelList.Clear();
         this.handleEvents = true;
         if (this.mPanel == null)
         {
             this.mPanel = UIPanel.Find(base.transform, true);
         }
         Transform transforms = base.transform;
         AABBox    aABBox     = NGUIMath.CalculateRelativeWidgetBounds(transforms.parent, transforms);
         this.mChild = new GameObject("Drop-down List")
         {
             layer = base.gameObject.layer
         };
         Transform vector3 = this.mChild.transform;
         vector3.parent         = transforms.parent;
         vector3.localPosition  = aABBox.min;
         vector3.localRotation  = Quaternion.identity;
         vector3.localScale     = Vector3.one;
         this.mBackground       = NGUITools.AddSprite(this.mChild, this.atlas, this.backgroundSprite);
         this.mBackground.pivot = UIWidget.Pivot.TopLeft;
         this.mBackground.depth = NGUITools.CalculateNextDepth(this.mPanel.gameObject);
         this.mBackground.color = this.backgroundColor;
         Vector4 vector4 = this.mBackground.border;
         this.mBgBorder = vector4.y;
         this.mBackground.cachedTransform.localPosition = new Vector3(0f, vector4.y, 0f);
         this.mHighlight       = NGUITools.AddSprite(this.mChild, this.atlas, this.highlightSprite);
         this.mHighlight.pivot = UIWidget.Pivot.TopLeft;
         this.mHighlight.color = this.highlightColor;
         UIAtlas.Sprite sprite   = this.mHighlight.sprite;
         float          single   = sprite.inner.yMin - sprite.outer.yMin;
         float          single1  = (float)this.font.size * this.textScale;
         float          single2  = 0f;
         float          single3  = -this.padding.y;
         List <UILabel> uILabels = new List <UILabel>();
         int            num      = 0;
         int            count    = this.items.Count;
         while (num < count)
         {
             string  item    = this.items[num];
             UILabel uILabel = NGUITools.AddWidget <UILabel>(this.mChild);
             uILabel.pivot = UIWidget.Pivot.TopLeft;
             uILabel.font  = this.font;
             uILabel.text  = (!this.isLocalized || !(Localization.instance != null) ? item : Localization.instance.Get(item));
             uILabel.color = this.textColor;
             uILabel.cachedTransform.localPosition = new Vector3(vector4.x, single3, 0f);
             uILabel.MakePixelPerfect();
             if (this.textScale != 1f)
             {
                 Vector3 vector31 = uILabel.cachedTransform.localScale;
                 uILabel.cachedTransform.localScale = vector31 * this.textScale;
             }
             uILabels.Add(uILabel);
             single3 = single3 - single1;
             single3 = single3 - this.padding.y;
             Vector2 vector2 = uILabel.relativeSize;
             single2 = Mathf.Max(single2, vector2.x * single1);
             UIEventListener boolDelegate = UIEventListener.Get(uILabel.gameObject);
             boolDelegate.onHover   = new UIEventListener.BoolDelegate(this.OnItemHover);
             boolDelegate.onPress   = new UIEventListener.BoolDelegate(this.OnItemPress);
             boolDelegate.parameter = item;
             if (this.mSelectedItem == item)
             {
                 this.Highlight(uILabel, true);
             }
             this.mLabelList.Add(uILabel);
             num++;
         }
         Vector3 vector32 = aABBox.size;
         single2 = Mathf.Max(single2, vector32.x - vector4.x * 2f);
         Vector3 vector33 = new Vector3(single2 * 0.5f / single1, -0.5f, 0f);
         Vector3 vector34 = new Vector3(single2 / single1, (single1 + this.padding.y) / single1, 1f);
         int     num1     = 0;
         int     count1   = uILabels.Count;
         while (num1 < count1)
         {
             UIHotSpot uIHotSpot = NGUITools.AddWidgetHotSpot(uILabels[num1].gameObject);
             vector33.z       = uIHotSpot.center.z;
             uIHotSpot.center = vector33;
             uIHotSpot.size   = vector34;
             num1++;
         }
         single2 = single2 + vector4.x * 2f;
         single3 = single3 - vector4.y;
         this.mBackground.cachedTransform.localScale = new Vector3(single2, -single3 + vector4.y, 1f);
         this.mHighlight.cachedTransform.localScale  = new Vector3(single2 - vector4.x * 2f + (sprite.inner.xMin - sprite.outer.xMin) * 2f, single1 + single * 2f, 1f);
         bool flag = this.position == UIPopupList.Position.Above;
         if (this.position == UIPopupList.Position.Auto)
         {
             UICamera uICamera = UICamera.FindCameraForLayer(base.gameObject.layer);
             if (uICamera != null)
             {
                 Vector3 viewportPoint = uICamera.cachedCamera.WorldToViewportPoint(transforms.position);
                 flag = viewportPoint.y < 0.5f;
             }
         }
         if (this.isAnimated)
         {
             float single4 = single3 + single1;
             this.Animate(this.mHighlight, flag, single4);
             int num2   = 0;
             int count2 = uILabels.Count;
             while (num2 < count2)
             {
                 this.Animate(uILabels[num2], flag, single4);
                 num2++;
             }
             this.AnimateColor(this.mBackground);
             this.AnimateScale(this.mBackground, flag, single4);
         }
         if (flag)
         {
             float   single5  = aABBox.min.x;
             Vector3 vector35 = aABBox.max;
             float   single6  = vector35.y - single3 - vector4.y;
             Vector3 vector36 = aABBox.min;
             vector3.localPosition = new Vector3(single5, single6, vector36.z);
         }
     }
 }
Пример #37
0
    public void showWindows()
    {
//		Debug.Log("showWindow");
        labelIDValue.text = Obj_MyselfPlayer.GetMe().accountID.ToString();

        friendRequsets        = new List <UserFriend>();//Obj_MyselfPlayer.GetMe().friendsList;//
        requestNum            = friendRequsets.Count;
        requestMax            = Obj_MyselfPlayer.GetMe().friendNumMax;
        labelFriendValue.text = requestNum.ToString() + "/" + requestMax.ToString();
//		Debug.Log("friendRequsets.Count:"+friendRequsets.Count);
//		Debug.Log("requestNum:"+requestNum);

        curPage = 1;
        if (requestNum < eachPageNum)
        {
            allPage = 1;
        }
        else
        {
            allPage = (requestNum % eachPageNum == 0) ? requestNum / eachPageNum : requestNum / eachPageNum + 1;
        }

        labelPage.text = curPage + "/" + allPage;

        if (requestNum > 0)
        {
            int startIdx = 0;
            int endIdx   = 0;
            if (curPage == allPage)
            {
                startIdx = (curPage - 1) * eachPageNum;
                endIdx   = startIdx + (requestNum - (curPage - 1) * eachPageNum);
            }
            else
            {
                startIdx = (curPage - 1) * eachPageNum;
                endIdx   = startIdx + eachPageNum;
            }
//			Debug.Log("startIdx:"+startIdx);
//			Debug.Log("endIdx:"+endIdx);

            for (int i = startIdx; i < endIdx; i++)
            {
                GameObject newItem = ResourceManager.Instance.loadWidget("FriendAddItem");                 //(GameObject)Instantiate(friendListItem);
                newItem.transform.parent        = gridFriend.transform;
                newItem.transform.localPosition = new Vector3(0, 0, -1);
                newItem.transform.localScale    = new Vector3(1, 1, 1);
                newItem.name = ((UserFriend)friendRequsets[i]).guid.ToString();                //friendList[i].GetAccountName();

                //头像按钮显示卡牌信息
                newItem.transform.FindChild("CardIcon/CardIconBtn").gameObject.name = ((UserFriend)friendRequsets[i]).guid.ToString();
                UIEventListener.Get(newItem.transform.FindChild("CardIcon/CardIconBtn").gameObject).onClick += ShowCardInfo;

                UILabel nameLabel = newItem.transform.FindChild("Labels/Label-Name").GetComponent <UILabel>();
                nameLabel.text = ((UserFriend)friendRequsets[i]).name;        //friendList[i].GetAccountName();

                Transform QxzbTopStarTrans = newItem.transform.FindChild("QxzbTopStar");
                if (QxzbTopStarTrans != null)
                {
                    //沒有群雄爭霸第一名
                    if (friendRequsets[i].nQxzbTopStar >= 3 &&
                        friendRequsets[i].nQxzbTopStar <= 7)
                    {
                        QxzbTopStarTrans.gameObject.SetActive(true);

                        Transform starBgSpTrans = QxzbTopStarTrans.FindChild("StarBgObj/starBgSp");
                        if (starBgSpTrans != null)
                        {
                            UISprite spStarBg = starBgSpTrans.GetComponent <UISprite>();
                            if (spStarBg != null)
                            {
                                spStarBg.spriteName = UserFriend.friendStarTopBg[friendRequsets[i].nQxzbTopStar];
                            }
                        }

                        Transform topStarTrans = QxzbTopStarTrans.FindChild("StarRank");
                        if (topStarTrans != null)
                        {
                            UISprite spTopStar = topStarTrans.GetComponent <UISprite>();
                            if (spTopStar != null)
                            {
                                spTopStar.spriteName = UserFriend.friendStarTop[friendRequsets[i].nQxzbTopStar];
                            }
                        }
                    }
                    else
                    {
                        QxzbTopStarTrans.gameObject.SetActive(false);
                    }
                }

                items.Add(newItem);
            }
        }
        gridFriend.GetComponent <UIGrid>().repositionNow = true;
    }
Пример #38
0
    public void SearchFriendDone(bool isSuccess)
    {
        clearItems();

        GameObject newItem = ResourceManager.Instance.loadWidget("FriendAddItem");         //(GameObject)Instantiate(friendListItem);

        newItem.transform.parent        = gridFriend.transform;
        newItem.transform.localPosition = new Vector3(0, 0, -1);
        newItem.transform.localScale    = new Vector3(1, 1, 1);
        newItem.name = Obj_MyselfPlayer.GetMe().friendSearchResult.guid.ToString();        //friendList[i].GetAccountName();

        UIEventListener.Get(newItem.transform.FindChild("ApplyBtn").gameObject).onClick += friendAdd;

        Transform QxzbTopStarTrans = newItem.transform.FindChild("QxzbTopStar");

        if (QxzbTopStarTrans != null)
        {
            //沒有群雄爭霸第一名
            if (Obj_MyselfPlayer.GetMe().friendSearchResult.nQxzbTopStar >= 3 &&
                Obj_MyselfPlayer.GetMe().friendSearchResult.nQxzbTopStar <= 7)
            {
                QxzbTopStarTrans.gameObject.SetActive(true);

                Transform starBgSpTrans = QxzbTopStarTrans.FindChild("StarBgObj/starBgSp");
                if (starBgSpTrans != null)
                {
                    UISprite spStarBg = starBgSpTrans.GetComponent <UISprite>();
                    if (spStarBg != null)
                    {
                        spStarBg.spriteName = UserFriend.friendStarTopBg[Obj_MyselfPlayer.GetMe().friendSearchResult.nQxzbTopStar];
                    }
                }

                Transform topStarTrans = QxzbTopStarTrans.FindChild("StarRank");
                if (topStarTrans != null)
                {
                    UISprite spTopStar = topStarTrans.GetComponent <UISprite>();
                    if (spTopStar != null)
                    {
                        spTopStar.spriteName = UserFriend.friendStarTop[Obj_MyselfPlayer.GetMe().friendSearchResult.nQxzbTopStar];
                    }
                }
            }
            else
            {
                QxzbTopStarTrans.gameObject.SetActive(false);
            }
        }

        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        ////templeID < 0 情况的容错处理,暂时显示默认头像,且错误头像点击不给予反映//
        if (Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID > 0)
        {
            UISprite icon_bg     = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-BG").GetComponent <UISprite>();
            UISprite icon_border = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite").GetComponent <UISprite>();
            int      icon_star   = TableManager.GetCardByID(Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID).Star;
            icon_bg.spriteName     = UserCardItem.littleCardFrameName[icon_star];
            icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star];
            UIEventListener.Get(newItem.transform.FindChild("CardIcon/CardIconBtn").gameObject).onClick += ShowCardInfo;
        }
        //--------------------------------------------------------------------
        UILabel nameLabel = newItem.transform.FindChild("Labels/Label-Name").GetComponent <UILabel>();

        nameLabel.text = Obj_MyselfPlayer.GetMe().friendSearchResult.name;       //friendList[i].GetAccountName();
        //---------------------------------------------------------------------
        //2013-7-26 Jack Wen
        UILabel levelLabel = newItem.transform.FindChild("Labels/Label-Level-Value").GetComponent <UILabel>();

        levelLabel.text = Obj_MyselfPlayer.GetMe().friendSearchResult.level.ToString();
        UILabel stateLabel     = newItem.transform.FindChild("Labels/Label-State").GetComponent <UILabel>();
        int     lastOnlineTime = Obj_MyselfPlayer.GetMe().friendSearchResult.lastOnlineHours;
        int     lastLogoutTime = Obj_MyselfPlayer.GetMe().friendSearchResult.lastLogoutHours;

        if (lastOnlineTime == -1 && lastLogoutTime >= 0)
        {
            UIImageButton button = newItem.GetComponent <UIImageButton>();
            button.normalSprite  = "liebiao_beijing_3";
            button.hoverSprite   = "liebiao_beijing_3";
            button.pressedSprite = "liebiao_beijing_3";
            UISprite back = newItem.transform.FindChild("Sprite/Background").GetComponent <UISprite>();
            back.spriteName = "liebiao_beijing_3";
            back            = newItem.transform.FindChild("Sprite/haoyoubeijing").GetComponent <UISprite>();
            back.alpha      = 0.5f;
            if (lastLogoutTime / 60 >= 24)
            {
                stateLabel.text = "[222222]离线:" + lastLogoutTime / 60 / 24 + "天";
            }
            else if (lastLogoutTime / 60 < 24 && lastLogoutTime / 60 > 0)
            {
                stateLabel.text = "[222222]离线:" + lastLogoutTime / 60 + "小时";
            }
            else
            {
                stateLabel.text = "[222222]离线:" + lastLogoutTime % 60 + "分钟";
            }
        }
        else if (lastOnlineTime >= 0 && lastLogoutTime == -1)
        {
            stateLabel.text = "[a5e295]登陆:" + lastOnlineTime / 60 + "小时前";
        }

        //头像按钮显示卡牌信息
        //2013-7-30 Jack Wen

        //五行显示
        UISprite sttributeIcon = newItem.transform.FindChild("Sprite-Attribut").GetComponent <UISprite>();
        string   strIconName   = "";

        if (Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID > 0)
        {
            int nAttributeID = TableManager.GetCardByID(Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID).Element;
            switch (nAttributeID)
            {
            case 0: strIconName = "jin"; break;

            case 1: strIconName = "mu"; break;

            case 2: strIconName = "shui"; break;

            case 3: strIconName = "huo"; break;

            case 4: strIconName = "tu"; break;
            }
        }
        else
        {
            strIconName = "jin";
        }
        sttributeIcon.spriteName = strIconName;
        UISprite icon = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-Icon").GetComponent <UISprite>();

        icon.spriteName = TableManager.GetAppearanceByID(TableManager.GetCardByID(Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID).Appearance).HeadIcon;
        //2013-8-2 Jack Wen
        //加入好友主卡牌星级显示
        if (Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID > 0)
        {
            Tab_Card tabCard = TableManager.GetCardByID(Obj_MyselfPlayer.GetMe().friendSearchResult.cardTempletID);
            for (int start_i = 1; start_i < 8; start_i++)
            {
                if (start_i <= tabCard.Star)
                {
                    newItem.transform.FindChild("StartManager/start_" + start_i).gameObject.SetActive(true);
                }
                else
                {
                    newItem.transform.FindChild("StartManager/start_" + start_i).gameObject.SetActive(false);
                }
            }
        }
        //2013-8-6 Jack Wen
        //显示卡牌等级
        UILabel cardLevel = newItem.transform.FindChild("Sprite/Panel-Lv/Label-lv").GetComponent <UILabel>();

        cardLevel.text = Obj_MyselfPlayer.GetMe().friendSearchResult.cardLevel.ToString();
        //---------------------------------------------------------------------
        items.Add(newItem);
    }
Пример #39
0
    //-----------------------------------------------------------------------------
    public static void showErrorMessage(int /*PBMessage.SCErrorMsg.ErrorType*/ type)
    {
        switch ((ErrorType)type)
        {
        case ErrorType.FRIEND_ADD:        //0
//			BoxManager.showMessage("您已向该玩家提出好友申请");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg1);
            BoxManager.showMessageByID((int)MessageIdEnum.Msg147);
            break;

        case ErrorType.ACCEPT_POWER:        //3
//			BoxManager.showMessage("您的体力已满");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg15);
            break;

        case ErrorType.SEARCH_FRIEND_NOT_FOUND:        //5
//			BoxManager.showMessage("未找到玩家");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg3);
            break;

        case ErrorType.SEARCH_FRIEND_ALREADY_MY_FRIEND:        //6
//			BoxManager.showMessage("该玩家已经是我的好友");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg4);
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg147);
            break;

        case ErrorType.LOGIN_VERSION_WRONG:        //7
//			BoxManager.showMessage("客户端版本需要更新");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg5);
            UIEventListener.Get(buttonYes).onClick += GotoVersionUpdate;
            break;

        case ErrorType.LOGIN_NAME_SAME:        //8
//			BoxManager.showMessage("已有同名玩家");
            Debug.LogWarning("LOGIN_NAME_SAME");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg6);
            break;

        case ErrorType.TASK_LIST://9
//            BoxManager.showMessage("获取任务列表错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg75);
            break;

        case ErrorType.TASK_FINISH://10
//            BoxManager.showMessage("获取任务奖励错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg76);
            break;

        case ErrorType.CARD_COMBINE://11
//            BoxManager.showMessage("卡牌合成错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg77);
            UIEventListener.Get(buttonYes).onClick += ContinueShow;
            break;

        case ErrorType.CARD_EVOLVE://12
//            BoxManager.showMessage("卡牌进化错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg78);
            //UIEventListener.Get(buttonYes).onClick += ContinueShow;
            break;

        case ErrorType.CARD_STRENGTHEN://13
//            BoxManager.showMessage("卡牌强化错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg79);
            //UIEventListener.Get(buttonYes).onClick += ContinueShow;
            break;

        case ErrorType.FRIEND_MAIL_FULL:        //14
//            BoxManager.showMessage("邮件不存在");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg80);
            break;

        case ErrorType.MAIL_NOT_EXIST://15
//          BoxManager.showMessage("对方收件箱已满,邮件发送失败");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg7);
            break;

        case ErrorType.MAIL_FRIEND_NOT_EXIST://16
//            BoxManager.showMessage("要发送的好友不存在");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg81);
            break;

        case ErrorType.MAIL_ITEM_DONE://17
//            BoxManager.showMessage("物品已经领取完毕");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg82);
            break;

        case ErrorType.COMBINE_SWALLOWED_CARDLIST://18
//            BoxManager.showMessage("吞噬卡牌组错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg83);
            break;

        case ErrorType.COMBINE_SWALLOWED_NOTEXIST://19
//            BoxManager.showMessage("吞噬卡牌不存在");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg84);
            break;

        case ErrorType.COMBINE_NO_MONEY:        //20
//			BoxManager.showMessage("合成费用不足");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg8);
            NetworkSender.Instance().buyGold(BuyGoldFinish, 1);
            break;

        case ErrorType.EVOLVE_MATERIALS_CARDLIST://21
//            BoxManager.showMessage("材料卡牌组错误");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg85);
            break;

        case ErrorType.EVOLVE_MATERIALS_NOTEXIST://22
//            BoxManager.showMessage("材料卡牌不存在");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg86);
            break;

        case ErrorType.EVOLVE_NOT_CONDITION://23
//            BoxManager.showMessage("不满足进化条件");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg87);
            break;

        case ErrorType.STRENGTHEN_NULL_CARD://24
//            BoxManager.showMessage("强化卡牌不存在");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg88);
            break;

        case ErrorType.STRENGTHEN_NOT_ITEM://25
//            BoxManager.showMessage("强化道具不足");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg89);
            break;

        case ErrorType.STRENGTHEN_NO_MONEY:        //26
//			BoxManager.showMessage("强化费用不足");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg9);
            NetworkSender.Instance().buyGold(BuyGoldFinish, 1);
            break;

        case ErrorType.GAMBLE_NO_FRIEND_POINT://27
//          BoxManager.showMessage("友情点数不足");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg51);
            break;

        case ErrorType.GAMBLE_NO_DOLLAR://28
//          BoxManager.showMessage("元宝不足");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg73);
            break;

        case ErrorType.GAMBLE_NO_LUCKY://29
//            BoxManager.showMessage("幸运值不足够");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg90);
            break;

        case ErrorType.GAMBLE_ERR://30
//            BoxManager.showMessage("抽奖错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg91);
            break;

        case ErrorType.SHOP_POWER://31
//            BoxManager.showMessage("购买体力错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg92);
            break;

        case ErrorType.SHOP_BAG://32
//            BoxManager.showMessage("购买背包错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg93);
            break;

        case ErrorType.SHOP_FRIEND://33
//            BoxManager.showMessage("购买好友上限错误");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg94);
            break;

        case ErrorType.SHOP_ERR://35
//            BoxManager.showMessage("商城错误,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg94);
            break;

        case ErrorType.BAG_FULL:        //37
//			BoxManager.showBagFullBox("您携带的侠士已经达到上限可以将侠士吸收、出售或者扩充您的背包.");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg74);
            break;

        case ErrorType.FRIEND_FULL://38
//          BoxManager.showMessage("您的好友数量已达上限");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg12);
            break;

        case ErrorType.BATTLE_ERR://40
//            BoxManager.showMessage("战斗异常,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg95);
            break;

        case ErrorType.BATTLE_ERR_COPY_NULL://41
//          //使用副本未开启
            BoxManager.showMessageByID((int)MessageIdEnum.Msg97);
            break;

        case ErrorType.BATTLE_ERR_COPY_LEVEL://42
//            BoxManager.showMessage("对不起,您的等级不够进入此副本");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg96);
            break;

        case ErrorType.BATTLE_ERR_COPY_NOTOPEN://43
//            BoxManager.showMessage("副本未开启");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg97);
            break;

        case ErrorType.BATTLE_ERR_COPY_TIMES://44
//            BoxManager.showMessage("副本次数已到上限");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg98);
            break;

        case ErrorType.BATTLE_ERR_CARD_ERR://45
//            BoxManager.showMessage("战斗卡牌异常,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg99);
            break;

        case ErrorType.BATTLE_ERR_PLAYER_POWER://46
//          BoxManager.showMessage("您的体力不足");
            NetworkSender.Instance().buyPower(BuyPowerDone);
            break;

        case ErrorType.SHOP_POWER_TIMES:        //47
//			BoxManager.showMessage("今日购买体力次数已达限制");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg10);
            break;

        case ErrorType.SHOP_DOLLAR:        //48
//			BoxManager.showMessage("当前元宝不足");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg11);
            break;

        case ErrorType.ADD_FRIEND_ALREADY_FRIEND:        //49
//			BoxManager.showMessage("对方已经是您的好友");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg4);
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg147);
            break;

        case ErrorType.ADD_FRIEND_MY_FULL:        //50
//			BoxManager.showMessage("您的好友数量已达上限");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg12);
            break;

        case ErrorType.ADD_FRIEND_HE_FULL://51
//            BoxManager.showMessage("对方好友数量已达上限");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg13);
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg147);
            break;

        case ErrorType.ADD_FRIEND_NOTFIND://56
//            BoxManager.showMessage("玩家未找到");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg3);
            break;

        case ErrorType.EVOLVE_NO_MONEY:        //57
//			BoxManager.showMessage("进化费用不足");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg14);
            NetworkSender.Instance().buyGold(BuyGoldFinish, 1);
            break;

        case ErrorType.MAIL_TOPLAYER_MAILFULL://58
//            BoxManager.showMessage("对方收件箱已满");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg7);
            break;

        case ErrorType.BIND_ERR://59
//            BoxManager.showMessage("绑定账号异常,请稍后重试");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg24);
            break;

        case ErrorType.BIND_ALREADY://60
//            BoxManager.showMessage("此账号已经被绑定");
            Debug.LogWarning("BIND_ALREADY");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg243);
            break;

        case ErrorType.BILLING_NET_ERR://61
//            BoxManager.showMessage("网络不通");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg24);
            break;

        case ErrorType.POWER_FULL:        //62
//			BoxManager.showMessage("体力值已满");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg15);
            break;

        case ErrorType.FRIEND_IS_NOT_MINE:        //63
//			BoxManager.showMessage("对方已不是您的好友");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg16);
            GameObject.Find("MainUILogic").SendMessage("OnFriendWindow");
            break;

        case ErrorType.POWER_TIMES_FULL:        //64
//			BoxManager.showMessage("今日获取体力次数已达限制");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg110);
            break;

        case ErrorType.POWER_SEND_ALREADY:        //65
//			BoxManager.showMessage("您已经送过该好友体力值");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg17);
            break;

        case ErrorType.ADD_FRIEND_ALREADY_MAIL:        //66
//			BoxManager.showMessage("已经向对方发送过好友申请邮件");
//			BoxManager.showMessageByID((int)MessageIdEnum.Msg1);
            BoxManager.showMessageByID((int)MessageIdEnum.Msg147);
            break;

        case ErrorType.BAG_MAX:        //67
//			BoxManager.showMessage("购买背包已达到上限");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg101);
            break;

        case ErrorType.SHOP_PVP_TIMES:        //69
//			BoxManager.showMessage("今日购买PVP已达上限","购买失败");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg141);
            break;

        case ErrorType.FRIEND_MAX:        //76
//			BoxManager.showMessage("扩充好友已达上限","扩充好友失败");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg140);
            break;

        case ErrorType.LEAD_POINT_NOT_ENOUGH:         //68
            BoxManager.showMessageByID((int)MessageIdEnum.Msg55);
            break;

        case ErrorType.BATTLE_PVP_TIMES:         //70
            BoxManager.showMessageByID((int)MessageIdEnum.Msg142);
            break;

        case ErrorType.PVP_SHOP_SCORE:         //71
            BoxManager.showMessageByID((int)MessageIdEnum.Msg143);
            break;

        case ErrorType.PVP_SHOP_ERR:         //72
            BoxManager.showMessageByID((int)MessageIdEnum.Msg144);
            break;

        case ErrorType.BATTLE_PVP_ERR:         //74
            BoxManager.showMessageByID((int)MessageIdEnum.Msg138);
            break;

        case ErrorType.BATTLE_PVP_ERR_CARD_ERR:         //75
            BoxManager.showMessageByID((int)MessageIdEnum.Msg138);
            break;

        case ErrorType.BATTLE_PVP_RANK_ERR:         //78
            BoxManager.showMessageByID((int)MessageIdEnum.Msg136);
            break;

        case ErrorType.BATTLE_PVP_LIST_ERR:         //79
            BoxManager.showMessageByID((int)MessageIdEnum.Msg137);
            break;

        case ErrorType.SCODE_ERR:  //77
//            BoxManager.showMessageByID((int)MessageIdEnum.Msg136);
            BoxManager.showMessageByID((int)MessageIdEnum.Msg151);
            break;

        case ErrorType.SCODE_ERR_USED:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg163);
            break;

        case ErrorType.SCODE_ERR_NOT_PASS:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg164);
            break;

        case ErrorType.SCODE_ERR_PARM_ERR:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg165);
            break;

        case ErrorType.SCODE_ERR_SAME_TYPE:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg166);
            break;

        case ErrorType.SCODE_ERR_NOT_EFFECT:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg167);
            break;

        case ErrorType.SCODE_ERR_NOT_THIS_AREA:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg168);
            break;

        case ErrorType.SCODE_ERR_NOT_THIS_GAME:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg169);
            break;

        case ErrorType.SCODE_ERR_DATA_ERR:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg170);
            break;

        case ErrorType.FS_ACTIVE_ERR:
            BoxManager.showMessage("风水激活失败", ClientConfigure.title);            //WML MARK
            break;

        case ErrorType.FS_LEVUP_ERR:
            BoxManager.showMessage("风水升级失败", ClientConfigure.title);            //WML MARK
            break;

        case ErrorType.FS_RESET_ERR:
            BoxManager.showMessage("风水重置失败", ClientConfigure.title);            //WML MARK
            break;

        case ErrorType.FS_STAR_LESS:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg187);
            UIEventListener.Get(BoxManager.buttonYes).onClick += GoPVEWindow;
            break;

        case ErrorType.FS_SUIPIAN_LESS:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg183);
            UIEventListener.Get(BoxManager.buttonYes).onClick += GoPVEWindow;
            break;

        case ErrorType.BGZ_NO_TIMES:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg188);
            break;

        case ErrorType.STUDYSKILL_ERR:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg214);
            break;

        case ErrorType.STUDYSKILL_NO_MONEY:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg215);
            break;

        case ErrorType.STUDYSKILL_NO_SKILL:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg216);
            break;

        case ErrorType.STUDYSKILL_CARDLIST:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg217);
            break;

        case ErrorType.STUDYSKILL_NOT_EXIST:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg218);
            break;

        case ErrorType.STUDYSKILLUPDATE_ERR:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg219);
            break;

        case ErrorType.STUDYSKILLUPDATE_MAX_LEV:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg220);
            break;

        case ErrorType.STUDYSKILLUPDATE_NO_MONEY:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg221);
            break;

        case ErrorType.STUDYSKILLUPDATE_CARDLIST:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg222);
            break;

        case ErrorType.STUDYSKILLUPDATE_CARD_NUM:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg223);
            break;

        case ErrorType.STUDYSKILLUPDATE_NOT_EXIST:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg224);
            break;

        case ErrorType.STUDYSKILLUPDATE_GROUP:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg225);
            break;

        case ErrorType.BATTLE_PATA_ERR:
            BoxManager.showMessage("爬塔战斗次数达到上限", ClientConfigure.title);
            break;

        case ErrorType.BATTLE_PATA_ERR_CARD_ERR:
            BoxManager.showMessage("爬塔战斗异常", ClientConfigure.title);
            break;

        case ErrorType.BATTLE_PATA_TIMES:
            BoxManager.showMessage("爬塔战斗卡牌异常", ClientConfigure.title);
            break;

        case ErrorType.WB_BATTLE_BOSS_DEAD:
            currentErrorType = (ErrorType)type;
            BoxManager.showMessageByID((int)MessageIdEnum.Msg236);
            UIEventListener.Get(buttonYes).onClick += HanderErrorType;
            break;

        case ErrorType.WB_BATTLE_BOSS_HIDE:
            currentErrorType = (ErrorType)type;
            BoxManager.showMessageByID((int)MessageIdEnum.Msg237);
            UIEventListener.Get(buttonYes).onClick += HanderErrorType;
            break;

        case ErrorType.QXZB_NOT_START:
            currentErrorType = (ErrorType)type;
            BoxManager.showMessageByID((int)MessageIdEnum.Msg234);
            UIEventListener.Get(buttonYes).onClick += BackToQxzbPvPController;
            break;

        default:
            //BoxManager.showMessage("服务器返回错误信息:"+(ErrorType)type);
            Debug.LogError("服务器返回错误信息:" + (ErrorType)type);
            break;
        }
    }
Пример #40
0
 protected override void OnDisable()
 {
     UIEventListener.Get(btnTap).onClick -= OnClickGo;
     btnHelp.onClick.RemoveListener(OpenHelpWin);
 }
Пример #41
0
 void Awake()
 {
     this.Name      = this.transform.FindChild("Name").GetComponent <UILabel>();
     this.RoleImage = this.transform.FindChild("HalfRoleIcon").GetComponent <UITexture>();
     UIEventListener.Get(this.gameObject).onClick = OnSelectRole;
 }
Пример #42
0
 //登陆成功
 void LoginSuceess()
 {
     UIEventListener.Get(mPlaySubmitBtn.gameObject).onClick -= OnPlaySubmit;
 }
Пример #43
0
 protected override void OnDisable()
 {
     base.OnDisable();
     UIEventListener.Get(gameObject).RemoveEventListener(eUIEventType.Down, OnDown);
     UIEventListener.Get(gameObject).RemoveEventListener(eUIEventType.Up, OnUp);
 }
Пример #44
0
    void Start()
    {
        UIEventListener.Get(ReturnBtn).onClick = OnReturn;

        UIEventListener.Get(shaixuanBtn).onClick = OnShaixuan;
    }
Пример #45
0
    /// <summary>
    /// Show the popup list dialog.
    /// </summary>

    public void Show()
    {
        if (enabled && NGUITools.GetActive(gameObject) && mChild == null && atlas != null && isValid && items.Count > 0)
        {
            mLabelList.Clear();

            // Automatically locate the panel responsible for this object
            if (mPanel == null)
            {
                mPanel = UIPanel.Find(transform);
                if (mPanel == null)
                {
                    return;
                }
            }

            // Disable the navigation script
            handleEvents = true;

            // Calculate the dimensions of the object triggering the popup list so we can position it below it
            Transform myTrans = transform;
            Bounds    bounds  = NGUIMath.CalculateRelativeWidgetBounds(myTrans.parent, myTrans);

            // Create the root object for the list
            mChild       = new GameObject("Drop-down List");
            mChild.layer = gameObject.layer;

            Transform t = mChild.transform;
            t.parent        = myTrans.parent;
            t.localPosition = bounds.min;
            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;

            // Add a sprite for the background
            mBackground       = NGUITools.AddSprite(mChild, atlas, backgroundSprite);
            mBackground.pivot = UIWidget.Pivot.TopLeft;
            mBackground.depth = NGUITools.CalculateNextDepth(mPanel.gameObject);
            mBackground.color = backgroundColor;

            // We need to know the size of the background sprite for padding purposes
            Vector4 bgPadding = mBackground.border;
            mBgBorder = bgPadding.y;
            mBackground.cachedTransform.localPosition = new Vector3(0f, bgPadding.y, 0f);

            // Add a sprite used for the selection
            mHighlight       = NGUITools.AddSprite(mChild, atlas, highlightSprite);
            mHighlight.pivot = UIWidget.Pivot.TopLeft;
            mHighlight.color = highlightColor;

            UISpriteData hlsp = mHighlight.GetAtlasSprite();
            if (hlsp == null)
            {
                return;
            }

            float          hlspHeight = hlsp.borderTop;
            float          fontHeight = activeFontSize;
            float          dynScale = activeFontScale;
            float          labelHeight = fontHeight * dynScale;
            float          x = 0f, y = -padding.y;
            List <UILabel> labels = new List <UILabel>();

            // Clear the selection if it's no longer present
            if (!items.Contains(mSelectedItem))
            {
                mSelectedItem = null;
            }

            // Run through all items and create labels for each one
            for (int i = 0, imax = items.Count; i < imax; ++i)
            {
                string s = items[i];

                UILabel lbl = NGUITools.AddWidget <UILabel>(mChild);
                lbl.name         = i.ToString();
                lbl.pivot        = UIWidget.Pivot.TopLeft;
                lbl.bitmapFont   = bitmapFont;
                lbl.trueTypeFont = trueTypeFont;
                lbl.fontSize     = fontSize;
                lbl.fontStyle    = fontStyle;
                lbl.text         = isLocalized ? Localization.Get(s) : s;
                lbl.color        = textColor;
                lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x - lbl.pivotOffset.x, y, -1f);
                lbl.overflowMethod = UILabel.Overflow.ResizeFreely;
                lbl.alignment      = alignment;
                labels.Add(lbl);

                y -= labelHeight;
                y -= padding.y;
                x  = Mathf.Max(x, lbl.printedSize.x);

                // Add an event listener
                UIEventListener listener = UIEventListener.Get(lbl.gameObject);
                listener.onHover   = OnItemHover;
                listener.onPress   = OnItemPress;
                listener.onClick   = OnItemClick;
                listener.parameter = s;

                // Move the selection here if this is the right label
                if (mSelectedItem == s || (i == 0 && string.IsNullOrEmpty(mSelectedItem)))
                {
                    Highlight(lbl, true);
                }

                // Add this label to the list
                mLabelList.Add(lbl);
            }

            // The triggering widget's width should be the minimum allowed width
            x = Mathf.Max(x, bounds.size.x * dynScale - (bgPadding.x + padding.x) * 2f);

            float   cx       = x;
            Vector3 bcCenter = new Vector3(cx * 0.5f, -fontHeight * 0.5f, 0f);
            Vector3 bcSize   = new Vector3(cx, (labelHeight + padding.y), 1f);

            // Run through all labels and add colliders
            for (int i = 0, imax = labels.Count; i < imax; ++i)
            {
                UILabel lbl = labels[i];
                NGUITools.AddWidgetCollider(lbl.gameObject);
                lbl.autoResizeBoxCollider = false;
                BoxCollider bc = lbl.GetComponent <BoxCollider>();

                if (bc != null)
                {
                    bcCenter.z = bc.center.z;
                    bc.center  = bcCenter;
                    bc.size    = bcSize;
                }
                else
                {
                    BoxCollider2D b2d = lbl.GetComponent <BoxCollider2D>();
                    b2d.offset = bcCenter;
                    b2d.size   = bcSize;
                }
            }

            int lblWidth = Mathf.RoundToInt(x);
            x += (bgPadding.x + padding.x) * 2f;
            y -= bgPadding.y;

            // Scale the background sprite to envelop the entire set of items
            mBackground.width  = Mathf.RoundToInt(x);
            mBackground.height = Mathf.RoundToInt(-y + bgPadding.y);

            // Set the label width to make alignment work
            for (int i = 0, imax = labels.Count; i < imax; ++i)
            {
                UILabel lbl = labels[i];
                lbl.overflowMethod = UILabel.Overflow.ShrinkContent;
                lbl.width          = lblWidth;
            }

            // Scale the highlight sprite to envelop a single item
            float scaleFactor = 2f * atlas.pixelSize;
            float w           = x - (bgPadding.x + padding.x) * 2f + hlsp.borderLeft * scaleFactor;
            float h           = labelHeight + hlspHeight * scaleFactor;
            mHighlight.width  = Mathf.RoundToInt(w);
            mHighlight.height = Mathf.RoundToInt(h);

            bool placeAbove = (position == Position.Above);

            if (position == Position.Auto)
            {
                UICamera cam = UICamera.FindCameraForLayer(gameObject.layer);

                if (cam != null)
                {
                    Vector3 viewPos = cam.cachedCamera.WorldToViewportPoint(myTrans.position);
                    placeAbove = (viewPos.y < 0.5f);
                }
            }

            // If the list should be animated, let's animate it by expanding it
            if (isAnimated)
            {
                float bottom = y + labelHeight;
                Animate(mHighlight, placeAbove, bottom);
                for (int i = 0, imax = labels.Count; i < imax; ++i)
                {
                    Animate(labels[i], placeAbove, bottom);
                }
                AnimateColor(mBackground);
                AnimateScale(mBackground, placeAbove, bottom);
            }

            // If we need to place the popup list above the item, we need to reposition everything by the size of the list
            if (placeAbove)
            {
                t.localPosition = new Vector3(bounds.min.x, bounds.max.y - y - bgPadding.y, bounds.min.z);
            }
        }
        else
        {
            OnSelect(false);
        }
    }
Пример #46
0
 protected override void OnDisable()
 {
     UIEventListener.Get(gameObject).onClick -= ShowNextPage;
     _btnClose.onClick.RemoveListener(Destroy);
 }
Пример #47
0
        public override void InitWindowOnAwake()
        {
            base.InitWindowOnAwake();
            InitWindowCoreData();

            twPositions = new TweenPosition[4];
            btnInfor    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject;
            btnRank     = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject;
            btnLevel    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject;
            btnSwitch   = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject;
            btnSkill    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject;
            lbSwitch    = GameUtility.FindDeepChild <UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label");

            twPositions[0] = btnInfor.GetComponent <TweenPosition>();
            twPositions[1] = btnRank.GetComponent <TweenPosition>();
            twPositions[2] = btnLevel.GetComponent <TweenPosition>();
            twPositions[3] = btnSkill.GetComponent <TweenPosition>();

            UIEventListener.Get(btnRank).onClick = delegate
            {
                ShowWindowData showData = new ShowWindowData();
                showData.forceResetWindow = true;

                string[] headIcons = new string[] { "Rambo", "Angry", "Smile", "Laugh", "Dead", "Frown", "Annoyed" };

                // fill the rank data
                ContextDataRank contextData = new ContextDataRank();
                contextData.listRankItemDatas = new List <RankItemData>();

                // rank list
                for (int i = 0; i < 10; i++)
                {
                    RankItemData newData = new RankItemData();
                    newData.playerName        = headIcons[UnityEngine.Random.Range(0, headIcons.Length)];
                    newData.headIcon          = "Emoticon - " + newData.playerName;
                    newData.playerName        = "Mr." + newData.playerName;
                    newData.playerDescription = string.Format("I'm {0}", newData.playerName);
                    contextData.listRankItemDatas.Add(newData);
                }
                showData.contextData = contextData;
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Rank, showData);
            };

            UIEventListener.Get(btnSwitch).onClick = delegate
            {
                switchFlag = !switchFlag;
                if (switchFlag)
                {
                    ShowBtns();
                }
                else
                {
                    HideBtns();
                }
            };

            UIEventListener.Get(btnLevel).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Level);
            };

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill);
            };
        }
Пример #48
0
 protected override void awakeInit()
 {
     UIEventListener.Get(btnReforge.gameObject).onClick = onClickReforge;
 }
Пример #49
0
 // Use this for initialization
 void Start()
 {
     // _pause.gameObject.GetComponent<UIEventListener>().onClick = OnClick;
     UIEventListener.Get(_load).onClick = OnClick;
 }
Пример #50
0
 void OnEnable()
 {
     UIEventListener.Get(gameObject).onClick += onClickToMe;
 }
Пример #51
0
    /// <summary>
    /// Show the popup list dialog.
    /// </summary>

    public virtual void Show()
    {
        if (enabled && NGUITools.GetActive(gameObject) && mChild == null && isValid && items.Count > 0)
        {
            mLabelList.Clear();
            StopCoroutine("CloseIfUnselected");

            // Ensure the popup's source has the selection
            UICamera.selectedObject = (UICamera.hoveredObject ?? gameObject);
            mSelection = UICamera.selectedObject;
            source     = UICamera.selectedObject;

            if (source == null)
            {
                Debug.LogError("Popup list needs a source object...");
                return;
            }

            mOpenFrame = Time.frameCount;

            // Automatically locate the panel responsible for this object
            if (mPanel == null)
            {
                mPanel = UIPanel.Find(transform);
                if (mPanel == null)
                {
                    return;
                }
            }

            // Calculate the dimensions of the object triggering the popup list so we can position it below it
            Vector3 min;
            Vector3 max;

            // Create the root object for the list
            mChild       = new GameObject("Drop-down List");
            mChild.layer = gameObject.layer;

            if (separatePanel)
            {
                if (GetComponent <Collider>() != null)
                {
                    var rb = mChild.AddComponent <Rigidbody>();
                    rb.isKinematic = true;
                }
                else if (GetComponent <Collider2D>() != null)
                {
                    var rb = mChild.AddComponent <Rigidbody2D>();
                    rb.isKinematic = true;
                }
                mChild.AddComponent <UIPanel>().depth = 1000000;
            }
            current = this;

            var t = mChild.transform;
            t.parent = mPanel.cachedTransform;

            // Manually triggered popup list on some other game object
            if (openOn == OpenOn.Manual && mSelection != gameObject)
            {
                startingPosition = UICamera.lastEventPosition;
                min              = mPanel.cachedTransform.InverseTransformPoint(mPanel.anchorCamera.ScreenToWorldPoint(startingPosition));
                max              = min;
                t.localPosition  = min;
                startingPosition = t.position;
            }
            else
            {
                var bounds = NGUIMath.CalculateRelativeWidgetBounds(mPanel.cachedTransform, transform, false, false);
                min              = bounds.min;
                max              = bounds.max;
                t.localPosition  = min;
                startingPosition = t.position;
            }

            StartCoroutine("CloseIfUnselected");

            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;

            var depth = separatePanel ? 0 : NGUITools.CalculateNextDepth(mPanel.gameObject);

            // Add a sprite for the background
            if (background2DSprite != null)
            {
                var sp2 = mChild.AddWidget <UI2DSprite>(depth);
                sp2.sprite2D = background2DSprite;
                mBackground  = sp2;
            }
            else if (atlas != null)
            {
                mBackground = NGUITools.AddSprite(mChild, atlas, backgroundSprite, depth);
            }
            else
            {
                return;
            }

            mBackground.pivot = UIWidget.Pivot.TopLeft;
            mBackground.color = backgroundColor;

            // We need to know the size of the background sprite for padding purposes
            var bgPadding = mBackground.border;
            mBgBorder = bgPadding.y;
            mBackground.cachedTransform.localPosition = new Vector3(0f, bgPadding.y, 0f);

            // Add a sprite used for the selection
            if (highlight2DSprite != null)
            {
                var sp2 = mChild.AddWidget <UI2DSprite>(++depth);
                sp2.sprite2D = highlight2DSprite;
                mHighlight   = sp2;
            }
            else if (atlas != null)
            {
                mHighlight = NGUITools.AddSprite(mChild, atlas, highlightSprite, ++depth);
            }
            else
            {
                return;
            }

            float hlspHeight = 0f, hlspLeft = 0f;

            if (mHighlight.hasBorder)
            {
                hlspHeight = mHighlight.border.w;
                hlspLeft   = mHighlight.border.x;
            }

            mHighlight.pivot = UIWidget.Pivot.TopLeft;
            mHighlight.color = highlightColor;

            float fontHeight = activeFontSize;
            var   dynScale = activeFontScale;
            var   labelHeight = fontHeight * dynScale;
            float x = 0f, y = -padding.y;
            var   labels = new List <UILabel>();

            // Clear the selection if it's no longer present
            if (!items.Contains(mSelectedItem))
            {
                mSelectedItem = null;
            }

            // Run through all items and create labels for each one
            for (int i = 0, imax = items.Count; i < imax; ++i)
            {
                var s = items[i];

                var lbl = NGUITools.AddWidget <UILabel>(mChild, mBackground.depth + 2);
                lbl.name         = i.ToString();
                lbl.pivot        = UIWidget.Pivot.TopLeft;
                lbl.bitmapFont   = bitmapFont;
                lbl.trueTypeFont = trueTypeFont;
                lbl.fontSize     = fontSize;
                lbl.fontStyle    = fontStyle;
                lbl.text         = isLocalized ? Localization.Get(s) : s;
                lbl.color        = textColor;
                lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x - lbl.pivotOffset.x, y, -1f);
                lbl.overflowMethod = UILabel.Overflow.ResizeFreely;
                lbl.alignment      = alignment;
                labels.Add(lbl);

                y -= labelHeight;
                y -= padding.y;
                x  = Mathf.Max(x, lbl.printedSize.x);

                // Add an event listener
                var listener = UIEventListener.Get(lbl.gameObject);
                listener.onHover   = OnItemHover;
                listener.onPress   = OnItemPress;
                listener.parameter = s;

                // Move the selection here if this is the right label
                if (mSelectedItem == s || (i == 0 && string.IsNullOrEmpty(mSelectedItem)))
                {
                    Highlight(lbl, true);
                }

                // Add this label to the list
                mLabelList.Add(lbl);
            }

            // The triggering widget's width should be the minimum allowed width
            x = Mathf.Max(x, (max.x - min.x) - (bgPadding.x + padding.x) * 2f);

            var cx       = x;
            var bcCenter = new Vector3(cx * 0.5f, -labelHeight * 0.5f, 0f);
            var bcSize   = new Vector3(cx, (labelHeight + padding.y), 1f);

            // Run through all labels and add colliders
            for (int i = 0, imax = labels.Count; i < imax; ++i)
            {
                var lbl = labels[i];
                NGUITools.AddWidgetCollider(lbl.gameObject);
                lbl.autoResizeBoxCollider = false;
                var bc = lbl.GetComponent <BoxCollider>();

                if (bc != null)
                {
                    bcCenter.z = bc.center.z;
                    bc.center  = bcCenter;
                    bc.size    = bcSize;
                }
                else
                {
                    var b2d = lbl.GetComponent <BoxCollider2D>();
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
                    b2d.center = bcCenter;
#else
                    b2d.offset = bcCenter;
#endif
                    b2d.size = bcSize;
                }
            }

            var lblWidth = Mathf.RoundToInt(x);
            x += (bgPadding.x + padding.x) * 2f;
            y -= bgPadding.y;

            // Scale the background sprite to envelop the entire set of items
            mBackground.width  = Mathf.RoundToInt(x);
            mBackground.height = Mathf.RoundToInt(-y + bgPadding.y);

            // Set the label width to make alignment work
            for (int i = 0, imax = labels.Count; i < imax; ++i)
            {
                var lbl = labels[i];
                lbl.overflowMethod = UILabel.Overflow.ShrinkContent;
                lbl.width          = lblWidth;
            }

            // Scale the highlight sprite to envelop a single item
            var scaleFactor = (atlas != null) ? 2f * atlas.pixelSize : 2f;
            var w           = x - (bgPadding.x + padding.x) * 2f + hlspLeft * scaleFactor;
            var h           = labelHeight + hlspHeight * scaleFactor;
            mHighlight.width  = Mathf.RoundToInt(w);
            mHighlight.height = Mathf.RoundToInt(h);

            var placeAbove = (position == Position.Above);

            if (position == Position.Auto)
            {
                var cam = UICamera.FindCameraForLayer(mSelection.layer);

                if (cam != null)
                {
                    var viewPos = cam.cachedCamera.WorldToViewportPoint(startingPosition);
                    placeAbove = (viewPos.y < 0.5f);
                }
            }

            // If the list should be animated, let's animate it by expanding it
            if (isAnimated)
            {
                AnimateColor(mBackground);

                if (Time.timeScale == 0f || Time.timeScale >= 0.1f)
                {
                    var bottom = y + labelHeight;
                    Animate(mHighlight, placeAbove, bottom);
                    for (int i = 0, imax = labels.Count; i < imax; ++i)
                    {
                        Animate(labels[i], placeAbove, bottom);
                    }
                    AnimateScale(mBackground, placeAbove, bottom);
                }
            }

            // If we need to place the popup list above the item, we need to reposition everything by the size of the list
            if (placeAbove)
            {
                min.y           = max.y - bgPadding.y;
                max.y           = min.y + mBackground.height;
                max.x           = min.x + mBackground.width;
                t.localPosition = new Vector3(min.x, max.y - bgPadding.y, min.z);
            }
            else
            {
                max.y = min.y + bgPadding.y;
                min.y = max.y - mBackground.height;
                max.x = min.x + mBackground.width;
            }

            var pt = mPanel.cachedTransform.parent;

            if (pt != null)
            {
                min = mPanel.cachedTransform.TransformPoint(min);
                max = mPanel.cachedTransform.TransformPoint(max);
                min = pt.InverseTransformPoint(min);
                max = pt.InverseTransformPoint(max);
            }

            // Ensure that everything fits into the panel's visible range
            var offset = mPanel.hasClipping ? Vector3.zero : mPanel.CalculateConstrainOffset(min, max);
            var pos    = t.localPosition + offset;
            pos.x           = Mathf.Round(pos.x);
            pos.y           = Mathf.Round(pos.y);
            t.localPosition = pos;
        }
        else
        {
            OnSelect(false);
        }
    }
Пример #52
0
 void OnDisable()
 {
     UIEventListener.Get(gameObject).onClick -= onClickToMe;
 }
Пример #53
0
    // Token: 0x060002AE RID: 686 RVA: 0x0001AAA4 File Offset: 0x00018CA4
    public virtual void Show()
    {
        if (!base.enabled || !NGUITools.GetActive(base.gameObject) || !(UIPopupList.mChild == null) || !this.isValid || this.items.Count <= 0)
        {
            this.OnSelect(false);
            return;
        }
        this.mLabelList.Clear();
        base.StopCoroutine("CloseIfUnselected");
        UICamera.selectedObject = (UICamera.hoveredObject ?? base.gameObject);
        this.mSelection         = UICamera.selectedObject;
        this.source             = this.mSelection;
        if (this.source == null)
        {
            Debug.LogError("Popup list needs a source object...");
            return;
        }
        this.mOpenFrame = Time.frameCount;
        if (this.mPanel == null)
        {
            this.mPanel = UIPanel.Find(base.transform);
            if (this.mPanel == null)
            {
                return;
            }
        }
        UIPopupList.mChild       = new GameObject("Drop-down List");
        UIPopupList.mChild.layer = base.gameObject.layer;
        if (this.separatePanel)
        {
            if (base.GetComponent <Collider>() != null)
            {
                UIPopupList.mChild.AddComponent <Rigidbody>().isKinematic = true;
            }
            else if (base.GetComponent <Collider2D>() != null)
            {
                UIPopupList.mChild.AddComponent <Rigidbody2D>().isKinematic = true;
            }
            UIPanel uipanel = UIPopupList.mChild.AddComponent <UIPanel>();
            uipanel.depth        = 1000000;
            uipanel.sortingOrder = this.mPanel.sortingOrder;
        }
        UIPopupList.current = this;
        Transform cachedTransform = this.mPanel.cachedTransform;
        Transform transform       = UIPopupList.mChild.transform;

        transform.parent = cachedTransform;
        Transform parent = cachedTransform;

        if (this.separatePanel)
        {
            UIRoot uiroot = this.mPanel.GetComponentInParent <UIRoot>();
            if (uiroot == null && UIRoot.list.Count != 0)
            {
                uiroot = UIRoot.list[0];
            }
            if (uiroot != null)
            {
                parent = uiroot.transform;
            }
        }
        Vector3 vector;
        Vector3 vector2;

        if (this.openOn == UIPopupList.OpenOn.Manual && this.mSelection != base.gameObject)
        {
            this.startingPosition = UICamera.lastEventPosition;
            vector  = cachedTransform.InverseTransformPoint(this.mPanel.anchorCamera.ScreenToWorldPoint(this.startingPosition));
            vector2 = vector;
            transform.localPosition = vector;
            this.startingPosition   = transform.position;
        }
        else
        {
            Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(cachedTransform, base.transform, false, false);
            vector  = bounds.min;
            vector2 = bounds.max;
            transform.localPosition = vector;
            this.startingPosition   = transform.position;
        }
        base.StartCoroutine("CloseIfUnselected");
        float fitScale = this.fitScale;

        transform.localRotation = Quaternion.identity;
        transform.localScale    = new Vector3(fitScale, fitScale, fitScale);
        int num = this.separatePanel ? 0 : NGUITools.CalculateNextDepth(this.mPanel.gameObject);

        if (this.background2DSprite != null)
        {
            UI2DSprite ui2DSprite = UIPopupList.mChild.AddWidget(num);
            ui2DSprite.sprite2D = this.background2DSprite;
            this.mBackground    = ui2DSprite;
        }
        else
        {
            if (!(this.atlas != null))
            {
                return;
            }
            this.mBackground = UIPopupList.mChild.AddSprite(this.atlas as INGUIAtlas, this.backgroundSprite, num);
        }
        bool flag = this.position == UIPopupList.Position.Above;

        if (this.position == UIPopupList.Position.Auto)
        {
            UICamera uicamera = UICamera.FindCameraForLayer(this.mSelection.layer);
            if (uicamera != null)
            {
                flag = (uicamera.cachedCamera.WorldToViewportPoint(this.startingPosition).y < 0.5f);
            }
        }
        this.mBackground.pivot = UIWidget.Pivot.TopLeft;
        this.mBackground.color = this.backgroundColor;
        Vector4 border = this.mBackground.border;

        this.mBgBorder = border.y;
        this.mBackground.cachedTransform.localPosition = new Vector3(0f, flag ? (border.y * 2f - (float)this.overlap) : ((float)this.overlap), 0f);
        if (this.highlight2DSprite != null)
        {
            UI2DSprite ui2DSprite2 = UIPopupList.mChild.AddWidget(num + 1);
            ui2DSprite2.sprite2D = this.highlight2DSprite;
            this.mHighlight      = ui2DSprite2;
        }
        else
        {
            if (!(this.atlas != null))
            {
                return;
            }
            this.mHighlight = UIPopupList.mChild.AddSprite(this.atlas as INGUIAtlas, this.highlightSprite, num + 1);
        }
        float num2 = 0f;
        float num3 = 0f;

        if (this.mHighlight.hasBorder)
        {
            num2 = this.mHighlight.border.w;
            num3 = this.mHighlight.border.x;
        }
        this.mHighlight.pivot = UIWidget.Pivot.TopLeft;
        this.mHighlight.color = this.highlightColor;
        float          num4 = (float)this.activeFontSize * this.activeFontScale;
        float          num5 = num4 + this.padding.y;
        float          num6 = 0f;
        float          num7 = flag ? (border.y - this.padding.y - (float)this.overlap) : (-this.padding.y - border.y + (float)this.overlap);
        float          num8 = border.y * 2f + this.padding.y;
        List <UILabel> list = new List <UILabel>();

        if (!this.items.Contains(this.mSelectedItem))
        {
            this.mSelectedItem = null;
        }
        int i     = 0;
        int count = this.items.Count;

        while (i < count)
        {
            string  text    = this.items[i];
            UILabel uilabel = UIPopupList.mChild.AddWidget(this.mBackground.depth + 2);
            uilabel.name         = i.ToString();
            uilabel.pivot        = UIWidget.Pivot.TopLeft;
            uilabel.bitmapFont   = (this.bitmapFont as INGUIFont);
            uilabel.trueTypeFont = this.trueTypeFont;
            uilabel.fontSize     = this.fontSize;
            uilabel.fontStyle    = this.fontStyle;
            uilabel.text         = (this.isLocalized ? Localization.Get(text, true) : text);
            uilabel.modifier     = this.textModifier;
            uilabel.color        = this.textColor;
            uilabel.cachedTransform.localPosition = new Vector3(border.x + this.padding.x - uilabel.pivotOffset.x, num7, -1f);
            uilabel.overflowMethod = UILabel.Overflow.ResizeFreely;
            uilabel.alignment      = this.alignment;
            uilabel.symbolStyle    = NGUIText.SymbolStyle.Colored;
            list.Add(uilabel);
            num8 += num5;
            num7 -= num5;
            num6  = Mathf.Max(num6, uilabel.printedSize.x);
            UIEventListener uieventListener = UIEventListener.Get(uilabel.gameObject);
            uieventListener.onHover   = new UIEventListener.BoolDelegate(this.OnItemHover);
            uieventListener.onPress   = new UIEventListener.BoolDelegate(this.OnItemPress);
            uieventListener.onClick   = new UIEventListener.VoidDelegate(this.OnItemClick);
            uieventListener.parameter = text;
            if (this.mSelectedItem == text || (i == 0 && string.IsNullOrEmpty(this.mSelectedItem)))
            {
                this.Highlight(uilabel, true);
            }
            this.mLabelList.Add(uilabel);
            i++;
        }
        num6 = Mathf.Max(num6, vector2.x - vector.x - (border.x + this.padding.x) * 2f);
        float   num9    = num6;
        Vector3 vector3 = new Vector3(num9 * 0.5f, -num4 * 0.5f, 0f);
        Vector3 vector4 = new Vector3(num9, num4 + this.padding.y, 1f);
        int     j       = 0;
        int     count2  = list.Count;

        while (j < count2)
        {
            UILabel uilabel2 = list[j];
            NGUITools.AddWidgetCollider(uilabel2.gameObject);
            uilabel2.autoResizeBoxCollider = false;
            BoxCollider component = uilabel2.GetComponent <BoxCollider>();
            if (component != null)
            {
                vector3.z        = component.center.z;
                component.center = vector3;
                component.size   = vector4;
            }
            else
            {
                BoxCollider2D component2 = uilabel2.GetComponent <BoxCollider2D>();
                component2.offset = vector3;
                component2.size   = vector4;
            }
            j++;
        }
        int width = Mathf.RoundToInt(num6);

        num6 += (border.x + this.padding.x) * 2f;
        num7 -= border.y;
        this.mBackground.width  = Mathf.RoundToInt(num6);
        this.mBackground.height = Mathf.RoundToInt(num8);
        int k      = 0;
        int count3 = list.Count;

        while (k < count3)
        {
            UILabel uilabel3 = list[k];
            uilabel3.overflowMethod = UILabel.Overflow.ShrinkContent;
            uilabel3.width          = width;
            k++;
        }
        float      num10      = 2f;
        INGUIAtlas inguiatlas = this.atlas as INGUIAtlas;

        if (inguiatlas != null)
        {
            num10 *= inguiatlas.pixelSize;
        }
        float f  = num6 - (border.x + this.padding.x) * 2f + num3 * num10;
        float f2 = num4 + num2 * num10;

        this.mHighlight.width  = Mathf.RoundToInt(f);
        this.mHighlight.height = Mathf.RoundToInt(f2);
        if (this.isAnimated)
        {
            this.AnimateColor(this.mBackground);
            if (Time.timeScale == 0f || Time.timeScale >= 0.1f)
            {
                float bottom = num7 + num4;
                this.Animate(this.mHighlight, flag, bottom);
                int l      = 0;
                int count4 = list.Count;
                while (l < count4)
                {
                    this.Animate(list[l], flag, bottom);
                    l++;
                }
                this.AnimateScale(this.mBackground, flag, bottom);
            }
        }
        if (flag)
        {
            float num11 = border.y * fitScale;
            vector.y  = vector2.y - border.y * fitScale;
            vector2.y = vector.y + ((float)this.mBackground.height - border.y * 2f) * fitScale;
            vector2.x = vector.x + (float)this.mBackground.width * fitScale;
            transform.localPosition = new Vector3(vector.x, vector2.y - num11, vector.z);
        }
        else
        {
            vector2.y = vector.y + border.y * fitScale;
            vector.y  = vector2.y - (float)this.mBackground.height * fitScale;
            vector2.x = vector.x + (float)this.mBackground.width * fitScale;
        }
        UIPanel uipanel2 = this.mPanel;

        for (;;)
        {
            UIRect parent2 = uipanel2.parent;
            if (parent2 == null)
            {
                break;
            }
            UIPanel componentInParent = parent2.GetComponentInParent <UIPanel>();
            if (componentInParent == null)
            {
                break;
            }
            uipanel2 = componentInParent;
        }
        if (cachedTransform != null)
        {
            vector  = cachedTransform.TransformPoint(vector);
            vector2 = cachedTransform.TransformPoint(vector2);
            vector  = uipanel2.cachedTransform.InverseTransformPoint(vector);
            vector2 = uipanel2.cachedTransform.InverseTransformPoint(vector2);
            float pixelSizeAdjustment = UIRoot.GetPixelSizeAdjustment(base.gameObject);
            vector  /= pixelSizeAdjustment;
            vector2 /= pixelSizeAdjustment;
        }
        Vector3 b       = uipanel2.CalculateConstrainOffset(vector, vector2);
        Vector3 vector5 = transform.localPosition + b;

        vector5.x = Mathf.Round(vector5.x);
        vector5.y = Mathf.Round(vector5.y);
        transform.localPosition = vector5;
        transform.parent        = parent;
    }
Пример #54
0
 // Use this for initialization
 void Start()
 {
     UIEventListener.Get(this.gameObject).onClick = this.EnterRoom;
 }
Пример #55
0
 public void SetEventListener()
 {
     UIEventListener.Get(BtnMagic1).onClick = OnBtnMagic1Click;
     UIEventListener.Get(BtnMagic2).onClick = OnBtnMagic2Click;
 }
Пример #56
0
    /// <summary>
    /// Display the drop-down list when the game object gets clicked on.
    /// </summary>

    void OnClick()
    {
        if (enabled && NGUITools.GetActive(gameObject) && mChild == null && atlas != null && font != null && items.Count > 0)
        {
            mLabelList.Clear();

            // Disable the navigation script
            handleEvents = true;

            // Automatically locate the panel responsible for this object
            if (mPanel == null)
            {
                mPanel = UIPanel.Find(transform, true);
            }

            // Calculate the dimensions of the object triggering the popup list so we can position it below it
            Transform myTrans = transform;
            Bounds    bounds  = NGUIMath.CalculateRelativeWidgetBounds(myTrans.parent, myTrans);

            // Create the root object for the list
            mChild       = new GameObject("Drop-down List");
            mChild.layer = gameObject.layer;

            Transform t = mChild.transform;
            t.parent        = myTrans.parent;
            t.localPosition = bounds.min;
            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;

            // Add a sprite for the background
            mBackground       = NGUITools.AddSprite(mChild, atlas, backgroundSprite);
            mBackground.pivot = UIWidget.Pivot.TopLeft;
            mBackground.depth = NGUITools.CalculateNextDepth(mPanel.gameObject);
            mBackground.color = backgroundColor;

            // We need to know the size of the background sprite for padding purposes
            Vector4 bgPadding = mBackground.border;
            mBgBorder = bgPadding.y;

            mBackground.cachedTransform.localPosition = new Vector3(0f, bgPadding.y, 0f);

            // Add a sprite used for the selection
            mHighlight       = NGUITools.AddSprite(mChild, atlas, highlightSprite);
            mHighlight.pivot = UIWidget.Pivot.TopLeft;
            mHighlight.color = highlightColor;

            UIAtlas.Sprite hlsp = mHighlight.GetAtlasSprite();
            if (hlsp == null)
            {
                return;
            }

            float          hlspHeight = hlsp.inner.yMin - hlsp.outer.yMin;
            float          labelHeight = font.size * font.pixelSize * textScale;
            float          x = 0f, y = -padding.y;
            List <UILabel> labels = new List <UILabel>();

            // Run through all items and create labels for each one
            for (int i = 0, imax = items.Count; i < imax; ++i)
            {
                string s = items[i];

                UILabel lbl = NGUITools.AddWidget <UILabel>(mChild);
                lbl.pivot = UIWidget.Pivot.TopLeft;
                lbl.font  = font;
                lbl.text  = (isLocalized && Localization.instance != null) ? Localization.instance.Get(s) : s;
                lbl.color = textColor;
                lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x, y, -1f);
                lbl.overflowMethod = UILabel.Overflow.ResizeFreely;
                lbl.MakePixelPerfect();
                if (textScale != 1f)
                {
                    lbl.cachedTransform.localScale = Vector3.one * textScale;
                }
                labels.Add(lbl);

                y -= labelHeight;
                y -= padding.y;
                x  = Mathf.Max(x, labelHeight);

                // Add an event listener
                UIEventListener listener = UIEventListener.Get(lbl.gameObject);
                listener.onHover   = OnItemHover;
                listener.onPress   = OnItemPress;
                listener.parameter = s;

                // Move the selection here if this is the right label
                if (mSelectedItem == s)
                {
                    Highlight(lbl, true);
                }

                // Add this label to the list
                mLabelList.Add(lbl);
            }

            // The triggering widget's width should be the minimum allowed width
            x = Mathf.Max(x, bounds.size.x - (bgPadding.x + padding.x) * 2f);

            Vector3 bcCenter = new Vector3(x * 0.5f, -labelHeight * 0.5f, 0f);
            Vector3 bcSize   = new Vector3(x, (labelHeight + padding.y), 1f);

            // Run through all labels and add colliders
            for (int i = 0, imax = labels.Count; i < imax; ++i)
            {
                UILabel     lbl = labels[i];
                BoxCollider bc  = NGUITools.AddWidgetCollider(lbl.gameObject);
                bcCenter.z = bc.center.z;
                bc.center  = bcCenter;
                bc.size    = bcSize;
            }

            x += (bgPadding.x + padding.x) * 2f;
            y -= bgPadding.y;

            // Scale the background sprite to envelop the entire set of items
            mBackground.width  = Mathf.RoundToInt(x);
            mBackground.height = Mathf.RoundToInt(-y + bgPadding.y);

            // Scale the highlight sprite to envelop a single item
            float scaleFactor = 2f * atlas.pixelSize;
            float w           = x - (bgPadding.x + padding.x) * 2f + (hlsp.inner.xMin - hlsp.outer.xMin) * scaleFactor;
            float h           = labelHeight + hlspHeight * scaleFactor;
            mHighlight.width  = Mathf.RoundToInt(w);
            mHighlight.height = Mathf.RoundToInt(h);

            bool placeAbove = (position == Position.Above);

            if (position == Position.Auto)
            {
                UICamera cam = UICamera.FindCameraForLayer(gameObject.layer);

                if (cam != null)
                {
                    Vector3 viewPos = cam.cachedCamera.WorldToViewportPoint(myTrans.position);
                    placeAbove = (viewPos.y < 0.5f);
                }
            }

            // If the list should be animated, let's animate it by expanding it
            if (isAnimated)
            {
                float bottom = y + labelHeight;
                Animate(mHighlight, placeAbove, bottom);
                for (int i = 0, imax = labels.Count; i < imax; ++i)
                {
                    Animate(labels[i], placeAbove, bottom);
                }
                AnimateColor(mBackground);
                AnimateScale(mBackground, placeAbove, bottom);
            }

            // If we need to place the popup list above the item, we need to reposition everything by the size of the list
            if (placeAbove)
            {
                t.localPosition = new Vector3(bounds.min.x, bounds.max.y - y - bgPadding.y, bounds.min.z);
            }
        }
        else
        {
            OnSelect(false);
        }
    }
Пример #57
0
 protected override void OnEnable()
 {
     UIEventListener.Get(gameObject).onClick += ShowNextPage;
     _btnClose.onClick.AddListener(Destroy);
 }
Пример #58
0
 //登陆失败反馈
 void ShowLoginFail()
 {
     mReLoginParent.gameObject.SetActive(true);
     mWaitingParent.gameObject.SetActive(false);
     UIEventListener.Get(mPlaySubmitBtn.gameObject).onClick += OnPlaySubmit;
 }
Пример #59
0
 protected override void OnEnable()
 {
     UIEventListener.Get(btnTap).onClick += OnClickGo;
     btnHelp.onClick.AddListener(OpenHelpWin);
 }
Пример #60
0
 void Awake()
 {
     UIEventListener.Get(btn.gameObject).onClick = onClickButton;
 }