Esempio n. 1
0
    public override void OnReadyForClose()
    {
        base.OnReadyForClose();

        mRunes[0].RemoveIconClickListener(OnRuneBtnClick0);
        mRunes[1].RemoveIconClickListener(OnRuneBtnClick1);
        mRunes[2].RemoveIconClickListener(OnRuneBtnClick2);
        mRunes[3].RemoveIconClickListener(OnRuneBtnClick3);
        mRunes[4].RemoveIconClickListener(OnRuneBtnClick4);
        mRunes[5].RemoveIconClickListener(OnRuneBtnClick5);

        mRuneBounsBtn.onClick.RemoveListener(OnRunePropBtnClick);
        mCloseDetailBtn.onClick.RemoveListener(OnCloseRuneDetailBtnClick);
        mStrenthBtn.onClick.RemoveListener(OnStrenthBtnClick);
        mIdentifyBtn.onClick.RemoveListener(OnIdentifyBtnClick);
        mChangeBtn.onClick.RemoveListener(OnChangeBtnClick);
        mPropCloseBtn.onClick.RemoveListener(OnRunePropCloseBtnClick);

        GameEventDispatcher.Inst.removeEventListener(GameEventID.U_HeroChangeTarget, OnSelectCardHeroChanged);
        GameEventDispatcher.Inst.removeEventListener(GameEventID.Net_RefreshItem, OnItemRefresh);
        GameEventDispatcher.Inst.removeEventListener(GameEventID.Net_RefreshHero, OnCardHeroDataChanged);

        for (int i = 0, j = mRunes.Length; i < j; i++)
        {
            mRunes[i].Destroy();
        }

        for (int i = 0, j = mRuneGoupItems.Length; i < j; i++)
        {
            mRuneGoupItems[i].Destroy();
        }

        mItemCommon = null;
        if (mDetailCommon != null)
        {
            mDetailCommon.Destroy();
            mDetailCommon = null;
        }
        mRuneAttrImgs  = null;
        mRuneDetails   = null;
        mRuneValues    = null;
        mRunes         = null;
        mRuneGoupItems = null;
        mObjectCard    = null;
        _instance      = null;

        foreach (UI_RuneAttriItem attrItem in mPropRuneQueue)
        {
            attrItem.Destroy();
        }
        mPropRuneQueue.Clear();
        mPropRuneQueue = null;
        //System.GC.Collect();

        //if(mRuneIdentifyMgr != null)
        //{
        //    mRuneIdentifyMgr.OnDestroy();
        //}

        //if(mRuneStrenthMgr != null)
        //{
        //    mRuneStrenthMgr.OnDestroy();
        //}
    }
