Esempio n. 1
0
 public void OnListBtnClick(GameObject go)
 {
     if (HOTween.IsTweening(this.mListBtn.transform))
     {
         if (!(go == null))
         {
             return;
         }
         HOTween.Kill(this.mListBtn.transform);
     }
     Globals.Instance.EffectSoundMgr.Play("ui/ui_001");
     if (this.mData != null)
     {
         if (this.mData.BtnsVisible)
         {
             this.mData.BtnsVisible = false;
             base.StartCoroutine(this.HideListBtns());
             if (GUICommonBagItem.mCurBagItemData == this.mData)
             {
                 GUICommonBagItem.mCurBagItemData = null;
                 GUICommonBagItem.mCurBagItem = null;
             }
         }
         else
         {
             this.mData.BtnsVisible = true;
             base.StartCoroutine(this.ShowListBtns());
             if (GUICommonBagItem.mCurBagItemData != null && GUICommonBagItem.mCurBagItem != null && GUICommonBagItem.mCurBagItemData != this.mData)
             {
                 if (!(GUICommonBagItem.mCurBagItem == null))
                 {
                     if (GUICommonBagItem.mCurBagItemData == GUICommonBagItem.mCurBagItem.mData)
                     {
                         GUICommonBagItem.mCurBagItem.OnListBtnClick(null);
                     }
                     else
                     {
                         GUICommonBagItem.mCurBagItemData.BtnsVisible = false;
                     }
                 }
             }
             GUICommonBagItem.mCurBagItemData = this.mData;
             GUICommonBagItem.mCurBagItem = this;
         }
     }
     else if (this.mLopetData != null)
     {
         if (this.mLopetData.State == 1)
         {
             this.mLopetData.State = 0;
             base.StartCoroutine(this.HideListBtns());
             if (GUICommonBagItem.mCurBagItemLopetData == this.mLopetData)
             {
                 GUICommonBagItem.mCurBagItemLopetData = null;
                 GUICommonBagItem.mCurBagItem = null;
             }
         }
         else
         {
             this.mLopetData.State = 1;
             base.StartCoroutine(this.ShowListBtns());
             if (GUICommonBagItem.mCurBagItemLopetData != null && GUICommonBagItem.mCurBagItem != null && GUICommonBagItem.mCurBagItemLopetData != this.mLopetData)
             {
                 if (!(GUICommonBagItem.mCurBagItem == null))
                 {
                     if (GUICommonBagItem.mCurBagItemLopetData == GUICommonBagItem.mCurBagItem.mLopetData)
                     {
                         GUICommonBagItem.mCurBagItem.OnListBtnClick(null);
                     }
                     else
                     {
                         GUICommonBagItem.mCurBagItemLopetData.State = 0;
                     }
                 }
             }
             GUICommonBagItem.mCurBagItemLopetData = this.mLopetData;
             GUICommonBagItem.mCurBagItem = this;
         }
     }
     else if (this.mPetData != null)
     {
         if (this.mPetData.State == 1)
         {
             this.mPetData.State = 0;
             base.StartCoroutine(this.HideListBtns());
             if (GUICommonBagItem.mCurBagItemPetData == this.mPetData)
             {
                 GUICommonBagItem.mCurBagItemPetData = null;
                 GUICommonBagItem.mCurBagItem = null;
             }
         }
         else
         {
             this.mPetData.State = 1;
             base.StartCoroutine(this.ShowListBtns());
             if (GUICommonBagItem.mCurBagItemPetData != null && GUICommonBagItem.mCurBagItem != null && GUICommonBagItem.mCurBagItemPetData != this.mPetData)
             {
                 if (!(GUICommonBagItem.mCurBagItem == null))
                 {
                     if (GUICommonBagItem.mCurBagItemPetData == GUICommonBagItem.mCurBagItem.mPetData)
                     {
                         GUICommonBagItem.mCurBagItem.OnListBtnClick(null);
                     }
                     else
                     {
                         GUICommonBagItem.mCurBagItemPetData.State = 0;
                     }
                 }
             }
             GUICommonBagItem.mCurBagItemPetData = this.mPetData;
             GUICommonBagItem.mCurBagItem = this;
         }
     }
 }
