示例#1
0
        public static List <PropData> getPropData(Dictionary <long, PlayerPropMsg> propMsg)
        {
            if (propMsg == null || 0 == propMsg.Count)
            {
                return(new List <PropData>());
            }

            List <PlayerPropMsg> datas = new List <PlayerPropMsg>(propMsg.Values);

            List <PropData> propList = new List <PropData>();

            for (int i = 0; i < datas.Count; i++)
            {
                PlayerPropMsg pd   = datas[i];
                ConfProp      prop = ConfProp.Get(pd.PropId);
                if (prop == null)
                {
                    continue;
                }

                if ((int)PROP_TYPE.E_EXHABIT == prop.type) //陈列物件除外
                {
                    continue;
                }

                if (prop.heapSize > 0 && prop.heapSize < pd.Count)
                {
                    int cellNum      = pd.Count / prop.heapSize;
                    int finalPropNum = pd.Count % prop.heapSize;
                    for (int j = 0; j < cellNum; j++)
                    {
                        PropData realPropData = new PropData(prop, prop.heapSize);
                        propList.Add(realPropData);
                    }
                    if (finalPropNum != 0)
                    {
                        PropData realPropData = new PropData(prop, finalPropNum);
                        propList.Add(realPropData);
                    }
                }
                else
                {
                    PropData realPropData = new PropData(prop, pd.Count);
                    propList.Add(realPropData);
                }
            }
            return(propList);
        }
示例#2
0
        public static List <PropData> getPropData(RepeatedField <PlayerPropMsg> propMsg)
        {
            if (propMsg == null)
            {
                return(new List <PropData>());
            }
            List <PropData> propList = new List <PropData>();

            for (int i = 0; i < propMsg.Count; i++)
            {
                PlayerPropMsg pd   = propMsg[i];
                ConfProp      prop = ConfProp.Get(pd.PropId);
                if (prop == null)
                {
                    continue;
                }
                if (prop.heapSize > 0 && prop.heapSize < pd.Count)
                {
                    int cellNum      = pd.Count / prop.heapSize;
                    int finalPropNum = pd.Count % prop.heapSize;
                    for (int j = 0; j < cellNum; j++)
                    {
                        PropData realPropData = new PropData(prop, prop.heapSize);
                        propList.Add(realPropData);
                    }
                    if (finalPropNum != 0)
                    {
                        PropData realPropData = new PropData(prop, finalPropNum);
                        propList.Add(realPropData);
                    }
                }
                else
                {
                    PropData realPropData = new PropData(prop, pd.Count);
                    propList.Add(realPropData);
                }
            }
            return(propList);
        }
示例#3
0
        /// <summary>
        /// 刷新背包
        /// </summary>
        /// <param name="confProp"></param>
        void ReflashBag(List <PropData> confProp, int chooseIndex)
        {
            m_chooseUIEffect.gameObject.transform.SetParent(m_panelDown_Img.gameObject.transform, false);
            m_chooseUIEffect.Visible = false;
            //m_Prop_grid.Clear();
            int propCount = confProp.Count;

            m_NothingTip_lab.SetActive(propCount == 0);
            if (propCount == 0)
            {
                m_propInfo_panel.setNoInfoData();
            }
            m_Prop_grid.EnsureSize <BagItem>(propCount);
            for (int i = 0; i < propCount; i++)
            {
                PropData prop    = confProp[i];
                BagItem  bagItem = m_Prop_grid.GetChild <BagItem>(i);
                bagItem.Visible = true;
                bagItem.setData(prop, m_propInfo_panel, chooseIndex == i);
            }
            m_Prop_grid.Widget.anchoredPosition = Vector2.one;
        }
