Ejemplo n.º 1
0
    public void InitUI(uint itemid, Action <RideFeeditem> callback)
    {
        m_itemid   = itemid;
        m_callback = callback;
        if (uiitem != null)
        {
            uiitem.Release();
            uiitem = null;
        }
        SetState(false);

        table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemid);
        if (itemdata != null)
        {
            uint itemNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemid);
            uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemid, itemNum);
            if (uiitem != null && iconGo != null)
            {
                uiitem.Attach(iconGo.transform);
            }


            if (lableName != null)
            {
                lableName.text = itemdata.itemName;
            }
            if (lableDes != null)
            {
                lableDes.text = itemdata.description;
            }
        }
    }
Ejemplo n.º 2
0
    void InitMedicine()
    {
        List <table.ItemDataBase> lstdata = GameTableManager.Instance.GetTableList <table.ItemDataBase>();

        table.ItemDataBase itemdata = null;
        for (int i = 0, imax = lstdata.Count; i < imax; i++)
        {
            itemdata = lstdata[i];
            if (itemdata.baseType != 2)
            {
                continue;
            }

            if (itemdata.subType == (int)ItemDefine.ItemConsumerSubType.Hp)
            {
                if (!m_dicHpMedicineItem.ContainsKey(itemdata.useLevel))
                {
                    m_dicHpMedicineItem.Add(itemdata.useLevel, itemdata.itemID);
                    m_lstHpKey.Add(itemdata.useLevel);
                }
            }
            else if (itemdata.subType == (int)ItemDefine.ItemConsumerSubType.Mp)
            {
                if (!m_dicMpMedicineItem.ContainsKey(itemdata.useLevel))
                {
                    m_dicMpMedicineItem.Add(itemdata.useLevel, itemdata.itemID);
                    m_lstMpKey.Add(itemdata.useLevel);
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void RefreshUI(uint nBaseId, uint nThisId = 0, uint num = 0)
    {
        table.ItemDataBase db = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(nBaseId);
        if (db == null)
        {
            Engine.Utility.Log.Error("Not Found Item By ID:{0}", nBaseId);
            return;
        }

        UIItemCommonGrid grid = this.GetGrid <UIItemCommonGrid>();

        if (grid == null)
        {
            Engine.Utility.Log.Error("Get UIItemCommonGrid error ");
            return;
        }
        grid.SetGridData(new ItemDefine.UIItemCommonData()
        {
            DwObjectId = nBaseId,
            IconName   = db.itemIcon,
            Num        = num,
            ItemThisId = nThisId,
            Qulity     = db.quality,
            ShowGetWay = false,
        });
    }
Ejemplo n.º 4
0
 public void OnPickUpItemRes(GameCmd.stPickUpItemReturnPropertyUserCmd_S cmd)
 {
     if (cmd.state == 0)
     {
         Engine.Utility.Log.Error("PICK UP ERROR ID:{0}", cmd.qwThisID);
     }
     else
     {
         if (!DataManager.Manager <TeamDataManager>().IsJoinTeam)
         {
             return;
         }
         table.ItemDataBase db = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(cmd.baseid);
         if (db != null)
         {
             if (db.IsBroad)
             {
                 CHATTYPE chatType = CHATTYPE.CHAT_TEAM;
                 string   name     = "[" + db.itemName + "]";
                 string   endTxt   = ChatDataManager.GetItemHrefString(name, MainPlayerHelper.GetPlayerID(), cmd.qwThisID, db.quality);
                 string   info     = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Team_Recruit_woshiqu, endTxt);
                 stWildChannelCommonChatUserCmd_CS wild = new stWildChannelCommonChatUserCmd_CS();
                 wild.byChatType = chatType;
                 wild.szInfo     = info;
                 wild.dwOPDes    = 0;
                 wild.timestamp  = (uint)DateTimeHelper.Instance.Now;
                 NetService.Instance.Send(wild);
             }
         }
     }
 }
Ejemplo n.º 5
0
    /// <summary>
    /// //类型 0-物品本身cd  1-组cd
    /// </summary>
    /// <param name="type"></param>
    /// <param name="baseid"></param>
    /// <param name="cd">sec</param>
    public void SetMedicineCDInfo(uint baseid, List <GameCmd.CDInfo> cdinfos)
    {
        UseItemFinalCD cddata = new UseItemFinalCD();

        cddata.baseid = baseid;
        for (int i = 0; i < cdinfos.Count; i++)
        {
            if (cdinfos[i].type == 0)
            {
                cddata.selfcd = cdinfos[i].cd;
            }
            else if (cdinfos[i].type == 1)
            {
                cddata.groupcd = cdinfos[i].cd;

                table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(baseid);
                if (itemdata != null)
                {
                    table.EffectFuncDataBase effectdata = GameTableManager.Instance.GetTableItem <table.EffectFuncDataBase>(itemdata.func_id);
                    if (effectdata != null)
                    {
                        cddata.groupid = effectdata.group_id;
                    }
                }
            }
        }
        cddata.startTime = UnityEngine.Time.realtimeSinceStartup;
        m_lstUseItemFinalCD.Add(cddata);
        if (UnityEngine.Application.isEditor)
        {
            //string msg = string.Format("使用物品返回{0} selfcd{1} groupcd{2}  startTime{3}", baseid, cddata.selfcd, cddata.groupcd, cddata.startTime);
            //UnityEngine.Debug.Log(msg);
        }
        //Engine.Utility.Log.LogGroup("ZCX", "使用物品返回{0} cd1{1} cd2{2}", baseid,cddata.selfcd,cddata.groupcd);
    }
Ejemplo n.º 6
0
 public void OnBuyItem(stSellInformConsignmentUserCmd_S cmd)
 {
     table.ItemDataBase item = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(cmd.item_baseid);
     if (item != null)
     {
         string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_jishouhangchushouwupin, item.itemName);
         ChatDataManager.SendToChatSystem(txt);
     }
 }
Ejemplo n.º 7
0
 string ReplaceItem(string strDesc, uint nItemId, uint mapId)
 {
     table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(nItemId);
     if (itemdb != null)
     {
         //strDesc = strDesc.Replace("item", string.Format("<color value=\"green\">{0}({1})</color>", itemdb.itemName, GetMapName(mapId)));
         strDesc = strDesc.Replace("item", string.Format("[00ff00]{0}({1})[-]", itemdb.itemName, GetMapName(mapId)));
     }
     return(strDesc);
 }
Ejemplo n.º 8
0
 /// <summary>
 ///获取物品UI控制类(不包含金币类--GetUIMoneyItem)
 /// </summary>
 /// <param name="dwObjectId"></param>
 /// <returns></returns>
 public UIItem GetUICommonItem(uint dwObjectId, uint num, uint itemThisId = 0, Action <UIItemCommonGrid> callback = null, Action <UIItemCommonGrid, bool> pressCallback = null, bool showGetWay = true)
 {
     table.ItemDataBase db = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(dwObjectId);
     if (db == null)
     {
         Engine.Utility.Log.Error(CLASS_NAME + "-> Not Found Item By ID:{0}", dwObjectId);
         return(null);
     }
     return(GetUIItem(db.itemIcon, num, dwObjectId, itemThisId, callback, pressCallback, showGetWay));
 }
Ejemplo n.º 9
0
    void ShowItemList(uint itemBaseId)
    {
        List <BaseItem> itemdataList = new List <BaseItem>();

        List <BaseItem> itemdataList1 = DataManager.Manager <ItemManager>().GetItemByBaseId(itemBaseId, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN);

        itemdataList.AddRange(itemdataList1);

        table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemBaseId);
        if (itemdb != null && itemdb.EqualsId != 0)
        {
            List <BaseItem> itemdataList2 = DataManager.Manager <ItemManager>().GetItemByBaseId(itemdb.EqualsId, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN);
            itemdataList.AddRange(itemdataList2);
        }


        if (itemdataList.Count <= 0)
        {
            Engine.Utility.Log.Error("背包没有道具{0}", itemBaseId);
        }
        int count = m_lstUIItem.Count;

        while (count > 0)
        {
            m_lstUIItem[0].Release();
            m_lstUIItem.RemoveAt(0);
            count = m_lstUIItem.Count;
        }
        m_lstUIItem.Clear();

        for (int i = 0; i < itemdataList.Count; i++)
        {
            UIItem uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemBaseId, itemdataList[i].Num, itemdataList[i].QWThisID, OnSelectItem);
            uiitem.Attach(m_grid_root.transform);
            if (uiitem.GetGrid <UIItemCommonGrid>().GetComponent <UIDragScrollView>() == null)
            {
                uiitem.GetGrid <UIItemCommonGrid>().gameObject.AddComponent <UIDragScrollView>();
            }
            //int x = (i % 3) * 85;
            //int y = -(i / 3) * 85;
            //uiitem.SetPosition(true, new Vector3(x, y, 0));
            m_lstUIItem.Add(uiitem);
        }

        if (m_grid_root != null)
        {
            m_grid_root.Reposition();
        }

        if (itemdataList.Count > 0)
        {
            OnSelectItem(m_lstUIItem[0].GetGrid <UIItemCommonGrid>());
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 添加 或者刷新item  此方法 默认刷新需要的图片在一个图集里面
    /// </summary>
    /// <param name="widget">父节点</param>
    /// <param name="itemName">名字</param>
    /// <param name="itemID">id</param>
    /// <param name="itemNum">数量 默认为0 会自己获取数量</param>
    static public void AttachParent(Transform widget, uint itemID, uint itemNum = 0, Action <UIItemCommonGrid> callback = null, bool showGetWay = true, uint needNum = 1)
    {
        UIManager uiMan    = DataManager.Manager <UIManager>();
        string    itemName = "ItemGrid";

        if (itemNum == 0)
        {
            itemNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID);
        }
        ItemDefine.UIItemCommonData data = new ItemDefine.UIItemCommonData();
        table.ItemDataBase          db   = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);
        if (db != null)
        {
            data.IconName   = db.itemIcon;
            data.Num        = (uint)itemNum;
            data.DwObjectId = itemID;
            data.Qulity     = db.quality;
            data.ShowGetWay = showGetWay;
            data.NeedNum    = needNum;
        }
        Transform itemTrans = widget.Find(itemName);

        if (itemTrans != null)
        {
            UIItemCommonGrid grid = itemTrans.GetComponent <UIItemCommonGrid>();
            if (grid != null)
            {
                UIItem item = new UIItem(grid);

                item.SetGridData(data);
            }
            else
            {
                UIItem item = uiMan.GetUICommonItem(itemID, itemNum, 0, callback);
                if (item != null)
                {
                    item.Attach(widget, itemName);
                    item.SetGridData(data);
                }
            }
        }
        else
        {
            UIItem item = uiMan.GetUICommonItem(itemID, itemNum, 0, callback);
            if (item != null)
            {
                item.Attach(widget, itemName);
                item.SetGridData(data);
            }
        }
    }