Esempio n. 2
0
    public override void InitUIData()
    {
        base.InitUIData();
        _instance = this;

        m_RuneAttriPos = selfTransform.FindChild("RuneDetail/RuneAttriPos");
        m_RuneItemPos  = selfTransform.FindChild("RuneDetail/RuneInfo/Panel/RunItem1");

        mRunes = new RuneIconItem[(int)EM_RUNE_POINT.EM_RUNE_POINT_NUMBER];
        for (int i = 0, j = (int)EM_RUNE_POINT.EM_RUNE_POINT_NUMBER; i < j; i++)
        {
            Transform trans = transform.FindChild("RuneGroup/RunItem" + i);
            mRunes[i] = new RuneIconItem(trans);
            mRunes[i].SetIsSpecial(i == (int)EM_RUNE_POINT.EM_RUNE_POINT_SPECIAL);
        }

        mRuneGoupItems = new UI_HeroRuneGroupItem[4];
        for (int i = 0; i < 4; i++)
        {
            Transform trans = transform.FindChild("RuneRewards/runesGrid/RunRewardsItem" + i);
            mRuneGoupItems[i] = new UI_HeroRuneGroupItem(trans);
        }

        mRuneBounsBtn = transform.FindChild("Rune bonusBtn").GetComponent <Button>();
        mRuneEffObj   = transform.FindChild("MagicArray01").gameObject;

        mRuneAttrImgs = new Image[3];
        mRuneDetails  = new Text[3];
        mRuneValues   = new Text[3];

        for (int i = 0; i < 3; i++)
        {
            mRuneAttrImgs[i] = transform.FindChild("RuneRewards/attriGrid/RunReward" + i + "_txt/Image").GetComponent <Image>();
            mRuneDetails[i]  = transform.FindChild("RuneRewards/attriGrid/RunReward" + i + "_txt/Left_Txt").GetComponent <Text>();
            mRuneValues[i]   = transform.FindChild("RuneRewards/attriGrid/RunReward" + i + "_txt/Right_Txt").GetComponent <Text>();
        }
        mMsgBoxTrans     = transform.FindChild("MsgBoxObj");
        mAttriTitleTxt   = transform.FindChild("Items/AttriTitle").GetComponent <Text>();
        mRuneAttriObj    = transform.FindChild("Items/AttriPair").gameObject;
        mAddRuneAttriObj = transform.FindChild("Items/AddAttriPair").gameObject;

        mRuneDetailObj = transform.FindChild("RuneDetail").gameObject;
        //Transform temp = transform.FindChild("RuneDetail/RuneInfo/Panel/RunItem1");
        //mRuneDetailItem = new RuneIconItem(temp);
        mUserObj        = transform.FindChild("RuneDetail/RuneInfo/Panel/UserName").gameObject;
        mSpecHeroName   = transform.FindChild("RuneDetail/RuneInfo/Panel/SpecialHeroName").GetComponent <Text>();
        mRuneName       = transform.FindChild("RuneDetail/RuneInfo/Panel/RuneName_txt/Name_txt").GetComponent <Text>();
        mUserName       = transform.FindChild("RuneDetail/RuneInfo/Panel/UserName/UserName_txt").GetComponent <Text>();
        mCloseDetailBtn = transform.FindChild("RuneDetail/RuneInfo/CloseBtn/Image").GetComponent <Button>();
        mStrenthBtn     = transform.FindChild("RuneDetail/RuneInfo/StrenthBtn").GetComponent <Button>();
        mStrenthTxt     = transform.FindChild("RuneDetail/RuneInfo/StrenthBtn/Text").GetComponent <Text>();
        mIdentifyBtn    = transform.FindChild("RuneDetail/RuneInfo/IdentifyBtn").GetComponent <Button>();
        mIdentifyTxt    = transform.FindChild("RuneDetail/RuneInfo/IdentifyBtn/Text").GetComponent <Text>();
        mChangeBtn      = transform.FindChild("RuneDetail/RuneInfo/ChangeBtn").GetComponent <Button>();
        mChangeTxt      = transform.FindChild("RuneDetail/RuneInfo/ChangeBtn/Text").GetComponent <Text>();
        mAttriList      = transform.FindChild("RuneDetail/RuneInfo/Panel/Attris/AttriList").gameObject;
        mAttriDetailTxt = transform.FindChild("Items/LineTxt").gameObject;

        mPropRuneQueue   = new List <UI_RuneAttriItem>();
        mPropRuneObj     = transform.FindChild("RuneProp").gameObject;
        mPropNoRuneObj   = transform.FindChild("RuneProp/NoRuneObj").gameObject;
        mPropNoRuneTxt   = transform.FindChild("RuneProp/NoRuneObj/Text").GetComponent <Text>();
        mPropCloseBtn    = transform.FindChild("RuneProp/CloseBtn").GetComponent <Button>();
        mPropCloseBtnTxt = transform.FindChild("RuneProp/CloseBtn/Text").GetComponent <Text>();
        mPropListTrans   = transform.FindChild("RuneProp/Panel/AttriList");
        mPropItemTrans   = transform.FindChild("RuneProp/Items/PropItem");

        //mRuneIdentityObj = transform.FindChild("RuneIdentify").gameObject;
        //mRuneStrenthObj = transform.FindChild("RuneStrenth").gameObject;

        mRunes[0].AddIconClickListener(OnRuneBtnClick0);
        mRunes[1].AddIconClickListener(OnRuneBtnClick1);
        mRunes[2].AddIconClickListener(OnRuneBtnClick2);
        mRunes[3].AddIconClickListener(OnRuneBtnClick3);
        mRunes[4].AddIconClickListener(OnRuneBtnClick4);
        mRunes[5].AddIconClickListener(OnRuneBtnClick5);

        mRuneBounsBtn.onClick.AddListener(OnRunePropBtnClick);
        mCloseDetailBtn.onClick.AddListener(OnCloseRuneDetailBtnClick);
        mStrenthBtn.onClick.AddListener(OnStrenthBtnClick);
        mIdentifyBtn.onClick.AddListener(OnIdentifyBtnClick);
        mChangeBtn.onClick.AddListener(OnChangeBtnClick);
        mPropCloseBtn.onClick.AddListener(OnRunePropCloseBtnClick);


        //功能提示
        m_FunctionTipsManager = FunctionTipsManager.GetInstance();
        m_TipsImageArray      = new GameObject[(int)EM_RUNE_POINT.EM_RUNE_POINT_NUMBER];
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_COMMON1] = selfTransform.FindChild("RuneGroup/RunItem0/TipsImage").gameObject;
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_COMMON2] = selfTransform.FindChild("RuneGroup/RunItem1/TipsImage").gameObject;
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_COMMON3] = selfTransform.FindChild("RuneGroup/RunItem2/TipsImage").gameObject;
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_COMMON4] = selfTransform.FindChild("RuneGroup/RunItem3/TipsImage").gameObject;
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_COMMON5] = selfTransform.FindChild("RuneGroup/RunItem4/TipsImage").gameObject;
        m_TipsImageArray[(int)EM_RUNE_POINT.EM_RUNE_POINT_SPECIAL] = selfTransform.FindChild("RuneGroup/RunItem5/TipsImage").gameObject;

        GameEventDispatcher.Inst.addEventListener(GameEventID.U_HeroChangeTarget, OnSelectCardHeroChanged);
        GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshItem, OnItemRefresh);
        GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshHero, OnCardHeroDataChanged);

        GameEventDispatcher.Inst.addEventListener(GameEventID.U_HeroChangeTarget, RefreshTips);
        GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshItem, RefreshTips);
        GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshHero, RefreshTips);

        InitUIString();

        //mStrenthTxt.gameObject.layer = LayerMask.NameToLayer("UI");
        GameEventDispatcher.Inst.addEventListener(GameEventID.G_Guide_Continue, ShowNewGuide);
    }