Esempio n. 1
0
        public void Init()
        {
            if (m_init)
            {
                return;
            }
            m_init = true;

            if (m_btnParent == null)
            {
                m_btnParent = transform;
            }
            if (m_focus == null)
            {
                m_focus = transform.FindChild("focus").GetComponent <RectTransform>();
            }

            if (m_aniable)
            {
                for (int i = 0; i < m_btnParent.childCount - 2; i++)
                {
                    UIEventListener listener = UIEventListener.Get(m_btnParent.FindChild(i.ToString()).gameObject);
                    listener.onClick   = OnClickBtn;
                    listener.parameter = i;
                    //UIButton.Get(listener.gameObject);
                }
            }
            else
            {
                for (int i = 0; i < m_btnParent.childCount - 1; i++)
                {
                    UIEventListener listener = UIEventListener.Get(m_btnParent.FindChild(i.ToString()).gameObject);
                    listener.onClick   = OnClickBtn;
                    listener.parameter = i;
                    //UIButton.Get(listener.gameObject);
                }
            }


            if (m_btnParent.childCount - 1 > 0 && m_changeTextColor)
            {
                //UIButton.Get(m_btnParent.FindChild("0").gameObject).SetTextColor(m_focusTextColor);
            }


            if (m_aniable)
            {
                pos       = transform.FindChild("light/pos");
                m_tabList = new GameObject[m_btnParent.transform.childCount - 2];
                for (int i = 0; i < m_tabList.Length; i++)
                {
                    m_tabList[i] = UIItem.GetChild(m_btnParent.transform, i.ToString()).gameObject;
                }
            }
        }
Esempio n. 2
0
        public static void SetItemMask(Transform parent, string txt)
        {
            Transform item = UIItem.GetChild(parent, "fg_mask");

            if (txt == null)
            {
                item.gameObject.SetActiveNew(false);
            }
            else
            {
                item.gameObject.SetActiveNew(true);
                UIItem.SetText(item, "txt", txt);
            }
        }
Esempio n. 3
0
        public void SetName(Transform head, string name, Vector3 offsetPos)
        {
            Transform item = head.FindChild("name");

            if (null == item)
            {
                item = (GameObject.Instantiate(m_nameObj)).GetComponent <RectTransform>();
                item.gameObject.SetActiveNew(true);
                item.SetParent(head);
                item.name          = "name";
                item.localRotation = Quaternion.identity;
                item.localScale    = Vector3.one;
            }
            item.localPosition = offsetPos;
            UIItem.SetText(item, "txt", name);
        }
Esempio n. 4
0
        public void SetLevel(Transform head, int level, Vector3 offsetPos)
        {
            Transform item = head.FindChild("level");

            if (null == item)
            {
                item = ((GameObject)GameObject.Instantiate(m_levelGo)).GetComponent <RectTransform>();
                item.gameObject.SetActiveNew(true);
                item.SetParent(head);
                item.name          = "level";
                item.localPosition = offsetPos;
                item.localRotation = Quaternion.identity;
                item.localScale    = Vector3.one;
            }
            item.SetAsFirstSibling();

            //等级字
            for (int i = 0; i < 15; i++)
            {
                UIItem.SetActiveNew(item, "txt/" + i, false);
                if (i == level - 1)
                {
                    UIItem.SetActiveNew(item, "txt/" + i, true);
                }
            }

            //等级背景
            //if (level < 6)
            //{
            //    UIItem.SetActiveNew(item, "bg_level/0", true);
            //    UIItem.SetActiveNew(item, "bg_level/1", false);
            //    UIItem.SetActiveNew(item, "bg_level/2", false);
            //}
            //else if (level > 5 && level < 11)
            //{

            //    UIItem.SetActiveNew(item, "bg_level/0", false);
            //    UIItem.SetActiveNew(item, "bg_level/1", true);
            //    UIItem.SetActiveNew(item, "bg_level/2", false);
            //}
            //else
            //{
            //    UIItem.SetActiveNew(item, "bg_level/0", false);
            //    UIItem.SetActiveNew(item, "bg_level/1", false);
            //    UIItem.SetActiveNew(item, "bg_level/2", true);
            //}
        }