Ejemplo n.º 11
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        uint itemID = GameTableManager.Instance.GetGlobalConfig <uint>("MaxPetItem");

        m_nNeedNum         = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID);
        m_nSkillNeedItemID = itemID;
        UIItem.AttachParent(m_sprite_unlock_item_icon.transform, itemID, (uint)m_nNeedNum, ShowGetWayCallBack);
        table.ItemDataBase itemData = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);
        if (itemData != null)
        {
            m_label_unlock_item_name.text = itemData.itemName;
        }
        int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId((uint)itemID);
        //  m_label_unlock_item_number.text = num.ToString();
    }
Ejemplo n.º 12
0
    bool CanUse(uint baseid)
    {
        //bool canUse = Engine.Utility.EventEngine.Instance().DispatchVote((int)GameVoteEventID.USE_MEDECAL_ITEM, baseid);

        //if (!canUse)
        //{
        //    return false;
        //}

        table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(baseid);
        if (itemdata != null)
        {
            if (itemdata.useLevel > MainPlayerHelper.GetPlayerLevel())
            {
                return(false);
            }


            table.EffectFuncDataBase effectdata = GameTableManager.Instance.GetTableItem <table.EffectFuncDataBase>(itemdata.func_id);
            if (effectdata != null)
            {
                bool canuse = true;
                for (int i = 0; i < m_lstUseItemFinalCD.Count; i++)
                {
                    if (m_lstUseItemFinalCD[i].groupid == effectdata.group_id)
                    {
                        if (m_lstUseItemFinalCD[i].groupcd > 0)
                        {
                            canuse = false;
                            break;
                        }
                    }

                    if (m_lstUseItemFinalCD[i].baseid == baseid)
                    {
                        if (m_lstUseItemFinalCD[i].selfcd > 0)
                        {
                            canuse = false;
                            break;
                        }
                    }
                }
                return(canuse);
            }
        }
        return(false);
    }
