| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 | using FairyGUI;using UI.CommonGame;using System.Collections;using System.Collections.Generic;namespace GFGGame{    public class GoodsItemTipsView : BaseWindow    {        private UI_GoodsItemTips _ui;        // private ItemView itemView;        private ApproachView approachView;        private ItemCfg itemCfg;        public override void Dispose()        {            // itemView.Dispose();            if (approachView != null)            {                approachView.Dispose();                approachView = null;            }            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            _ui = UI_GoodsItemTips.Create();            this.viewCom = _ui.target;            this.viewCom.Center();            this.modal = true;            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;            approachView = new ApproachView();            approachView.OnInit(_ui.m_comTipsApproach.target);            _ui.m_comTipsBase.m_listTag.itemRenderer = RenderListTagItem;            _ui.m_comTipsBase.m_comScaleList.m_listItem.itemRenderer = ListItemRenderer;            _ui.m_comBg.m_btnClose.onClick.Add(Hide);        }        protected override void AddEventListener()        {            base.AddEventListener();            EventAgent.AddEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);        }        protected override void OnShown()        {            base.OnShown();            //防止引导检测之前触发点击事件            GRoot.inst.touchable = false;            int itemID = (int)(viewData as object[])[0];            object[] sourceDatas = (viewData as object[])[1] as object[];            itemCfg = ItemCfgArray.Instance.GetCfg(itemID);            UpdateBase();            UpdateScore();            UpdateTags();            UpdateItems();            UpdateSourec(sourceDatas);            // this.viewCom.height = _ui.m_grpTips.height;            // this.viewCom.Center();            Timers.inst.AddUpdate(CheckGuide);        }        protected override void OnHide()        {            GRoot.inst.touchable = true;            if (approachView != null)            {                approachView.OnHide();            }            Timers.inst.Remove(CheckGuide);            base.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();            EventAgent.RemoveEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);        }        private void UpdateBase()        {            if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL)            {                _ui.m_comBg.m_txtTitle.text = string.Format("{0}  _{1}", itemCfg.name, itemCfg.id);            }            else            {                _ui.m_comBg.m_txtTitle.text = itemCfg.name;            }            _ui.m_comTipsBase.m_txtOwned.SetVar("count", "" + ItemDataManager.GetItemNum(itemCfg.id)).FlushVars();            _ui.m_comTipsBase.m_txtDesc.text = string.IsNullOrEmpty(itemCfg.desc) ? "暂无描述" : itemCfg.desc;            _ui.m_comTipsBase.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);            _ui.m_comTipsBase.m_txtType.visible = itemCfg.itemType == ConstItemType.DRESS_UP;            if (itemCfg.itemType == ConstItemType.DRESS_UP)            {                _ui.m_comTipsBase.m_txtType.text = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).name;            }            if ((viewData as object[]).Length >= 2)            {                _ui.m_comTipsBase.m_unlock.visible = !(bool)(viewData as object[])[2];            }            RarityIconController.UpdateRarityIcon(_ui.m_comTipsBase.m_loaRarity, itemCfg.id, false);            ET.Log.Debug(itemCfg.name + "  itemId:" + itemCfg.id);        }        private void UpdateScore()        {            bool isDressUpOrCard = itemCfg.itemType == ConstItemType.DRESS_UP || itemCfg.itemType == ConstItemType.CARD;            _ui.m_comTipsBase.m_loaRarity.visible = isDressUpOrCard;            _ui.m_comTipsBase.m_grpScore.visible = isDressUpOrCard;            if (!isDressUpOrCard) return;            _ui.m_comTipsBase.m_txtGong.text = "" + itemCfg.score1;            _ui.m_comTipsBase.m_txtShang.text = "" + itemCfg.score2;            _ui.m_comTipsBase.m_txtJue.text = "" + itemCfg.score3;            _ui.m_comTipsBase.m_txtZhi.text = "" + itemCfg.score4;        }        private void UpdateTags()        {            _ui.m_comTipsBase.m_listTag.visible = itemCfg.tagsArr.Length > 0;            _ui.m_comTipsBase.m_listTag.numItems = itemCfg.tagsArr.Length;        }        private void RenderListTagItem(int index, GObject obj)        {            UI_ListTagItem item = UI_ListTagItem.Proxy(obj);            ItemUtil.UpdateTag(item.m_comTag.target, itemCfg.tagsArr[index][0]);            item.m_txtTagScore.text = itemCfg.tagsArr[index][1].ToString();            UI_ListTagItem.ProxyEnd();        }        private void UpdateItems()        {            _ui.m_comTipsBase.m_grpComScaleList.visible = itemCfg.itemsArr.Length > 0;            _ui.m_comTipsBase.m_comScaleList.m_listItem.visible = itemCfg.itemsArr.Length > 0;            _ui.m_comTipsBase.m_comScaleList.m_listItem.numItems = itemCfg.itemsArr.Length;        }        private void ListItemRenderer(int index, GObject obj)        {            ItemData itemData = ItemUtil.createItemData(itemCfg.itemsArr[index]);            if (obj.data == null)            {                obj.data = new ItemView(obj as GComponent);            }            (obj.data as ItemView).SetData(itemData);            (obj.data as ItemView).ChangeTxtCountStyle();        }        private void UpdateSourec(object[] sourceDatas)        {            _ui.m_comTipsApproach.target.visible = sourceDatas != null;            if (sourceDatas == null) return;            approachView.OnShow(sourceDatas);        }        private void CheckGuide(object param)        {            GRoot.inst.touchable = true;            if ((_ui.m_comTipsApproach.m_list.numItems > 0 && (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0) || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_SYNTHETIC) <= 0))            {                UpdateToCheckGuide(null);            }            else            {                Timers.inst.Remove(CheckGuide);            }        }        protected override void UpdateToCheckGuide(object param)        {            if (!ViewManager.CheckIsTopView(this.viewCom)) return;            List<string[]> _approachDatas = _ui.m_comTipsApproach.m_list.data as List<string[]>;            if (_approachDatas == null) return;            GComponent obj = null;            for (int i = 0; i < _approachDatas.Count; i++)            {                if (_approachDatas[i][0] == ConstFunctionId.FU_ZHUANG_DIAN || _approachDatas[i][0] == ConstFunctionId.FU_ZHUANG_HE_CHENG)                {                    _ui.m_comTipsApproach.m_list.ScrollToView(i);                    UI_ListSourceItem item = UI_ListSourceItem.Proxy(_ui.m_comTipsApproach.m_list.GetChildAt(i));                    obj = item.m_btnGo.target;                    UI_ListSourceItem.ProxyEnd();                    break;                }            }            GuideController.TryGuide(obj, ConstGuideId.BUY_CLOTHING, 4, "该物品可以在服装店购买,点开服装店看看。");            GuideController.TryGuide(obj, ConstGuideId.CLOTHING_SYNTHETIC, 2, "该物品可以在绣坊-服装合成哦");        }    }}
 |