Beispiel #1
0
        private void CreateChatItems()
        {
            ExpressionBtn.transform.GetChild(0).gameObject.SetActive(false);
            ShortBtn.transform.GetChild(0).gameObject.SetActive(true);
            GameObject obj = null;

            for (int i = 0; i < ChatConfig.getInstance().m_chatInfoList.Count; ++i)
            {
                if (i < ChatItemList.Count)
                {
                    obj = ChatItemList[i];
                }
                else
                {
                    obj = GameObject.Instantiate(ChatItem);
                    obj.transform.SetParent(ShortGrid.transform);
                    obj.transform.localScale    = Vector3.one;
                    obj.transform.localPosition = Vector3.zero;
                    ChatItemList.Add(obj);
                    UI ui = ComponentFactory.Create <UI, GameObject>(obj);
                    ui.AddComponent <UIChatItemComponent>();
                    chatUiList.Add(ui);
                }
                chatUiList[i].GetComponent <UIChatItemComponent>().SetChatItemInfo(ChatConfig.getInstance().m_chatInfoList[i]);
            }
        }
Beispiel #2
0
        public async void Awake()
        {
            await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/chat.json", ChatConfig.getInstance().init);

            ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>();

            ExpressionBtn  = rc.Get <GameObject>("ExpressionBtn").GetComponent <Button>();
            ShortBtn       = rc.Get <GameObject>("ShortBtn").GetComponent <Button>();
            Mask           = rc.Get <GameObject>("Mask").GetComponent <Button>();
            ExceptionTxt   = rc.Get <GameObject>("ExceptionTxt").GetComponent <Text>();
            ExpressionGrid = ExpressionBtn.transform.Find("Select_Btn/Scroll/ExpressionGrid").gameObject;
            ShortGrid      = ShortBtn.transform.Find("Select_Btn/Scroll/ShortGrid").gameObject;

            ExpressionBtn.onClick.Add(() => { CreatExpressions(); });

            CommonUtil.SetTextFont(this.GetParent <UI>().GameObject);

            Mask.onClick.Add(() =>
            {
                CloseOrOpenChatUI(false);
            });

            ShortBtn.onClick.Add(() => { CreateChatItems(); });

            ExpressionItem = CommonUtil.getGameObjByBundle(UIType.UIExpression);
            ChatItem       = CommonUtil.getGameObjByBundle(UIType.UIChatItem);
            isOpen         = false;

            //选中表情包界面
            CreatExpressions();
        }