protected override void OnDestroy() { OnClose(); base.OnDestroy(); mCharacterPreview.Destroy(); mCharacterPreview = null; }
protected override void OnLoad() { base.OnLoad(); mFashionName = FindComponent <UILabel>("listContiner/namebg/fashionname"); mGetWay = FindComponent <UILabel>("listContiner/getway"); mDesc = FindComponent <UILabel>("listContiner/desc"); mPropTitle = FindComponent <UILabel>("listContiner/proptitle"); mDefence = FindComponent <UILabel>("listContiner/defence"); mAttack = FindComponent <UILabel>("listContiner/attack"); mPower = FindComponent <UILabel>("listContiner/power"); mLife = FindComponent <UILabel>("listContiner/life"); mCritical = FindComponent <UILabel>("listContiner/critical"); mAddStarBtn = FindComponent <UIButton>("listContiner/btngrid/AddstarBtn"); mWearBtn = FindComponent <UIButton>("listContiner/btngrid/EquipBtn"); mWearTxt = FindComponent <UILabel>("listContiner/btngrid/EquipBtn/Label"); mBuyBtn = FindComponent <UIButton>("listContiner/btngrid/BuyBtn"); mBuyText = FindComponent <UILabel>("listContiner/btngrid/BuyBtn/Label"); mBtnGrid = FindComponent <UIGrid>("listContiner/btngrid"); mFashionItemGrid = FindComponent <UIGrid>("listContiner/ScrollView/itemgrid"); ownItemNum = FindComponent <UILabel>("listContiner/ownItemNum"); mExamFashionItem = FindChild("FashionItem"); mExamFashionItem.SetActive(false); mAwardContainer = FindChild("awardContainer"); mPreview = FindComponent <UISprite>("listContiner/Preview"); mCharacterPreview = new UICharacterPreview(); //初始化时装列表 mItemDic = new Dictionary <int, FashionItemUI>(); IDictionaryEnumerator enumerator = DataManager.FashionTable.GetEnumerator(); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { return; } while (enumerator.MoveNext()) { FashionTableItem res = enumerator.Value as FashionTableItem; if (res.sex != pdm.GetResId()) { continue; } FashionItemUI item = new FashionItemUI(GameObject.Instantiate(mExamFashionItem) as GameObject); UIAtlasHelper.SetSpriteImage(item.cloth, res.pic); item.gameObject.SetActive(true); item.gameObject.transform.parent = mFashionItemGrid.gameObject.transform; item.gameObject.transform.localScale = Vector3.one; item.name.text = res.name; item.mBtn.CustomData = res.id; mItemDic.Add(res.id, item); } mFashionItemGrid.maxPerLine = mItemDic.Count > 8 ? Mathf.CeilToInt(mItemDic.Count / 2) : 4; mPropTitle.text = StringHelper.GetString("fashion_pro"); }
protected override void OnLoad() { base.OnLoad(); mButtonReadMe = FindComponent <UIButton>("mainContainer/Center/ReadMe"); mButtonLeftBtn = FindComponent <UIButton>("mainContainer/Center/PageLeft"); mButtonRightBtn = FindComponent <UIButton>("mainContainer/Center/PageRight"); mLabelMyFight = FindComponent <UILabel>("mainContainer/Bottom/MyFigh"); mLabelMyFightTxt = FindComponent <UILabel>("mainContainer/Bottom/MyFightTxt"); mLabelRecomFight = FindComponent <UILabel>("mainContainer/Bottom/RecomFight"); mLabelScrib = FindComponent <UILabel>("mainContainer/Bottom/Scrib"); mLabelState = FindComponent <UILabel>("mainContainer/Bottom/State/Label"); mButtonOk = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/OkBtn"); mButtonSweep = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/Sweep"); mButtonBack = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/Back"); mButtonDoAgain = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/DoAgain"); mButtonRank = FindComponent <UIButton>("mainContainer/Bottom/Paihang"); mScrolV = FindComponent <UIScrollView>("mainContainer/Center/Scroll View"); mGridDrop = FindComponent <UIGrid>("mainContainer/Bottom/DropGrid"); mBtnGrid = FindComponent <UIGrid>("mainContainer/Bottom/BtnGrid"); mGridFloor = FindComponent <UIGrid>("mainContainer/Center/Scroll View/Grid"); mSpriteAchieveOne = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve1"); mSpriteAchieveTwo = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve2"); mSpriteAchieveThree = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve3"); mLabelWeekScore = FindComponent <UILabel>("mainContainer/Bottom/WeekScoreNum"); mFirstDrop = FindChild("mainContainer/Bottom/DropGrid/FirstDrop"); mNormalDrop = FindChild("mainContainer/Bottom/DropGrid/SecondDrop"); mBackGround = FindChild("BackGround"); mExamRankItem = FindChild("ViewItem"); mExamRankItem.SetActive(false); mRankTween = FindComponent <UIPlayTween>("rankContainer"); mMainTween = FindComponent <UIPlayTween>("mainContainer"); mRankLeftTween = FindComponent <TweenPosition>("rankContainer/left"); mRankRightTween = FindComponent <TweenPosition>("rankContainer/right"); mMainTweenPos = FindComponent <TweenPosition>("mainContainer"); mMainTween.resetOnPlay = true; mRankTween.resetOnPlay = true; mRankNum = FindComponent <UILabel>("rankContainer/right/ranknum"); mPlayerName = FindComponent <UILabel>("rankContainer/right/playername"); mRankTimer = FindComponent <UILabel>("rankContainer/right/awardIcon/timer"); mShowAwardBtn = FindComponent <UIButton>("rankContainer/right/awardIcon"); mGoToChalBtn = FindComponent <UIButton>("rankContainer/right/GotoChallenge"); mSelfScore = FindComponent <UILabel>("rankContainer/right/scorebg/Label"); mScoreTip = FindComponent <UILabel>("rankContainer/right/tip"); mPreview = FindComponent <UISprite>("rankContainer/right/Preview"); mDizuo = FindComponent <UISprite>("rankContainer/right/dizuo"); mRankGuid = FindComponent <UIGrid>("rankContainer/left/scrollView/itemguid"); mRanAwardPanel = new ChaRankAwardUI(FindChild("RankAwardPanel")); mRanAwardPanel.mGameObject.SetActive(false); mExamChallengeBtn = FindChild("floorinfo"); mExamChallengeBtn.gameObject.SetActive(false); mChalModule = ModuleManager.Instance.FindModule <ChallengeModule>(); mCharacterPreview = new UICharacterPreview(); mCharacterPreview.BackgroundSprite = mDizuo; mCharacterPreview.SetTargetSprite(mPreview); mCharacterPreview.SetCameraOrthographicSize(1.2f); mCharacterPreview.RotationY = 180; mCharacterPreview.Pos = new Vector3(0, 0.3f, 0); mCharacterPreview.Enable = true; //初始化 InitUI(); }
protected override void OnLoad() { base.OnLoad(); midBk = FindChild("Content/Background/MidBK"); //翻页 pagePrev = FindComponent <UIButton>("Content/Background/MidBK/WingList/pagePre"); pagePrevAni = FindComponent <UIButton>("Content/Background/MidBK/WingList/pagePreAni"); pageNext = FindComponent <UIButton>("Content/Background/MidBK/WingList/pageNext"); pageNextAni = FindComponent <UIButton>("Content/Background/MidBK/WingList/pageNextAni"); //翅膀 wingItemProfab = FindChild("wingItem"); mWingItemUIList = new List <WingItemUI>(); winggrid = FindChild("Content/Background/MidBK/WingList/winggrid"); wingName = FindComponent <UILabel>("Content/Background/MidBK/WingList/wingName"); buffDesc = FindComponent <UILabel>("Content/Background/MidBK/WingList/bufftext"); //翅膀试穿 mPreviewSprite = FindComponent <UISprite>("Content/Background/MidBK/WingList/mPreView"); mPreviewSprite.transform.localPosition = Vector3.zero; mCharacterPreview = new UICharacterPreview(); wingItemProfab.SetActive(false); tip = FindComponent <UILabel>("Content/Background/MidBK/WingList/tip"); tip.gameObject.SetActive(true); tip.pivot = UIWidget.Pivot.Left; tip.gameObject.transform.localPosition = new Vector3(-304f, -145f, 0); pageSprite = FindChild("pageItem"); pageBar = new LockStatePageBarUI(FindChild("Content/Background/MidBK/lockStateBar"), WingDefine.MaxWingNum, pageSprite); WingDescript = FindChild("Content/Background/WingDescript"); WingDescriptText = FindComponent <UILabel>("Content/Background/WingDescript/WingDescriptText"); //翅膀进度条 levelbar = FindChild("Content/Background/levelbar"); levelnum = FindComponent <UILabel>("Content/Background/levelbar/levelnum"); nextLevel = FindComponent <UILabel>("Content/Background/levelbar/nextLevel"); levelPercent = FindComponent <UILabel>("Content/Background/levelbar/levelPercent"); levelProcessbar = FindComponent <UISlider>("Content/Background/levelbar/levelProcessbar"); levbarAni = FindComponent <UISprite>("Content/Background/levelbar/levbarAni"); levbarAni.gameObject.SetActive(false); UISpriteAnimation ani = levbarAni.gameObject.GetComponent <UISpriteAnimation>(); ani.Reset(); ani.onFinished += AnimationFinesh; //翅膀属性 wingPropObj = FindChild("Content/Background/wingPrperty"); mProps = new List <WingPropertyItem>(); for (int i = 0; i < WingDefine.PropertyNum; ++i) { var tempP = new WingPropertyItem(ObjectCommon.GetChild(wingPropObj, "Grid/prop" + (i + 1))) { mType = (WingPropertyType)i }; mProps.Add(tempP); } //消耗物品 stuff = FindComponent <UISprite>("Content/Background/wingPrperty/stuff"); stuffname = FindComponent <UILabel>("Content/Background/wingPrperty/stuff/stuffname"); stuffnum = FindComponent <UILabel>("Content/Background/wingPrperty/stuff/stuffnum"); jihuotiaojianTxt = FindComponent <UILabel>("Content/Background/jihuotiaojian/jihuotiaojianTxt"); backBtn = FindComponent <UIButton>("Content/Background/MidBK/WingList/backBtn"); tryOnBtn = FindComponent <UIButton>("Content/Background/MidBK/WingList/wearBtn"); jihuoAni = FindComponent <UISprite>("Content/Background/UnlockCondition/jihuoAni"); jihuoAni.gameObject.SetActive(false); jihuoBtn = FindComponent <UIButton>("Content/Background/UnlockCondition/jihuoBtn"); zhanValue = FindComponent <UILabel>("Content/Background/jihuotiaojian/zhanBK/zhanValue"); jinglianBtn = FindComponent <UIButton>("Content/Background/wingPrperty/jinglianBtn"); jinglianTxt = FindComponent <UILabel>("Content/Background/wingPrperty/jinglianBtn/Label"); equipBtn = FindComponent <UIButton>("Content/Background/wingPrperty/equipBtn"); equipWord = FindComponent <UILabel>("Content/Background/wingPrperty/equipBtn/Label"); UnlockCondition = FindChild("Content/Background/UnlockCondition"); mConditionUIList = new List <wingConditionUI>(); for (int i = 0; i < WingDefine.MaxConditonNum; ++i) { mConditionUIList.Add(new wingConditionUI(ObjectCommon.GetChild(UnlockCondition, "Grid/dachengdiaojian" + (i + 1)))); } if (mNeedInit) { Init(); } }