Ejemplo n.º 13
0
 [Execute]//道具连接信息返回 stRequestUrlItemInfoChatUserCmd
 public void Excute(GameCmd.stReturnUrlItemInfoChatUserCmd_S cmd)
 {
     table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(cmd.obj.dwObjectID);
     if (itemdb != null)
     {
         if (cmd.special)
         {
             DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.RidePetTipsPanel, data: cmd.obj);
         }
         else
         {
             BaseItem baseItem = new BaseItem(cmd.obj.dwObjectID, cmd.obj);
             //cmd.obj
             TipsManager.Instance.ShowItemTips(baseItem);
         }
     }
 }
Ejemplo n.º 14
0
    /// <summary>
    /// 图标
    /// </summary>
    /// <param name="iconName"></param>
    void SetIcon()
    {
        gameObject.SetActive(true);
        table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);

        if (itemdb != null)
        {
            if (null != this.icon)
            {
                UIManager.GetTextureAsyn(itemdb.itemIcon, ref m_curIconAsynSeed, () =>
                {
                    if (null != icon)
                    {
                        icon.mainTexture = null;
                    }
                }, icon, false);
            }
        }
    }
Ejemplo n.º 15
0
    public void Init(MedicineSettingPanel parent, table.ItemDataBase itemdatabase, AutoRecoverGrid.MedicalType type)
    {
        m_parent = parent;
        if (itemdatabase == null)
        {
            return;
        }
        int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemdatabase.itemID);

        mtype    = type;
        m_itemid = itemdatabase.itemID;
        if (uiitem != null)
        {
            uiitem.Release();
            uiitem = null;
        }
        bool showGetWay = mtype != AutoRecoverGrid.MedicalType.HpAtOnce;

        if (num > 0)
        {
            uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemdatabase.itemID, (uint)num, 0, null, null, showGetWay);
        }
        else
        {
            uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemdatabase.itemID, (uint)num, 0, (grid) => {
                m_parent.OnClickItem(grid.Data.DwObjectId);
            }, null, showGetWay);
        }
        if (uiitem != null && iconTrans != null)
        {
            uiitem.Attach(iconTrans);
            //uiitem.SetPosition(true, new Vector3(0, -iconTrans.GetComponent<UIWidget>().height * 0.5f, 0));
        }

        if (lableDes != null)
        {
            lableDes.text = itemdatabase.description;
        }
        if (lableName != null)
        {
            lableName.text = itemdatabase.itemName;
        }
    }