Esempio n. 2
0
 public void Refresh()
 {
     if (this.mData != null)
     {
         this.mIconItem.Refresh(this.mData, false, false, false);
         this.mIconItem.SetMask = this.ShowIconGray();
         this.tempStr = this.GetLevel();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mLevel.enabled = false;
         }
         else
         {
             this.mLevel.enabled = true;
             this.mLevel.text = this.tempStr;
         }
         this.tempStr = this.GetName();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mName.enabled = false;
         }
         else
         {
             this.mName.enabled = true;
             this.mName.color = Tools.GetItemQualityColor(this.mData.Info.Quality);
             this.mName.text = this.tempStr;
         }
         this.mPoint0.text = this.GetPoint0();
         this.mPoint0Value.text = this.GetPoint0Value();
         this.mPoint1.text = this.GetPoint1();
         this.mPoint1Value.text = this.GetPoint1Value();
         this.tempInt = this.GetRefineLevel();
         if (this.tempInt > 0)
         {
             this.mRefineLevel.gameObject.SetActive(true);
             this.mRefineLevel.text = Singleton<StringManager>.Instance.GetString("equipImprove1", new object[]
             {
                 this.tempInt
             });
             this.mRefineLevelBG.enabled = true;
         }
         else
         {
             this.tempStr = this.GetTip();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mRefineLevel.gameObject.SetActive(false);
             }
             else
             {
                 this.mRefineLevel.gameObject.SetActive(true);
                 this.mRefineLevel.text = this.tempStr;
                 this.mRefineLevelBG.enabled = false;
             }
         }
         this.tempStr = this.GetDesc();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mDesc.enabled = false;
         }
         else
         {
             this.mDesc.enabled = true;
             this.mDesc.text = this.tempStr;
         }
         this.tempStr = this.GetRelation();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mRelation.enabled = false;
         }
         else
         {
             this.mRelation.enabled = true;
             this.mRelation.text = this.tempStr;
         }
         if (this.ShowStars())
         {
             this.mStars.Show();
             this.tempInt = this.GetStarsNum();
             this.mStars.Refresh(this.tempInt);
         }
         else
         {
             this.mStars.Hide();
         }
         this.tempPetData = this.GetPetDataEx();
         if (this.tempPetData == null)
         {
             this.mOwner.enabled = false;
         }
         else
         {
             this.mOwner.enabled = true;
             if (this.tempPetData.IsPlayerBattling())
             {
                 this.mOwner.text = Singleton<StringManager>.Instance.GetString("equipImprove10", new object[]
                 {
                     Globals.Instance.Player.Data.Name
                 });
             }
             else
             {
                 this.mOwner.text = Singleton<StringManager>.Instance.GetString("equipImprove10", new object[]
                 {
                     this.tempPetData.Info.FirstName
                 });
             }
         }
         if (this.ShowSelect())
         {
             this.mSelectToggle.SetCheckValue(this.mData.IsSelected);
         }
         this.tempInt = this.GetPrice(out this.tempStr, out this.tempBool);
         if (this.tempInt > 0)
         {
             this.mPrice.gameObject.SetActive(true);
             this.mPrice.text = this.tempInt.ToString();
             this.mPriceIcon.enabled = this.tempBool;
             this.mPriceName.text = this.tempStr;
         }
         else
         {
             this.mPrice.gameObject.SetActive(false);
         }
         if (this.mListBtn.activeInHierarchy)
         {
             if (this.mData.BtnsVisible)
             {
                 this.mInfo.gameObject.SetActive(false);
                 this.mList.SetActive(true);
                 this.mListBtn.transform.localRotation = Quaternion.Euler(0f, 0f, -180f);
                 this.mRefineBtn.gameObject.SetActive(true);
                 this.mEnhanceBtn.gameObject.SetActive(true);
                 if (GUICommonBagItem.mCurBagItem != this)
                 {
                     GUICommonBagItem.mCurBagItem = this;
                     GUICommonBagItem.mCurBagItemData = this.mData;
                 }
             }
             else
             {
                 this.mInfo.gameObject.SetActive(true);
                 this.mList.SetActive(false);
                 this.mListBtn.transform.localRotation = Quaternion.identity;
                 this.mRefineBtn.gameObject.SetActive(false);
                 this.mEnhanceBtn.gameObject.SetActive(false);
             }
             this.tempStr = this.GetEnhanceMax();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mEnhanceMax.enabled = false;
             }
             else
             {
                 this.mEnhanceMax.enabled = true;
                 this.mEnhanceMax.text = this.tempStr;
             }
             this.tempStr = this.GetRefineMax();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mRefineMax.enabled = false;
             }
             else
             {
                 this.mRefineMax.enabled = true;
                 this.mRefineMax.text = this.tempStr;
             }
             if (this.ShowListGoBtn())
             {
                 this.mListGoBtn.SetActive(true);
             }
             else
             {
                 this.mListGoBtn.SetActive(false);
             }
         }
         else
         {
             this.mListBtn.SetActive(false);
             this.tempStr = this.GetClickableBtnTxt();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mClickableBtnSprite.gameObject.SetActive(false);
             }
             else
             {
                 this.mClickableBtnSprite.gameObject.SetActive(true);
                 this.mClickableBtnTxt.text = this.tempStr;
                 NGUITools.SetActive(this.mClickableBtnEffect, this.ShowClickableBtnEffect());
             }
         }
     }
     else if (this.mPetData != null)
     {
         this.mIconItem.Refresh(this.mPetData, false, false, false);
         this.mIconItem.SetMask = this.ShowIconGray();
         this.mIconItem.EnableLeftTopTag = this.ShowIconLeftTopTag();
         this.mIconItem.SetLeftTopTag(this.GetIconLeftTopTagLb());
         this.tempStr = this.GetLevel();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mLevel.enabled = false;
         }
         else
         {
             this.mLevel.enabled = true;
             this.mLevel.text = this.tempStr;
         }
         this.tempStr = this.GetName();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mName.enabled = false;
         }
         else
         {
             this.mName.enabled = true;
             this.mName.color = Tools.GetItemQualityColor(this.mPetData.Info.Quality);
             this.mName.text = this.tempStr;
         }
         this.mPoint0.text = this.GetPoint0();
         this.mPoint0Value.text = this.GetPoint0Value();
         this.mPoint1.text = this.GetPoint1();
         this.mPoint1Value.text = this.GetPoint1Value();
         this.tempStr = this.GetTip();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mRefineLevel.gameObject.SetActive(false);
         }
         else
         {
             this.mRefineLevel.gameObject.SetActive(true);
             this.mRefineLevel.text = this.tempStr;
             this.mRefineLevelBG.enabled = false;
         }
         this.tempStr = this.GetDesc();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mDesc.enabled = false;
         }
         else
         {
             this.mDesc.enabled = true;
             this.mDesc.text = this.tempStr;
         }
         this.tempStr = this.GetRelation();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mRelation.enabled = false;
         }
         else
         {
             this.mRelation.enabled = true;
             this.mRelation.text = this.tempStr;
         }
         if (this.ShowStars())
         {
             this.mStars.Show();
             this.tempInt = this.GetStarsNum();
             this.mStars.Refresh(this.tempInt);
         }
         else
         {
             this.mStars.Hide();
         }
         this.mOwner.enabled = false;
         this.mPrice.gameObject.SetActive(false);
         if (this.mListBtn.activeInHierarchy)
         {
             if (this.mPetData.State == 1)
             {
                 this.mInfo.gameObject.SetActive(false);
                 this.mList.SetActive(true);
                 this.mListBtn.transform.localRotation = Quaternion.Euler(0f, 0f, -180f);
                 this.mRefineBtn.gameObject.SetActive(true);
                 this.mEnhanceBtn.gameObject.SetActive(true);
                 if (GUICommonBagItem.mCurBagItem != this)
                 {
                     GUICommonBagItem.mCurBagItem = this;
                     GUICommonBagItem.mCurBagItemPetData = this.mPetData;
                 }
             }
             else
             {
                 this.mInfo.gameObject.SetActive(true);
                 this.mList.SetActive(false);
                 this.mListBtn.transform.localRotation = Quaternion.identity;
                 this.mRefineBtn.gameObject.SetActive(false);
                 this.mEnhanceBtn.gameObject.SetActive(false);
             }
             if (this.ShowListGoBtn())
             {
                 this.mListGoBtn.SetActive(true);
             }
             else
             {
                 this.mListGoBtn.SetActive(false);
             }
         }
         else
         {
             this.mListBtn.SetActive(false);
             this.tempStr = this.GetClickableBtnTxt();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mClickableBtnSprite.gameObject.SetActive(false);
             }
             else
             {
                 this.mClickableBtnSprite.gameObject.SetActive(true);
                 this.mClickableBtnTxt.text = this.tempStr;
                 NGUITools.SetActive(this.mClickableBtnEffect, this.ShowClickableBtnEffect());
             }
             this.tempBool = this.EnableClickableBtn();
             if (this.tempBool)
             {
                 this.mClickableBtn.isEnabled = true;
                 for (int i = 0; i < this.mClickableBtns.Length; i++)
                 {
                     this.mClickableBtns[i].SetState(UIButtonColor.State.Normal, true);
                 }
             }
             else
             {
                 this.mClickableBtn.isEnabled = false;
                 for (int j = 0; j < this.mClickableBtns.Length; j++)
                 {
                     this.mClickableBtns[j].SetState(UIButtonColor.State.Disabled, true);
                 }
             }
         }
     }
     else if (this.mLopetData != null)
     {
         this.mIconItem.Refresh(this.mLopetData, false, false, false);
         this.mIconItem.SetMask = this.ShowIconGray();
         this.mIconItem.EnableLeftTopTag = this.ShowIconLeftTopTag();
         this.mIconItem.SetLeftTopTag(this.GetIconLeftTopTagLb());
         this.tempStr = this.GetLevel();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mLevel.enabled = false;
         }
         else
         {
             this.mLevel.enabled = true;
             this.mLevel.text = this.tempStr;
         }
         this.tempStr = this.GetName();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mName.enabled = false;
         }
         else
         {
             this.mName.enabled = true;
             this.mName.color = Tools.GetItemQualityColor(this.mLopetData.Info.Quality);
             this.mName.text = this.tempStr;
         }
         this.mPoint0.text = this.GetPoint0();
         this.mPoint0Value.text = this.GetPoint0Value();
         this.mPoint1.text = this.GetPoint1();
         this.mPoint1Value.text = this.GetPoint1Value();
         this.mEnhanceLb.text = this.GetEnhanceLb();
         this.mRefineLb.text = this.GetRefineLb();
         this.tempStr = this.GetTip();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mRefineLevel.gameObject.SetActive(false);
         }
         else
         {
             this.mRefineLevel.gameObject.SetActive(true);
             this.mRefineLevel.text = this.tempStr;
             this.mRefineLevelBG.enabled = false;
         }
         this.tempStr = this.GetDesc();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mDesc.enabled = false;
         }
         else
         {
             this.mDesc.enabled = true;
             this.mDesc.text = this.tempStr;
         }
         this.tempStr = this.GetRelation();
         if (string.IsNullOrEmpty(this.tempStr))
         {
             this.mRelation.enabled = false;
         }
         else
         {
             this.mRelation.enabled = true;
             this.mRelation.text = this.tempStr;
         }
         if (this.ShowStars())
         {
             this.mStars.Show();
             this.tempInt = this.GetStarsNum();
             this.mStars.Refresh(this.tempInt);
         }
         else
         {
             this.mStars.Hide();
         }
         this.mOwner.enabled = false;
         this.mPrice.gameObject.SetActive(false);
         if (this.mListBtn.activeInHierarchy)
         {
             if (this.mLopetData.State == 1)
             {
                 this.mInfo.gameObject.SetActive(false);
                 this.mList.SetActive(true);
                 this.mListBtn.transform.localRotation = Quaternion.Euler(0f, 0f, -180f);
                 this.mRefineBtn.gameObject.SetActive(true);
                 this.mEnhanceBtn.gameObject.SetActive(true);
                 if (GUICommonBagItem.mCurBagItem != this)
                 {
                     GUICommonBagItem.mCurBagItem = this;
                     GUICommonBagItem.mCurBagItemLopetData = this.mLopetData;
                 }
             }
             else
             {
                 this.mInfo.gameObject.SetActive(true);
                 this.mList.SetActive(false);
                 this.mListBtn.transform.localRotation = Quaternion.identity;
                 this.mRefineBtn.gameObject.SetActive(false);
                 this.mEnhanceBtn.gameObject.SetActive(false);
             }
             this.tempStr = this.GetEnhanceMax();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mEnhanceMax.enabled = false;
             }
             else
             {
                 this.mEnhanceMax.enabled = true;
                 this.mEnhanceMax.text = this.tempStr;
             }
             this.tempStr = this.GetRefineMax();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mRefineMax.enabled = false;
             }
             else
             {
                 this.mRefineMax.enabled = true;
                 this.mRefineMax.text = this.tempStr;
             }
             if (this.ShowListGoBtn())
             {
                 this.mListGoBtn.SetActive(true);
             }
             else
             {
                 this.mListGoBtn.SetActive(false);
             }
         }
         else
         {
             this.mListBtn.SetActive(false);
             this.tempStr = this.GetClickableBtnTxt();
             if (string.IsNullOrEmpty(this.tempStr))
             {
                 this.mClickableBtnSprite.gameObject.SetActive(false);
             }
             else
             {
                 this.mClickableBtnSprite.gameObject.SetActive(true);
                 this.mClickableBtnTxt.text = this.tempStr;
                 NGUITools.SetActive(this.mClickableBtnEffect, this.ShowClickableBtnEffect());
             }
         }
     }
 }