Esempio n. 5
0
        /// <summary>
        /// 设置未读
        /// </summary>
        /// <param name="index">0>leng-1</param>
        /// <param name="unread"></param>
        public void SetUnread(int index, bool unread)
        {
            if (index >= m_btnParent.childCount || index < 0)
            {
                return;
            }
            Transform item = m_btnParent.FindChild(index.ToString());

            if (item == null)
            {
                Debug.LogError("item:" + index);
            }
            else
            {
                GameObject obj = item.gameObject;
                UIItem.GetChild(obj.transform, "unread").gameObject.SetActiveNew(unread);
            }
        }
Esempio n. 6
0
        public void UpdateHeroList()
        {
            PlayerCsv playerCsv = CsvManager.Inst.GetCsv <PlayerCsv>((int)eAllCSV.eAC_Player);

            m_listHero = new List <PlayerCsvData>(playerCsv.m_dicData.Values);
            m_ui.m_list.Init(m_listHero.Count, (item, index) =>
            {
                UIItem.SetRawImage(item, "icon", m_listHero[index].Icon);

                UIEventListener lis = UIEventListener.Get(item.gameObject);
                lis.parameter       = index;
                lis.onClick         = (go) => {
                    m_heroIndex = m_listHero[index].Id;
                    m_ui.m_list.SetChoice(index);
                    m_ui.SetModel(m_listHero[index].ShowModelResId);
                };
            });
        }
Esempio n. 7
0
File: UIHUD.cs Progetto: mengtest/fs
        private void Update()
        {
            if (m_Start)
            {
                m_curTime += Time.deltaTime;
                if (m_curTime > m_maxTime)
                {
                    HUDInfo hudInfo = m_tempList[0];
                    //Debug.Log("hud:" + hudInfo.txt);
                    Transform item;
                    if (m_cacheList.First != null)
                    {
                        item = m_cacheList.First.Value.transform;
                        m_cacheList.RemoveFirst();
                    }
                    else
                    {
                        item = GameObject.Instantiate(m_item).transform;
                    }
                    item.SetParent(m_parent);
                    item.gameObject.SetActiveNew(true);
                    item.localPosition = hudInfo.pos;

                    item.SetParent(GUIManager.m_PanelRoot);

                    string     text   = hudInfo.txt;
                    GameObject txtObj = UIItem.SetText(item, UIItemTitle.txt, text);

                    UIAnimationHelp help = UIAnimationHelp.Get(txtObj);
                    help.m_param = item.gameObject;
                    help.Init();
                    help.Play(OnAnimaEnd);

                    m_curTime = 0;
                    m_tempList.RemoveAt(0);
                    if (m_tempList.Count == 0)
                    {
                        m_Start = false;
                    }
                }
            }
        }
Esempio n. 8
0
        public void Open(string okTxt, string cancelTxt, string text, System.Action <bool, object> clickEvent)
        {
            Client.Inst().m_uiResInitDialog.OpenPanel(true);
            m_recheck.SetActiveNew(true);
            UIItem.SetText(m_btnOk, "txt", okTxt);
            if (!string.IsNullOrEmpty(cancelTxt))
            {
                m_btnExit.SetActiveNew(true);
                UIItem.SetText(m_btnExit, "txt", cancelTxt);
            }
            else
            {
                m_btnExit.SetActiveNew(false);
            }
            UIItem.SetItemAlign(UIItem.eItemAlignType.Center, m_btnOk.transform.parent);

            if (m_txtInfo != null)
            {
                m_txtInfo.text = text;
            }
            m_event = clickEvent;
        }
Esempio n. 9
0
        /// <summary>
        /// 更新BUFF图标列表
        /// </summary>
        public void UpdateBuffList(Transform head, List <UIHeadBuff> list)
        {
            Transform buffItem   = head.FindChild("buff");
            Transform listParent = buffItem.FindChild("list");

            UIItem.ClearList(listParent);
            int index = 0;

            for (int i = 0; i < list.Count; i++)
            {
                int iconId = list[i].icon;
                if (iconId == 0)
                {
                    continue;
                }

                Transform icon = UIItem.GetChild(listParent, index.ToString());
                icon.gameObject.SetActiveNew(true);
                UIItem.SetRawImage(icon, iconId, this);
                index++;
            }
            UIItem.SetItemAlign(UIItem.eItemAlignType.Center, listParent);
        }
Esempio n. 10
0
 public void SetPorp(int index, string text)
 {
     UIItem.SetText(m_propParent, index.ToString(), text);
 }