Ejemplo n.º 16
0
    private void ResreshDiscountUI()
    {
        SevenDayWelfare data = null;

        if (m_lstCurrWelfare.Count > 0)
        {
            data = m_lstCurrWelfare[0];
        }
        if (data == null)
        {
            return;
        }
        m_label_OldNum.text = data.param1.ToString();
        m_label_NewNum.text = data.param2.ToString();

        if (data.lstWelfareItems.Count > 0)
        {
            table.ItemDataBase itemDb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(data.lstWelfareItems[0].itemid);
            if (itemDb != null)
            {
                UIManager.GetTextureAsyn(itemDb.itemIcon, ref m_playerAvataCASD, () =>
                {
                    if (null != m__Icon)
                    {
                        m__Icon.mainTexture = null;
                    }
                }, m__Icon);

                m_label_GiftBagName.text = itemDb.itemName;
            }
        }

        if (data.state == QuickLevState.QuickLevState_HaveGet)
        {
            m_btn_Btn_Buy.isEnabled = false;
            m_btn_Btn_Buy.GetComponentInChildren <UILabel>().text = "已购买";
        }
        else
        {
            m_btn_Btn_Buy.isEnabled = true;
            m_btn_Btn_Buy.GetComponentInChildren <UILabel>().text = "购买";
        }
    }
Ejemplo n.º 17
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);

        if (data is UseItemCommonPanel.UseItemData)
        {
            m_useItemData = (UseItemCommonPanel.UseItemData)data;

            table.ItemDataBase itemTb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(m_useItemData.itemid);
            if (itemTb != null)
            {
                m_useItemData.maxuseNum = itemTb.maxUseTimes;

                if (m_labelName != null)
                {
                    m_labelName.text = itemTb.itemName;
                }

                if (m_labelDesc != null)
                {
                    m_labelDesc.text = itemTb.description;
                }

                if (itemTb.maxUseTimes != 0)
                {
                    if (m_labelUseTimes != null)
                    {
                        m_labelUseTimes.gameObject.SetActive(true);
                        m_labelUseTimes.text = string.Format("{0}/{1}", m_useItemData.useNum, itemTb.maxUseTimes);
                    }
                }
                else
                {
                    if (m_labelUseTimes != null)
                    {
                        m_labelUseTimes.gameObject.SetActive(false);
                    }
                }
                RefreshItemNum();
            }
        }
    }