示例#4
0
        public static List <PropData> getPropData(PropNetworkData propData)
        {
            if (propData == null)
            {
                return(new List <PropData>());
            }
            List <PropData> propList = new List <PropData>();

            for (int i = 0; i < propData.pds.Count; i++)
            {
                PropDataNetWork pd   = propData.pds[i];
                ConfProp        prop = ConfProp.Get(pd.id);

                if (prop.heapSize > 0 && prop.heapSize < pd.sum)
                {
                    int cellNum      = pd.sum / prop.heapSize;
                    int finalPropNum = pd.sum % prop.heapSize;
                    for (int j = 0; j < cellNum; j++)
                    {
                        PropData realPropData = new PropData(prop, prop.heapSize);
                        propList.Add(realPropData);
                    }
                    if (finalPropNum != 0)
                    {
                        PropData realPropData = new PropData(prop, finalPropNum);
                        propList.Add(realPropData);
                    }
                }
                else
                {
                    PropData realPropData = new PropData(prop, pd.sum);
                    propList.Add(realPropData);
                }
            }
            return(propList);
        }
示例#5
0
 public override void Dispose()
 {
     base.Dispose();
     m_lastPropData = null;
     m_item_btn.RemoveChangeCallBack(btnClick);
 }
示例#6
0
 public override void OnHide()
 {
     base.OnHide();
     m_lastPropData = null;
 }
示例#7
0
        public void setInfoData(PropData propData)
        {
            m_curPropData = propData;
            if (propData != null)
            {
                m_Icon_img.Sprite  = propData.prop.icon;
                m_Title_lab.Text   = LocalizeModule.Instance.GetString(propData.prop.name);
                m_Sum_lab.Text     = string.Format("x{0}", propData.num);
                m_Content_lab.Text = LocalizeModule.Instance.GetString(propData.prop.description);
                m_Money_lab.Text   = propData.prop.price.ToString();
                long skillId    = propData.prop.skillId;
                int  tradeLimit = propData.prop.tradeLimit;
                if (skillId > 0)
                {
                    ConfSkill skill = ConfSkill.Get(skillId);
                    if (skill != null && skill.phase <= 3)
                    {
                        if (tradeLimit == 0)
                        {
                            tradeLimit = 1;
                        }
                        else if (tradeLimit == 2)
                        {
                            tradeLimit = 3;
                        }
                    }
                }

                SetPropInfoVisible(true);
                if (tradeLimit == 0)
                {
                    m_MsgNode_obj.SetActive(true);
                    m_SaleUseNode_obj.SetActive(true);
                    m_Sale_btn.SetActive(true);
                    m_Use_btn.SetActive(true);
                    m_NoSaleTip_lab.SetActive(false);
                    m_MultiFunc_btn.SetActive(false);
                    m_ShopTips_lab.SetActive(false);
                    m_currentInfo_enum = PropInfoTypeEnum.None;
                }
                else if (tradeLimit == 1)
                {
                    m_MsgNode_obj.SetActive(true);
                    m_MultiFunc_btn.SetActive(true);
                    m_SaleUseNode_obj.SetActive(true);
                    m_Sale_btn.SetActive(false);
                    m_Use_btn.SetActive(false);
                    m_NoSaleTip_lab.SetActive(false);
                    m_ShopTips_lab.SetActive(false);
                    m_MultiFunc_lab.Text = "Sale";
                    m_currentInfo_enum   = PropInfoTypeEnum.Sale;
                }
                else if (tradeLimit == 2)
                {
                    m_MultiFunc_btn.SetActive(true);
                    m_MsgNode_obj.SetActive(true);
                    m_SaleUseNode_obj.SetActive(false);
                    m_Sale_btn.SetActive(false);
                    m_Use_btn.SetActive(false);
                    m_NoSaleTip_lab.SetActive(true);
                    m_ShopTips_lab.SetActive(false);
                    m_MultiFunc_lab.Text = "Use";
                    m_currentInfo_enum   = PropInfoTypeEnum.Use;
                }
                else if (tradeLimit == 3)
                {
                    m_MsgNode_obj.SetActive(true);
                    m_SaleUseNode_obj.SetActive(false);
                    m_Sale_btn.SetActive(false);
                    m_Use_btn.SetActive(false);
                    m_NoSaleTip_lab.SetActive(false);
                    m_MultiFunc_btn.SetActive(false);
                    m_ShopTips_lab.SetActive(false);
                    m_currentInfo_enum = PropInfoTypeEnum.None;
                }
            }
        }
示例#8
0
 public BagUseData(PropData p, PropInfoTypeEnum info)
 {
     prop     = p;
     infoType = info;
 }