Esempio n. 11
0
 //备用,如果策划加了零时需求,可以拿来用
 public static void SetItemLevel(Transform parent, string level)
 {
     UIItem.SetText(parent, UIItemTitle.txtLevel, level);
 }
Esempio n. 12
0
 public static void SetItemIsOpen(Transform parent, bool open)
 {
     UIItem.GetBtn(parent, SSwitchBtn.s_open).SetActiveNew(open);
     UIItem.GetBtn(parent, SSwitchBtn.s_close).SetActiveNew(!open);
 }
Esempio n. 13
0
 public static void SetItemCondition(Transform parent, int icon_condition)
 {
     UIItem.SetImage(parent, "icon_condition", icon_condition);
 }
Esempio n. 14
0
 public void SetTabTxtOnIndex(int index, string value)
 {
     UIItem.SetText(m_btnParent, index + "/txt", value);
 }
Esempio n. 15
0
        /// <summary>
        /// 设置道具,返回icon对象
        /// </summary>
        public static GameObject SetGoodsItem(Transform item, GoodsItem itemVal)
        {
            if (null == item || null == itemVal)
            {
                return(null);
            }
            UIItem.SetText(item, UIItemTitle.txtName, itemVal.name);

            //物品描述
            if (itemVal.describe != "")
            {
                UIItem.SetText(item, UIItemTitle.txtDescribe, itemVal.describe);
            }
            // 图标
            //GameObject iconObject = UIItem.SetImage(item, UIItemTitle.imgIcon, itemVal.iconId, itemVal.icon, true);
            GameObject iconObject = UIItem.GetChild(item, UIItemTitle.imgIcon).gameObject;

            if (String.IsNullOrEmpty(itemVal.icon))
            {
                iconObject.SetActiveNew(false);
            }
            else
            {
                UnityEngine.Profiling.Profiler.BeginSample("LoadImage");
                UIItem.SetImage(item, UIItemTitle.imgIcon, int.Parse(itemVal.icon));
                if (!iconObject.ActiveSelfNew())
                {
                    iconObject.SetActiveNew(true);
                }
                UnityEngine.Profiling.Profiler.EndSample();
                //UIButton.Get(iconObject);
            }
            // 强化等级
            //if (itemVal.level != "" && IsInt(itemVal.level) && int.Parse(itemVal.level) > 0)
            UIItem.SetText(item, UIItemTitle.txtLevel, itemVal.level);
            GameObject tmpBgLevel = UIItem.GetBtn(item, "bg_level");

            if (tmpBgLevel != null)
            {
                if (itemVal.rate == null)
                {
                    tmpBgLevel.SetActiveNew(false);
                }
                else
                {
                    tmpBgLevel.SetActiveNew(true);
                }
            }
            //else
            //    UIItem.SetText(item, UIItemTitle.txtLevel, "");

            // 数量
            if (itemVal.count != "" && IsInt(itemVal.count) && int.Parse(itemVal.count) >= 0)
            {
                UIItem.SetText(item, UIItemTitle.txtCount, itemVal.count);
            }
            else
            {
                UIItem.SetText(item, UIItemTitle.txtCount, "");
            }

            if (itemVal.price >= 0)
            {
                UIItem.SetText(item, UIItemTitle.txtPrice, itemVal.price.ToString());
            }
            // 品质
            if (itemVal.rank != "")
            {
                UIItem.SetText(item, UIItemTitle.txtRank, itemVal.rank);
            }
            //星级
            if (itemVal.starLevel >= 0)
            {
                UIItem.SetStarLevel(item, UIItemTitle.txtStarLevel, itemVal.starLevel);
            }

            // 宝石孔
            UIItem.SetText(item, "gem_count", itemVal.gemHoleNum + "/6");

            if (itemVal.currency > 0)
            {
            }
            // 还有一个类型,用于特效预留
            return(iconObject);
        }
Esempio n. 16
0
 public void SetIocn(int index, int icon)
 {
     UIItem.SetRawImage(m_tabIcon.transform, index.ToString(), icon);
 }
Esempio n. 17
0
 public void SetMasterIcon(int icon)
 {
     UIItem.SetRawImage(m_icon.transform, icon);
 }
Esempio n. 18
0
 public static void SetRedPoint(Transform parent, bool isRed)
 {
     UIItem.GetBtn(parent, "red").SetActiveNew(isRed);
 }