Ejemplo n.º 18
0
    /// <summary>
    /// 根据道具id获取外框(公共图集) 圆框
    /// </summary>
    /// <param name="num"> (装备为附加属性条目数,其他物品为附加品质)</param>
    /// <returns></returns>
    public static string GetItemBgYuanBorderIconByItemID(uint itemID)
    {
        string borderName = "";

        if (m_dicBgYuanBorderIconCache.TryGetValue(itemID, out borderName))
        {
            return(borderName);
        }
        else
        {
            table.ItemDataBase item = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);
            if (item != null)
            {
                borderName = GameTableManager.Instance.GetGlobalConfig <string>("ItemQualityBgYuanBorderName"
                                                                                , ((ItemDefine.ItemQualityType)item.quality).ToString());
                m_dicBgYuanBorderIconCache.Add(itemID, borderName);
            }
        }
        return(borderName);
    }
Ejemplo n.º 19
0
    void SetQua()
    {
        table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);

        if (itemdb != null)
        {
            if (m_sprQua == null)
            {
                m_sprQua = transform.Find("qua").GetComponent <UISprite>();
            }
            if (m_sprQua != null)
            {
                UIManager.GetQualityAtlasAsyn(itemdb.quality, ref m_curQualityAsynSeed, () =>
                {
                    if (null != m_sprQua)
                    {
                        m_sprQua.atlas = null;
                    }
                }, m_sprQua);
            }
        }
    }
Ejemplo n.º 20
0
    private void SetType2UI(table.Trailerdatabase data, bool isOpen)
    {
        m_trans_Type1.gameObject.SetActive(false);
        m_trans_Type2.gameObject.SetActive(true);
        if (data == null)
        {
            return;
        }

        UILabel labelTitle = m_trans_Type2.Find("title").GetComponent <UILabel>();

        if (labelTitle != null)
        {
            labelTitle.text = data.strTitle;
        }
        UILabel labelDesc = m_trans_Type2.Find("desc").GetComponent <UILabel>();

        if (labelDesc != null)
        {
            if (isOpen)
            {
                labelDesc.effectStyle = UILabel.Effect.Outline;
                //labelDesc.effectColor = new Color(8 / 255.0f, 28 / 255.0f, 8 / 255.0f);
                labelDesc.text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Local_Txt_Trailer_4);
                //labelDesc.color = new Color(48 / 255.0f, 241 / 255.0f, 48 / 255.0f);
            }
            else
            {
                labelDesc.effectStyle = UILabel.Effect.Outline;
                //labelDesc.effectColor = new Color(44 / 255.0f, 24 / 255.0f, 4 / 255.0f);
                labelDesc.text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Local_Txt_Trailer_5);
                //labelDesc.color = new Color(255 / 255.0f, 245 / 255.0f, 87 / 255.0f);
            }
        }
        //m_trans_Type2.Find("effect").gameObject.SetActive(isOpen);
        PlayEffect(m_trans_Type2.Find("effect"), isOpen);
        UITexture icon = m_trans_Type2.Find("Icon").GetComponent <UITexture>();

        if (icon != null)
        {
            if (string.IsNullOrEmpty(data.strJobItem) == false)
            {
                string[] strJobItem = data.strJobItem.Split(';');
                int      job        = MainPlayerHelper.GetMainPlayerJob();
                if (strJobItem.Length >= job && job > 0)
                {
                    string[] strItem = strJobItem[job - 1].Split('_');
                    if (strItem.Length == 2)
                    {
                        uint itemId = uint.Parse(strItem[0]);

                        table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemId);
                        if (itemdb != null)
                        {
                            UIManager.GetTextureAsyn(itemdb.itemIcon,
                                                     ref m_currencyAsynSeed, () =>
                            {
                                if (null != icon)
                                {
                                    icon.mainTexture = null;
                                }
                            }, icon, false);
                        }
                    }
                }
            }
            else if (string.IsNullOrEmpty(data.strItem) == false)
            {
                string[] strItem = data.strItem.Split('_');
                if (strItem.Length == 2)
                {
                    uint itemId = uint.Parse(strItem[0]);
                    table.ItemDataBase itemdb = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemId);
                    if (itemdb != null)
                    {
                        UIManager.GetTextureAsyn(itemdb.itemIcon,
                                                 ref m_currencyAsynSeed, () =>
                        {
                            if (null != icon)
                            {
                                icon.mainTexture = null;
                            }
                        }, icon, false);
                    }
                }
            }
        }
    }
Ejemplo n.º 21
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);

        if (data is LearnSkillInfo)
        {
            m_LearnSkillInfo = data as LearnSkillInfo;
        }
        if (m_LearnSkillInfo == null)
        {
            return;
        }
        table.RideSkillDes skilldata = GameTableManager.Instance.GetTableItem <table.RideSkillDes>(m_LearnSkillInfo.skillid);
        if (skilldata != null)
        {
            m_label_skill_effect_Label.text = skilldata.skillDesc;
            m_label_name.text = string.Format("领悟{0}", skilldata.skillName);
        }

        table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(m_nUseItemId);
        int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(m_nUseItemId);

        if (itemdata != null)
        {
            if (m_uiitem != null)
            {
                m_uiitem.Release();
                m_uiitem = null;
            }
            if (num > 0)
            {
                m_uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemdata.itemID, (uint)num);
            }
            else
            {
                m_uiitem = DataManager.Manager <UIManager>().GetUICommonItem(itemdata.itemID, (uint)num, 0, OnGetItem);
            }
            if (m_uiitem != null)
            {
                m_uiitem.Attach(m_sprite_xiaohao_icon.cachedTransform);
                UIManager.GetQualityAtlasAsyn(itemdata.quality, ref m_qCASD, () =>
                {
                    if (null != m_sprite_itemqua)
                    {
                        m_sprite_itemqua.atlas = null;
                    }
                }, m_sprite_itemqua);
            }
            m_label_xiaohao_name.text = itemdata.itemName;
        }

        if (num >= 1)
        {
            m_label_xiaohao_number.text = string.Format("{0}/{1}", num, 1);
        }
        else
        {
            m_label_xiaohao_number.text = string.Format("[ff0000]{0}[-]/{1}", num, 1);
        }
        OnSelectCoin();
    }
Ejemplo n.º 22
0
    void ShowItemInfo(MainUsePanelData data)
    {
        /*
         * List<BaseItem> lstItems = DataManager.Manager<ItemManager>().GetItemByBaseId(itemBaseid);
         * if (lstItems.Count <= 0)
         * {
         *  m_nitemThisId = 0;
         *  m_nitemBaseId = 0;
         *  return;
         * }
         * m_nitemThisId = lstItems[0].QWThisID;
         * m_nitemBaseId = itemBaseid;
         */

        //npc
        if (data.type == 1)
        {
            m__icon.gameObject.SetActive(false);
            m_sprite_iconCollect.gameObject.SetActive(true);
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                return;
            }

            INPC npc = es.FindNPC(data.Id);
            if (npc == null)
            {
                return;
            }

            //this.name = npc.GetName();
            this.name = "采集";
            m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME);
        }
        //item
        else if (data.type == 2)
        {
            m__icon.gameObject.SetActive(true);
            m_sprite_iconCollect.gameObject.SetActive(false);
            table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(data.Id);
            if (itemdata != null)
            {
                UIManager.GetTextureAsyn(itemdata.itemIcon, ref m_iconCASD, () =>
                {
                    if (null != m__icon)
                    {
                        m__icon.mainTexture = null;
                    }
                }, m__icon);

                //this.name = itemdata.itemName;
                this.name = "使用";
                m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME);
            }
        }

        //特效
        UIParticleWidget wight = m_sprite_iconBg.GetComponent <UIParticleWidget>();

        if (null == wight)
        {
            wight       = m_sprite_iconBg.gameObject.AddComponent <UIParticleWidget>();
            wight.depth = 100;
        }

        if (wight != null)
        {
            UIParticleWidget p = wight.GetComponent <UIParticleWidget>();
            if (p == null)
            {
                p       = wight.gameObject.AddComponent <UIParticleWidget>();
                p.depth = 20;
            }
            if (p != null)
            {
                p.SetDimensions(1, 1);
                p.ReleaseParticle();
                p.AddParticle(50019);
            }
        }

        StartCoroutine(WaitToClose());
    }
Ejemplo n.º 23
0
    private UIItem GetUIItem(string spriteName, uint num, uint itemid = 0, uint itemThisId = 0, Action <UIItemCommonGrid> callback = null, Action <UIItemCommonGrid, bool> pressCallback = null, bool showGetWay = true)
    {
        UnityEngine.Object obj = UIManager.GetResGameObj(GridID.Uiitemcommongrid);
        if (obj == null)
        {
            Engine.Utility.Log.Error("Get GridID.Uiitemcommongrid failed");
            return(null);
        }

        GameObject       gridObj = GameObject.Instantiate(obj) as GameObject;
        UIItemCommonGrid grid    = gridObj.GetComponent <UIItemCommonGrid>();

        if (null == grid)
        {
            grid = gridObj.AddComponent <UIItemCommonGrid>();
        }

        uint qulity = 0;

        table.ItemDataBase db = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemid);
        if (db != null)
        {
            qulity = db.quality;
        }
        grid.SetGridData(new ItemDefine.UIItemCommonData()
        {
            DwObjectId = itemid,
            IconName   = spriteName,
            Num        = num,
            ItemThisId = itemThisId,
            Qulity     = qulity,
            ShowGetWay = showGetWay,
        });

        if (itemid != 0)//非零显示tips
        {
            bool blongPress = false;
            grid.RegisterUIEventDelegate((UIEventType eventType, object data, object param) =>
            {
                UIItemCommonGrid uigrid = data as UIItemCommonGrid;
                switch (eventType)
                {
                case UIEventType.Click:
                    blongPress = false;

                    if (callback != null)
                    {
                        callback(uigrid);
                        return;
                    }

                    if (uigrid.Data.Num > 0)
                    {
                        if (uigrid.Data.ItemThisId > 0)
                        {
                            TipsManager.Instance.ShowItemTips(uigrid.Data.ItemThisId, uigrid.gameObject, false);
                        }
                        else
                        {
                            //策划说货币也要弹出Tips
//                                 if (uigrid.Data.DwObjectId == MainPlayerHelper.GoldID || uigrid.Data.DwObjectId == MainPlayerHelper.MoneyTicketID)
//                                 {
//                                     return;
//                                 }
                            TipsManager.Instance.ShowItemTips(uigrid.Data.DwObjectId, uigrid.gameObject, false);
                        }
                    }
                    else
                    {
                        PanelID panelId = UIFrameManager.Instance.CurrShowPanelID;
                        uint itemID     = uigrid.Data.DwObjectId;
                        if (DataManager.Manager <UIPanelManager>().IsShowPanel(panelId))
                        {
                            UIPanelBase panelBase = DataManager.Manager <UIPanelManager>().GetPanel(panelId);
                            UIPanelManager.LocalPanelInfo uidata = panelBase.PanelInfo;
                            //Client.UIPanelInfo uidata = panelBase.PanelShowInfo;
                            if (uidata != null && uidata.NeedBg)
                            {
                                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.GetWayPanel, data: itemID);
                            }
                        }
                        else if (panelId == PanelID.None)
                        {
                            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.GetWayPanel, data: itemID);
                        }
                    }
                    break;

                case UIEventType.LongPress:
                    blongPress = true;
                    if (pressCallback != null)
                    {
                        pressCallback(uigrid, blongPress);
                        return;
                    }
                    if (grid.Data.ItemThisId > 0)
                    {
                        TipsManager.Instance.ShowItemTips(grid.Data.ItemThisId, grid.gameObject, false);
                    }
                    else
                    {
                        TipsManager.Instance.ShowItemTips(uigrid.Data.DwObjectId, uigrid.gameObject, false);
                    }
                    break;

                case UIEventType.Press:
                    bool press = (bool)param;
                    if (!press && blongPress)
                    {
                        blongPress = false;
                        if (pressCallback != null)
                        {
                            pressCallback(uigrid, blongPress);
                            return;
                        }
                        DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ItemTipsPanel);
                    }
                    break;
                }
            });
        }

        UIItem item = new UIItem(grid);

        return(item);
    }
Ejemplo n.º 24
0
    /// <summary>
    /// 点击属性提升符石选择
    /// </summary>
    private void OnSelectProcessRuneStone()
    {
        if (!IsSelectEquipAttr() || DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            TipsManager.Instance.ShowTips("请勾选需要提升的属性");
            return;
        }

        GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex);
        if (null == selectAttrPair)
        {
            Engine.Utility.Log.Error("Get AttrPair faield,promoteid:{0}", 0);
            return;
        }
        uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair);
        bool filterEqual     = IsProccessMode(ForgingProccessMode.Promote);
        //筛选满足条件符石
        List <uint> baseIdList = emgr.GetMatchProperyRunestone(selectAttrPair, filterEqual);

        UILabel          desLabel     = null;
        Action <UILabel> desLabAction = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                if (filterEqual)
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_1);
                }
                else
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_2);
                }
            }
        };
        uint tempSelectGemRuneStoneId             = 0;
        UIRSInfoSelectGrid selectGemRuneStoneGrid = null;
        UIEventDelegate    eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIRSInfoSelectGrid tempGrid = grid as UIRSInfoSelectGrid;
                RuneStone          tempRs   = DataManager.Manager <ItemManager>()
                                              .GetTempBaseItemByBaseID <RuneStone>(tempGrid.BaseId, ItemDefine.ItemDataType.RuneStone);
                if (tempSelectGemRuneStoneId == tempGrid.BaseId)
                {
                    tempSelectGemRuneStoneId = 0;
                    tempGrid.SetHightLight(false);
                }
                else if (tempGrid.BaseId != 0)
                {
                    bool enable = (!filterEqual) ? (tempRs.Grade >= selectAttrGrade) : (tempRs.Grade > selectAttrGrade);
                    if (enable)
                    {
                        tempSelectGemRuneStoneId = tempGrid.BaseId;
                        if (null != selectGemRuneStoneGrid)
                        {
                            selectGemRuneStoneGrid.SetHightLight(false);
                        }
                        tempGrid.SetHightLight(true);
                        selectGemRuneStoneGrid = tempGrid;
                    }
                    else if (filterEqual)
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Promote1);
                    }
                    else
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Eliminate1);
                    }
                }
            }
        };

        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = baseIdList.Count,
            title            = "选择符石",
            nullTips         = "您未拥有该类符石",
            cloneTemp        = m_trans_UIRSInfoSelectGrid.gameObject,
            onChooseCallback = () =>
            {
                if (tempSelectGemRuneStoneId != m_uint_selectRSBaseId)
                {
                    m_uint_selectRSBaseId = tempSelectGemRuneStoneId;
                    UpdateProccess(Data);
                }
            },
            gridCreateCallback = (obj, index) =>
            {
                if (index >= baseIdList.Count)
                {
                    Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,index out of range");
                }
                else
                {
                    table.ItemDataBase      tempItemDataBase      = imgr.GetLocalDataBase <table.ItemDataBase>(baseIdList[index]);
                    table.RunestoneDataBase tempRuneStoneDataBase = imgr.GetLocalDataBase <table.RunestoneDataBase>(baseIdList[index]);
                    if (null == tempItemDataBase || null == tempRuneStoneDataBase)
                    {
                        Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,get itemdatabase or tempItemDataBase null baseid:{0}", baseIdList[index]);
                    }
                    else
                    {
                        UIRSInfoSelectGrid gemRuneStoneGrid = obj.GetComponent <UIRSInfoSelectGrid>();
                        if (null == gemRuneStoneGrid)
                        {
                            gemRuneStoneGrid = obj.AddComponent <UIRSInfoSelectGrid>();
                        }
                        gemRuneStoneGrid.RegisterUIEventDelegate(eventDlg);
                        RuneStone rs = DataManager.Manager <ItemManager>()
                                       .GetTempBaseItemByBaseID <RuneStone>(baseIdList[index], ItemDefine.ItemDataType.RuneStone);
                        bool select = (baseIdList[index] == m_uint_selectRSBaseId);
                        bool enable = (!filterEqual) ? (rs.Grade >= selectAttrGrade) : (rs.Grade > selectAttrGrade);
                        gemRuneStoneGrid.SetGridViewData(baseIdList[index], select, enable);
                        if (select)
                        {
                            selectGemRuneStoneGrid   = gemRuneStoneGrid;
                            tempSelectGemRuneStoneId = baseIdList[index];
                        }
                    }
                }
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }